Admin cars
#1

Hey guys,

I'm trying to make Admin-Only cars, using the "LuxAdmin" FS. Can anyone give me some help, how to make the cars Admin-Only, like if your Admin level is higher as 1, you can enter them, and if you're lower as 1; you cant enter the car

Hope you guys can help me
~Wesley
Reply
#2

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
     if(GetVehicleModel(vehicleid) == 451 && !IsLuxAdmin(playerid))
    {
         SendClientMessage(playerid, 0x0, "Only admin's can enter this vehicle.");
         return 0;
    }    
     return 1;
}
Reply
#3

pawn Код:
new admincar;
 
admincar = CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay);
 
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new PlayerVehicle[playerid] = GetPlayerVehicleID(playerid);
if(Vehicle == admincar)
{                      
if(pData[ playerid ][ P_LEVEL ] > 0) // change to your admin definition
{
SendClientMessage(playerid, YELLOW, "* Welcome Back Admin!");
} else {
SendClientMessage(playerid, RED, "* You got spooked by the alarm system");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
Reply
#4

And how do i asign the admin cars?

pawn Код:
new adminvehicle;

adminvehicle = AddStaticVehicle(-------);
Like that or something?

Edit:

I'll guess imma use the last one, thanks both
Reply
#5

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
And how do i asign the admin cars?

pawn Код:
new adminvehicle;

adminvehicle = AddStaticVehicle(-------);
Like that or something?
You could do it like this:

#define MAX_ACARS 5

new admincar[MAX_ACARS];

admincar[0] = CreateVehicle etc.
admincar[1] = CreateVehicle etc.
Reply
#6

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
Hey guys,

I'm trying to make Admin-Only cars, using the "LuxAdmin" FS. Can anyone give me some help, how to make the cars Admin-Only, like if your Admin level is higher as 1, you can enter them, and if you're lower as 1; you cant enter the car

Hope you guys can help me
~Wesley
Tell me the cars your using..

pawn Код:
forward IsAdminVehicle;

public OnPlayerEnterVehicle()
{
    if(IsAdminVehicle(GetPlayerVehicleID(playerid) && level[playerid] >= 1)
    {
        return 1;
    }
    else if(level[playerid] == 0)
    {
        EjectPlayer(playerid)
        return ;
    }
    return 1;
}

IsAdminVehicle(vehicleid)
{//modify the '-' in 'AV[-]' to the amount of vehicle's placed below
        new AV[7] = { 415,487,490,522,579,580,603 }; // modify this to your vehicleid's
    for(new i = 0; i < sizeof(AV); i++)
    {
        if(GetVehicleModel(vehicleid) == AV[i]) return 1;
    }
    return 0;
}
Reply
#7

Getting these errors:

Код:
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdmin.pwn(7655) : error 008: must be a constant expression; assumed zero
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdmin.pwn(7655) : error 008: must be a constant expression; assumed zero
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdmin.pwn(7655) : error 036: empty statement
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdmin.pwn(7655) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
new admincar;

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
    new PlayerVehicle[playerid] = GetPlayerVehicleID(playerid);
    if(Vehicle == admincar)
    {
    if(pData[ playerid ][ P_LEVEL ] > 1) // change to your admin definition
    {
    SendClientMessage(playerid, COLOUR_BLUE, "* Welcome back Admin");
    } else {
    SendClientMessage(playerid, COLOUR_RED, "* Hehe oopsy, you're not an admin");
    RemovePlayerFromVehicle(playerid);
    }
    }
    }
    return 1;
    }
return 1;
}

public OnFilterScriptInit()
{
    admincar = AddStaticVehicle(411,2990.5266,486.9260,531.8724,359.2304,0,0); // parkeergarage infernus admin
    admincar = AddStaticVehicle(411,3007.0715,487.9013,531.8724,359.6575,0,0); // parkeergarage  admin 2
    admincar = AddStaticVehicle(562,2973.6538,485.5471,531.8053,0.8081,0,0); // parkeer garage elegy 1 admin
    admincar = AddStaticVehicle(562,2983.8596,485.9474,531.8047,359.9193,0,0); // parkeergarage elegy 2 admin
    admincar = AddStaticVehicle(562,3047.0522,507.4697,531.8049,270.4333,0,0); // parkeergarage elegy 3 admin
}
Reply
#8

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
Getting these errors:

Код:
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdmin.pwn(7655) : error 008: must be a constant expression; assumed zero
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdmin.pwn(7655) : error 008: must be a constant expression; assumed zero
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdmin.pwn(7655) : error 036: empty statement
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdmin.pwn(7655) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
new admincar;

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
    new PlayerVehicle[playerid] = GetPlayerVehicleID(playerid);
    if(Vehicle == admincar)
    {
    if(pData[ playerid ][ P_LEVEL ] > 1) // change to your admin definition
    {
    SendClientMessage(playerid, COLOUR_BLUE, "* Welcome back Admin");
    } else {
    SendClientMessage(playerid, COLOUR_RED, "* Hehe oopsy, you're not an admin");
    RemovePlayerFromVehicle(playerid);
    }
    }
    }
    return 1;
    }
return 1;
}

