SA-MP Forums Archive
moving objects 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: moving objects errors (/showthread.php?tid=214148)



moving objects errors - Tizixoriginal - 20.01.2011

hi,

I'm a beginner (newb) at scripting PAWN and i tried to make a small filterscript for an elevator, I don't want to bother you too much but i'd like that someone helped me out on this one.
The point is, i used a tutorial, copied to my script, replaced the coords and stuff. After compiling it tells me

Quote:
Originally Posted by PAWN Compiler Output
\filterscripts\elevator.pwn(94) : warning 217: loose indentation
\filterscripts\elevator.pwn(96) : error 010: invalid function or declaration
\filterscripts\elevator.pwn(101) : error 010: invalid function or declaration
\filterscripts\elevator.pwn(104) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
here's the script:


pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
        if (strcmp("/up", cmdtext, true, 10) == 0)
            {
            MoveObject(elevator, 2898,-2657.30175781, 45.42610168,0.97);//elevator goes up
            SendClientMessage(playerid, 0xFF8000FF, "<Elevator> The elevator is going up!");
            }
            return 1;
            }
        if (strcmp("/down", cmdtext, true, 10) == 0)
            {
            MoveObject(elevator, 2898,-2657.30175781, 6.04528284,0.97);//Elevator goes back down.
            SendClientMessage(playerid, 0xFF8000FF, "<Elevator> The elevator is going down!");
            }
            return 1;
            }

    return 1;
        }
}
I know it will probably be a small, stupid mistake i made, but i'd like to know what i did wrong so i won't make this mistake next time!
Thanks


Re: moving objects errors - ExeC - 20.01.2011

new Name;

pawn Код:
Name = CreateObject(objectid, something);
pawn Код:
MoveObject(Name, x,y,z,speed); //For speed, I use 3.0
Wrong:
pawn Код:
MoveObject(elevator, 2898,-2657.30175781, 45.42610168,0.97);//elevator goes up



Re: moving objects errors - Mikkel_Pedersen - 20.01.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/up", cmdtext, true, 10) == 0)
    {
            MoveObject(elevator, 2898,-2657.30175781, 45.42610168,0.97);//elevator goes up
            SendClientMessage(playerid, 0xFF8000FF, "<Elevator> The elevator is going up!");
            return 1;
    }
    if (strcmp("/down", cmdtext, true, 10) == 0)
    {
        MoveObject(elevator, 2898,-2657.30175781, 6.04528284,0.97);//Elevator goes back down.
        SendClientMessage(playerid, 0xFF8000FF, "<Elevator> The elevator is going down!");
        return 1;
    }
    return 1;
}
I assume you already defined the elevator.


Re: moving objects errors - Tizixoriginal - 20.01.2011

Thanks a lot, man!



And ye, i also defined it
pawn Код:
new elevator;
pawn Код:
public OnGameModeInit()
{
    elevator = CreateObject(2898, -2657.20214844,1328.15625000,6.04528284,0.24719238,358.74206543,0.00000000);
}


After testing, i still have to figure out why it doesn't work 0.o