/giveallscore - bug
#1

PHP код:
CMD:giveallscore(playerid,params[])
{
    if(
Spawned[playerid] == 0) return SendClientMessage(playerid0xf8f8f8fff,"ERROR: {F00f00}You can't use this command while you are not spawned!");
    if(
PlayerInfo[playerid][pAdmin] >= 5)
    {
    new 
string[128];
    new 
amount;
    new 
pname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpname,sizeof(pname));
    if(
sscanf(params,"i",amount)) return SCM(playerid0xf8f8f8fff,"Syntax: {f00f00}/giveallscore <amount>");
    if(
amount || amount 900000) return SCM(playerid0xf8f8f8fff,"ERROR: {FFFFFF}900000 is high amount can be used!");
    foreach(
Playeri)
    {
    
SetPlayerScore(GetPlayerScore(i), amount);
    
format(string,sizeof(string),"{ffa700}Administrator {f00f00}%s {ffa700}has given all {f00f00}%d {ffa700}score!",pname,amount);
    
SendClientMessage(i, -1string);
    }
    }
    else
    {
    
SCM(playerid0xf8f8f8fff,"ERROR: {FFFFFF}You aren't authorized to use this command!");
    }
    return 
1;

So it's compile fine but it gives player score just if he's score was 0 if it was atleast 1 nothing happens
Reply
#2

PHP код:
SetPlayerScore(iGetPlayerScore(i) + amount); 
I would consider learning how to script before actually attempting it...
Reply
#3

Quote:
Originally Posted by Threshold
Посмотреть сообщение
PHP код:
SetPlayerScore(iGetPlayerScore(i) + amount); 
I would consider learning how to script before actually attempting it...
Thank you, it works fine.
Reply
#4

You gave me this code with bug! It's not even saving playerscore in database. -_- You bad friend.
Reply
#5

PHP код:
CMD:giveallscore(playerid,params[]) 

    if(
Spawned[playerid] == 0) return SendClientMessage(playerid0xf8f8f8fff,"ERROR: {F00f00}You can't use this command while you are not spawned!"); 
    if(
PlayerInfo[playerid][pAdmin] >= 5
    { 
    new 
string[128]; 
    new 
amount
    new 
pname[MAX_PLAYER_NAME]; 
    
GetPlayerName(playeridpname,sizeof(pname)); 
    if(
sscanf(params,"i",amount)) return SCM(playerid0xf8f8f8fff,"Syntax: {f00f00}/giveallscore <amount>"); 
    if(
amount || amount 900000) return SCM(playerid0xf8f8f8fff,"ERROR: {FFFFFF}900000 is high amount can be used!"); 
    foreach(
Playeri
    { 
    
//SetPlayerScore(GetPlayerScore(i), amount); 
   
SetPlayerScore(iGetPlayerScore(i) + amount); 
    
format(string,sizeof(string),"{ffa700}Administrator {f00f00}%s {ffa700}has given all {f00f00}%d {ffa700}score!",pname,amount); 
    
SendClientMessage(i, -1string); 
    } 
    } 
    else 
    { 
    
SCM(playerid0xf8f8f8fff,"ERROR: {FFFFFF}You aren't authorized to use this command!"); 
    } 
    return 
1

This would work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)