SA-MP Forums Archive
How to make this work for RCON admins - 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: How to make this work for RCON admins (/showthread.php?tid=133065)



How to make this work for RCON admins - Torran - 10.03.2010

Im making a kick command,
If you have some dislikes about the command dont say it :P
I was wondering how to make it for RCON admins aswell as the admin level?
Id prefer it in the format im using if you could

pawn Код:
CMD:kick(playerid, params[])
{
    new id, reason;

  if (AccountInfo[playerid][AdminLevel] < 0) SendClientMessage(playerid, COLOR_RED, "Error ~ You are not an administrator with the required level");
  else if (sscanf(params, "uz", id, reason)) SendClientMessage(playerid, COLOR_RED, "Usage ~ /kick [PlayerID/PartOfName] [Reason]");
  else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "Error ~ Player not Connected");
  else if (AccountInfo[id][AdminLevel] > 5) SendClientMessage(playerid, COLOR_RED, "Error ~ You cannot kick the highest level admin");
  else
    {
      new string[128];
      new sendername[MAX_PLAYER_NAME];
      new targetname[MAX_PLAYER_NAME];

      GetPlayerName(playerid, sendername, sizeof sendername);
      GetPlayerName(playerid, targetname, sizeof targetname);

      format(string, sizeof string, "Administrator %s has kicked you from the server, Reason: %s", sendername, reason);
      SendClientMessage(id, COLOR_BLUE, string);

      format(string, sizeof string, "You have kicked player %s, Reason: %s", targetname, reason);
      SendClientMessage(playerid, COLOR_BLUE, string);

      Kick(playerid);
  }
    return 1;
}



Re: How to make this work for RCON admins - laser50 - 10.03.2010

if(IsPlayerAdmin??



Re: How to make this work for RCON admins - Carlton - 10.03.2010

You should use the || which means or, so the old code you have put in was:

Код:
else if (AccountInfo[id][AdminLevel] > 5) SendClientMessage(playerid, COLOR_RED, "Error ~ You cannot kick the highest level admin");
It should be changed to ( Also even though you said don't say anything about your code, I have to for the protection ):
Код:
else if (AccountInfo[id][AdminLevel] > 5 || IsPlayerAdmin(id)) SendClientMessage(playerid, COLOR_RED, "Error ~ You cannot kick the highest level admin");
About the paranethises words I've said, in math and so as PAWN the structures are still the same.


> - Left is greater than right
< - Left is less than right


So re-read your statement: If(ThePlayer'sAdminLevel is greater than 5). That will mean if the player is higher than the lead admin can't kick them. So that will lead other admins to kick the high level admin, change > to <




Re: How to make this work for RCON admins - Torran - 10.03.2010

Quote:
Originally Posted by Carlton
You should use the || which means or, so the old code you have put in was:

Код:
else if (AccountInfo[id][AdminLevel] > 5) SendClientMessage(playerid, COLOR_RED, "Error ~ You cannot kick the highest level admin");
It should be changed to ( Also even though you said don't say anything about your code, I have to for the protection ):
Код:
else if (AccountInfo[id][AdminLevel] > 5 || IsPlayerAdmin(id)) SendClientMessage(playerid, COLOR_RED, "Error ~ You cannot kick the highest level admin");
About the paranethises words I've said, in math and so as PAWN the structures are still the same.


> - Left is greater than right
< - Left is less than right


So re-read your statement: If(ThePlayer'sAdminLevel is greater than 5). That will mean if the player is higher than the lead admin can't kick them. So that will lead other admins to kick the high level admin, change > to <

Ok thanks


Re: How to make this work for RCON admins - Scenario - 10.03.2010

Simple, use if(IsPlayerAdmin(playerid)).

Sorry if it has already been solved. But what is another person saying the correct code Good luck.