22.09.2010, 22:16
(
Последний раз редактировалось Prozack; 22.09.2010 в 22:29.
)
This function will locate the position that is directly in front of a player at a given distance.
It works well with /bring or /goto commands and keeps people from spawning on other players heads.
Test s[0]!=9999.99 on return to ensure the player is not spectating. If so, don't go there.
It's not nice to /bring a person in front of your vehicle
It works well with /bring or /goto commands and keeps people from spawning on other players heads.
Test s[0]!=9999.99 on return to ensure the player is not spectating. If so, don't go there.
It's not nice to /bring a person in front of your vehicle

Код:
new Float:s[4];
new Bool:IsSpectactor[MAX_PLAYERS];
stock PlayerVacinityLocation(playerid,Float:distance)
{
new reset[]={9999.99,0.00,0.00,0.00};
new Float:degrad=0.01745329251994;
new Float:angle;
new Float:p[4];
s=reset;
if(!IsSpectator[playerid]){
GetPlayerPos(playerid,p[0],p[1],p[2]);
GetPlayerFacingAngle(playerid,p[3]);
if(IsPlayerInAnyVehicle(playerid)){
new vehicleid=GetPlayerVehicleID(playerid);
GetVehicleZAngle(playerid,p[3]);
}
angle=p[3]*degrad;
s[0]=p[0]-floatsin(angle)*distance;
s[1]=p[1]+floatcos(angle)*distance;
s[2]=p[2]+0.0001;
s[3]=p[3]+180.0;
}
}

