Server Crash - DIALOG
#1

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
Reply
#2

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
}
Reply
#3

It doesn't work, error..


Still have a problem :S
Reply
#4

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 '?'
Reply
#5

Still got the problem
Reply
#6

pawn Код:
new find=strfind(inputtext,"%",true);
if(find!=-1)
{
  strdel(inputtext,find,find+1);
}
Reply
#7

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.
Reply
#8

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.
Reply
#9

there, I added it to my guide.
Reply
#10

Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)