Taking the inputtext from a dialog and checking if it's a playerid - 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: Taking the inputtext from a dialog and checking if it's a playerid (
/showthread.php?tid=569876)
Taking the inputtext from a dialog and checking if it's a playerid -
Sellize - 03.04.2015
I want to use the inputtext from a dialog and see if it's a valid playerid but it doesnt seem to work
Код:
else if(dialogid == DIALOG_TELLID)
{
if(response)
{
if(chatting[playerid] == 1) return SendClientMessage(playerid, -1, "{FF0000}You are already chatting with someone.");
if(!IsNumeric(inputtext) || strlen(inputtext) > 5) return SendClientMessage(playerid, -1, "{FF0000}You entered an invalid playerid.");
new id = strval(inputtext);
return 1;
}
}
Re: Taking the inputtext from a dialog and checking if it's a playerid -
CalvinC - 03.04.2015
And then check if the player is connected.
Код:
if(!IsNumeric(inputtext) || strlen(inputtext) > 5) return SendClientMessage(playerid, -1, "{FF0000}You entered an invalid playerid.");
new id = strval(inputtext);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "{FF0000}You entered an invalid playerid.");
Re: Taking the inputtext from a dialog and checking if it's a playerid -
Sellize - 03.04.2015
Quote:
Originally Posted by CalvinC
And then check if the player is connected.
Код:
if(!IsNumeric(inputtext) || strlen(inputtext) > 5) return SendClientMessage(playerid, -1, "{FF0000}You entered an invalid playerid.");
new id = strval(inputtext);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "{FF0000}You entered an invalid playerid.");
|
That's what I had before but when I use it won't work at all. The dialog just closes
EDIT: NVM it works!
Re: Taking the inputtext from a dialog and checking if it's a playerid -
Chlorine - 03.04.2015
pawn Код:
else if(dialogid == DIALOG_TELLID)
{
if(response)
{
if(chatting[playerid] == 1) return SendClientMessage(playerid, -1, "{FF0000}You are already chatting with someone.");
if(!IsNumeric(inputtext)) return SendClientMessage(playerid, -1, "{FF0000}You entered an invalid playerid.");
new id = strval(inputtext);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "{FF0000}Invalid player id.");
return 1;
}
}
EDIT: Was too late.
Re: Taking the inputtext from a dialog and checking if it's a playerid -
CalvinC - 03.04.2015
If you press one of the buttons, it will close the dialog, i don't think you can stop that.
But it doesn't send any messages either when it's an invalid ID?
Re: Taking the inputtext from a dialog and checking if it's a playerid -
Vince - 03.04.2015
I would advice to simply run sscanf against it. Way simpler,
and it provides the ability to input a name as well.