03.07.2011, 19:31
You will be using the bit-wise AND check. I would go into detail why, but it explains thoroughly on the wiki. Take a look at this page: https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Also, to check if the player clicked the right mouse button (which would be fire button), you can use the KEY_FIRE definition.
Also, to check if the player clicked the right mouse button (which would be fire button), you can use the KEY_FIRE definition.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_FIRE)
{
new vehid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if (turbo == 1)
{
new Float:Velocity[3];
GetVehicleVelocity(vehid, Velocity[0], Velocity[1], Velocity[2]);
if(Velocity[0] < maxspeed && Velocity[1] < maxspeed && Velocity[0] > -maxspeed && Velocity[1] > -maxspeed)
{
SetVehicleVelocity(vehid, Velocity[0]*speed, Velocity[1]*speed, 0.0);
}
}
}
}
return 1;
}