SA-MP Forums Archive
Giveplayerid - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Giveplayerid (/showthread.php?tid=512108)



Giveplayerid - Trynda - 09.05.2014

Hello, im really confused with this

I want the /givetoken

and it will increase the token value of player depends on token value i type

pawn Code:
CMD:givetoken(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] == 6)
    {
        new giveplayerid;
        new string[128];
        if(sscanf(params, "ud", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givetoken [playerid/partofname] [token value]");

        format
    }
}



Re: Giveplayerid - mrtms - 09.05.2014

PHP Code:
CMD:givetoken(playeridparams[])
{
    new 
giveplayeridtokenstring[128];
    if(
PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(
sscanf(params"ud"giveplayeridtoken)) return SendClientMessage(playeridCOLOR_GREY"USAGE: /givetoken [player] [amount]");
    
    
//This really depends on the variable you use to store the tokens
    
PlayerInfo[giveplayerid][pTokens] += token;
    
    
format(stringsizeof(string), "%s has given you %d token(s)!"GetPlayerName(playerid), token);
    
SendClientMessage(giveplayeridCOLOR_WHITEstring);
    return 
1;

I'm not to sure what you use to store the value of the token to the player, so I made up some random variable under the enum of PlayerInfo. Just replace the PlayerInfo[giveplayerid][pTokens], with the correct variable you use to store the amount of tokens a player has.


Re: Giveplayerid - Trynda - 09.05.2014

Quote:
Originally Posted by mrtms
View Post
PHP Code:
CMD:givetoken(playeridparams[])
{
    new 
giveplayeridtokenstring[128];
    if(
PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(
sscanf(params"ud"giveplayeridtoken)) return SendClientMessage(playeridCOLOR_GREY"USAGE: /givetoken [player] [amount]");
    
    
//This really depends on the variable you use to store the tokens
    
PlayerInfo[giveplayerid][pTokens] += token;
    
    
format(stringsizeof(string), "%s has given you %d token(s)!"GetPlayerName(playerid), token);
    
SendClientMessage(giveplayeridCOLOR_WHITEstring);
    return 
1;

I'm not to sure what you use to store the value of the token to the player, so I made up some random variable under the enum of PlayerInfo. Just replace the PlayerInfo[giveplayerid][pTokens], with the correct variable you use to store the amount of tokens a player has.
Thanks bro (+rep) But how about the /checktoken?


Re: Giveplayerid - mrtms - 09.05.2014

PHP Code:
CMD:checktoken(playeridparams[])
{
    new 
giveplayeridstring[128];
    if(
PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(
sscanf(params"u"giveplayerid)) return SendClientMessage(playeridCOLOR_GREY"USAGE: /checktoken [player]");
    
    
format(stringsizeof(string), "%s Tokens: %d"GetPlayerName(giveplayerid). PlayerInfo[giveplayerid][pToken]);
    
SendClientMessage(playeridCOLOR_WHITEstring);
    return 
1;




Re: Giveplayerid - [..MonTaNa..] - 09.05.2014

EDIT: too late