23.09.2013, 19:32
OnDialogueResponse requires you to return 0.
pawn Код:
#define DIALOG_SERVER 3
CMD:server(playerid, params[])
{
if(gPlayerInfo[playerid][pAdmin] >= 4)
{
if(!sscanf(params, "u", params[0]))
{
ShowPlayerDialog(playerid, DIALOG_SERVER , DIALOG_STYLE_LIST, "[0.3x] ..::DisturBed Games::.. - server 1","Server exit\nServer reloadBans\nServer reload filterscripts\nChange rcon password ","SEND","EXIT");
new string[128];
format(string, sizeof(string), "ADMINS: %s has entred the main operator server system", GetName(playerid));
SendMessageToAdmins(COL_ORANGE, string);
}
} else SendClientMessage(playerid, -1, "SERVER: You are not allowed to use this command");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new pName[24], str[128];
GetPlayerName(playerid, pName, 24);
if(dialogid == DIALOG_REGISTER)
{
if(response)
{
SendClientMessage(playerid, -1, "{FFAE00}SERVER: You have registred this account");
mysql_real_escape_string(inputtext, inputtext,TuberiasMySQL);
format(str,128, "INSERT INTO users (username, password) VALUES ('%s', '%s')",pName, inputtext);
mysql_function_query(TuberiasMySQL, str, false, "OnQueryFinish", "iis", 0,playerid,inputtext);
}
else
{
SendClientMessage(playerid, COL_RED, "KICKED: You must register before to spawn");
Kick(playerid);
}
}
if(dialogid == DIALOG_LOGIN)
{
if(response)
{
GetPlayerName(playerid, pName, 24);
mysql_real_escape_string(inputtext, inputtext, TuberiasMySQL);
format(str, sizeof(str), "SELECT * FROM users WHERE username='%s'", pName);
mysql_function_query(TuberiasMySQL, str, true, "OnQueryFinish", "iis", 0,playerid, inputtext);
}
else
{
SendClientMessage(playerid, COL_RED, "KICKED: You need to login to play here");
Kick(playerid);
}
}
if(dialogid == DIALOG_SERVER )
{
if(response)
{
switch(listitem)
{
case 0:
{
SendRconCommand("exit");
new string[128];
format(string, sizeof(string), "SERVER: Administrator %s has shutted down the server", GetName(playerid));
SendClientMessageToAll(-1, string);
}
case 1:
{
SendRconCommand("reloadbans");
new string[128];
format(string, sizeof(string), "ADMINS: Administrator %s has reloaded the bans", GetName(playerid));
SendMessageToAdmins(-1, string);
}
case 2:
{
SendRconCommand("reloadfs");
new string[128];
format(string, sizeof(string), "SERVER: Administrator %s has re-loaded all filterscripts", GetName(playerid));
SendClientMessageToAll(-1, string);
}
}
}
}
return 0;
}