02.01.2017, 13:48
(
Последний раз редактировалось AndreiWow; 02.01.2017 в 14:54.
)
Why is this speedometer not showing when entering the vehicle?
Код:
new Text:bg; new Text:barsus; new Text:viteza; new Text:vitezakm; new Text:tipmasina;
Код:
SetTimer("Speedometer", 200, true);
Код:
bg = TextDrawCreate(625.200195, 362.140075, "usebox"); TextDrawLetterSize(bg, 0.000000, 5.283332); TextDrawTextSize(bg, 500.400024, 0.000000); TextDrawAlignment(bg, 1); TextDrawColor(bg, 0); TextDrawUseBox(bg, true); TextDrawBoxColor(bg, 102); TextDrawSetShadow(bg, 0); TextDrawSetOutline(bg, 0); TextDrawFont(bg, 0); barsus = TextDrawCreate(496.799926, 349.440002, "LD_SPAC:white"); TextDrawLetterSize(barsus, 0.000000, 0.000000); TextDrawTextSize(barsus, 131.999908, 11.946675); TextDrawAlignment(barsus, 1); TextDrawColor(barsus, -1378294017); TextDrawSetShadow(barsus, 0); TextDrawSetOutline(barsus, 0); TextDrawFont(barsus, 4); vitezakm = TextDrawCreate(569.599914, 393.493255, "km/h"); TextDrawLetterSize(vitezakm, 0.449999, 1.600000); TextDrawAlignment(vitezakm, 1); TextDrawColor(vitezakm, -1); TextDrawSetShadow(vitezakm, 0); TextDrawSetOutline(vitezakm, 1); TextDrawBackgroundColor(vitezakm, 51); TextDrawFont(vitezakm, 2); TextDrawSetProportional(vitezakm, 1); viteza = TextDrawCreate(506.399749, 348.693237, "100"); TextDrawLetterSize(viteza, 0.874800, 7.677864); TextDrawAlignment(viteza, 1); TextDrawColor(viteza, -1); TextDrawSetShadow(viteza, 0); TextDrawSetOutline(viteza, 1); TextDrawBackgroundColor(viteza, 51); TextDrawFont(viteza, 2); TextDrawSetProportional(viteza, 1); tipmasina = TextDrawCreate(533.600158, 347.946716, "sultan"); TextDrawLetterSize(tipmasina, 0.779600, 1.308799); TextDrawAlignment(tipmasina, 1); TextDrawColor(tipmasina, -1061109505); TextDrawUseBox(tipmasina, true); TextDrawBoxColor(tipmasina, 0); TextDrawSetShadow(tipmasina, 0); TextDrawSetOutline(tipmasina, 1); TextDrawBackgroundColor(tipmasina, 51); TextDrawFont(tipmasina, 0); TextDrawSetProportional(tipmasina, 1);
Код:
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) { TextDrawShowForPlayer(playerid, bg); TextDrawShowForPlayer(playerid, barsus); TextDrawShowForPlayer(playerid, vitezakm); TextDrawShowForPlayer(playerid, viteza); TextDrawShowForPlayer(playerid, tipmasina); } else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) { TextDrawHideForPlayer(playerid, bg); TextDrawHideForPlayer(playerid, barsus); TextDrawHideForPlayer(playerid, vitezakm); TextDrawHideForPlayer(playerid, tipmasina); TextDrawHideForPlayer(playerid, viteza); }
Код:
forward Speedometer(playerid); public Speedometer(playerid) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i)) { new string[32], string2[32]; format(string, sizeof(string), "%s", VehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400]); TextDrawSetString(tipmasina, string); format(string2, sizeof(string2), "%d", GetPlayerSpeed(i, 0)); TextDrawSetString(viteza, string2); } } return 1; }
Код:
TextDrawHideForAll(bg); TextDrawHideForAll(barsus); TextDrawHideForAll(vitezakm); TextDrawDestroy(bg); TextDrawDestroy(barsus); TextDrawDestroy(vitezakm); TextDrawHideForAll(viteza); TextDrawDestroy(viteza); TextDrawDestroy(tipmasina); TextDrawHideForAll(tipmasina);