How to check what a player wrote in a dialog
#10

Quote:
Originally Posted by MicroD
Посмотреть сообщение
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 
{ 
	if(dialogid == YourDialogID) 
	{ 
        	if(response) 
        	{ 
			new pID, reason[32], string[144];
            		if(sscanf(inputtext, "us[32]", pID, reason))
			{
				//errorcode
			}
            		else
			{
				format(string, sizeof(string), "[KICK]: %s has been kicked by %s Reason: %s", GetName(pID), GetName(playerid), reason);
				SendClientMessageToAll(COLOR_RED, string);
				Kick(pID);
			}
        	} 
    	} 
}
^ Requires sscanf https://sampforum.blast.hk/showthread.php?tid=120356
Quote:
Originally Posted by Stinged
Посмотреть сообщение
It isn't, well at least the way your doing it.

You need something called sscanf.
Use sscanf to split inputtext into an id and a string.

Then tell the admin to enter in the dialog this:
ID REASON

(of course replace id with id and the reason with the text)
I don't think you guys quite get me.

Let me explain it again:

I have a dialog that when a player presses "Kick A Player" it'll create another dialog with input style and then how
do I get what the player wrote in that? Like first after the admin presses 'kick a player' it'll create another dialog asking for ID, how do I get the ID, then it checks if the id is valid or not, then it'll ask for a reason and what you wrote
in those two dialogs will format the message into a client message and kick the player eventually.

I just want to know, HOW TO GET WHAT THE PLAYER WROTE IN THE FIRST DIALOG.
&&& In the SECOND dialog for the reason, that's the only thing I need to know, thanks.

Note: I use sscanf2, DOF2 and zcmd...
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)