Fix CS1503: Argument 1: cannot convert from 'ulong' to 'string' (Oxide)
Your code passed a numeric user ID (ulong) where the Oxide permission API expects the string form. Replace player.userID with player.UserIDString in permission calls; the property UserIDString returns the decimal ID as a string.
Error while compiling VipCheck: [1] Argument 1: cannot convert from 'EncryptedValue<ulong>' to 'string' at 25:46
Why it happens
BasePlayer.userID is an implicit ulong wrapper, and passing it to a method that declares a string parameter fails because C# has no implicit conversion from ulong to string. Oxide's permission methods — permission.UserHasPermission, permission.GrantUserPermission, permission.RevokeUserPermission — and the lang helper lang.GetMessage(key, plugin, userId) all take the user ID as a string. The same mistake appears in player.ChatMessage parameters in some overloads, in BasePlayer.FindAwakeOrSleeping input, and in team/user ID arguments for plugin calls. The console shows the line and column (at 21:45) pointing at the argument, not at the call, so it is easy to glance past. CS1503 is a compile-time argument-type mismatch, so the plugin never loads and no hooks or commands run until you fix it.
How to fix it
- Open the file named in the console (
VipCheck.cs) and go to the reported line (e.g. line 21). - Find the argument the compiler flagged — the one holding
player.userIDor anyulongvalue. - Replace
player.userIDwithplayer.UserIDStringwhen calling permission or lang methods. - If you genuinely need the numeric ID, call
player.userID.Get()and pass it to an API that accepts a ulong; otherwise keep the string form. - Save the file. Oxide reloads automatically; if not, run
oxide.reload VipCheckin the server console. - Confirm the output shows
Loaded plugin VipCheck v1.0.0 by RustPluginGeneratorand noError while compilingline. As a sanity check, runoxide.show user <name>and verify the permission you registered appears.
Before and after
using Oxide.Core;
using Oxide.Core.Libraries.Covalence;
namespace Oxide.Plugins
{
[Info("VipCheck", "RustPluginGenerator", "1.0.0")]
[Description("Checks if a player has the vip permission and reports it in chat.")]
public class VipCheck : RustPlugin
{
private const string PermVip = "vipcheck.vip";
private void Init()
{
permission.RegisterPermission(PermVip, this);
}
[ChatCommand("vip")]
private void CmdVip(BasePlayer player, string command, string[] args)
{
if (player == null)
{
return;
}
if (permission.UserHasPermission(player.userID, PermVip))
{
player.ChatMessage("You are a VIP.");
}
else
{
player.ChatMessage("You do not have the VIP permission.");
}
}
}
}using Oxide.Core;
using Oxide.Core.Libraries.Covalence;
namespace Oxide.Plugins
{
[Info("VipCheck", "RustPluginGenerator", "1.0.0")]
[Description("Checks if a player has the vip permission and reports it in chat.")]
public class VipCheck : RustPlugin
{
private const string PermVip = "vipcheck.vip";
private void Init()
{
permission.RegisterPermission(PermVip, this);
}
[ChatCommand("vip")]
private void CmdVip(BasePlayer player, string command, string[] args)
{
if (player == null)
{
return;
}
if (permission.UserHasPermission(player.UserIDString, PermVip))
{
player.ChatMessage("You are a VIP.");
}
else
{
player.ChatMessage("You do not have the VIP permission.");
}
}
}
}FAQ
Why does player.userID work in some places and fail here?
Some APIs accept the ulong directly (for example player.userID.Get() for methods that take a ulong). Permission and lang methods are string-based, so you must use player.UserIDString there. Check the parameter type in the method signature or the Oxide API notes before choosing.
Does CS1503 always mean I passed the wrong ID type?
No. CS1503 means the argument type does not match the parameter type. In Oxide plugins the most common case is ulong vs string for user IDs, but it also fires for wrong numeric types (int vs float) and for passing an entity where a player is expected. Read the two types in the message.
Does Carbon compile the same file and show the same error?
Yes, Carbon loads Oxide plugins and runs the same C# compiler, so the CS1503 error and the fix are identical. Only the log path and some formatting differ (carbon/logs vs oxide/logs). The corrected code works under both frameworks.
Why does the error appear only after I edit the file?
Oxide recompiles the plugin each time the .cs file is saved and on reload/startup. The error stops the plugin from loading, so the source on disk and the running server fall out of sync until you fix and save again.
Different error?
Paste the full console output and get the cause and a fix in plain English.
Open the error explainerSkip the debugging
Generated plugins are compiled before you get them, and compiler errors are fixed automatically.
Generate a plugin2 free plugins a month, no card.
Last updated Oct 26, 2026.
Get plugins that compile first time
Generate