Take a look please!
#1

This is my ooc command:

pawn Код:
command(ooc, playerid, params[])
{
    new Message[128], string[128];
    if(sscanf(params, "s", Message))
    {
        SendClientMessage(playerid, ORANGE, "Usage: /o(oc) [message]");
    }
    else
    {
        if( PlayerInfo[playerid][Admin] >= 1)
        {
            format(string, sizeof(string), "(( Server Admin %s: %s )) ", GetName(playerid), Message);
            SendClientMessageToAll(HIGHLIGHT, string);
        }
        else
        {
            format(string, sizeof(string), "(( %s: %s ))", GetName(playerid), Message);
        }
    }
    return 1;
}
Everything is fine except one problem. Look at this screen shot:



See how it cuts out half way across my screen. Please help me!
Reply
#2

Why use sscanf? You can just do this:
pawn Код:
CMD:ooc(playerid, params[])
{
    if(isnull(params))
    {
        SendClientMessage(playerid, ORANGE, "[USAGE]/o(oc) [Message]");
    }
    else
    {
        new string[128], playersname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playersname, sizeof(playersname));
        format(string, sizeof(string), "(( %s: %s ))", playersname, params);
        SendClientMessageToAll(HIGHLIGHT, string);
    }
    return 1;
}
Reply
#3

I prefer using sscanf as i learned to script using it. Anyway will this work?
Reply
#4

Using sscanf when you only need to extract data from one parameter is useless. You can use the 'params' coming in zcmd, so yes, it will work.
Reply
#5

pawn Код:
if(sscanf(params, "s[128]", Message))
Reply
#6

Ok so just to clarify if i use zcmd it will get rid of the problem i have?
Reply
#7

Up to you but I dont think sscanf is needed in this case, good luck!
Reply
#8

You're already zcmd. You use xir's solution (specifying the string destination size) or use "params" (and isnull)that's already coming in zcmd.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)