About my /shout command there is a weirdo bug.
#1

Guys today i made a command /shout with strcmp and im requesting some help.

Problem: when i do /shout hello
Its gonna display Name: Shouts: **ut** hello !!

My code

Code:
    if(!strcmp(cmdtext, "/shout", true, 5)) 
    {
        if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /shout [text]");
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "%s shouts: %s !!", str, cmdtext[4]);
        SendClientMessageToAll(0xFFFFFFAA, str);
        return 1;
    }
What is the problem?

Picture:
Reply
#2

Probably since cmdtext[3] is /sho and not /shout, meaning it needs to be 5 for the first part of the command (/shout). ((cmdtext[5]))
Reply
#3

Quote:
Originally Posted by Kindred
View Post
Probably since cmdtext[3] is /sho and not /shout, meaning it needs to be 5 for the first part of the command (/shout). ((cmdtext[5]))
Thanks for help but still not working.
Reply
#4

By my count, '/shout' is 6 letters, plus the space would make 7 which means the text starts at cmdtext[8].
Reply
#5

Quote:
Originally Posted by Vince
View Post
By my count, '/shout' is 6 letters, plus the space would make 7 which means the text starts at cmdtext[8].
Hello, vince my command is not working anymore.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)