Posts: 716
Threads: 92
Joined: May 2018
I have a command which can be executed only by cops and admins level 5.
I have this check:
pawn Код:
if(gTeam[playerid] != TEAM_COP || Player[playerid][AccountLevel] < 5) return SCM(playerid, COLOR_LIGHTRED, "* You must be a law enforcement officer to remove a roadblock.");
But doesn't work. It says i need to be a Law Enforcement Officer. (P.S I'm a civ with admin level 5).
Posts: 211
Threads: 0
Joined: Aug 2018
Reputation:
0
I do not see anything wrong with that line, are you sure the problem is there?
Have you set the level correctly in 5 or greater than 5?
Show the complete code.
Posts: 357
Threads: 6
Joined: Feb 2018
TRY THIS!
Код:
if(gTeam[playerid] == TEAM_COP || Player[playerid][AccountLevel] < 5) return SCM(playerid, COLOR_LIGHTRED, "* You must be a law enforcement officer to remove a roadblock.");
Posts: 716
Threads: 92
Joined: May 2018
Ok thanks. I have another problem referred to this command too.
pawn Код:
CMD:rrb(playerid, params[])
{
if(gTeam[playerid] != TEAM_COP && Player[playerid][AccountLevel] < 5) return SCM(playerid, COLOR_LIGHTRED, "* You must be a law enforcement officer to remove a roadblock.");
if (Player[playerid][AccountLevel] < 5) return 0;
if(Player[playerid][Jailed] == 1) return SCM(playerid, COLOR_LIGHTRED, "* You can't use this command while jailed.");
SendNearbyMessage(playerid, 30.0, COLOR_BBLUE, "* %s has picked up a roadblock object.", ReturnName(playerid, 0));
new string[100];
format(string,sizeof(string),"* [DISPATCHER]: %s has picked up a roadblock.", ReturnName(playerid, 0));
SendMessageToCops(string);
for(new i = 0; i < sizeof(Roadblocks); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, Roadblocks[i][sX], Roadblocks[i][sY], Roadblocks[i][sZ]))
{
if(Roadblocks[i][sCreated] == 1)
{
Roadblocks[i][sCreated] = 0;
Roadblocks[i][sX] = 0.0;
Roadblocks[i][sY] = 0.0;
Roadblocks[i][sZ] = 0.0;
DestroyDynamicObject(Roadblocks[i][sObject]);
}
}
else
{
SCM(playerid, COLOR_LIGHTRED, "* You are not near a roadblock.");
}
}
return 1;
}
This command should remove a single roadblock object in a range of 5 meters from the player. Problem is, i get spammed with "you are not near a roadblock".
Posts: 235
Threads: 23
Joined: May 2018
Reputation:
0
remove AccountLevel one ur using it 2 times
Posts: 716
Threads: 92
Joined: May 2018
Ok gonna test later. About the gteam and admin level check, hold on:
pawn Код:
if(gTeam[playerid] != TEAM_COP && Player[playerid][AccountLevel] < 5
Doing in this way will check if player is not a cop AND has an admin level lower than 5. I don't have to do in this way.
I need to check if is only a civilian (TEAM_CIVILIAN) OR an admin with level 5.
With your check EVERY admin from 0 to 4 is allowed to execute that command (even players since their admin level is 0!).
Or im wrong?
Posts: 235
Threads: 23
Joined: May 2018
Reputation:
0
if you using < then it will allow all the admin levels like
if you d <1 then it will allowed for 1-max levels
if you do <5 then it will allowed for 5- max levels
if you do <7 then it will allowed for 7- max levels
it works like this
and to make your command for law enforcer you are using correct
you are using Account Level 2 times thats why maybe its not working for the team cops.