Server Crash
#1

Hi!
I have a problem with command: /gang

Код:
CMD:gang(playerid,cmdtext[])
{
	ShowPlayerDialog(playerid,37,2,"Gang","Create Gang\nDelete Gang\nInvite User\nRemove User\nGang Spawn\nGang Color\nJoin the gang\nGet away from gang\nGang Info\nGangs Info",">>","X");
	return 1;
}
When someone write "/gang %s %s" then server crash.
How can i fix this ?
Reply
#2

You don't need to type /gang %s %s.
According to your command it you just need to type /gang and then it will show an dialog.
Reply
#3

I remember about crashes when using % symbol as inputtext. You may need to modify the include and if there's any character % to replace it with a safe character.

By the way, I'm not sure if that will fix your problem (I doubt).

pawn Код:
CMD:gang(playerid,cmdtext[])
{
    if(isnull)) ShowPlayerDialog(playerid,37,2,"Gang","Create Gang\nDelete Gang\nInvite User\nRemove User\nGang Spawn\nGang Color\nJoin the gang\nGet away from gang\nGang Info\nGangs Info",">>","X");
    return 1;
}
Reply
#4

I've tested this and there are 2 errors:
error 017: undefined symbol "isnull"
error 029: invalid expression, assumed zero

(I marked them.)
Код:
CMD:gang(playerid,cmdtext[])
{
    if(isnull)) ShowPlayerDialog(playerid,37,2,"Gang","Create Gang\nDelete Gang\nInvite User\nRemove User\nGang Spawn\nGang Color\nJoin the gang\nGet away from gang\nGang Info\nGangs Info",">>","X");
    return 1;
}
How can i replace % to safe character ?
Reply
#5

Oops, sorry I forgot the parameter.

pawn Код:
if(isnull(params)) ShowPlayerDialog( ... );
Reply
#6

For me is
Код:
if(isnull(cmdtext))
How about this ?

Код:
CMD:gang(playerid,cmdtext[])
{
    new tmp[10];
    if(sscanf(cmdtext,"s[10]",tmp))
    {
        ShowPlayerDialog(playerid,37,2,"Gang","Create Gang\nDelete Gang\nInvite User\nRemove User\nGang Spawn\nGang Color\nJoin the gang\nGet away from gang\nGang Info\nGangs Info",">>","X");
    }
    return 1;
}
Reply
#7

No need of sscanf, you don't want parameters. We want to make sure it's null to prevent it.

Try:

1st:
pawn Код:
CMD:gang(playerid,cmdtext[])
{
    if(isnull(cmdtext)) ShowPlayerDialog(playerid,37,2,"Gang","Create Gang\nDelete Gang\nInvite User\nRemove User\nGang Spawn\nGang Color\nJoin the gang\nGet away from gang\nGang Info\nGangs Info",">>","X");
    return 1;
}
2nd:
pawn Код:
CMD:gang(playerid,cmdtext[])
{
    #pragma unused cmdtext
    ShowPlayerDialog(playerid,37,2,"Gang","Create Gang\nDelete Gang\nInvite User\nRemove User\nGang Spawn\nGang Color\nJoin the gang\nGet away from gang\nGang Info\nGangs Info",">>","X");
    return 1;
}
If it still crashes, you'll have modify the zcmd to replace the % character.
Reply
#8

i do this:

Код:
stock DialogStringHack(string[])
{
	new i, len=strlen(string);
	for(; i<len; i++)
	{
		if(string[i]=='%') string[i]='#';
	}
}
And this:
Код:
DialogStringHack(inputtext);
to OnDialogResponse
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)