public OnFilterScriptInit()
{
    admincar = AddStaticVehicle(411,2990.5266,486.9260,531.8724,359.2304,0,0); // parkeergarage infernus admin
    admincar = AddStaticVehicle(411,3007.0715,487.9013,531.8724,359.6575,0,0); // parkeergarage  admin 2
    admincar = AddStaticVehicle(562,2973.6538,485.5471,531.8053,0.8081,0,0); // parkeer garage elegy 1 admin
    admincar = AddStaticVehicle(562,2983.8596,485.9474,531.8047,359.9193,0,0); // parkeergarage elegy 2 admin
    admincar = AddStaticVehicle(562,3047.0522,507.4697,531.8049,270.4333,0,0); // parkeergarage elegy 3 admin
}
Do this:

Quote:

#define MAX_ACARS 5

new admincar[MAX_ACARS];

admincar[0] = CreateVehicle etc.
admincar[1] = CreateVehicle etc.

Reply
#9

Changed it, but still getting the same errors:
Код:
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdmin.pwn(7663) : error 008: must be a constant expression; assumed zero
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdmin.pwn(7663) : error 008: must be a constant expression; assumed zero
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdmin.pwn(7663) : error 036: empty statement
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdmin.pwn(7663) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
    {
    new PlayerVehicle[playerid] = GetPlayerVehicleID(playerid); //line 7663
    if(Vehicle == admincar)
    {
    if(pData[ playerid ][ P_LEVEL ] > 1) // change to your admin definition
    {
    SendClientMessage(playerid, COLOUR_BLUE, "* Welcome back Admin");
    } else {
    SendClientMessage(playerid, COLOUR_RED, "* Hehe oopsy, you're not an admin");
    RemovePlayerFromVehicle(playerid);
    }
    }
    }
    return 1;
    }
Reply
#10

Then this should be your new onplayerstatechange code

pawn Код:
public OnPlayerStateChange( playerid, newstate, oldstate )
{
if(newstate == PLAYER_STATE_DRIVER)
{
new Vehicle = GetPlayerVehicleID(playerid);
for(new j=0; j < 5; j++) // Change the 5 if you're using more admin vehicles
{
if(Vehicle == admincar[j])
{
if(pData[ playerid ][ P_LEVEL ] > 0) // Change to your admin shizzle
{
SendClientMessage(playerid, YELLOW, "* Welcome Back Admin!");
} else {
SendClientMessage(playerid, RED, "* You got spooked by the alarm system");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
Reply
#11

Oh,, i didn't notice this:

pawn Код:
#if EnableSpec == true // <-------------------
//==============================================================================
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    switch(newstate)
    {
        case PLAYER_STATE_ONFOOT:
        {
        switch(oldstate)
        {
            case PLAYER_STATE_DRIVER: OnPlayerExitVehicle(playerid,255);
            case PLAYER_STATE_PASSENGER: OnPlayerExitVehicle(playerid,255);
            }
        }
    }
    return 1;
}
#endif // <---------------------
Can i just make an extra public OnPlayerStateChange, or do i have to put it in here?
Reply
#12

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
Can i just make an extra public OnPlayerStateChange, or do i have to put it in here?
Put it there.
Reply
#13

Wesley just look at my previous post, that should work, because I got it myself, and it works..
Reply
#14

Quote:
Originally Posted by [SFA]SpiRRiT
Посмотреть сообщение
Wesley just look at my previous post, that should work, because I got it myself, and it works..
I just tried your's out, and im getting those errors:

Код:
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7636) : error 017: undefined symbol "level"
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7636) : warning 215: expression has no effect
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7636) : error 001: expected token: ";", but found "]"
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7636) : error 029: invalid expression, assumed zero
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7636) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
if(IsAdminVehicle(GetPlayerVehicleID(playerid) && level[playerid] >= 1) //<----- line 7636
Reply
#15

Do you read your error msgs?

If you do you might already solved that problem..

*Ahum* Change: level *Ahum*
Reply
#16

Yeah i just did; but forget to post

Changed it to
pawn Код:
if(IsAdminVehicle(GetPlayerVehicleID(playerid) && AccInfo[playerid][Level] >= 1)
Thats how they do the commands aswell, so i thought this would work for here aswell
But then im getting those errors:

Код:
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7636) : warning 202: number of arguments does not match definition
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7637) : error 001: expected token: ")", but found "{"
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7640) : warning 217: loose indentation
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7640) : error 017: undefined symbol "level"
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7640) : warning 215: expression has no effect
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7640) : error 001: expected token: ";", but found "]"
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7640) : warning 217: loose indentation
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7640) : error 029: invalid expression, assumed zero
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7640) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#17

You have a ')' missing

pawn Код:
if(IsAdminVehicle(GetPlayerVehicleID(playerid)) && AccInfo[playerid][Level] >= 1)
Reply
#18

Код:
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7636) : warning 202: number of arguments does not match definition
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7636) : error 029: invalid expression, assumed zero
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7636) : warning 215: expression has no effect
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7636) : error 001: expected token: ";", but found "]"
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7636) : error 029: invalid expression, assumed zero
C:\Users\wesley.PC_van_Kelsey\Desktop\SAMP_Flight\filterscripts\LuxAdminWITHERRORS.pwn(7636) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Got those now >_<...

Off for today; c ya guys tomorrow
Reply
#19

Anyone knows how to solve this yet?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)