Dialog Cmd problem - 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: Dialog Cmd problem (
/showthread.php?tid=638860)
Dialog Cmd problem -
NitroZeth - 07.08.2017
Hello all , i get this error in my command Banlist
Код:
CMD:banlist(playerid, params[])
{
if(PlayerInfo[playerid][Level] >= 4)
{
new ID, Query[256],string[135], DBResult: result;
format(Query, sizeof(Query), "SELECT * FROM BANNED");
result = db_query(bans, Query);
ID = db_num_rows(result);
db_free_result(result);
format(string, sizeof(string), "%s\t Ban List\n\n{FC4949}Banned Accounts:{FFFFFF} %d\n{FC4949}Permanent Bans: {FFFFFF}%d\n", string,ID,ID);
ShowPlayerDialog( playerid, DIALOG_BANLIST, DIALOG_STYLE_INPUT, "Ban List",string, "Search", "Close" );
CMDMessageToAdmins(playerid,"BANLIST");
string = "\0", Query = "\0";
}
return 1;
}
The Dialog close when i put a name in the Cmd
Re: Dialog Cmd problem -
Kane - 07.08.2017
PHP код:
format(Query, sizeof(Query), "SELECT * FROM BANNED");
result = db_query(bans, Query);
There's no reason to use format if you're not actually formatting anything.
And what's the error?
Re: Dialog Cmd problem -
BrnX - 07.08.2017
(( test message,sorry
Re: Dialog Cmd problem -
NitroZeth - 07.08.2017
When I put the name of a player, the command is closed, rather it closes the window of the command you understand?
Re: Dialog Cmd problem -
Kane - 07.08.2017
https://sampwiki.blast.hk/wiki/OnDialogResponse
You need to define DIALOG_BANLIST and make it do something in there.
I get what you're trying to do but I think it's not going to work. Here's an ideal way of doing it:
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_BANLIST)
{
if (response)
{
if(strlen(inputtext) < 3) return SendClientMessage(playerid, -1, "You specified an invalid account name.");
new
query[128], string[128], DBResult: result;
format (query, sizeof(query), "SELECT * FROM BANNED Where Name = '%e'", inputtext);
result = db_query(bans, query);
}
}
}
Et cetera, et cetera. Grab the data and store it in a string and show it if the ban exists.
Re: Dialog Cmd problem -
NitroZeth - 07.08.2017
When i put that code
Pawno stops working xd