26.08.2011, 09:56
pawn Код:
public OnPlayerConnect(playerid)
{
M_OnPlayerConnect(playerid);
IsPlayerInMission[playerid] = false;
speedos[playerid] = TextDrawCreate(10.0,200.0," ");
TextDrawShowForPlayer(playerid, speedos[playerid]);
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new vid = GetPlayerVehicleID(playerid);
new string[125];
format(string, sizeof string, "Fuel: %i", fuel[vid]);
TextDrawSetString(td_fuel[playerid], string);
TextDrawShowForPlayer(playerid, td_fuel[playerid]);
}
else
{
TextDrawHideForPlayer(playerid, td_fuel[playerid]);
}
return 1;
}
public OnPlayerUpdate(playerid)
{
new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int;
vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid != 0)
{
GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
final_speed_int = floatround(final_speed,floatround_round);
format(speed_string,256,"Speed: %i",final_speed_int);
TextDrawSetString(speedos[playerid], speed_string);
}
else
{
TextDrawSetString(speedos[playerid], " ");
}
return 1;
}