[Tutorial] [TUT]Making a simple flip command
#1

Making a simple /flip command
Hey all today i am going to show you how to make a very simple /flip command.

Lets start then.

now today we will be using some very simple funtions such as

pawn Code:
IsPlayerInAnyVehicle
pawn Code:
GetPlayerVehicleID
pawn Code:
GetVehicleZAngle
and
pawn Code:
SetVehicleZAngle
Now let me explain how IsPlayerInAnyVehicle works.

pawn Code:
if(!IsPlayerInAnyVehicle(playerid))
This will check if the player is in a vehicle

And if he isn't in a vehicle we can return a message.

Like this:

pawn Code:
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,color,"You must be in a vehicle");
Okay i hope i explained that well.

Now i will explain about GetPlayerVehicleID

First will need to make a varaible

pawn Code:
new vehicleid;
Now theres the varaible made lets move on

now we can use GetPlayerVehicleID

[pawn]vehicleid = GetPlayerVehicleID(playerid);/pawn]

This gets the players vehicleid.

Now we're gonna move on to

GetVehicleZAngle

Right first we need to create a Float


pawn Code:
new Float:vangle;

now we can use GetVehicleZAngle

So lets explain how this works.

[pawn]GetVehicleZAngle(vehicleid,zangle);/pawn]

this gets the players vehicle.

Ok lastly we have

SetVehicleZAngle

Now this will Set the players vehicle back to the current position.

Ok

And when your finished your code should look like this.


pawn Code:
if (strcmp("/flip", cmdtext, true, 10) == 0)
    {   if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED2,"You must be in a vehicle.");
        {
        new vehicle;
        new Float:zangle;
        vehicle = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(vehicle,zangle);
        SetVehicleZAngle(vehicle,zangle);
        SendClientMessage(playerid,color,"Vehicle succesfully flipped.");
        }

        return 1;
    }

Remmeber to define "color"
Reply


Messages In This Thread
[TUT]Making a simple flip command - by Jay. - 24.07.2010, 13:39
Re: [TUT]Making a simple flip command - by willsuckformoney - 24.07.2010, 17:01
Re: [TUT]Making a simple flip command - by Jay. - 24.07.2010, 18:58
Re: [TUT]Making a simple flip command - by Carlton - 24.07.2010, 21:00
Re: [TUT]Making a simple flip command - by Flo_White - 24.07.2010, 21:07
Re: [TUT]Making a simple flip command - by Agent Smith - 24.07.2010, 21:10
Re: [TUT]Making a simple flip command - by Flo_White - 24.07.2010, 21:13
Re: [TUT]Making a simple flip command - by willsuckformoney - 24.07.2010, 22:58
Re: [TUT]Making a simple flip command - by hab2ever - 25.07.2010, 05:02
Re: [TUT]Making a simple flip command - by Jay. - 25.07.2010, 16:29
Re: [TUT]Making a simple flip command - by Jay. - 25.07.2010, 16:38
Re: [TUT]Making a simple flip command - by CSMajor - 25.07.2010, 20:18
Re: [TUT]Making a simple flip command - by John_F - 28.07.2010, 21:51

Forum Jump:


Users browsing this thread: 1 Guest(s)