Target ID to inputtext -
Riwerry - 04.01.2014
Hello guys, I do not know, how can I make dialog with inputtext, where will be targetid as inputtext. For example I am in kick dialog, where admin type to dialog 23 and it will kick the ID 23 player. Also want to make when admin type to dialog for example two targetids, each targetid will be after space, for example admin type to dialog 22 25 23, and it will kick these players. Thanks.
Re: Target ID to inputtext -
MatriXgaMer - 04.01.2014
I dont understend you, maybe this will help you
Click me !
Re: Target ID to inputtext -
Seif- - 04.01.2014
I recommend
sscanf with the parameter "u". You can also use the delimiter coma(,) with sscanf.
Re: Target ID to inputtext -
Riwerry - 04.01.2014
I know about sscanf but how can I make so the ID of the player, who is putted to the dialog by admin will be kicked..
Re: Target ID to inputtext -
Konstantinos - 04.01.2014
Show a dialog with style DIALOG_STYLE_INPUT so admins can input a player's ID.
In OnDialogResponse, if the dialogid is the one you gave for that dialog and response is 1:
Re: Target ID to inputtext - Patrick - 04.01.2014
Quote:
Originally Posted by Riwerry
I know about sscanf but how can I make so the ID of the player, who is putted to the dialog by admin will be kicked..
|
Convert
inputtext(string) into
integer/number using
strval
Example Code
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid = 1) //example dialog id
{
new otherid = strval(inputtext);
Kick(otherid);
}
return true;
}
Код:
This forum requires that you wait 240 seconds between posts. Please try again in 79 seconds.
- kgui
EDIT - Konstantinos was faster because of this timer -_-
Re: Target ID to inputtext -
Riwerry - 04.01.2014
yeah and as i said how i can make multiple target ids? for example 20 5 6 and it will kick those all..
Re: Target ID to inputtext -
Hansrutger - 04.01.2014
What you're trying to do is a very weird way of doing it to be honest, IMO. I would make multiple input dialogs rather, and then let the user put in the id's one after another in the dialogs.
https://sampwiki.blast.hk/wiki/Strdel
- Loop through the whole string by using strlen (as in for(new i = 0; i <= strlen(inputtext)...).
- Search for a "space", by that I mean searching for (' ') without brackets:
if (name[i] == ' ') then use strdel, otherwise continue the loop.
- Then use as suggested above, strval.
I won't make the code for you because I find this too complicated for me to do in one minute. I'd have to test the code etc. :P
Re: Target ID to inputtext -
Mic_H - 04.01.2014
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid = KICK)
{
new KickID;
if(!response)
{
SendClientMessage(//Whatever);
}
else if (sscanf(inputtext, "u", KickID)) //PlayerID/Player_Name can be accepted with "u"
{
SendClientMessage(playerid, 0xFF0000FF, "You can't leave it Blank.");
//Show Dialog again;
}
else
{
Kick(KickID);
}
}
return 0;
}