12.12.2013, 14:25
How can i make a moveable gate with a range and if he isn't in rane it will type error or sth
THANKS
THANKS
CMD:/gate(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, Range, GateX, GateY, GateZ)){
// Open gate
} else
{
// You're not in range
}
return 1
}
// at OnGameModeInt
new gate = CreateObject(modelID, X, Y, Z, X rotation, Y rotation, Z rotation, DrawDistance); // you may use samp map editor or if mta map editor, use http://www.convertffs.com to convert an object from mta to samp..
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/gate", true))
{
if(IsPlayerInRangeOfPoint(playerid, float:distance, x, y, z)) // check if the player at the place
{
SetObjectPos(gate, X, Y,Z); // you can get the pos when you create the gate opens
}
else // if other
{
SendClientMessage(playerid, RED, "You are not near the gate!");
}
return 1;
}
return 0;
}