SA-MP Forums Archive
Admin cars - 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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Admin cars (/showthread.php?tid=253197)



Admin cars - Wesley221 - 05.05.2011

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


Re: Admin cars - Cameltoe - 05.05.2011

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;
}



Re: Admin cars - [DDC]Delight - 05.05.2011

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;
}



Re: Admin cars - Wesley221 - 05.05.2011

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


Re: Admin cars - [DDC]Delight - 05.05.2011

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.


Re: Admin cars - [SFA]SpiRRiT - 05.05.2011

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;
}



Re: Admin cars - Wesley221 - 05.05.2011

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
}



Re: Admin cars - [DDC]Delight - 05.05.2011

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.




Re: Admin cars - Wesley221 - 05.05.2011

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;
    }



Re: Admin cars - [DDC]Delight - 05.05.2011

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;
}



Re: Admin cars - Wesley221 - 05.05.2011

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?


Re: Admin cars - MadeMan - 05.05.2011

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.


Re: Admin cars - [SFA]SpiRRiT - 05.05.2011

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


Re: Admin cars - Wesley221 - 05.05.2011

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



Re: Admin cars - [DDC]Delight - 05.05.2011

Do you read your error msgs?

If you do you might already solved that problem..

*Ahum* Change: level *Ahum*


Re: Admin cars - Wesley221 - 05.05.2011

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.



Re: Admin cars - MadeMan - 05.05.2011

You have a ')' missing

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



Re: Admin cars - Wesley221 - 05.05.2011

Код:
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


Re: Admin cars - Wesley221 - 06.05.2011

Anyone knows how to solve this yet?