Raised This Month: $51 Target: $400
 12% 

Solved [CS:GO] Remove X key from KeyValue after X time(2 weeks, 1 month)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:35.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode