11.01.2014, 20:22
pawn Код:
#include <a_samp>
#define pressed(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
new vehicleid = GetPlayerVehicleID(playerid);
if(pressed(KEY_FIRE)){
IncreaseSpeed(vehicleid,5.0);
}
return true;
}
stock IncreaseSpeed(vehicleid,Float:speed){ //By OTACON
new Float:Velocity[4];
SetVehicleVelocity(vehicleid,0,0,0);
GetVehicleVelocity(vehicleid,Velocity[0],Velocity[1],Velocity[2]);
GetVehicleZAngle(vehicleid,Velocity[3]);
Velocity[0] = Velocity[0] + (speed/speed * floatsin(-Velocity[3], degrees));
Velocity[1] = Velocity[1] + (speed/speed * floatcos(-Velocity[3], degrees));
SetVehicleVelocity(vehicleid,Velocity[0],Velocity[1],Velocity[2]);}