Help!!! - 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: Help!!! (
/showthread.php?tid=581060)
Help!!! -
Mouiz - 10.07.2015
This is an admin score adding command:
PHP код:
CMD:givefreeroamscore(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 5) {
new string[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], pID, score;
if(sscanf(params, "ud", pID, score)) return GameTextForPlayer(playerid,"~g~/givefreeroamscore [id] [score]",4500,3);
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "This player is not connected");
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(pID, pName, sizeof(pName));
format(string, sizeof(string), "%s has given you %d freeroam score", name, score);
SendClientMessage(pID, BAN, string);
format(string, sizeof(string), "You have given %d freeroam score to %s", score, pName);
SendClientMessage(playerid, BAN, string);
PlayerInfo[pID][pKills] = ++score;
}
return 1;
}
but when i use it,i set the player score to the entered amount but i want it to "+" the score with the entered amount,please help
Re: Help!!! -
SloProKiller - 10.07.2015
pawn Код:
PlayerInfo[pID][pKills] += score;
//or
PlayerInfo[pID][pKills] = PlayerInfo[pID][pKills] + score;
Both do the same thing, so use only one of the lines above.
Re: Help!!! -
NotYoMama - 10.07.2015
Replace
Код:
PlayerInfo[pID][pKills] = ++score;
WITH
Код:
PlayerInfo[pID][pKills] += score;
Please tell me if it worked...
Re: Help!!! -
CodeStyle175 - 10.07.2015
PHP код:
UserName(pid){
new string[24];
GetPlayerName(playerid,string,sizeof(string));
return string;
}
CMD:givefreeroamscore(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 5)return 0;
new string[128], pID, score;
if(sscanf(params, "ud", pID, score)) return GameTextForPlayer(playerid,"~g~/givefreeroamscore [id] [score]",4500,3);
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "This player is not connected");
format(string, sizeof(string), "%s has given you %d freeroam score", UserName(playerid), score);
SendClientMessage(pID, BAN, string);
format(string, sizeof(string), "You have given %d freeroam score to %s", score, UserName(pID));
SendClientMessage(playerid, BAN, string);
PlayerInfo[pID][pKills] +=score;
return 1;
}
Re: Help!!! -
Mouiz - 10.07.2015
thanks for the help