[Tutorial] Creating Admin Vehicles
#1

Welcome this is my second tutorial unfortunately the first was deleted so i hope to have more luck with this so basically ill show you how to create admin vehicles the easiest way possible okay so i shall start with single admin vehicles so firstly you will need a "new" so place this outside any function

pawn Code:
new AdminVehicle;
this shows the compiler that its valid, however please note you can change AdminVehicle to what ever you want. Okay so thats that sorted, if done correctly you should get this:
Code:
C:\Users\Unlimited DMers\Desktop\Fas FreeRoam\gamemodes\tutorial.pwn(234) : warning 203: symbol is never used: "AdminVehicle"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
that basically just means that its not being used which is good as its better then tones of errors! okay now in the
pawn Code:
public OnGameModeInit() //callback
add
pawn Code:
AdminVehicle = AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:angle, color1, color2)
for tutorial sense i used grove street and a NRG-500 so my code would be:

pawn Code:
AdminVehicles = AddStaticVehicle(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,); // admin_nrg1
okay so thats sorted now, you have your vehicle in place but with that AdminVehicle means nothing to pawno so now we add this to the
pawn Code:
public OnPlayerEnterVehicle
pawn Code:
if(vehicleid == AdminVehicles && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
basically all you really need is ClearAnimations(playerid); & the top "if" statement, all this will do is unless the player is an rcon admin then it wont let them enter the car you can also use the similar method when create private cars there are a few tutorials on that else where however if you wanted to add multiple AdminVehicles then you would need to change this to
pawn Code:
new AdminVehicles[amount +1];
you must keep the +1 but the "amount" defines how many vehicles are admin only so now you must simply label your AdminVehicles like so
pawn Code:
AdminVehicles[0] = AddStaticVehicle(522,2434.1450,-1675.1233,13.4768,181.4236,1,0); // admin_nrg1
Also instead of
pawn Code:
if(vehicleid == AdminVehicles && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
you will need to add [id] so if like mine you have [0] on your "AddStaticVehicle" line the create code should be
pawn Code:
if(vehicleid == AdminVehicles[0] && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
you can have any amount of this on your script just make sure you change the [amount +1] so say for example you have 10 AdminVehicles you will need
pawn Code:
new AdminVehicles[10 + 1];
you will also need to add them in your "OnGameModeInit" and "OnPlayerEnterVehicle" so i have added them for you please note its all the same so please dont copy it as it will give you errors, also i have "AddStaticVehicleEx" that just allows me to add spawn delay to my vehicles

pawn Code:
public OnGameModeInit();
    AdminVehicles[0] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[1] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[2] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[3] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[4] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[5] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[6] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[7] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[8] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[9] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[10] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
And then on my OnPlayerEnterVehicle

pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == AdminVehicles[0] && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
    if(vehicleid == AdminVehicles[1] && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
    if(vehicleid == AdminVehicles[2] && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
    if(vehicleid == AdminVehicles[3] && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
    if(vehicleid == AdminVehicles[4] && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
    if(vehicleid == AdminVehicles[5] && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
    if(vehicleid == AdminVehicles[6] && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
    if(vehicleid == AdminVehicles[7] && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
    if(vehicleid == AdminVehicles[8] && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
    if(vehicleid == AdminVehicles[9] && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
    if(vehicleid == AdminVehicles[10] && !IsPlayerAdmin(playerid))
    {
        ClearAnimations(playerid);
        GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
    }
    return 1;
}
And thats it all done enjoy your new admin cars


IMPORTANT NOTE:You will have to be RCON admin to use them
CREDITS:
DaRkAnGeL[NBK]
Zonoya
Wesley221
Credits to the last two as this morning i didnt know how to create admin vehicles and after my thread received alot of viewers i decided to create this tutorial,
I Really Hope This Helps & Doesn't Get Deleted
Thanks XD





If you thought this tutorial was helpful please comment below also comment with any constructive criticism and any ideas for the next tutorial thanks
Reply
#2

3 Tutoirals about this is already written :S
Reply
#3

Nice tutorial, Very well explained.
Reply
#4

Nice Tut.
1-This forum requires that you wait 120 seconds between posts. Please try again in 78 seconds.
Reply
#5

pawn Code:
new AdminVehicles[10 + 1];
What? Why not:

pawn Code:
new AdminVehicles[10 char];
Reply
#6

thanks guys XD and um FireCat idk lmfao XD btw how would i create a private car with DaRkAnGeL[NBK] as the [NBK] credits errors
Reply
#7

Very Good Tutorial

Thanks 10/10
Reply
#8

Quote:
Originally Posted by Foxy95
View Post
Very Good Tutorial

Thanks 10/10
any time
Reply
#9

Quote:
Originally Posted by DaRkAnGeL[NBK]
View Post
pawn Code:
public OnGameModeInit();
    AdminVehicles[0] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[1] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[2] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[3] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[4] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[5] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[6] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[7] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[8] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[9] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
    AdminVehicles[10] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,60000); // admin_nrg1
What is this meant to do? You don't have a semi colon on the end of a callback .
Reply
#10

thanks
Reply
#11

Nice tutorial, helped me in my comming filterscript.. 10/10 m8.
- Could you PLEASE, if you know how to do this, post a tutorial about:

How to make this with COMMANDS?
Reply
#12

Quote:
Originally Posted by FireCat
View Post
pawn Code:
new AdminVehicles[10 + 1];
What? Why not:

pawn Code:
new AdminVehicles[10 char];
Because vehicleid's can exceed '0xFFFF'
Reply
#13

Use a loop!

Код:
	for(new i = 0; i < sizeof(AdminVehicles); i ++)
	{
		if(vehicleid == AdminVehicles[i] && !IsPlayerAdmin(playerid))
		{
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)