pawn Код:
// Ongamemodeinit
for(new i = 0; i < MAX_PLAYERS; i++)
{
TextDrawSetSelectable(EngineStart[i], 1);
TextDrawSetSelectable(EngineStop[i], 1);
}
// OnPlayerStateChange
if(IsCar(vehiclemodel) || IsMotorCycle(vehiclemodel) || IsBoat(vehiclemodel))
{
TextDrawShowForPlayer(playerid, EngineStart[playerid]);
TextDrawShowForPlayer(playerid, EngineStop[playerid]);
SelectTextDraw(playerid, RED);
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
new vehicle = GetPlayerVehicleID(playerid);
new lights, alarm, doors, bonnet, boot;
if (clickedid != Text:INVALID_TEXT_DRAW)
{
if(clickedid == EngineStart[playerid])
{
SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
TextDrawShowForPlayer(playerid,speed[playerid]);
}
else if(clickedid == EngineStop[playerid])
{
SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);
}
CancelSelectTextDraw(playerid);
}
return 1;
}
public SpeedoUpdate()
{
for(new i = 0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
new Float:x,Float:y,Float:z,string[24],vehicleid = GetPlayerVehicleID(i);
GetVehicleVelocity(vehicleid,x,y,z);
format(string,sizeof(string),"%d~w~km/h", GetPlayerSpeed(i, true));//floatround(floatsqroot(((x*x)+(y*y))+(z*z))*250.666667));
TextDrawSetString(speed[i],string);
if(GetPlayerSpeed(i, true) >= 2)
{
TextDrawHideForPlayer(i, EngineStop[i]);
TextDrawSetSelectable(EngineStart[i], 1);
SelectTextDraw(playerid, 0xFF0000FF);
}
else
{
TextDrawShowForPlayer(i, EngineStop[i]);
SelectTextDraw(playerid, 0xFF0000FF);
TextDrawSetSelectable(EngineStop[i], 1);
}
}
if(!IsPlayerInAnyVehicle(i))
{
TextDrawHideForPlayer(i,speed[i]);
}
}
}