GetXYInFrontOfPlayer(playerid, &Float ![]() { new Float:a; GetPlayerPos(playerid, x, y, a); GetPlayerFacingAngle(playerid, a); if (GetPlayerVehicleID(playerid)) { GetVehicleZAngle(GetPlayerVehicleID(playerid), a); } x += (distance * floatsin(-a, degrees)); y += (distance * floatcos(-a, degrees)); } |
new Float ![]() GetPlayerPos(playerid, x, y, z); GetXYInFrontOfPlayer(playerid, x, y, 5.0); SetPlayerPos(playerid, x, y, z); |
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z) { if(IsPlayerConnected(playerid)) { 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); //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz); if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { return 1; } } return 0; }
if(PlayerToPoint(20, i,1133.0699,-9.5731,1000.6797)) {//Restaurant Entrance GameTextForPlayer(i, "~Y~Restaurant, 5000, 1); SetPlayerInterior(i, 4); SetPlayerPos(i,1022.599975,-1123.699951,23.799999); }
if(IsPlayerInRangeOfPoint(playerid, 5.0, WALL COORD X, WALL COORD Y, WALL COORD Z)) { SetPlayerPos(playerid,TELEPORT X,TELEPORT Y,TELEPORT Z); }
Originally Posted by jameskmonger
Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, WALL COORD X, WALL COORD Y, WALL COORD Z)) { SetPlayerPos(playerid,TELEPORT X,TELEPORT Y,TELEPORT Z); } The "TELEPORT #" is the coordinates that you want to tele to. |
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_ONFOOT) { if(IsPlayerInRangeOfPoint(playerid, 5.0, WALL COORD X, WALL COORD Y, WALL COORD Z)) { SetPlayerPos(playerid,TELEPORT X,TELEPORT Y,TELEPORT Z); }
Originally Posted by SuperS82
Most likely in OnPlayerStateChange. Not too sure, I've never used IsPlayerInRangeOfPoint.
Try this: Код:
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_ONFOOT) { if(IsPlayerInRangeOfPoint(playerid, 5.0, WALL COORD X, WALL COORD Y, WALL COORD Z)) { SetPlayerPos(playerid,TELEPORT X,TELEPORT Y,TELEPORT Z); } ![]() Let me know if it works for ya |