Server Crash -
Patryk98 - 07.11.2013
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 ?
Re: Server Crash -
Tagathron - 07.11.2013
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.
Re: Server Crash -
Konstantinos - 07.11.2013
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;
}
Re: Server Crash -
Patryk98 - 07.11.2013
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 ?
Re: Server Crash -
Konstantinos - 07.11.2013
Oops, sorry I forgot the parameter.
pawn Код:
if(isnull(params)) ShowPlayerDialog( ... );
Re: Server Crash -
Patryk98 - 08.11.2013
For me is
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;
}
Re: Server Crash -
Konstantinos - 08.11.2013
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.
Re: Server Crash -
Patryk98 - 10.11.2013
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