SA-MP Forums Archive
admin command only - 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: admin command only (/showthread.php?tid=80162)



admin command only - luckie12 - 02.06.2009

hi how to make a admin only command?


Re: admin command only - Karlip - 02.06.2009

Check if the player is an admin. (RCON)

EX:
pawn Код:
if(IsPlayerAdmin(playerid) == 1))
{
   //code here
}



Re: admin command only - AiVAMAN - 02.06.2009

pawn Код:
if(IsPlayerAdmin(playerid) == 1))
{
  //do something here
  return 1;
}else{
  SendClientMessage(playerid, COLOR_RED, "You are not an admin");
  return 0;
  }
  return 1;
}
hope taht helps..


Re: admin command only - luckie12 - 02.06.2009

Quote:
Originally Posted by ·٠•●°Alive°●•٠·
pawn Код:
if(IsPlayerAdmin(playerid) == 1))
{
  //do something here
  return 1;
}else{
  SendClientMessage(playerid, COLOR_RED, "You are not an admin");
  return 0;
  }
  return 1;
}
hope taht helps..
at this:

pawn Код:
if(IsPlayerAdmin(playerid) == 1))
is that only for admins that are lvl 1?

can i change it to
pawn Код:
if(IsPlayerAdmin(playerid) == 5))
only command for lvl 5 admins?


Re: admin command only - Karlip - 02.06.2009

No,it works only if you have logged in as an RCON admin.

If you want an admin system,download one.

the
Код:
== 1))
will only check if you ARE an admin and
Код:
== 0))
will check if you're not an admin


Re: admin command only - Ignas1337 - 02.06.2009

You can also add a value and save it to files like...
pawn Код:
new pAdminLevel[MAX_PLAYERS];
and it can be used to define the level. OFC you must save/load it each time a player connects/disconnects/updates/logins/logsout/wherever you need it.