need help
#1

Код:
CMD:giveallscore(playerid, params[])
{
	if(PlayerInfo[playerid][aLevel] < 3) return SendClientMessage(playerid, RED, "Only admin level 3 can use this command."); 
    if(score < 0) return SendClientMessage(playerid, RED, "You cant set a players score below 0.");
	new score;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    PlayerPlaySound(i,1057,0.0,0.0,0.0);
	SetPlayerScore(i, score);
	}
	new astring[128];
    format(astring, sizeof(astring), "Admin %s(%d) has Give All Player %d Score", GetName(playerid), playerid, score);
    SendAdminMessage(YELLOW, astring);
	return true;
}
and when i complie it i got this error

Код:
C:\Users\Home\Desktop\NVCNR\gamemodes\NVCNR.pwn(24391) : error 017: undefined symbol "score"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

pawn Код:
CMD:giveallscore(playerid, params[])
{
    new score;
if(PlayerInfo[playerid][aLevel] < 3) return SendClientMessage(playerid, RED, "Only admin with a level greater than 3 can use this command.");
    if(sscanf(params,"i",score)) return SendClientMessage(playerid,-1,"USAGE: /giveallscore [Score]");
if(score < 0) return SendClientMessage(playerid, RED, "You cannot set players' score below 0.");
   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    PlayerPlaySound(i,1057,0.0,0.0,0.0);
    SetPlayerScore(i, score);
    }
    new astring[128];
    format(astring, sizeof(astring), "Admin %s(%d) has Give All Player %d Score", GetName(playerid), playerid, score);
    SendAdminMessage(YELLOW, astring);
    return true;
}
The error was given since you used the variable 'score' before actually declaring it.
Reply
#3

Thank You
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)