Ondrej Igar 24 Odesláno: 16. Duben, 2012 Share Odesláno: 16. Duben, 2012 Delam si do GM tachometr ale nezobrazuje se mi rychlost ale 0 nebo tak. Snimek http://img98.imageshack.us/img98/2768/jfunwm.jpg Toto mam v souboru .pwn (Nenechte se zmast, new-y atd. tam mam taky ale nebuu je sem psat) //Nahore stock GetPlayerSpeed(playerid,bool:kmh) { new Float:Vx,Float:Vy,Float:Vz,Float:rtn; GetPlayerVelocity(playerid,Vx,Vy,Vz); rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2))); return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100); } //OnGameModeInit SetTimer("speed", 1000, true); Speed[i] = TextDrawCreate(464,301,"Rychlost: 0 km/h"); TextDrawLetterSize(Speed[i],0.500000,1.000000); TextDrawAlignment(Speed[i],0); TextDrawBackgroundColor(Speed[i],0x000000FF); TextDrawFont(Speed[i],1); TextDrawUseBox(Speed[i],0); TextDrawSetOutline(Speed[i],1); TextDrawSetProportional(Speed[i],1); TextDrawSetShadow(Speed[i],1); //Public public speed() { new i; for(i=0;i { if(IsPlayerConnected(i)) { if(IsPlayerInAnyVehicle(i)) { //CarSpeed = GetPlayerSpeed(i,true); new string[500]; //format(string,sizeof(string),"~b~Rychlost: ~W~%d% km/h~n~~b~Rychlost: ~w~%d km/h" ,GetPlayerSpeed(i,true),GetPlayerSpeed(i,true)); format(string,sizeof(string),"~b~Rychlost: ~W~%0.f km/h~n~~b~Rychlost: ~w~%d km/h~n~~b~Rychlost: ~w~%0.d km/h" ,GetPlayerSpeed(i,true),GetPlayerSpeed(i,true),GetPlayerSpeed(i,true));[color=#FF0000]//Dal jsem to tam 3x testoval jsem ruzne funkce ale vsechny 0[/color] TextDrawSetString(Speed[i],string); TextDrawShowForPlayer(i,Speed[i]); } else { TextDrawHideForPlayer(i,Speed[i]); } } } return 1; } Link to comment Share on other sites More sharing options...
0 _Martin_ 10 Odesláno: 17. Duben, 2012 Share Odesláno: 17. Duben, 2012 Skús ten format premazať a nechať tam len toto: format(string,sizeof(string),"Rychlost: %d km/h", GetPlayerSpeed(i,true)); a pole string nemaj na 500 stačí ti tých 25 cca. Potom uvidíme čo s tým ďalej keď ti to aj tak nepojde. Sent from my iPhone 4S using Tapatalk Link to comment Share on other sites More sharing options...
0 .JokeR. 0 Odesláno: 17. Duben, 2012 Share Odesláno: 17. Duben, 2012 S mubby-m jsem to skoušel,ale furt to píśe: 0 Km/h A ten string 500 skousel pry kvuly tomu jestly vubec to neni stingem. Link to comment Share on other sites More sharing options...
0 _Martin_ 10 Odesláno: 17. Duben, 2012 Share Odesláno: 17. Duben, 2012 Ten string nerobí nič len trocha optimalizácie pretože 500 je na text ktorý má sotva 100 znakov dosť veľa a zbytočný. Keď budem na počítači juknem na môj tacháč a porovnám to s vašim čo tam je inak Sent from my iPhone 4S using Tapatalk Link to comment Share on other sites More sharing options...
0 _Martin_ 10 Odesláno: 17. Duben, 2012 Share Odesláno: 17. Duben, 2012 No pozeral som to a asi (nie som si istý!) ale zobrazuješ ten TD aj keď nastúpi do auta? Ak áno tak vážne neviem...lebo kód nevypadá byť zlý. Ja to mám takto 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); } OnGameModeInit for(new playerid;playerid{ textdraw2[playerid] = TextDrawCreate(516,411,"0 km/h"); TextDrawLetterSize(textdraw2[playerid],0,0); TextDrawAlignment(textdraw2[playerid],0); TextDrawBackgroundColor(textdraw2[playerid],0x00000000); TextDrawFont(textdraw2[playerid],1); TextDrawUseBox(textdraw2[playerid],1); TextDrawBoxColor(textdraw2[playerid],0x00000000); } potom si nastavujem sekundový timer for(new i;i { if(IsPlayerInAnyVehicle(i) && GetPlayerVehicleSeat(i) == 0) { new txd[75]; format(txd,sizeof(txd),"%d km/h",GetPlayerSpeed(i,true)); TextDrawSetString(textdraw2[i],txd); TextDrawShowForPlayer(i,textdraw2[i]); } if(!IsPlayerInAnyVehicle(i) || GetPlayerVehicleSeat(i) != 0) { TextDrawHideForPlayer(i,textdraw2[i]); } } a potom OnPlayerEnterVehicle new txd[75]; format(txd,sizeof(txd),"%d km/h",GetPlayerSpeed(playerid,true)); TextDrawSetString(textdraw2[playerid],txd); TextDrawShowForPlayer(playerid,textdraw2[playerid]); nakoniec onplayerexitvehicle TextDrawHideForPlayer(playerid,textdraw2[playerid]); Link to comment Share on other sites More sharing options...
Dotaz
Ondrej Igar 24
Delam si do GM tachometr ale nezobrazuje se mi rychlost ale 0 nebo tak.
Snimek http://img98.imageshack.us/img98/2768/jfunwm.jpg
Toto mam v souboru .pwn (Nenechte se zmast, new-y atd. tam mam taky ale nebuu je sem psat)
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