SA-MP Forums Archive
MoveObject Autmaticly - 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: MoveObject Autmaticly (/showthread.php?tid=398003)



MoveObject Autmaticly - Mustafa6155 - 07.12.2012

This is my code

pawn Код:
CMD:verplaats(playerid, params[])
{
        new string[50],movetime ;
        if(Objctmoved==0)
        {
                movetime = MoveObject(koe, 1993.5585, 206.7081, 27.4299, 2.00);
                Objctmoved=1;
        }else if(Objctmoved==1){
                movetime = MoveObject(koe, 1984.1281, 228.6638, 27.6008, 2.00);//Other Possition
                Objctmoved=2;
        }else if(Objctmoved==2){
                movetime = MoveObject(koe, 1967.7006, 211.0770, 28.9272, 2.00);
                Objctmoved=3;
        }else if(Objctmoved==3){
                movetime = MoveObject(koe, 1931.3905, 189.9864, 34.6937, 2.00);
                Objctmoved=4;
        }else if(Objctmoved==4){
                movetime = MoveObject(koe, 1920.3376, 206.2707, 31.9666, 2.00);
                Objctmoved=5;
        }else if(Objctmoved==5){
                movetime = MoveObject(koe, 1918.2622, 231.7208, 28.8713, 2.00);
                Objctmoved=0;//start again
        }
        format(string, sizeof(string), "Object will finish moving in %d milliseconds", movetime);
        SendClientMessage(playerid, 0xFF000000, string);
}

How to make it goes auto maticly


Re: MoveObject Autmaticly - park4bmx - 07.12.2012

Call the same if statements under OnObjectMoved
That will make the animation never stop(it will just keep running).
I can't show you becouse I'm on my phone.


Re: MoveObject Autmaticly - park4bmx - 07.12.2012

There u go, took me some time on this phone ;x
pawn Код:
CMD:verplaats(playerid, params[])
{
        new string[50],movetime ;
        if(Objctmoved==0)
        {
                movetime = MoveObject(koe, 1993.5585, 206.7081, 27.4299, 2.00);
                Objctmoved=1;
        }
        format(string, sizeof(string), "Object will finish moving in %d milliseconds", movetime);
        SendClientMessage(playerid, 0xFF000000, string);
}

public OnObjectMoved(objectid)
{
    switch(Objctmoved)
    {
        case 0:{
                movetime = MoveObject(koe, 1993.5585, 206.7081, 27.4299, 2.00);
                Objctmoved=1;
        }case 1:{
                movetime = MoveObject(koe, 1984.1281, 228.6638, 27.6008, 2.00);//Other Possition
                Objctmoved=2;
        }case 2:{
                movetime = MoveObject(koe, 1967.7006, 211.0770, 28.9272, 2.00);
                Objctmoved=3;
        }case 3:{
                movetime = MoveObject(koe, 1931.3905, 189.9864, 34.6937, 2.00);
                Objctmoved=4;
        }case 4:{
                movetime = MoveObject(koe, 1920.3376, 206.2707, 31.9666, 2.00);
                Objctmoved=5;
        }case 5:{
                movetime = MoveObject(koe, 1918.2622, 231.7208, 28.8713, 2.00);
                Objctmoved=0;//start again
        }
    }
    return 1;
}



Re: MoveObject Autmaticly - Mustafa6155 - 07.12.2012

WHy i get this?
C:\Users\Mustafa\Desktop\SAmp SRV\ForYou\gamemodes\FarmWereld.pwn(171) : error 017: undefined symbol "movetime"


Re: MoveObject Autmaticly - tyler12 - 07.12.2012

Because movetime isn't a global variable.


Re: MoveObject Autmaticly - Mustafa6155 - 07.12.2012

What is global and what is local??


Re: MoveObject Autmaticly - tyler12 - 07.12.2012

Global is outside of the command.


Re: MoveObject Autmaticly - Mustafa6155 - 07.12.2012

And how to make it global variable that.


Re: MoveObject Autmaticly - tyler12 - 07.12.2012

pawn Код:
new movetime;

CMD:verplaats(playerid, params[])
{
        new string[50];
        if(Objctmoved==0)
        {
                movetime = MoveObject(koe, 1993.5585, 206.7081, 27.4299, 2.00);
                Objctmoved=1;
        }
        format(string, sizeof(string), "Object will finish moving in %d milliseconds", movetime);
        SendClientMessage(playerid, 0xFF000000, string);
}

public OnObjectMoved(objectid)
{
    switch(Objctmoved)
    {
        case 0:{
                movetime = MoveObject(koe, 1993.5585, 206.7081, 27.4299, 2.00);
                Objctmoved=1;
        }case 1:{
                movetime = MoveObject(koe, 1984.1281, 228.6638, 27.6008, 2.00);//Other Possition
                Objctmoved=2;
        }case 2:{
                movetime = MoveObject(koe, 1967.7006, 211.0770, 28.9272, 2.00);
                Objctmoved=3;
        }case 3:{
                movetime = MoveObject(koe, 1931.3905, 189.9864, 34.6937, 2.00);
                Objctmoved=4;
        }case 4:{
                movetime = MoveObject(koe, 1920.3376, 206.2707, 31.9666, 2.00);
                Objctmoved=5;
        }case 5:{
                movetime = MoveObject(koe, 1918.2622, 231.7208, 28.8713, 2.00);
                Objctmoved=0;//start again
        }
    }
    return 1;
}



Re: MoveObject Autmaticly - Mustafa6155 - 07.12.2012

Only i need to creare is new movetime; try later..