SA-MP Forums Archive
/b interupts other commands starting with b - 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: /b interupts other commands starting with b (/showthread.php?tid=133815)



/b interupts other commands starting with b - Chriham3 - 14.03.2010

Hello!
I am having a /b script, basically local ooc.

But after I created: /bomb, it appears:
(( LOCAL OOC: Christian_Hammer)) mb

my /b is:

pawn Код:
if(!strcmp(cmdtext, "/b", true, 2))
  {
    if(!cmdtext[2])
        SendClientMessage(playerid, 0xFF0000FF, "USAGE: /b [text]");
        {
    new string[128];
    GetPlayerName(playerid, string, sizeof(string));
    format(string, sizeof(string), "(( LOCAL OOC: %s)) %s", string, cmdtext[3]);
    ProxDetector(30, playerid, string,COLOR_GRAD1,COLOR_GRAD2,COLOR_GRAD3,COLOR_GRAD4,COLOR_GRAD5);
    }
 return 1;
}



Re: /b interupts other commands starting with b - Torran - 14.03.2010

I would suggest using DCMD/ZCMD and params,
That way all you really need is params and not params[..] which is causing the problem i think


Re: /b interupts other commands starting with b - Nero_3D - 14.03.2010

ye sure, its obviously that the script stops all other commands with /b
If people have no clue what they do, they should use dcmd / zcmd like Joe already told us

Solution:

1. Put this command at the end of OnPlayerCommandText
2. use this fixed command

pawn Код:
if(strcmp(cmdtext[1], "b", true, 2) == 0 && (cmdtext[2] == EOS || cmdtext[2] == ' '))
    {
        if(cmdtext[2] != ' ' || cmdtext[3] == EOS)
            return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /b [text]");
        new string[166]; //Name (24) + Max typed text (124) + Added text (17) + EOS (1)
        GetPlayerName(playerid, string, sizeof(string));
        format(string, sizeof(string), "(( LOCAL OOC: %s)) %s", string, cmdtext[3]);
        return ProxDetector(30.0, playerid, string, COLOR_GRAD1, COLOR_GRAD2, COLOR_GRAD3, COLOR_GRAD4, COLOR_GRAD5);
    }