Posts: 578
Threads: 40
Joined: Dec 2016
Quote:
Originally Posted by zLink
List of admin commands
Log in rcon ( /rcon login [password] )
PHP код:
enum EnumAdminCommands {command[45],information[80]};
new const AdminCommands[][EnumAdminCommands] = //{"command","information"}
{
{"/Admincmd","List of commands for admin"},
{"/Example","This command does not exist!"},
{"/Example2","..."}
};
CMD:admincmd(playerid) //using include izcmd
{
if(!IsPlayerAdmin(playerid)) //change
return 0;
new ss[50],s[500];
for(new i; i < sizeof(AdminCommands); i++)
{
format(ss, 50, "%s\n", AdminCommands[i][command]);
strcat(s, ss);
}
ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "Admin Commands", s, "more", "close");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[ ])
{
if(dialogid == 888)
{
if(!response)
return 0;
new s[80];
for(new i; i < sizeof(AdminCommands); i++)
if(listitem == i) format(s, 80, "%s", AdminCommands[i][information]);
return ShowPlayerDialog(playerid, 889, DIALOG_STYLE_MSGBOX, "Admin Commands", s,"close","");
}
return 0;
}
I was going to throw it in the trash, but it's a job.
Sorry for my english and if I posted on the wrong topic.
|
Oooor just:
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[ ])
{
if(dialogid == 888)
if(response)
ShowPlayerDialog(playerid, 889, DIALOG_STYLE_MSGBOX, "Admin Commands", AdminCommands[i][information], "Close","");
}
Don't return false if OnDialogResponse may be used somewhere else again.