Command is acting weird
#1

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
Reply
#2

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;
}
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)