SA-MP Forums Archive
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(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 5) {
    new 
string[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], pIDscore;
    if(
sscanf(params"ud"pIDscore)) return GameTextForPlayer(playerid,"~g~/givefreeroamscore [id] [score]",4500,3);
    if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"This player is not connected");
    
GetPlayerName(playeridnamesizeof(name));
    
GetPlayerName(pIDpNamesizeof(pName));
    
format(stringsizeof(string), "%s has given you %d freeroam score"namescore);
    
SendClientMessage(pIDBANstring);
    
format(stringsizeof(string), "You have given %d freeroam score to %s"scorepName);
    
SendClientMessage(playeridBANstring);
    
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(playeridparams[]) 

    if(
PlayerInfo[playerid][pAdmin] < 5)return 0
    new 
string[128], pIDscore
    if(
sscanf(params"ud"pIDscore)) return GameTextForPlayer(playerid,"~g~/givefreeroamscore [id] [score]",4500,3); 
    if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"This player is not connected"); 
    
format(stringsizeof(string), "%s has given you %d freeroam score"UserName(playerid), score); 
    
SendClientMessage(pIDBANstring); 
    
format(stringsizeof(string), "You have given %d freeroam score to %s"scoreUserName(pID)); 
    
SendClientMessage(playeridBANstring); 
    
PlayerInfo[pID][pKills] +=score
    return 
1




Re: Help!!! - Mouiz - 10.07.2015

thanks for the help