Make vehicles only for admins Help?
#1

Hey guys, im just wondering is there a way to make this vehicles only for admins?

Код:
    AddStaticVehicle(522,217.8630,1854.9401,12.4834,0.6474,151,0); // nrg area51
    AddStaticVehicle(470,213.7728,1854.6956,12.9258,1.8452,43,0); // patriot area51
    AddStaticVehicle(447,225.8707,1887.0684,17.6522,1.7829,75,2); // seasparrow area51
    AddStaticVehicle(495,221.9560,1854.6931,13.2558,359.1743,151,0); // sandking area51
+Rep for the dude who help me.
Reply
#2

Example:

pawn Код:
AdminVehicles[4]; //This is a global variable

AdminVehicles[0] = AddStaticVehicle(522,217.8630,1854.9401,12.4834,0.6474,151,0); // nrg area51
AdminVehicles[1] = AddStaticVehicle(470,213.7728,1854.6956,12.9258,1.8452,43,0); // patriot area51
AdminVehicles[2] = AddStaticVehicle(447,225.8707,1887.0684,17.6522,1.7829,75,2); // seasparrow area51
AdminVehicles[3] = AddStaticVehicle(495,221.9560,1854.6931,13.2558,359.1743,151,0); // sandking area51

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    for(new i = 0; i < 4; i++)
    {
        if(vehicleid == AdminVehicles[i])
        {
            //If the vehicle is an admin vehicle, do something here to check if the player is admin
        }
    }
    return 1;
}
I suggest searching first
Reply
#3

Quote:
Originally Posted by Kindred
Посмотреть сообщение
Example:

pawn Код:
AdminVehicles[4]; //This is a global variable

AdminVehicles[0] = AddStaticVehicle(522,217.8630,1854.9401,12.4834,0.6474,151,0); // nrg area51
AdminVehicles[1] = AddStaticVehicle(470,213.7728,1854.6956,12.9258,1.8452,43,0); // patriot area51
AdminVehicles[2] = AddStaticVehicle(447,225.8707,1887.0684,17.6522,1.7829,75,2); // seasparrow area51
AdminVehicles[3] = AddStaticVehicle(495,221.9560,1854.6931,13.2558,359.1743,151,0); // sandking area51

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    for(new i = 0; i < 4; i++)
    {
        if(vehicleid == AdminVehicles[i])
        {
            //If the vehicle is an admin vehicle, do something here to check if the player is admin
        }
    }
    return 1;
}
I suggest searching first
I already searched but don't found anything.

But i don't understand you. Now iv'e got errors.

Код:
error 017: undefined symbol "AdminVehicles"
What's wrong?
Reply
#4

Quote:
Originally Posted by Kindred
Посмотреть сообщение
Example:

pawn Код:
AdminVehicles[4]; //This is a global variable

AdminVehicles[0] = AddStaticVehicle(522,217.8630,1854.9401,12.4834,0.6474,151,0); // nrg area51
AdminVehicles[1] = AddStaticVehicle(470,213.7728,1854.6956,12.9258,1.8452,43,0); // patriot area51
AdminVehicles[2] = AddStaticVehicle(447,225.8707,1887.0684,17.6522,1.7829,75,2); // seasparrow area51
AdminVehicles[3] = AddStaticVehicle(495,221.9560,1854.6931,13.2558,359.1743,151,0); // sandking area51

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    for(new i = 0; i < 4; i++)
    {
        if(vehicleid == AdminVehicles[i])
        {
            //If the vehicle is an admin vehicle, do something here to check if the player is admin
        }
    }
    return 1;
}
I suggest searching first
err... This only check it when the player enters the vehicle..
If you want it only for admins, I would suggest using OnPlayerStateChange to check when they are inside a vehicle, to remove them if they are not admin..

EDIT: for your error, replace the
pawn Код:
AdminVehicles[4]; //This is a global variable
that Kindred wrote, with
pawn Код:
new AdminVehicles[4]; //This is a global variable
Reply
#5

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
err... This only check it when the player enters the vehicle..
If you want it only for admins, I would suggest using OnPlayerStateChange to check when they are inside a vehicle, to remove them if they are not admin..

EDIT: for your error, replace the
pawn Код:
AdminVehicles[4]; //This is a global variable
that Kindred wrote, with
pawn Код:
new AdminVehicles[4]; //This is a global variable
Can you help me? i looked in wiki but there only i find the states i can't build the command.
If anyone enter it to drop him from the veh.
Reply
#6

Step one : Find an admin filterscript
Step Two : Find the if(IsAdminLevel code
Step Three : Add that code under onplayerentervehicle and show players the message that they are not admin.like:
Код:
if(IsAdminLevel[playerid]==0)//when player is not an admin
{
SendClientMessage(playerid,COLOR_RED,"Only Admins can enter this vehicle");
}
else //when player is admin 
{

}
Step Four : Dont forget to make you admin at the server files.

I recom u use ladmin or luxadmin.
Reply
#7

So i make this.
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    for(new i = 0; i < 4; i++)
    {
        if(vehicleid == AdminVehicles[i])
        {
 	    if(!IsPlayerAdmin(playerid)) return //---//
        }
    }
    return 1;
}
Where are the //---// what i need to type to drop the player?
Reply
#8

use OnPlayerStateChange not OnPlayerEnterVehicle it will not work for sure..
Plus if player change state to PLAYER_STATE_DRIVER check if player's vehicle id is Admin's Vehicle
if its Admin Vehicle check if player is admin, if he is admin, then return 1;, if he is not, Remove him from the vehicle.

This forum requires that you wait 120 seconds between posts. Please try again in 25 seconds.
Reply
#9

Quote:
Originally Posted by Romel
Посмотреть сообщение
use OnPlayerStateChange not OnPlayerEnterVehicle it will not work for sure..
Plus if player change state to PLAYER_STATE_DRIVER check if player's vehicle id is Admin's Vehicle
if its Admin Vehicle check if player is admin, if he is admin, then return 1;, if he is not, Remove him from the vehicle.

This forum requires that you wait 120 seconds between posts. Please try again in 25 seconds.
Good, but the problem is i can't build the command. If i can i won't start this tread. I need help for the command. When i see the problems i learn from my fails.
Reply
#10

Thanks Romel, you helped me alot. +Rep for you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)