Dialog 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: Dialog Error (
/showthread.php?tid=584935)
Dialog Error -
sexybeast - 09.08.2015
So I've tried to add in a dialog message for registering age and I can't understand why I'm getting an error.
The code is
PHP код:
1 if(dialogid == 51) //Age
2 {
3 if(!response)
4 {
5 Kick(playerid);
6 }
7 else
8 {
9 new age = strval(inputtext);
10 if(age < 18 || age > 99) return SendClientMessage(playerid, COLOR_GREY, "SERVER: Age must be between 18 and 99");
11 {
12 DisplayDialogForPlayer(playerid, 51);
13 }
14 else
15 {
16 new string[128];
17 PlayerInfo[playerid][pAge] = age;
18 format(string, sizeof(string), "SERVER: You've set your character's age to %d", PlayerInfo[playerid][pAge]);
19 SendClientMessage(playerid, COLOR_GREY, string);
20 }
21 }
22 return 1;
23 }
And the error message is:
Код:
C:(6902) : error 029: invalid expression, assumed zero
Which is line 14 above, - "else"
Anyone have any idea why this error is appearing?
Re: Dialog Error -
IceBilizard - 09.08.2015
Try this one
pawn Код:
if(dialogid == 51) //Age
{
if(!response)
{
Kick(playerid);
}
else
{
new string[128];
new age = strval(inputtext);
if(age < 18 || age > 99)
{
DisplayDialogForPlayer(playerid, 51);
SendClientMessage(playerid, COLOR_GREY, "SERVER: Age must be between 18 and 99");
return 1;
}
PlayerInfo[playerid][pAge] = age;
format(string, sizeof(string), "SERVER: You've set your character's age to %d", PlayerInfo[playerid][pAge]);
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}
Re: Dialog Error -
sexybeast - 09.08.2015
Worked, thank you!