03.09.2012, 18:32
I'm trying to make a moving gate and to be high enough so nobody can skip to the other side of the gate. Can anyone help me ?
gate = CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance);
MoveObject(gate, new x, new y, new z, SPEED );
//On top of the script new impaund; //OnGameModeInit impaund = CreateObject(980, 1620.66, -1862.22, 15.33, 0.00, 0.00, 180.00); //OnPlayerCommandText if(!strcmp(cmdtext, "/open", true)) { if(IsPlayerInRangeOfPoint(playerid, 15.0, 0, 0, 0)) { MoveObject(impaund, 0, 0, 0, 3.0); return 1; } } else if(strcmp(cmdtext, "/close", true)) { if(IsPlayerInRangeOfPoint(playerid, 15.0, 0, 0, 0)) { MoveObject(impaund, 1620.66, -1862.22, 15.33, 3.0); return 1; } } return 1; } return 0; }
new impaund_Open; // it checks if gates is open
if (strcmp("/open", cmdtext, true, 10) == 0) { if(impaund_Open == 1) return SendClientMessage(playerid ,SOME COLOR ,"Gate is already open!"); if(IsPlayerInRangeOfPoint(playerid, 15.0, 1620.66, -1862.22, 15.33) ) { // NEW = position of gates when they are open MoveObject(impaund, NEW X postion, NEW Y postion, NEW Z postion, 3.0); impaund_Open = 1; } else return SendClientMessage(playerid ,SOME COLOR ,"You are not near that gate!"); return 1; } else if (strcmp("/close", cmdtext, true, 10) == 0) { if(impaund_Open == 0) return SendClientMessage(playerid ,SOME COLOR ,"Gate is already closed!"); if(IsPlayerInRangeOfPoint(playerid, 15.0, 1620.66, -1862.22, 15.33) ) { MoveObject(impaund, 1620.66, -1862.22, 15.33, 3.0); impaund_Open = 0; } else return SendClientMessage(playerid ,SOME COLOR ,"You are not near that gate!"); return 1; }
new gate;
gate= CreateObject(...);
if(strcmp(cmd, "/opengate", true) == 0)
{
if(PlayerToPoint(5.0, playerid, Float:X, Float:Y, Float:Z))
{
MoveObject(gate, Float:X, Float:Y, Float:Z, TIME, 0, 0, 0);
SetTimer("GateClose", 10000, 0);
return 1;
}
}
forward GateClose();
public GateClose()
{
MoveObject(gate, Float:X, Float:Y, Float:Z, TIME, Float:rX, Float:rY, Float:rZ);
return 1;
}