[Tutorial] Flip with a Key
#1

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)

PHP Code:
#define flip KEY_NO //KEY NO IS "N" 
STEP 2: Now under the OnPlayerKeyStateChange callback we add our command.

PHP Code:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    
//THE FUNCTION HERE(THANKS TO RedFusion for the correction)
    
return 1;

STEP 3: Function, the code to insert into the callback is this:

PHP Code:
if( newkeys flip )
{
    if( 
IsPlayerInAnyVehicleplayerid ) )//This need to know if you are in a vehicle
    
{
        new 
currentveh GetPlayerVehicleIDplayerid ), Float:angle//This is for the id of your vehicle
        
        
GetVehicleZAnglecurrentvehangle ); //This get the Z angle
        
SetVehicleZAnglecurrentvehangle );//This SET the Z angle for our vehicle
        
        
SendClientMessageplayerid0xFFFFFFFF"The vehicle was flipped." ); //Is a message
    
}
}
return 
1;//remember this!!

Thanks, BYE
Reply
#2

Fix your indentation. Maybe also explain more?
Reply
#3

Is the first tutorial, I'll do better soon ^^
Reply
#4

I don't really see how this is a tutorial.. So simple.
Yet, you did explain the small amount of information that was in there, that's good!

Btw i believe it's called a function, not a command
Reply
#5

It is a small error,yes is a function ^^

Thanks RedFusion ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)