[help] else function - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [help] else function (
/showthread.php?tid=87291)
[help] else function -
[mad]MLK - 19.07.2009
can anyone tell me why i get this compile error (return 1; line)
Код:
C:\Documents and Settings\Chris\Desktop\Stunt City\gamemodes\NewServer.pwn(566) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Heres my code:
Код:
if (pickupid == who)
{
new pname[24], string[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s has just purchased MR.Whoopey fleet of vehicles.", pname);
SendClientMessageToAll(0x33AA33AA, string);
SendClientMessage(playerid, 0xFFA500AA, "Better go serve some ice cream!.");
GivePlayerMoney(playerid, -1000);
}
else
SendClientMessage(playerid, 0xFFA500AA, "You dont have enough cash for this price: $1000");
}
return 1;
}
Re: [help] else function -
member - 19.07.2009
The else statement wouldn't work because there is no if statement in there to check the player's cash, you need to check if the player has enough money if you want to put something if they don't.
pawn Код:
if (pickupid == who)
{
if (GetPlayerMoney(playerid) >= 1000) // if player has $1000+
{
new pname[24], string[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s has just purchased MR.Whoopey fleet of vehicles.", pname);
SendClientMessageToAll(0x33AA33AA, string);
SendClientMessage(playerid, 0xFFA500AA, "Better go serve some ice cream!.");
GivePlayerMoney(playerid, -1000);
}
else
{
SendClientMessage(playerid, 0xFFA500AA, "You dont have enough cash for this price: $1000");
}
}
Re: [help] else function -
James_Alex - 19.07.2009
iy dosen't work cuz you fotgot the '{' after the else
Re: [help] else function -
[mad]MLK - 19.07.2009
hey, the error is on return 1; line
Re: [help] else function -
James_Alex - 19.07.2009
cuz u forgot the '{' after thye else
Re: [help] else function -
[mad]MLK - 19.07.2009
hey hustler i get this error on return 1
Код:
C:\Documents and Settings\Chris\Desktop\Stunt City\gamemodes\NewServer.pwn(572) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
Re: [help] else function -
gemadon - 31.07.2009
Its not an error, its a warning, just hit backspace on that line until it disappears
Re: [help] else function -
iLinx - 31.07.2009
indentation = amount of times your script is indented in our out (using tab + backspace)
when you get a indentation error try indenting it with tab a couple of times or taking it back using backspace
hope that made sense
off : hai mlk