public OnPlayerEnterVehicle(playerid, vehicleid)
{
if(GetVehicleModel(vehicleid) == 451 && !IsLuxAdmin(playerid))
{
SendClientMessage(playerid, 0x0, "Only admin's can enter this vehicle.");
return 0;
}
return 1;
}
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;
}
new adminvehicle;
adminvehicle = AddStaticVehicle(-------);
And how do i asign the admin cars?
pawn Код:
|
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 |
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;
}
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.
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
}
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 Код:
|
#define MAX_ACARS 5 new admincar[MAX_ACARS]; admincar[0] = CreateVehicle etc. admincar[1] = CreateVehicle etc. |
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.
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;
}
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;
}
#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?
|
Wesley just look at my previous post, that should work, because I got it myself, and it works..
|
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.
if(IsAdminVehicle(GetPlayerVehicleID(playerid) && level[playerid] >= 1) //<----- line 7636
if(IsAdminVehicle(GetPlayerVehicleID(playerid) && AccInfo[playerid][Level] >= 1)
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.
if(IsAdminVehicle(GetPlayerVehicleID(playerid)) && AccInfo[playerid][Level] >= 1)
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.