SA-MP Forums Archive
Take a look please! - 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: Take a look please! (/showthread.php?tid=252031)



Take a look please! - cloudysky - 29.04.2011

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!


Re: Take a look please! - Tommy_Mandaz - 29.04.2011

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;
}



Re: Take a look please! - cloudysky - 29.04.2011

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


Re: Take a look please! - admantis - 29.04.2011

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.


Re: Take a look please! - xir - 29.04.2011

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



Re: Take a look please! - cloudysky - 29.04.2011

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


Re: Take a look please! - Tommy_Mandaz - 29.04.2011

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


Re: Take a look please! - admantis - 29.04.2011

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.