05.11.2010, 06:53
yup tried public.. samp thing
pawn Код:
stock SetPlayerRouting(playerid, Float:x1, Float:y1)
{
if(IsPlayerInAnyVehicle(playerid) && Gps[playerid] == 1)
{
new string[128];
new textstring[200];
new Float:x2, Float:y2, Float:z2;
new Float:angle2;
GetVehiclePos(GetPlayerVehicleID(playerid), x2, y2, z2);
GetVehicleZAngle(GetPlayerVehicleID(playerid), angle2);
new Float:dist;
dist = floatsqroot(floatpower(floatabs(floatsub(x1,x2)),2)+floatpower(floatabs(floatsub(y1,y2)),2));
new Float:angle1;
if( (y1-y2) >= 0.0) angle1 = acos((x1-x2)/dist) - 90;
else angle1 = 270 - acos((x1-x2)/dist);
new Float:offset;
offset = 360.0 - angle2 + angle1;
if(offset >= 360.0) offset = offset - 360.0;
else if(offset < 0.0) offset = offset + 360.0;
if(offset >= 330.0 || offset < 30.0) format(string, sizeof(string), "~u~ ~w~%d ~u~", floatround(dist));
else if(offset >= 30.0 && offset < 60.0) format(string, sizeof(string), "~<~ ~w~%d", floatround(dist));
else if(offset >= 60.0 && offset < 100.0) format(string, sizeof(string), "~<~~<~ ~w~%d", floatround(dist));
else if(offset >= 100.0 && offset < 150.0) format(string, sizeof(string), "~d~~<~ ~w~%d", floatround(dist));
else if(offset >= 150.0 && offset < 210.0) format(string, sizeof(string), "~d~ ~w~%d ~d~", floatround(dist));
else if(offset >= 210.0 && offset < 260.0) format(string, sizeof(string), "~w~%d ~>~~d~", floatround(dist));
else if(offset >= 260.0 && offset < 300.0) format(string, sizeof(string), "~w~%d ~>~~>~", floatround(dist));
else if(offset >= 300.0 && offset < 330.0) format(string, sizeof(string), "~w~%d ~>~", floatround(dist));
format(textstring,sizeof(textstring),"~r~Global Positionating System~n~~b~Tracking Coordinates:~w~~n~X %.01f - Y %.01f~n~~n~~p~Distance & Direction:~n~%s", x1, y1, string);
TextDrawSetString(Textdraw53[playerid],textstring);
if(floatround(dist) <= 25)
{
format(textstring,sizeof(textstring),"~r~Global Positionating System~n~~b~Tracking Coordinates: ~w~~n~X %.01f - Y %.01f~n~~n~~p~Arrived at Position!", x1, y1);
TextDrawSetString(Textdraw53[playerid],textstring);
}
TelePosGps[playerid][tX] = x1;
TelePosGps[playerid][tY] = y1;
}
return 1;
}