SA-MP Forums Archive
[Tutorial] How to create organization vehicles. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to create organization vehicles. (/showthread.php?tid=193167)



How to create organization vehicles. - Tee - 25.11.2010

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.


Re: How to create organization vehicles. - ingokodba - 17.12.2010

This was realy help me!Thank you!


Re: How to create organization vehicles. - MestreKiller - 17.12.2010

resuming:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid == SAPD1||SAPD2 && Member[playerid] != 1)
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, red, "This is an Organization vehicle!");
        }
    }
    return 1;
}



Re: How to create organization vehicles. - Tee - 18.12.2010

I never tryed that way. It could work.


Re: How to create organization vehicles. - Jochemd - 18.12.2010

Nice and simple, but I recommend you to do it dynamic. I mean:

new SAPD[2];

SAPD[0] = AddStaticVehicle(blabla);
SAPD[1] = AddStaticVehicle(blabla);

etc.


Re: How to create organization vehicles. - MestreKiller - 18.12.2010

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Nice and simple, but I recommend you to do it dynamic. I mean:

new SAPD[2];

SAPD[0] = AddStaticVehicle(blabla);
SAPD[1] = AddStaticVehicle(blabla);

etc.
yeh its more effecient


Re: How to create organization vehicles. - Tee - 19.12.2010

Quote:
Originally Posted by [OC]MestreKiller
Посмотреть сообщение
resuming:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid == SAPD1||SAPD2 && Member[playerid] != 1)
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, red, "This is an Organization vehicle!");
        }
    }
    return 1;
}
Sorry that will not work.


Re: How to create organization vehicles. - Jochemd - 30.12.2010

Indeed it wouldn't.


Re: How to create organization vehicles. - THE_KNOWN - 12.01.2011

some one help me with this the raf org vehs are bugged. the vehs are at area 51 and they dont act like org vehs. check my script (attached).


Re: How to create organization vehicles. - black_dota - 14.01.2011

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Nice and simple, but I recommend you to do it dynamic. I mean:

new SAPD[2];

SAPD[0] = AddStaticVehicle(blabla);
SAPD[1] = AddStaticVehicle(blabla);

etc.
you were faster than me xD