IsValidObject errors - 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: IsValidObject errors (
/showthread.php?tid=442695)
IsValidObject errors -
Finn707 - 08.06.2013
I'm trying to create two commands, one for each smoke machine on my map. When you type the command, it will check if the smoke machine already exists, if it does exist it will destroy it, if it doesn't it will create it, so basically a toggle command.
Here's my code:
pawn Код:
CMD:mainsmoke(playerid, params[])
{
if(IsValidObject(mainsmoke)) //Line 257
{
DestroyObject(mainsmoke);
}
else
{
mainsmoke = CreateObject(2780, 183.95290, -1820.93359, 14.48730, 20.00000, 180.00000, 90.00000);//Main Stage Smoke Machine
}
return 1;
}
CMD:othersmoke(playerid, params[])
{
if(IsValidObject(othersmoke))
{
DestroyObject(othersmoke);
}
else
{
othersmoke = CreateObject(2780, 350.79459, -1845.34143, 3.39632, 0.00000, 0.00000, 267.86960);//Small Stage Smoke Machine
}
return 1;
}
And the errors I get when compiling:
Код:
festival2.pwn(257) : warning 202: number of arguments does not match definition
festival2.pwn(259) : warning 202: number of arguments does not match definition
festival2.pwn(263) : error 029: invalid expression, assumed zero
festival2.pwn(269) : warning 202: number of arguments does not match definition
festival2.pwn(271) : warning 202: number of arguments does not match definition
festival2.pwn(275) : error 029: invalid expression, assumed zero
Also at the top of my script I have:
pawn Код:
#define mainsmoke
#define othersmoke
Re: IsValidObject errors -
Vince - 08.06.2013
If an error says "undefined symbol" then that does not per definition mean that you need to use #define. Use normal declarations with
new.
Re: IsValidObject errors -
Finn707 - 08.06.2013
Yeah thanks I forgot, I just saw "undefined" and automatically used #define, it works now.