OK, No problem, I'll have a look at Seif Admin script and will edit this post with the command and code. See u in a bit. ( i mean post it in a bit).
EDIT: Ok this should work, i hope.
![smiley](images/smilies/arrow.gif)
Open up your
SeifAdmin filterscript file, not your gamemode. Press Ctrl+F and find this: new Missile[MAX_PLAYERS];
Then underneath that line put this:
pawn Код:
new bool:PlayerAllowedAdminVehicles[MAX_PLAYERS] = false;
![smiley](images/smilies/arrow.gif)
Then after this callback/function:
pawn Код:
stock GetFileValue(string[])
paste this (modified version of Andre's IsCopCar function):
pawn Код:
stock IsAdminCar(carid)
{
new Operative[] = { 520, 425, 432, 447 }; // Hydra, Hunter, Tank, Seasparrow, Add more by adding a ', [vehicleid]'
for(new i = 0; i < sizeof(Operative); i++)
{
if(GetVehicleModel(carid) == Operative[i]) return 1;
}
return 0;
}
anywhere in your script (but outside any commands and callbacks).
![smiley](images/smilies/arrow.gif)
Then after OnPlayerCommandText or after any command paste this:
pawn Код:
if(strcmp(cmd, "/allowadmincar", true) == 0) // Unfreezes the player
{
if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid)) /// Change Admin level here
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /allowadmincar [playername/id]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Will allow player to access admin vehicles the specified player.");
return 1;
}
new giveplayerid = ReturnUser(tmp);
if(giveplayerid != INVALID_PLAYER_ID)
{
new string2[128];
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "-| Administrator %s has allowed %s access to admin vehicles|-", sendername,giveplayername);
format(string2, sizeof(string2), "*** Hi %s , Administrator: %s given you permission to use admin vehicles. Enjoy!", giveplayername, sendername);
SendClientMessageToAdmins(ADMIN_RED, string, 1);
SendClientMessage(giveplayerid, LIGHTBLUE, string2);
PlayerAllowedAdminVehicles[giveplayerid] = true; // IMPORTANT
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "%d is not a connected player.", giveplayerid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "You need to be an Administrator to do that!");
return 1;
}
if(strcmp(cmd, "/removeadmincar", true) == 0) // Unfreezes the player
{
if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid)) /// Change Admin level here
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /removeadmincar [playername/id]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Will allow player to access admin vehicles the specified player.");
return 1;
}
new giveplayerid = ReturnUser(tmp);
if(giveplayerid != INVALID_PLAYER_ID)
{
new string2[128];
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "-| Administrator %s has allowed %s access to admin vehicles|-", sendername,giveplayername);
format(string2, sizeof(string2), "*** Hi %s , Administrator: %s removed your permission to use admin vehicles.", giveplayername, sendername);
SendClientMessageToAdmins(ADMIN_RED, string, 1);
SendClientMessage(giveplayerid, LIGHTBLUE, string2);
PlayerAllowedAdminVehicles[giveplayerid] = false; // IMPORTANT
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "%d is not a connected player.", giveplayerid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "You need to be an Administrator to do that!");
return 1;
}
![smiley](images/smilies/arrow.gif)
After that, you just need to paste this outside and callbacks and commands.
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new carid;
carid = GetVehicleModel(GetPlayerVehicleID(playerid));
if (AccountInfo[playerid][AdminLevel] <= 1 || !IsPlayerAdmin(playerid)) /// Change Admin level here
{
if(IsAdminCar(carid) && !PlayerAllowedAdminVehicles[playerid]) // If Player Enters any Admin Car and is not allowed Admin Vehicles
{
SendClientMessage(playerid, 0xFF0000AA, "You cannot use this Vehicle, You need to be an Admin to do that or have permission given - Ejected!");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
![smiley](images/smilies/arrow.gif)
Put this under your OnPlayerDisconnect callback.
pawn Код:
PlayerAllowedAdminVehicles[playerid] = false; // IMPORTANT otherwise another player can connect and use admin cars
It should disable Hydra, Hunter, Tank, Seasparrow vehicles for non-admins unless you give them permission using the /allowadmincar [playerid/part of name] command. To remove their permission use /removeadmincar [playerid/ part of name]. When non-admins disconnect they will lose their permission.
Let me know if it works. It's untested.