08.04.2013, 17:21
That's what I've done so far, probably you gonna know how to change the rest.
All what you have to do is design your textdraw in public "VehicleStats" because I have no clue what the messages means.. Just use TextDrawSetString - https://sampwiki.blast.hk/wiki/TextDrawSetString It's not that hard, try. Change a message to your textdraw because I don't know how your textdraw looks.
pawn Код:
#include <a_samp>
new Text:Textdraw[6];
new Timer[MAX_PLAYERS];
public OnGameModeInit()
{
Textdraw[0] = TextDrawCreate(630.750000, 302.500000, "usebox");
TextDrawLetterSize(Textdraw[0], 0.000000, 10.183333);
TextDrawTextSize(Textdraw[0], 482.375000, 0.000000);
TextDrawAlignment(Textdraw[0], 1);
TextDrawColor(Textdraw[0], 0);
TextDrawUseBox(Textdraw[0], true);
TextDrawBoxColor(Textdraw[0], 127);
TextDrawSetShadow(Textdraw[0], 0);
TextDrawSetOutline(Textdraw[0], -10);
TextDrawFont(Textdraw[0], 0);
Textdraw[1] = TextDrawCreate(493.125000, 284.666534, "Velocimetro");
TextDrawLetterSize(Textdraw[1], 0.449999, 1.600000);
TextDrawAlignment(Textdraw[1], 1);
TextDrawColor(Textdraw[1], 16777215);
TextDrawSetShadow(Textdraw[1], 0);
TextDrawSetOutline(Textdraw[1], 1);
TextDrawBackgroundColor(Textdraw[1], 51);
TextDrawFont(Textdraw[1], 2);
TextDrawSetProportional(Textdraw[1], 1);
Textdraw[2] = TextDrawCreate(499.375000, 303.916748, "Motor:");
TextDrawLetterSize(Textdraw[2], 0.449999, 1.600000);
TextDrawAlignment(Textdraw[2], 1);
TextDrawColor(Textdraw[2], -1);
TextDrawSetShadow(Textdraw[2], 0);
TextDrawSetOutline(Textdraw[2], 2);
TextDrawBackgroundColor(Textdraw[2], 51);
TextDrawFont(Textdraw[2], 3);
TextDrawSetProportional(Textdraw[2], 1);
Textdraw[3] = TextDrawCreate(519.375000, 326.083282, "KM/H:");
TextDrawLetterSize(Textdraw[3], 0.449999, 1.600000);
TextDrawAlignment(Textdraw[3], 1);
TextDrawColor(Textdraw[3], -1);
TextDrawSetShadow(Textdraw[3], 0);
TextDrawSetOutline(Textdraw[3], -3);
TextDrawBackgroundColor(Textdraw[3], 51);
TextDrawFont(Textdraw[3], 3);
TextDrawSetProportional(Textdraw[3], 1);
Textdraw[4] = TextDrawCreate(488.125000, 348.250122, "GASOLEO:");
TextDrawLetterSize(Textdraw[4], 0.449999, 1.600000);
TextDrawAlignment(Textdraw[4], 1);
TextDrawColor(Textdraw[4], -1);
TextDrawSetShadow(Textdraw[4], 0);
TextDrawSetOutline(Textdraw[4], 2);
TextDrawBackgroundColor(Textdraw[4], 51);
TextDrawFont(Textdraw[4], 3);
TextDrawSetProportional(Textdraw[4], 1);
Textdraw[5] = TextDrawCreate(495.000000, 371.583404, "ESTADO:");
TextDrawLetterSize(Textdraw[5], 0.449999, 1.600000);
TextDrawAlignment(Textdraw[5], 1);
TextDrawColor(Textdraw[5], -1);
TextDrawSetShadow(Textdraw[5], 0);
TextDrawSetOutline(Textdraw[5], 2);
TextDrawBackgroundColor(Textdraw[5], 51);
TextDrawFont(Textdraw[5], 3);
TextDrawSetProportional(Textdraw[5], 1);
return true;
}
public OnGameModeExit()
{
for(new i = 0; i != 5; i++)
{
TextDrawDestroy(Text:Textdraw[i]);
}
return true;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
for(new i = 0; i != 5; i++)
{
TextDrawShowForPlayer(playerid, Text:Textdraw[i]);
}
Timer[playerid] = SetTimerEx("VehicleStats", 1000, true, "d", playerid);
}
if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
{
for(new i = 0; i != 5; i++)
{
TextDrawHideForPlayer(playerid, Text:Textdraw[i]);
}
KillTimer(Timer[playerid]);
}
return true;
}
public VehicleStats(playerid)
{
new i = playerid;
if(!IsPlayerConnected(i))continue;
if(ShowFuel[i] && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new form[128];
new vehicle = GetPlayerVehicleID(i);
if(!OutOfFuel[i])
{
if(Fuel[vehicle] <= 25)
{
if(EngineStatus[vehicle])
{
format(form, sizeof(form), "~w~~n~~n~~n~~n~~y~Motor a trabalhar.~n~~w~Gasolina:~g~ %d%~n~~r~deposito na reserva.~n~~w~Velocidade:~g~ %dKm/h",Fuel[vehicle], GetSpeedKM(i));
// Here
}
else
{
format(form, sizeof(form), "~w~~n~~n~~n~~n~~y~Motor desligado.~n~~w~Gasolina:~g~ %d%~n~~r~deposito na reserva.~n~~w~Velocidade:~g~ %dKm/h",Fuel[vehicle], GetSpeedKM(i));
// Here
}
}
else
{
if(EngineStatus[vehicle])
{
format(form, sizeof(form), "~w~~n~~n~~n~~n~~n~~y~Motor a trabalhar.~n~~w~Gasolina:~g~ %d%~n~~w~Velocidade:~g~ %dKm/h",Fuel[vehicle],GetSpeedKM(i));
// Here
}
else
{
format(form, sizeof(form), "~w~~n~~n~~n~~n~~n~~y~Motor desligado.~n~~w~Gasolina:~g~ %d%~n~~w~Velocidade:~g~ %dKm/h",Fuel[vehicle],GetSpeedKM(i));
// Here
}
}
}
}
return true;
}