Use IsPlayerAdmin,
Example:
pawn Код:
if(strcmp("/kickme", cmdtext, true, 7) == 0){
if(IsPlayerAdmin(playerid)){
Kick(playerid);
}
else return SendClientMessage(playerid, -1, "You're not an admin.");
}
I suggest changing to ZCMD though and doing such as this:
pawn Код:
#include <zcmd>
CMD:kickme(playerid, params[]){
if(IsPlayerAdmin(playerid)){
Kick(playerid);
}
else return SendClientMessage(playerid, -1, "You're not an admin!");
}
EDIT:
pawn Код:
#include <a_samp>
#include <zcmd> //Include the ZCMD command processor
enum _playerData //Create the enumerator for player data
{
pAdmin //Create the variable for administrators
}
new PlayerInfo[MAX_PLAYERS][_playerData]; //Create the variable to use the _playerData enumerator
public OnPlayerConnect(playerid){
PlayerInfo[playerid][pAdmin] = 1; // Set this to 0 usually to reset the variable; though I set it to 1 to make them a level 1 admin.
return 1;
}
CMD:kickme(playerid, params[]){ //Create the command to kick the player using the command
if(PlayerInfo[playerid][pAdmin] >= 1){ //Check the administrator level of the player (to see if level 1 or above)
Kick(playerid); //Kick the player from the server after checking their admin level is correct.
}
else return SendClientMessage(playerid, -1, "You're not an admin.");
return 1;
}