View Single Post
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 04-10-2018 , 08:38   Re: [CS:GO] Remove X key from KeyValue after X time(2 weeks, 1 month)
Reply With Quote #11

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 clientint 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(1playersizeof(player));
    
GetCmdArg(2tokenssizeof(tokens));

    
int target FindTarget(clientplayertruefalse);
    
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 clientint 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(1playersizeof(player));
    
GetCmdArg(2tokenssizeof(tokens));

    
int target FindTarget(clientplayertruefalse);
    
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:
 [ServerYou don't have enough tokens to buy this.
 [Server] You have: -251 | Required: 7 
__________________

Last edited by PinHeaDi; 04-10-2018 at 12:12.
PinHeaDi is offline