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(playerid, params[])
{
new giveplayerid, token, string[128];
if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "ud", giveplayerid, token)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /givetoken [player] [amount]");
//This really depends on the variable you use to store the tokens
PlayerInfo[giveplayerid][pTokens] += token;
format(string, sizeof(string), "%s has given you %d token(s)!", GetPlayerName(playerid), token);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
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
PHP Code:
CMD:givetoken(playerid, params[])
{
new giveplayerid, token, string[128];
if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "ud", giveplayerid, token)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /givetoken [player] [amount]");
//This really depends on the variable you use to store the tokens
PlayerInfo[giveplayerid][pTokens] += token;
format(string, sizeof(string), "%s has given you %d token(s)!", GetPlayerName(playerid), token);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
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(playerid, params[])
{
new giveplayerid, string[128];
if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /checktoken [player]");
format(string, sizeof(string), "%s Tokens: %d", GetPlayerName(giveplayerid). PlayerInfo[giveplayerid][pToken]);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
Re: Giveplayerid -
[..MonTaNa..] - 09.05.2014
EDIT: too late