Originally Posted by Ro[X
y ]
I did 4 TextDraws of the Vehicle State 1| "Vehicle State" 2| "Engine" 3| "Fuel" 4| "Vehicle" How can I do a textdraw for player and not for everyone. Because I want if the player's vehicle health will be 50 it will be like that: ---------- but if my friend car going to explode so it's write to me or to the other players his engine state. |
format(string,sizeof(string),"~w~Vehicle: ~b~%s",VehicleName[GetVehicleModel(vehicleid)-400]); TextDrawSetString(Textdraw3,string); TextDrawShowForPlayer(playerid,Textdraw0); TextDrawShowForPlayer(playerid,Textdraw1); TextDrawShowForPlayer(playerid,Textdraw2); TextDrawShowForPlayer(playerid,Textdraw3); Fuel = SetTimerEx("FuelUpdate", 300, true, "i", playerid); Engine = SetTimerEx("EngineUpdate", 300,true, "i", playerid);
public FuelUpdate(playerid) { if(IsPlayerConnected(playerid)) { new vehicle = GetPlayerVehicleID(playerid); if(IsPlayerInAnyVehicle(playerid) == 1) { if(Gas[vehicle] >= 1) { if(Gas[vehicle] >= 0 && Gas[vehicle] <= 0) { TextDrawSetString(Textdraw2,"~w~Fuel: ----------"); SendClientMessage(playerid,COLOR_LIGHTRED,"There is no fuel in the fuel's tank please fill your car or /exit"); TogglePlayerControllable(playerid, 0); } if(Gas[vehicle] >= 0 && Gas[vehicle] <= 10) { TextDrawSetString(Textdraw2,"~w~Fuel:~r~ -~w~---------"); } if(Gas[vehicle] >= 10 && Gas[vehicle] <= 20) { TextDrawSetString(Textdraw2,"~w~Fuel:~r~ --~w~--------"); } else if(Gas[vehicle] >= 20 && Gas[vehicle] <= 30) { TextDrawSetString(Textdraw2,"~w~Fuel:~r~ ---~w~-------"); } else if(Gas[vehicle] >= 30 && Gas[vehicle] <= 40) { TextDrawSetString(Textdraw2,"~w~Fuel:~r~ ----~w~------"); } else if(Gas[vehicle] >= 40 && Gas[vehicle] <= 50) { TextDrawSetString(Textdraw2,"~w~Fuel:~r~ -----~w~-----"); } else if(Gas[vehicle] >= 50 && Gas[vehicle] <= 60) { TextDrawSetString(Textdraw2,"~w~Fuel:~r~ ------~w~----"); } else if(Gas[vehicle] >= 60 && Gas[vehicle] <= 70) { TextDrawSetString(Textdraw2,"~w~Fuel:~r~ -------~w~---"); } else if(Gas[vehicle] >= 70 && Gas[vehicle] <= 80) { TextDrawSetString(Textdraw2,"~w~Fuel:~r~ --------~w~--"); } else if(Gas[vehicle] >= 80 && Gas[vehicle] <= 90) { TextDrawSetString(Textdraw2,"~w~Fuel:~r~ ---------~w~-"); } else if(Gas[vehicle] >= 90 && Gas[vehicle] <= 100) { TextDrawSetString(Textdraw2,"~w~Fuel:~r~ ----------"); } } } } return 1; }
public EngineUpdate(playerid) { new Float:health; GetVehicleHealth(GetPlayerVehicleID(playerid),health); if (IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { if(health >= 0 && health <= 0) { TextDrawSetString(Textdraw1,"~w~Engine: ----------"); } else if(health >= 0 && health <= 100) { TextDrawSetString(Textdraw1,"~w~Engine: ~r~-~w~---------"); } else if(health >= 100 && health <= 200) { TextDrawSetString(Textdraw1,"~w~Engine: ~r~--~w~--------"); } else if(health >= 200 && health <= 300) { TextDrawSetString(Textdraw1,"~w~Engine: ~r~---~w~-------"); } else if(health >= 300 && health <= 400) { TextDrawSetString(Textdraw1,"~w~Engine: ~r~----~w~------"); } else if(health >= 400 && health <= 500) { TextDrawSetString(Textdraw1,"~w~Engine: ~r~-----~w~-----"); } else if(health >= 500 && health <= 600) { TextDrawSetString(Textdraw1,"~w~Engine: ~r~------~w~----"); } else if(health >= 600 && health <= 700) { TextDrawSetString(Textdraw1,"~w~Engine: ~r~-------~w~---"); } else if(health >= 700 && health <= 800) { TextDrawSetString(Textdraw1,"~w~Engine: ~r~--------~w~--"); } else if(health >= 800 && health <= 900) { TextDrawSetString(Textdraw1,"~w~Engine: ~r~---------~w~-"); } else if(health >= 900 && health <= 1000) { TextDrawSetString(Textdraw1,"~w~Engine: ~r~----------"); } } return 1; }
OnFilterScriptInit() { for(new i=0;i<MAX_PLAYERS;i++) { Textdraw0[i] = TextDrawCreate(....); } }