Guys what is wrong with this Elevator? -
Gangster-rocks - 26.07.2012
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);
Re: Guys what is wrong with this Elevator? -
Marlon_Lorran - 26.07.2012
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;
}
Re: Guys what is wrong with this Elevator? -
Gangster-rocks - 26.07.2012
Did not work D: thanks btw.
Re: Guys what is wrong with this Elevator? -
Ranama - 26.07.2012
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
Re: Guys what is wrong with this Elevator? -
fury14 - 26.07.2012
Код:
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...
Re: Guys what is wrong with this Elevator? -
Gangster-rocks - 27.07.2012
Nothing works but i've solve it by my self.