need 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: need help (
/showthread.php?tid=399174)
need help -
rapister - 13.12.2012
Код:
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.
Re: need help -
RajatPawar - 13.12.2012
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.
Re: need help -
rapister - 13.12.2012
Thank You