sscanf same parameters - 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: sscanf same parameters (
/showthread.php?tid=622645)
sscanf same parameters -
MerryDeer - 25.11.2016
How in OnPlayerCommandReceived make check what command lenght max player can write?
Respuesta: sscanf same parameters -
Swedky - 25.11.2016
I think you're using ZCMD, so...
Max lenght is 31 - 4; "31" because that's max lenght for a function/callback name and "- 4" because ZCMD use 4 chars to "tag" that's a command.
I mean, when you make a command
You're doing this:
pawn Код:
forward cmd_mycmd(...);
public cmd_mycmd(...)
Re: sscanf same parameters -
iamjems - 25.11.2016
PHP код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if(strlen(cmdtext) > YOUR_MAX_LENGTH)
{
SendClientMessage(playerid, COLORERROR, "The command you entered is too long.");
return 0;
}
return 1;
}
I have no idea why are you checking the command's length, but there you go...
Re: sscanf same parameters -
SickAttack - 25.11.2016
Quote:
Originally Posted by iamjems
PHP код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if(strlen(cmdtext) > YOUR_MAX_LENGTH)
{
SendClientMessage(playerid, COLORERROR, "The command you entered is too long.");
return 0;
}
return 1;
}
I have no idea why are you checking the command's length, but there you go...
|
That's wrong since
cmdtext isn't only the command, it's the command + params. Use a while loop or a for loop and check for a space.