pe.vanasek 0 Odesláno: 30. Duben, 2014 Share Odesláno: 30. Duben, 2014 Ahoj lidi mám problém s tachometrem, když vleze hráč do auta tak se zobrazí a když vyleze, tak se skryje To je funkční ale jenom hráči s ID 0 ukazuje rychlost, ale ostatním hráčům to ukazuje Rychlost:%, Prosím nevíte co s tím? Děkuju new PlayerText:tachometrtest[MAX_PLAYERS]; forward tachometr1(playerid); stock na rychlost.......není důležitý.... public tachometr1(playerid) { new string[50]; format(string,sizeof(string),"rychlost: %d",GetPlayerSpeed(playerid,true)); PlayerTextDrawSetString(playerid, tachometrtest[playerid], string); return 1; } public OnPlayerStateChange(playerid,newstate,oldstate) { if(newstate == PLAYER_STATE_DRIVER) { tachometrtest[playerid] = CreatePlayerTextDraw(playerid, 524.000000, 330.000000, "Rychlost:%"); PlayerTextDrawShow(playerid, tachometrtest[playerid]);//ZOBRAZENIE (TextDrawShowForPlayer) SetTimer("tachometr1",1,1); } if(oldstate == PLAYER_STATE_DRIVER) { PlayerTextDrawHide(playerid, tachometrtest[playerid]);//ZMIZNUTIE (TextDrawHideForPlayer) } return 1; } Link to comment Share on other sites More sharing options...
0 Arthom 6 Odesláno: 30. Duben, 2014 Share Odesláno: 30. Duben, 2014 warning, na tvojom mieste by som už prestal spamovať vanasek, existuje aj tzv. cyklus, aby si to vyvolal u všetkých hračov, ja by som to spravil úplne inak lebo toto čo si spravil je úplne na hlavu Link to comment Share on other sites More sharing options...
0 pe.vanasek 0 Odesláno: 30. Duben, 2014 Author Share Odesláno: 30. Duben, 2014 ok, Dík ale muzes mi pls naznacit jak by si to spravil? Link to comment Share on other sites More sharing options...
0 Arthom 6 Odesláno: 30. Duben, 2014 Share Odesláno: 30. Duben, 2014 warning, zbytočne píšeš -.- v posledných tématoch iba blbosti a nijak si nepomohol, možno hodnotenie ok beriem asi nejak takto: #include <a_samp> new Text:Tachometer[MAX_PLAYERS]; public OnFilterScriptInit() { SetTimer("TachometerTimer", 100, true); return 1; } public OnFilterScriptExit() { return 1; } public OnPlayerConnect(playerid) { Tachometer[playerid] = TextDrawCreate(524.000000, 330.000000, ""); return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) { TextDrawShowForPlayer(playerid, Tachometer[playerid]); } else if (oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) { TextDrawHideForPlayer(playerid, Tachometer[playerid]); } return 1; } stock GetPlayerSpeed(playerid, bool:kmh) { new Float:Vx,Float:Vy,Float:Vz,Float:rtn; if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz); rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2))); return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100); } forward TachometerTimer(); public TachometerTimer(){ for (new i = 0; i < MAX_PLAYERS; i++) { /* Ten cyklus o ktorom som hovoril */ if (IsPlayerConnected(i) && IsPlayerInAnyVehicle(i)) { new str[256]; format(str, sizeof(str), "Rychlost: %i", GetPlayerSpeed(i, true)); TextDrawSetString(Tachometer[i], str); } } return 1; } je to spísane naslepo, lebo idem spať a už sa mi to testovať nechce, malo by to ísť Link to comment Share on other sites More sharing options...
0 pe.vanasek 0 Odesláno: 1. Květen, 2014 Author Share Odesláno: 1. Květen, 2014 Kluci moc vám děkuju, teď jdu na nákup A potom se do toho dám :D Díky moc, nevím co bych bez vás dělal.... Link to comment Share on other sites More sharing options...
Dotaz
pe.vanasek 0
Ahoj lidi mám problém s tachometrem, když vleze hráč do auta tak se zobrazí a když vyleze, tak se skryje To je funkční ale jenom hráči s ID 0 ukazuje rychlost, ale ostatním hráčům to ukazuje Rychlost:%, Prosím nevíte co s tím? Děkuju
new PlayerText:tachometrtest[MAX_PLAYERS];
forward tachometr1(playerid);
stock na rychlost.......není důležitý....
Link to comment
Share on other sites
4 odpovědí na tuto otázku
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now