Help!!!
#1

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

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

Replace
Код:
PlayerInfo[pID][pKills] = ++score;
WITH


Код:
PlayerInfo[pID][pKills] += score;
Please tell me if it worked...
Reply
#4

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

Reply
#5

thanks for the help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)