So now it works.. One last thing, if a use a command to remove/add tokens, so to add or remove from UsedTokens[iClient] will it work as I thing it will?
PHP Code:
public Action AddTokens(int client, int args)
{
if (args < 2)
{
ReplyToCommand(client, "[SM] Usage: sm_addtokens <name or #userid> <tokens to give>");
return Plugin_Handled;
}
char player[64], tokens[10];
GetCmdArg(1, player, sizeof(player));
GetCmdArg(2, tokens, sizeof(tokens));
int target = FindTarget(client, player, true, false);
int whattoadd = StringToInt(tokens);
if (target == -1)
{
ReplyToCommand(client, "[SM] Target not found.");
return Plugin_Handled;
}
UsedTokens[target] -= whattoadd;
return Plugin_Continue;
}
public Action RemoveTokens(int client, int args)
{
if (args < 2)
{
ReplyToCommand(client, "[SM] Usage: sm_removetokens <name or #userid> <tokens to remove>");
return Plugin_Handled;
}
char player[64], tokens[10];
GetCmdArg(1, player, sizeof(player));
GetCmdArg(2, tokens, sizeof(tokens));
int target = FindTarget(client, player, true, false);
int whattoremove = StringToInt(tokens);
if (target == -1)
{
ReplyToCommand(client, "[SM] Target not found.");
return Plugin_Handled;
}
UsedTokens[target] += whattoremove;
return Plugin_Continue;
}
This for example.
P.S: Nope, not working as intended.
It's sometimes working when adding 2 for example. If i use it again:
PHP Code:
[Server] You don't have enough tokens to buy this.
[Server] You have: -251 | Required: 7
__________________