SA-MP Forums Archive
About my /shout command there is a weirdo bug. - 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: About my /shout command there is a weirdo bug. (/showthread.php?tid=358234)



About my /shout command there is a weirdo bug. - DeeCaay - 09.07.2012

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:



Re: strcmp help - Kindred - 09.07.2012

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]))


Re : Re: strcmp help - DeeCaay - 09.07.2012

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.


Re: strcmp help - Vince - 09.07.2012

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


Re : Re: strcmp help - DeeCaay - 09.07.2012

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.