How can I create the /secretadmin cmd - 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)
+--- Thread: How can I create the /secretadmin cmd (
/showthread.php?tid=286622)
How can I create the /secretadmin cmd -
Cr4zyR0d - 29.09.2011
I want to create a command for Admins like /secretadmin to hide your name out of /admins list, so no one can see you in /admin list..
I will appreciate your help,
thanks.
Код:
if(strcmp(cmd, "/admins", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 0)
{
SendClientMessage(playerid, COLOR_WHITE, "Admins Online:");
//foreach(Player, i)
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] > 0)
{
GetPlayerName(i, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "%d Admin: %s",PlayerInfo[i][pAdmin],giveplayer);
SendClientMessage(playerid, COLOR_GREY, string);
}
}
}
}
}
return 1;
}
Re: How can I create the /secretadmin cmd -
[MG]Dimi - 29.09.2011
PHP код:
//top of script
new bool:Hidden[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
Hidden[playerid] = false;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp("/hide", cmdtext, true))
{
if(PlayerInfo[playerid][pAdmin] > 0)
{
switch(Hidden[playerid])
{
case true:
{
Hidden[playerid] = false;
SendClientMessage(playerid,0xFFFFFFFF,"You are now not showing in admins list!");
}
case false:
{
Hidden[playerid] = true;
SendClientMessage(playerid,0xFFFFFFFF,"You are now showing in admins list!");
}
}
return 1;
}
else SendClientMessage(playerid,0xFF0000FF,"You can't use this command");
return 1;
}
if(!strcmp(cmdtext, "/admins", true))
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 0)
{
SendClientMessage(playerid, COLOR_WHITE, "Admins Online:");
//foreach(Player, i)
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] > 0)
{
if(Hidden[i] = false)
{
GetPlayerName(i, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "%d Admin: %s",PlayerInfo[i][pAdmin],giveplayer);
SendClientMessage(playerid, COLOR_GREY, string);
}
}
}
}
}
}
return 1;
}
return 0;
}
NOTE: UNTESTED!
EDIT: JUST REPLACE MY /HIDE COMMAND WITH YOURS