SA-MP Forums Archive
Command is acting weird - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command is acting weird (/showthread.php?tid=125754)



Command is acting weird - (Jeff) - 05.02.2010

Ok i found this Local chat inc, with the topic the guy gave this code
pawn Код:
if(strcmp(cmdtext, "/me", true, 3) == 0)
    {
    if(!cmdtext[3])return SendClientMessage(playerid, COLOR_RED, "USAGE: /me [text]");
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "*%s %s", str, cmdtext[4]);
    SendLocalMessage(playerid, COLOR_PURPLE, 7, str);
    return 1;
    }
works fine but when i edit only the "/me" to "/b" it doesn't work :S


Re: Command is acting weird - LuxurioN™ - 05.02.2010

Simple, try:

pawn Код:
if(strcmp(cmdtext, "/b", true, 2) == 0)
{
if(!cmdtext[2])return SendClientMessage(playerid, COLOR_RED, "USAGE: /b [text]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "*%s %s", str, cmdtext[3]);
SendLocalMessage(playerid, COLOR_PURPLE, 7, str);
return 1;
}



Re: Command is acting weird - hvampire - 05.02.2010

look at this :
if(strcmp(cmdtext, "/me", true, 3) == 0)
/me: is 3 letters [/me]

so simply /b = 2 letters so

if(strcmp(cmdtext, "/b", true, 2) == 0)