MoveObject Autmaticly
#1

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

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.
Reply
#3

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;
}
Reply
#4

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

Because movetime isn't a global variable.
Reply
#6

What is global and what is local??
Reply
#7

Global is outside of the command.
Reply
#8

And how to make it global variable that.
Reply
#9

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;
}
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)