SA-MP Forums Archive
Car speed - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Car speed (/showthread.php?tid=651791)



Car speed - Calinut200 - 27.03.2018

helo i want to check speed vehicle and to show to player with /speed for first.
I watch tutorials and topics and i don't know..i'm confuse

PHP код:
stock GetVehicleSpeed(vehicleid)
{
    new 
Float:V[3];
    
GetVehicleVelocity(vehicleidV[0], V[1], V[2]);
    return 
floatround(floatsqroot(V[0] * V[0] + V[1] * V[1] + V[2] * V[2]) * 180.00);

PHP код:
CMD:speed(playerid)
{
    new 
string[128];
    
format(string,sizeof(string),"Viteza actuala %i!",GetVehicleSpeed(playerid));
    
SendClientMessage(playerid,-1,string);
    return 
1;

in game /speed don't work , don't show the speed. Why?Can some explain detalied?


Re: Car speed - Florin48 - 27.03.2018

folosesti comanda in timp ce mergi sau stai pe loc?

Код:
stock GetSpeed(playerid)
{
    new Float:ST[3];
    GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    return floatround(1.61*floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 100.3);
}



Re: Car speed - Calinut200 - 27.03.2018

Iti multumsc, acest stock este mai bun decat al meu , acum functioneaza.Am o intrebare, cum fac ca textdraw
unde scrie SPEED : X sa se actualizeze constant cand se schimba x?


Re: Car speed - Calinut200 - 27.03.2018

Iti multumsc, acest stock este mai bun decat al meu , acum functioneaza.Am o intrebare, cum fac ca textdraw
unde scrie SPEED : X sa se actualizeze constant cand se schimba x?


Re: Car speed - ForCop - 28.03.2018

Quote:
Originally Posted by Calinut200
Посмотреть сообщение
helo i want to check speed vehicle and to show to player with /speed for first.
I watch tutorials and topics and i don't know..i'm confuse

PHP код:
stock GetVehicleSpeed(vehicleid)
{
    new 
Float:V[3];
    
GetVehicleVelocity(vehicleidV[0], V[1], V[2]);
    return 
floatround(floatsqroot(V[0] * V[0] + V[1] * V[1] + V[2] * V[2]) * 180.00);

PHP код:
CMD:speed(playerid)
{
    new 
string[128];
    
format(string,sizeof(string),"Viteza actuala %i!",GetVehicleSpeed(playerid));
    
SendClientMessage(playerid,-1,string);
    return 
1;

in game /speed don't work , don't show the speed. Why?Can some explain detalied?
Код:
stock GetVehicleSpeed(vehicleid) 
{ 
    new Float:vx,Float:vy,Float:vz; 
    GetVehicleVelocity(vehicleid, vx, vy, vz); 
    return floatsqroot(floatpower(floatabs(vx), 2.0) + floatpower(floatabs(vy), 2.0) + floatpower(floatabs(vz), 2.0)) * 126.6;
}  

the function is faster.



Re: Car speed - Florin48 - 28.03.2018

daca vrei sa se actualizeze la fiecare miscare il pui la OnPlayerUpdate(playerid); sau poti sa creezi un timer dar acesta nu e asa rapid insa nu creeaza lag care la un numar mare de jucatori de observa