28.01.2012, 09:41
Hi, I have made a filterscript that shows the player's vehicle health,
but I have a little problem.
When only one player is in a vehicle, it works perfectly,
but if two or more players are in a vehicle, the textdraw starts to flash.
I think I'm doing something wrong, but I can't find out what.
Any ideas?
but I have a little problem.
When only one player is in a vehicle, it works perfectly,
but if two or more players are in a vehicle, the textdraw starts to flash.
I think I'm doing something wrong, but I can't find out what.
Any ideas?
Код:
new Text:Text; new Float:VehicleHealth; new string[128]; public OnPlayerUpdate(playerid) { if(IsPlayerInAnyVehicle(playerid) == 1) { new VehicleID = GetPlayerVehicleID(playerid); GetVehicleHealth(VehicleID, VehicleHealth); VehicleHealth = floatround(VehicleHealth / 10, floatround_round); format(string,sizeof(string), "%0.0f%%", VehicleHealth); TextDrawDestroy(Text); Text = TextDrawCreate(5, 433, string); TextDrawSetShadow(Text, 0); TextDrawUseBox(Text, 1); TextDrawBoxColor(Text, 0x202020FF); TextDrawTextSize(Text, 48, 0); if(VehicleHealth <= 100) TextDrawColor(Text,0x00FF00FF); if(VehicleHealth < 90) TextDrawColor(Text,0x40FF00FF); if(VehicleHealth < 80) TextDrawColor(Text,0x80FF00FF); if(VehicleHealth < 70) TextDrawColor(Text,0xC0FF00FF); if(VehicleHealth < 60) TextDrawColor(Text,0xFFFF00FF); if(VehicleHealth < 50) TextDrawColor(Text,0xFFC000FF); if(VehicleHealth < 40) TextDrawColor(Text,0xFF8000FF); if(VehicleHealth < 30) TextDrawColor(Text,0xFF4000FF); if(VehicleHealth < 25) TextDrawColor(Text,0xFF0000FF); TextDrawShowForPlayer(playerid, Text); } if(IsPlayerInAnyVehicle(playerid) == 0) TextDrawDestroy(Text); return 1; }