sscanf same parameters
#1

How in OnPlayerCommandReceived make check what command lenght max player can write?
Reply
#2

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

pawn Код:
CMD:mycmd(...)
You're doing this:

pawn Код:
forward cmd_mycmd(...);
public cmd_mycmd(...)
Reply
#3

PHP код:
public OnPlayerCommandReceived(playeridcmdtext[])
{
    if(
strlen(cmdtext) > YOUR_MAX_LENGTH)
    {
        
SendClientMessage(playeridCOLORERROR"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...
Reply
#4

Quote:
Originally Posted by iamjems
Посмотреть сообщение
PHP код:
public OnPlayerCommandReceived(playeridcmdtext[])
{
    if(
strlen(cmdtext) > YOUR_MAX_LENGTH)
    {
        
SendClientMessage(playeridCOLORERROR"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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)