24.06.2012, 17:36
When pressed LMB the nitro starts and automatically removes the nitro after 7 second. will not affect other script and other keys.
//Define this first
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
//Under OnPlayerKeyStateChange
if (PRESSED( KEY_FIRE ))
{
AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
}
pawn Код:
|
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if (newkeys & KEY_HORN) { if(IsPlayerInAnyVehicle(playerid)) { new VehicleID,Float:B; VehicleID = GetPlayerVehicleID(playerid); GetVehicleZAngle(VehicleID,B); SetVehicleZAngle(VehicleID,B); } } return 1; } |
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_HORN)
{
if(IsPlayerInAnyVehicle(playerid))
{
new VehicleID,Float:B;
VehicleID = GetPlayerVehicleID(playerid);
GetVehicleZAngle(VehicleID,B);
SetVehicleZAngle(VehicleID,B);
}
return 1;
}
if(PRESSED(KEY_FIRE)) /////Here
{
//....
return 1;
}
pawn Код:
|