I have setvehiclespeed function, how can I make getvehiclespeed using similiar setup?
#1

Here is my SetVehicleSpeed function:

Код:
stock SetVehicleSpeed(vehicleid, Float:speed)
{
	new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:a;
	GetVehicleVelocity(vehicleid, x1, y1, z1);
	GetVehiclePos(vehicleid, x2, y2, z2);
	GetVehicleZAngle(vehicleid, a); a = 360 - a;
	x1 = (floatsin(a, degrees) * (speed/100) + floatcos(a, degrees) * 0 + x2) - x2;
	y1 = (floatcos(a, degrees) * (speed/100) + floatsin(a, degrees) * 0 + y2) - y2;
	SetVehicleVelocity(vehicleid, x1, y1, z1);
}
Could someone help me and make GetVehicleSpeed function with similiar setup and close values?
Reply
#2

PHP код:
GetVehicleSpeed(vehicleid)
{
    new 
Float:VxFloat:VyFloat:Vz;
    
GetVehicleVelocity(vehicleidVxVyVz);
    new 
Float:rtn;
    
rtn floatsqroot(floatpower(Vx*100,2) + floatpower(Vy*100,2));
    
rtn floatsqroot(floatpower(rtn,2) + floatpower(Vz*100,2));
    return 
floatround(rtn);

Maybe this will help you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)