14.08.2010, 17:21
Do it in steps:
Step 1: Recognize the command /enter
Step 2: Check if the player is at the /enter position (Using PlayerToPoint (Posted Below))
Step 3: If the above is true, set the players new position inside the prison
Usage:
Step 1: Recognize the command /enter
Step 2: Check if the player is at the /enter position (Using PlayerToPoint (Posted Below))
Step 3: If the above is true, set the players new position inside the prison
pawn Код:
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
pawn Код:
if(PlayerToPoint(distance,playerid,X-Value,Y-Value,Z-Value))
{
//Move the player
}
else
{
//Send error message / do not move player
}