10.03.2012, 17:40
(
Последний раз редактировалось SnG.Scot_MisCuDI; 10.03.2012 в 23:36.
)
pawn Код:
forward Float:GetDistanceBetweenPlayers(p1,p2);
pawn Код:
stock Float:GetDistanceBetweenPlayers(p1,p2){
new Float:x1,Float:y1,Float:z1,Float:x3,Float:y3,Float:z3;
if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2)){
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x3,y3,z3);
return floatsqroot(floatpower(floatabs(floatsub(x3,x1)),2)+floatpower(floatabs(floatsub(y3,y1)),2)+floatpower(floatabs(floatsub(z3,z1)),2));
}
pawn Код:
CMD:i( playerid, params[ ] )
{
new ID, string[ 128 ], string2[ 128 ], name[ MAX_PLAYER_NAME ];
new Float:Distance = GetDistanceBetweenPlayers(playerid,ID);
if( sscanf( params, "u", ID ) ) return SendClientMessage( playerid, COLOR_WHITE, "USAGE: /i [id]" );
if( IsPlayerConnected( ID ) == 0) return SendClientMessage( playerid, COLOR_RED, "Player is not connected!" );
GetPlayerName( ID, name, MAX_PLAYER_NAME );
new carid = GetPlayerVehicleID( ID );
TextDrawShowForPlayer( playerid, info1 );
TextDrawShowForPlayer( playerid, info0 );
if( !IsPlayerInAnyVehicle( ID ) )
{
format( string, 128, "~y~Player Info: ~r~~h~%s[%d]~n~~n~~g~Location:~w~%s~n~~g~Distance:~w~%0.2f~n~~g~Vehicle:~w~On Foot", name, ID, ReturnPlayerZone( ID ), Distance );
}
else
{
format( string, 128, "~y~Player Info: ~r~~h~%s[%d]~n~~n~~g~Location:~w~%s~n~~g~Distance:~w~%0.2f~n~~g~Vehicle:~w~%s", name, ID, ReturnPlayerZone( ID ), Distance, VehicleNames[ GetVehicleModel( carid ) - 400 ] );
}
TextDrawSetString( info1, string );
return 1;
}