Server Crash - DIALOG -
Kohva - 27.10.2009
Hello,
I have a problem with INPUT dialog.
I made a opportunity to send private message if player click on another player name under TAB..
But if inputtext consist %s or %d , then server will make gamemode restart.
Код:
if(strlen(inputtext))
{
new sender[MAX_PLAYER_NAME];
new taker[MAX_PLAYER_NAME];
GetPlayerName(playerid, sender, sizeof(name));
GetPlayerName(clicked[playerid], taker, sizeof(name));
format(string, sizeof(string), "->%s(ID: %d) Erasхnum: %s", sender, playerid, inputtext);
SendClientMessage(clicked[playerid], COLOR_YELLOW, string);
format(string, sizeof(string), "<-Erasхnum %s(ID: %d): %s", taker, clicked[playerid], inputtext);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
Is it possible to deny writeing " % " into INPUT dialog , if someone write it, then server will say incorrect message or something...
Please help
Re: Server Crash - DIALOG -
Luka P. - 27.10.2009
Okay, you have those parameters:
playerid, dialogid, response, listitem, inputtext[]
Try something like
pawn Код:
if(inputtext == "%") // but you've probably get a "inputtext must be indexed" (something like that), but try it
{
//effect
}
Re: Server Crash - DIALOG -
Kohva - 27.10.2009
It doesn't work, error..
Still have a problem :S
Re: Server Crash - DIALOG -
UsaBoy91 - 27.10.2009
Quote:
Originally Posted by Luka™
Okay, you have those parameters:
playerid, dialogid, response, listitem, inputtext[]
Try something like
pawn Код:
if(inputtext == "%") // but you've probably get a "inputtext must be indexed" (something like that), but try it { //effect }
|
must be character , not string
if(inputtext == '%')
This will not work ... because in SA-MP Console Text , the symbol '%' goes to '?'
Re: Server Crash - DIALOG -
Kohva - 28.10.2009
Still got the problem
Re: Server Crash - DIALOG -
MenaceX^ - 28.10.2009
pawn Код:
new find=strfind(inputtext,"%",true);
if(find!=-1)
{
strdel(inputtext,find,find+1);
}
Re: Server Crash - DIALOG -
Kohva - 29.10.2009
Quote:
Originally Posted by Seif_
pawn Код:
for(new s; s < strlen(inputtext); s++) { if (inputtext == '%') { inputtext = ' '; } }
|
Thanks. This should be in some dialog tutorial, if it isn't yet.
Re: Server Crash - DIALOG -
Finn - 29.10.2009
Quote:
Originally Posted by MenaceX^
pawn Код:
new find=strfind(inputtext,"%",true); if(find!=-1) { strdel(inputtext,find,find+1); }
|
What if there are more than one "%" in the inputtext?
Just use Seif's code.
Re: Server Crash - DIALOG -
Daren_Jacobson - 30.10.2009
there, I added it to my guide.
Re: Server Crash - DIALOG -
KazanTip - 01.11.2009
Thanks!