Guys what is wrong with this Elevator?
#1

pawn Код:
CMD:elevup(playerid,params[])
{
    if(gTeam[playerid] == Team_Stars)
    {
        MoveObject(elev[0],280.46, 1822.38, 6,  5, 90.00, 0.00, 90.00);
        MoveObject(elev[1],291.34, 1822.41, 6, 5,  90.00, 0.00, 270.00);
        SetTimer("up",2000,true);
    }
    return 1;
}
when type /elevup it go down lol but how can i make it go up this is the objects
pawn Код:
elev[0] = CreateObject(986, 280.46, 1822.38, 17.16,   90.00, 0.00, 90.00);
    elev[1] = CreateObject(986, 291.34, 1822.41, 17.16,   90.00, 0.00, 270.00);
Reply
#2

Try this:

Код:
CMD:elevup(playerid,params[])
{
    if(gTeam[playerid] == Team_Stars)
    {
        MoveObject(elev[0],280.46, 1822.38, 17.16,   90.00-6, 3);
        MoveObject(elev[1],291.34, 291.34, 1822.41, 17.16,   90.00-6, 3);
        SetTimer("up",2000,true);
    }
    return 1;
}
Reply
#3

Did not work D: thanks btw.
Reply
#4

you'll have to check if the elevator is up or down, you can do this with a second variable.

like when you start the server, you make a new variable like this:
and you only need one object, like this:
Код:
new elevatorstate = 0;
OnGameModeInit{
new elevator = CreateObject(986, 280.46, 1822.38, 17.16,   90.00, 0.00, 90.00);
}
CMD:elevup(playerid,params[])
{
    if(gTeam[playerid] == Team_Stars)
    {
        if(elevatorstate == 0){//this will happend if none have said the command before
        MoveObject(elevator,280.46, 1822.38, 17.16,   90.00, 6, 3);//and here it should be a , instead of - i think
        elevatorstate = 1;
        }
        else{// and if the elevatorstate not is 0 it have to be 1 so then this else block will be called
        MoveObject(elevator,291.34, 291.34, 1822.41, 17.16,   90.00, 6, 3);//and here it should be a , instead of - i think
        elevatorstate = 0;//this sets the elevatorstate to down(or wich positio it is)
        }
        SetTimer("up",2000,true);
    }
    return 1;
}
Hope it works now
Reply
#5

Код:
CMD:elevup(playerid,params[])
{
    if(gTeam[playerid] == Team_Stars)
    {
        MoveObject(elev[0],291.34, 1822.41, 6, 5,  90.00, 0.00, 270.00);
        SetTimer("up",2000,true);
    }
    return 1;
}
If Ranama answer doesn't work, try this...
Reply
#6

Nothing works but i've solve it by my self.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)