15.07.2013, 21:58
Good evening all, today I wish to present my guide on how to make a button that flips the vehicle.
OK, start:
STEP 1: Define the key button. (For another key visit Here)
STEP 2: Now under the OnPlayerKeyStateChange callback we add our command.
STEP 3: Function, the code to insert into the callback is this:
Thanks, BYE
OK, start:
STEP 1: Define the key button. (For another key visit Here)
PHP Code:
#define flip KEY_NO //KEY NO IS "N"
PHP Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
//THE FUNCTION HERE(THANKS TO RedFusion for the correction)
return 1;
}
PHP Code:
if( newkeys & flip )
{
if( IsPlayerInAnyVehicle( playerid ) )//This need to know if you are in a vehicle
{
new currentveh = GetPlayerVehicleID( playerid ), Float:angle; //This is for the id of your vehicle
GetVehicleZAngle( currentveh, angle ); //This get the Z angle
SetVehicleZAngle( currentveh, angle );//This SET the Z angle for our vehicle
SendClientMessage( playerid, 0xFFFFFFFF, "The vehicle was flipped." ); //Is a message
}
}
return 1;//remember this!!
}