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



admin commands - sarab_singh - 09.08.2013

Код:
COMMAND:acmds(playerid, params[])
{
	if(PlayerInfo[playerid][AdminLevel] > 0)
	{
		new lvl1[200];
		format(lvl1, sizeof(lvl1) , ""blue"%s"yellow"\n/spec /(on/off)duty /reports /mytime /asay /wanteds /jailed /frozen /muted /showguns /morning /miniguns", alevels[1]);
		new lvl2[100];
		format(lvl2, sizeof(lvl2), "\n\n"blue"%s"yellow"\n/eject /warn /slap /clearchat", alevels[2]);
		new lvl3[300];
		format(lvl3, sizeof(lvl3), "\n\n"blue"%s"yellow"\n/burn /ip /announce /goto /(un)mute /(un)freeze /setall(weather/time) /akill /car /setmoney", alevels[3]);
		new lvl4[300];
		format(lvl4, sizeof(lvl4), "\n\n"blue"%s"yellow"\n/enable /disable /crash /get /kick /move /healall /armourall /disarmall /ejectall /giveallweapon /set(score/armour/health) /aka", alevels[4]);
		new lvl5[100];
		format(lvl5, sizeof(lvl5), "\n\n"blue"%s"yellow"\n/togping /setadminlevel, /setviplevel, /ban", alevels[5]);
		new lvl22[300];
		strcat(lvl22, lvl1, sizeof(lvl22));
		strcat(lvl22, lvl2, sizeof(lvl22));
		new lvl33[500];
		strcat(lvl33, lvl22, sizeof(lvl33));
		strcat(lvl33, lvl3, sizeof(lvl33));
		new lvl44[800];
		strcat(lvl44, lvl33, sizeof(lvl44));
		strcat(lvl44, lvl4, sizeof(lvl44));
		new lvl55[900];
		strcat(lvl55, lvl44, sizeof(lvl55));
		strcat(lvl55, lvl5, sizeof(lvl55));
	
		switch(PlayerInfo[playerid][AdminLevel])
		{
			case 1:	ShowPlayerDialog(playerid, CMD_DIALOG, DIALOG_STYLE_MSGBOX, "Admin commands", lvl1, "Ok", "");
			case 2:	ShowPlayerDialog(playerid, CMD_DIALOG, DIALOG_STYLE_MSGBOX, "Admin commands", lvl22, "Ok", "");
			case 3:	ShowPlayerDialog(playerid, CMD_DIALOG, DIALOG_STYLE_MSGBOX, "Admin commands", lvl33, "Ok", "");
			case 4:	ShowPlayerDialog(playerid, CMD_DIALOG, DIALOG_STYLE_MSGBOX, "Admin commands", lvl44, "Ok", "");
			case 5:	ShowPlayerDialog(playerid, CMD_DIALOG, DIALOG_STYLE_MSGBOX, "Admin commands", lvl55, "Ok", "");
		}
	}
	else SendClientMessage(playerid, RED, "Your admin level is not high enough for this command");
    return 1;
}
This is a command to show all admin commands when I use /acmds when not admin then it says that your admin level is not high enough to use this command but when admin uses it it says server unknown command
can any one help


Re: admin commands - verlaj - 09.08.2013

try using this

if(PlayerInfo[playerid][AdminLevel] > 1)


Re: admin commands - sarab_singh - 09.08.2013

Quote:
Originally Posted by verlaj
Посмотреть сообщение
try using this

if(PlayerInfo[playerid][AdminLevel] > 1)
I think adminlevel >=1 because using adminlevel > 1 adminlevel 1 cant use this command


Re: admin commands - PT - 09.08.2013

try somethig like this

pawn Код:
#define admincmd 123

CMD:admcmds(playerid)
{
    new pt[700];
    if(PlayerInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, 0xFF6262FF, "ERROR: you are not Admin");
   
    if(PlayerInfo[playerid][AdminLevel] == 1)
    {
         strcat(pt, "/spec /(on/off)duty /reports /mytime /asay /wanteds /jailed /frozen /muted /showguns /morning /miniguns\n", sizeof(pt));
         strcat(pt, "/eject /warn /slap /clearchat   \n", sizeof(pt));
    }
    if(PlayerInfo[playerid][AdminLevel] == 2)
    {
         strcat(pt, "/eject /warn /slap /clearchat   \n", sizeof(pt));
    }
    /*
        Another level's
    */

    ShowPlayerDialog(playerid, admincmd, DIALOG_STYLE_MSGBOX, "Helper", pt, "Ok", #);
    return 1;
}
i just try help, sorry if i fail, i'm not a very good scripter


Re: admin commands - sarab_singh - 09.08.2013

PT i like your way and it also conservers memory i will use this one
But still i have question that why my command is not working when i use it previously it was working but now why its not


Re: admin commands - PT - 09.08.2013

don't show the dialog?
it's that?