25.10.2010, 13:19
In this tutorial, you're going to learn how to create a private vehicle, for specific teams or administrators, etc. (Just edit and make it fit your needs).
Let's start!
At the top of your script, under the includes, add:
Okay, basically, this will a couple warnings from appearing to you when you finish the script.
Search for:
Under:
Add:
The 'vehicleid' available at the top of the script is: GetPlayerVehicleID function, some people don't want to make the code longer or looking rubbish, they just do that to make it shorter. Let me explain this to you...
This code:
Is the same as:
So, basically that's it for this part! We'll now move to OnGameModeInIt (for gamemodes), or OnFilterScriptInIt (for filterscripts).
Under:
Add:
Model ID: Vehicle ID.
X: Position X.
Y: Position Y.
Z: Position Z.
Angle: The angle of the vehicle.
Color1: The color #1 of the vehicle.
Color2: The color #2 of the vehicle. (Not all vehicles have it, only some, such as: Banshee, Bullet.)
Well, well, well! That is it! Congratulations.
You've made a private vehicle, to add more private vehicles, just add the same thing, but instead of having it named car1, make it car2, and so on, or whatever you feel is good! It won't effect.
Leave your comments below.
Let's start!
At the top of your script, under the includes, add:
pawn Код:
new car1;
Search for:
Код:
OnPlayerStateChange
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && vehicleid == car1 && !IsPlayerAdmin(playerid)) {
RemovePlayerFromVehicle(playerid); // Ejects the player from the vehicle.
SendClientMessage(playerid, RED, "You must be a RCON administrator to drive this vehicle."); // Outputs a message to the player.
return 1;
}
This code:
pawn Код:
if(newstate == PLAYER_STATE_DRIVER && vehicleid == car1 && !IsPlayerAdmin(playerid)) {
pawn Код:
if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == car1 && !IsPlayerAdmin(playerid)) {
Under:
pawn Код:
public OnGameModeInit()
{
pawn Код:
car1 = AddStaticVehicle(MODELID, X, Y, Z, ANGLE,COLOR1,COLOR2);
X: Position X.
Y: Position Y.
Z: Position Z.
Angle: The angle of the vehicle.
Color1: The color #1 of the vehicle.
Color2: The color #2 of the vehicle. (Not all vehicles have it, only some, such as: Banshee, Bullet.)
Well, well, well! That is it! Congratulations.
You've made a private vehicle, to add more private vehicles, just add the same thing, but instead of having it named car1, make it car2, and so on, or whatever you feel is good! It won't effect.
Leave your comments below.