Player Score
#5

PHP Code:
CMD:givepoints(playeridparams[])
{
    if(
PlayerInfo[playerid][AdminLevel] < 3) return LowLevel(playerid);
    new 
pos;
    if(!
params[0]||!(pos chrfind(' ',params)+1)||!params[pos]) return SendLanguageText(playeridSERVER_COLOR"Pouћitн: /givepoints [ID] [POINTS]","Usage: /givepoints [ID] [POINTS]");
    if(
strlen(params) > 23) return SystemMessage(playerid"[PB] Chybnй parametry!","[PB] Incorrect parameters!");
    new 
CMD_ID strval(params);
    if(!
IsPlayerConnected(CMD_ID)) return NotConnected(playerid);
    new 
Castka strval(params[pos]),string[200],string1[200];
    
//SetPlayerScore(CMD_ID, GetPlayerScore(playerid) + Castka);
    
    // New Line
    
PlayerInfo[playerid][Score] += Castka;
    
// New Line
    
if(CMD_ID == playerid)
    {
        
format(string150"[PB] Přidal sis %d bodů na svůj ъčet. Nynн mбљ %d bodů."Castka,GetPlayerScore(CMD_ID));
        
format(string1150"[PB] You added %d points to your account. Now u have %d points."Castka,GetPlayerScore(CMD_ID));
        
SendLanguageText(playeridSERVER_COLORstring,string1);
    }
    else
    {
        
format(string200"[PB] Přidal si hrбči %s %d bodů. Nynн mб %d bodů."Jmeno(CMD_ID),Castka,GetPlayerScore(CMD_ID));
        
format(string1200"[PB] You added %d points to player %s. Now he have %d points."Castka,Jmeno(CMD_ID),GetPlayerScore(CMD_ID));
        
SendLanguageText(playeridSERVER_COLORstring,string1);
        
format(string200"[PB] Administrбtor %s ti přidal %d bodů. Nynн mбљ %d bodů.",Jmeno(playerid),Castka,GetPlayerScore(CMD_ID));
        
format(string1200"[PB] Admin %s added %d points to your account. Now u have %d points.",Jmeno(playerid),Castka,GetPlayerScore(CMD_ID));
        
SendLanguageText(playeridSERVER_COLORstring,string1);
    }
    return 
true;
}
public 
OnPlayerUpdate(playerid)
{
    
SetPlayerScore(playeridPlayerInfo[playerid][Score]);
    return 
1;

and dont forget to change PlayerInfo[playerid][Score] except of setting player score in anywhere of your script
Reply


Messages In This Thread
Player Score - by MichiCZ - 11.04.2019, 15:57
Re: Player Score - by SiaReyes - 11.04.2019, 16:38
Re: Player Score - by MichiCZ - 11.04.2019, 16:47
Re: Player Score - by MicroKyrr - 11.04.2019, 18:48
Re: Player Score - by khRamin78 - 12.04.2019, 06:39

Forum Jump:


Users browsing this thread: 1 Guest(s)