One error! - 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: One error! (
/showthread.php?tid=416643)
One error! -
KlooP - 17.02.2013
Hi friends, I'm getting this error:
error 008: must be a constant expression; assumed zero
Код:
case DIALOG_AVP_KREDITUV3:
{
if(!response) return box(playerid, DIALOG_AVP_KREDITUV, DIALOG_STYLE_LIST, "Kreditų valdymas", "Duoti kreditų visiems\nDuoti kreditų ћaidėjui\nAtimti kreditus iљ ћaidėjo\nAtimti dalį kreditų", "Pasirinkti", "Grįћti");
if(response)
{
if(strval(inputtext) != INVALID_PLAYER_ID)
{
box(playerid, DIALOG_AVP_KREDITUV4, DIALOG_STYLE_INPUT, "Duoti kreditų ћaidėjui", "Įveskite sumą kurią norite duoti ћaidėjui", "Duoti", "Atgal");
new LaikinasID[MAX_PLAYERS] = strval(inputtext); // THIS LINE HAS ERROR!
} else {
box(playerid, DIALOG_AVP_KREDITUV3, DIALOG_STYLE_INPUT, "Duoti kreditų ћaidėjui", "Toks ћaidėjas nėra prisijungęs! Įraљykite teisingą ћaidėjo ID", "Toliau", "Grįћti");
}
}
}
EDIT: I just found solution,
Код:
new LaikinasID[MAX_PLAYERS] = "strval(inputtext)";
Is it good code?
Re: One error! -
Youice - 17.02.2013
try:
Код:
new LaikinasID[MAX_PLAYERS] = inputtext;
Re: One error! -
LarzI - 17.02.2013
Just a common mistake. You've used MAX_PLAYERS instead of the playerid.
pawn Код:
new
LaikinasID[ playerid ] = strval( inputtext )
;
Re: One error! -
[MG]Dimi - 17.02.2013
Quote:
Originally Posted by LarzI
Just a common mistake. You've used MAX_PLAYERS instead of the playerid.
pawn Код:
new LaikinasID[ playerid ] = strval( inputtext ) ;
|
Then he doesn't need
Re: One error! -
LarzI - 17.02.2013
Quote:
Originally Posted by [MG]Dimi
|
Obviously not - my bad. I'm really really tired. The declaration should be globally, else just remove the entire array cell making it a normal integer variable.