Giveplayerid
#1

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
    }
}
Reply
#2

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.
Reply
#3

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?
Reply
#4

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;

Reply
#5

EDIT: too late
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)