[Tutorial] How to create organization vehicles.
#1

Hello fellow friends, this tutorial will teach you how to create organization vehicles.
NOTE: This tutorial is linked to my other tutorial about how to create organizations. However, you can manipulate it to created restricted vehicles on your server.

Lets get started.

Go to the top of your script, below the "#defines" and add:
pawn Код:
new SAPD1,SAPD2
First, get the coordination for the vehicles ready. Now the new variables that we made, will hold the vehicles.
Now go to OnGameModeInt(); and add:

pawn Код:
SAPD1 = AddStaticVehicle(598,2256.2041,2476.9424,10.5694,356.1667,0,1); // policecar1
SAPD2 = AddStaticVehicle(598,2256.2522,2442.7004,10.5722,358.7384,0,1); // policecar2
Now this is the part that we will remove the player from the vehicle if they are not in that org.

Go to OnPlayerStateChane and add:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid == SAPD1 && Member[playerid] != 1)
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, red, "This is an Organization vehicle!");
        }
    }
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid == SAPD2 && Member[playerid] != 1)
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, red, "This is an Organization vehicle!");
        }
    }
    return 1;
}
What the code above is really saying is that. When the player changes state (When they are seated in the SAPD car) it will check if they are in SAPD, and if they are not, it will remove them from the car.

I hope this helped. NB i am not good at tutorials

Note: This is outdated since I made a dynamic MySQL version.
Reply


Messages In This Thread
How to create organization vehicles. - by Tee - 25.11.2010, 05:53
Re: How to create organization vehicles. - by ingokodba - 17.12.2010, 17:15
Re: How to create organization vehicles. - by MestreKiller - 17.12.2010, 18:21
Re: How to create organization vehicles. - by Tee - 18.12.2010, 17:53
Re: How to create organization vehicles. - by Jochemd - 18.12.2010, 19:01
Re: How to create organization vehicles. - by MestreKiller - 18.12.2010, 19:29
Re: How to create organization vehicles. - by Tee - 19.12.2010, 18:57
Re: How to create organization vehicles. - by Jochemd - 30.12.2010, 14:33
Re: How to create organization vehicles. - by THE_KNOWN - 12.01.2011, 14:41
Re: How to create organization vehicles. - by black_dota - 14.01.2011, 08:10

Forum Jump:


Users browsing this thread: 2 Guest(s)