faraday.
Специалист
Еще одно маленькое готовое решение от меня.
public OnPlayerStateChange(playerid, newstate, oldstate)
в таймер обновления или в OnPlayerUpdate
в public OnPlayerDeath(playerid, killerid, reason)
аттеншн: [ переменная бензина ] замените на свою.
автор: unreal.
public OnPlayerStateChange(playerid, newstate, oldstate)
PHP:
if newstate == PLAYER_STATE_DRIVER*then {
new Float:pos[3];
SetPVarInt(playerid, "speedo_object", CreatePlayerObject(playerid, 19482,0.0,0.0,0.0,0.0,0.0,0.0));
GetVehicleModelInfo(GetVehicleModel(GetPlayerVehicleID(playerid)),VEHICLE_MODEL_INFO_SIZE,pos[0],pos[1],pos[2]);
AttachPlayerObjectToVehicle(playerid, GetPVarInt(playerid, "speedo_object"),GetPlayerVehicleID(playerid),pos[0]-(pos[0]*0.1 ),pos[1]-(pos[1]*1.7),pos[2]/2,0.0,0.0,230.0);
}
if oldstate == PLAYER_STATE_DRIVER*then {
DestroyPlayerObject(playerid, GetPVarInt(playerid, "speedo_object")),DeletePVar(playerid, "speedo_object");
}
PHP:
if(IsPlayerInAnyVehicle(playerid))
{
new Float:pos[4], str[84],Float:hp;
GetVehicleHealth(GetPlayerVehicleID(playerid),hp);
GetVehicleVelocity(GetPlayerVehicleID(playerid),pos[0],pos[1],pos[2]);
format(str, sizeof(str), "\n%d {ffffff}КМ/Ч\nБЕНЗИН: {FF0000}%d л.\n{FFFFFF}СОСТОЯНИЕ: {00FF00}%d%%", floatround(floatsqroot(((pos[0]*pos[0])+(pos[1]*pos[1]))+(pos[2]*pos[2]))*156.666667),[ переменная бензина ],floatround(hp)/10);
SetPlayerObjectMaterialText(playerid, GetPVarInt(playerid, "speedo_object"),str,0,OBJECT_MATERIAL_SIZE_512x256,"Tahoma",24,true,0xFF00FF00,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
}
в public OnPlayerDeath(playerid, killerid, reason)
PHP:
DestroyPlayerObject(playerid, GetPVarInt(playerid, "speedo_object")),DeletePVar(playerid, "speedo_object");
аттеншн: [ переменная бензина ] замените на свою.
автор: unreal.
Последнее редактирование:
