30.11.2009, 11:40
Hi all.. I'm doing my own car info script wich shows speed, health, gas and stuff.. But it's not working that I need. Info shows just for me. Here is the script:
When I do like that: for(new w = 0; w < MAX_PLAYERS; w++) it works, but has bug. When one player enter one veh all good. But when other player enter other car, car info shows first player info. Maybe someone know how to fix it?
Код:
public MasinosTextDraw(playerid) { new vehicleid = GetPlayerVehicleID(playerid); new model = GetVehicleModel(vehicleid); new Float:bukle; GetVehicleHealth(vehicleid, bukle); if(IsPlayerInAnyVehicle(playerid)) { TextDrawShowForPlayer(playerid, Text:Degalai); TextDrawShowForPlayer(playerid, Text:Greitis); TextDrawShowForPlayer(playerid, Text:GreitisStr); TextDrawShowForPlayer(playerid, Text:Bukle); TextDrawShowForPlayer(playerid, Text:Atrakinta); TextDrawShowForPlayer(playerid, Text:VModelis); if(model != BMX || model != BIKE || model != MTBIKE || model != 537) { TextDrawShowForPlayer(playerid, Text:DegalaiStr); new GasStr[64]; format(GasStr,128,"%d",vehicleDB[vehicleid][gas]); TextDrawSetString(Text:DegalaiStr,GasStr); } if(model == BMX || model == BIKE || model == MTBIKE || model == 537) { TextDrawHideForPlayer(playerid, DegalaiStr); } if(bukle > 800) { TextDrawHideForPlayer(playerid, Text:Gera); TextDrawHideForPlayer(playerid, Text:Bloga); TextDrawShowForPlayer(playerid, Text:Puiki); } else if(bukle < 800) { TextDrawHideForPlayer(playerid, Text:Puiki); TextDrawHideForPlayer(playerid, Text:Bloga); TextDrawShowForPlayer(playerid, Text:Gera); } else if(bukle < 470) { TextDrawHideForPlayer(playerid, Text:Puiki); TextDrawHideForPlayer(playerid, Text:Gera); TextDrawShowForPlayer(playerid, Text:Bloga); } new ModelStr[64]; format(ModelStr,128,"%s",aVehicleNames[GetVehicleModel(vehicleid)-400]); TextDrawSetString(Text:VModelis,ModelStr); new Float:X, Float:Y, Float:Z, Float:Speed; GetVehicleVelocity(GetPlayerVehicleID(playerid), X, Y, Z); Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)), floatpower(Z, 2))), 100.0); new GreicioStr[64]; format(GreicioStr,128,"%i",floatround(Speed, floatround_floor)); TextDrawSetString(Text:GreitisStr,GreicioStr); if(vehicleDB[vehicleid][locked] == true || motoDB[vehicleid][locked] == true) { TextDrawHideForPlayer(playerid, Text:Atrakinta); TextDrawShowForPlayer(playerid, Text:Uzrakinta); } else if(vehicleDB[vehicleid][locked] == false || motoDB[vehicleid][locked] == false) { TextDrawHideForPlayer(playerid, Text:Uzrakinta); TextDrawShowForPlayer(playerid, Text:Atrakinta); } } else { TextDrawHideForPlayer(playerid, Text:Degalai); TextDrawHideForPlayer(playerid, Text:DegalaiStr); TextDrawHideForPlayer(playerid, Text:Greitis); TextDrawHideForPlayer(playerid, Text:GreitisStr); TextDrawHideForPlayer(playerid, Text:Bukle); TextDrawHideForPlayer(playerid, Text:Atrakinta); TextDrawHideForPlayer(playerid, Text:Uzrakinta); TextDrawHideForPlayer(playerid, Text:VModelis); TextDrawHideForPlayer(playerid, Text:Gera); TextDrawHideForPlayer(playerid, Text:Puiki); TextDrawHideForPlayer(playerid, Text:Bloga); } return 1; }