Minor problem
#1

Hey i made an ooc command which looks like this

pawn Code:
dcmd_ooc(playerid,params[])
{
    new text,name[MAX_PLAYER_NAME],string[128];
    if(sscanf(params,"s",text)) SendClientMessage(playerid,COLOUR_RED,"Usage: /ooc message");
    else
    {
        GetPlayerName(playerid,name,sizeof(name));
        format(string,sizeof(string),"OOC %s: %s",name,text);
        SendClientMessageToAll(COLOUR_WHITE,string);
        }
    return 1;
}
Which works fine exept it sends the text plus an "SERVER: Unknown command" no matter where i put the return 1; Any ideas?
Reply
#2

You should return the message ( return SendClientMessage(...); ).
Reply
#3

Had no effect.

Even tried return both messages
Reply
#4

pawn Code:
dcmd_ooc(playerid, params[])
    {
    new sendername[32];
    new idx;
    new string[128];

    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(params);
    while ((idx < length) && (params[idx] <= ' '))
    {
    idx++;
    }
    new offset = idx;
    new result[128];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
    result[idx - offset] = params[idx];
    idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/o)oc [ooc chat]");
    return 1;
    }
    format(string, sizeof(string), "OOC [%d]%s: %s", playerid, sendername, result);
    SendClientMessageToAll(COLOR_WHITE,string);
    printf("%s", string);
    return 1;
    }
Reply
#5

Thanks worked
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)