SA-MP Forums Archive
Invalid 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)
+--- Thread: Invalid function (/showthread.php?tid=545404)



Invalid function - Bek_Loking - 08.11.2014

Well, I've got this problem, I do not know how to fix it :c I'll rep up the guy that manages to help me

PHP код:
C:\Users\MARKO\Desktop\Learning\gamemodes\ARP.pwn(491) : error 008: must be a constant expression; assumed zero
C
:\Users\MARKO\Desktop\Learning\gamemodes\ARP.pwn(493) : warning 209: function "cmd_opendgates" should return a value
C
:\Users\MARKO\Desktop\Learning\gamemodes\ARP.pwn(494) : error 010: invalid function or declaration
C
:\Users\MARKO\Desktop\Learning\gamemodes\ARP.pwn(39) : warning 204: symbol is assigned a value that is never used: "dg"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase
2 Errors
. 
The dg is never used, that's okay I'm not planning on using it just yet.
And this is the script:
PHP код:
CMD:opendgates(playerid, params[])
{
     if(!
IsPlayerInRangeOfPoint(playerid,5,2517.15381, 2345.71021, 11.21650)) return SendClientMessage(playerid, COLOR_RED, "You're not near the crack den.");
     else if
     {
    -> 
error line MoveObject(dm,2517.15381, 2345.71021, 5,1.5,5);
     
SendClientMessage(playerid, COLOR_AQUA, "{FFFFFF}[DRUG DEALER]{FFFF66}Get in,scrub.");
-> 
error line }
-> 
error line return 1;
} 



Re: Invalid function - Virtual1ty - 08.11.2014

Not sure about this one but "if - else if" construction needs an expression to validate to either true(1) or false(0), hence the error. If you don't require a second "case" just use "if - else" construction.


Re: Invalid function - Bek_Loking - 08.11.2014

<3 removed "if" at "else if" and it fixed it <3
*on Croatian ( because im from Croatia )
Hvala kralju.


Re: Invalid function - Virtual1ty - 08.11.2014

Hey, hey no problem!
Glad it's sorted out (: