24.01.2014, 00:14
Well, i was wondering how to make a player able to boost his car by typing /ssb and when he types it, it gives him the abillity to left click to speed boost any help on how to make a player speed boost?
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(newkeys & KEY_FIRE)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new Float:x,Float:y,Float:z;
GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
SetVehicleVelocity(GetPlayerVehicleID(playerid), x * 1.0, y * 1.0, z * 1.0);
}
}
}
return 1;
}
new Float:x,Float:y,Float:z,Float:a,Float:distance = 0.27;
GetVehicleVelocity(vehicleid, x, y, z);
GetVehicleZAngle(vehicleid, a);
SetVehicleVelocity(vehicleid,floatadd(x,floatmul(distance,floatsin(-a,degrees))), floatadd(y,floatmul(distance,floatcos(-a,degrees))), z);