13.06.2015, 03:16
Here's my IsPlayerInRangeOfPoint: IsPlayerInRangeOfPoint(playerid, 4.0, 2522.8105,-1679.3905,15.4970)) in i want to spawn in sweets house.
CMD:enter(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, 2522.8105,-1679.3905,15.4970))
{
SetPlayerPos (playerid, x, y, z);
SetPlayerInterior (playerid, interior);
}
else SendClientMessage (playerid, -1, "You must stay near a door");
return 1;
}
CMD:exit(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, x, y, z))
{
SetPlayerPos (playerid, 2522.8105, -1679.3905, 15.4970);
SetPlayerInterior (playerid, 0);
}
else SendClientMessage (playerid, -1, "You must stay near a door");
return 1;
}
CMD:enter(playerid,params[])
{
// First line: We are checking if here IS NOT near the entrance and if we confirm that we return him message.
if(!IsPlayerInRangeOfPoint(playerid,4.0,2522.8105,-1679.3905,15.4970)) return SendClientMessage(playerid,-1,"ERROR: You are not near the entrance");
else // else if he is near the entrance...
{
SetPlayerPos(playerid,2527.654052,-1679.388305,1015.498596); // Setting position..
SetPlayerInterior(playerid,1); // ... And interior. DONE!
}
return 1;
}
CMD:exit(playerid,params[])
{
// Here we have done the same thing just changed the coordinates.
if(!IsPlayerInRangeOfPoint(playerid,4.0,2527.654052,-1679.388305,1015.498596)) return SendClientMessage(playerid,-1,"ERROR: You are not near the exit");
else
{
SetPlayerPos(playerid,2522.8105,-1679.3905,15.4970);
SetPlayerInterior(playerid,0);
}
return 1;
}