01.03.2019, 07:00
Hello
How can teleport with zcmd when i get close to an object like ( Doors / Gates or ....)
Thanks
How can teleport with zcmd when i get close to an object like ( Doors / Gates or ....)
Thanks
cmd:enter(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(playerid, 0, 0, 0)) return SendClientMessage(playerid, -1, "You are not near the door!");
SetPlayerPos(playerid, 1, 1, 1);
return 1;
}
CMD:enter(playerid, params[]) { if (IsPlayerInRangeOfPoint(playerid, 7.0, 2410.7625,22.7374,318.7558)) { SetPlayerPos(playerid, 2617.1079,62.8777,256.7219); return 1; } return 0; }
CMD:enter(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(playerid, 7.0, 2410.7625,22.7374,318.7558)) return SendClientMessage(playerid, -1, "You are not near the door!");
SetPlayerPos(playerid, 2617.1079,62.8777,256.7219);
return 1;
}
new objectid;
objectid = CreateDynamicObject(....);
CMD:enter(playerid, params[])
{
new Float:x, Float:y, Float:z;
GetDynamicObjectPos(objectid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z))
{
SetPlayerPos(...);
}
return 1;
}
Poor codes shown above. There isn't only one door in your server is it? Loop through all your server's doors, then run the checks needed |
You can also use GetDynamicObjectPos |