IsValidObject errors
#1

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
Reply
#2

If an error says "undefined symbol" then that does not per definition mean that you need to use #define. Use normal declarations with new.
Reply
#3

Yeah thanks I forgot, I just saw "undefined" and automatically used #define, it works now.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)