SA-MP Forums Archive
Characters problem - 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)
+--- Thread: Characters problem (/showthread.php?tid=516318)



Characters problem - ajam112 - 30.05.2014

Hello guys, i just got problem.. when i type too much (5/5).. i just see 2/5 of it.. how can i do that? here is the default commands for /o(oc).. i already test changing the iText to 1024 but still won't work.

pawn Код:
COMMAND:o(playerid, params[])
{
    if(PlayerTemp[playerid][muted]) return SendClientError(playerid, "You are muted!");
    if(!oocenable && !PlayerInfo[playerid][power] && !PlayerInfo[playerid][helper]) return SendClientError(playerid, "OOC is off!");
    new iText[ 200 ];
    if(sscanf(params, "s", iText)) return SCP(playerid, "[msg]");
    if(PlayerInfo[playerid][power] || PlayerInfo[playerid][helper] || PlayerInfo[playerid][power] != 31337)
    {
        format(iStr,sizeof(iStr),"{8bbc8b}(( {CCFFCC}%s %s: %s {8bbc8b}))",AdminLevelName(playerid), AnonAdmin(playerid),iText);
        SendMessageToAll(0xCCFFCC00, iStr);
    }
    else
    {
        format(iStr,sizeof(iStr),"{8bbc8b}(( [OOC] {CCFFCC}%s: %s {8bbc8b}))",RPName(playerid),iText);
        PlayerLoop(f) { if(PlayerTemp[f][oocoff]==0) SendMessageToPlayer(f,0xCCFFCC00,iStr); }
    }
    format(iStr, sizeof(iStr), "10(( [Global OOC]: %s %s: %s ))", AdminLevelName(playerid),PlayerName(playerid), iText);
    iEcho(iStr);
    return 1;
}



Re: Characters problem - Konstantinos - 30.05.2014

It's because of the "s" specifier in sscanf. You need to specify its lenght in square brackets otherwise it's by default 32. You also don't need sscanf for that and it can be done by isnull and "params".

pawn Код:
COMMAND:o(playerid, params[])
{
    if(PlayerTemp[playerid][muted]) return SendClientError(playerid, "You are muted!");
    if(!oocenable && !PlayerInfo[playerid][power] && !PlayerInfo[playerid][helper]) return SendClientError(playerid, "OOC is off!");
    if(isnull(params)) return SCP(playerid, "[msg]");
    if(PlayerInfo[playerid][power] || PlayerInfo[playerid][helper] || PlayerInfo[playerid][power] != 31337)
    {
        format(iStr,sizeof(iStr),"{8bbc8b}(( {CCFFCC}%s %s: %s {8bbc8b}))",AdminLevelName(playerid), AnonAdmin(playerid),params);
        SendMessageToAll(0xCCFFCC00, iStr);
    }
    else
    {
        format(iStr,sizeof(iStr),"{8bbc8b}(( [OOC] {CCFFCC}%s: %s {8bbc8b}))",RPName(playerid),params);
        PlayerLoop(f) { if(PlayerTemp[f][oocoff]==0) SendMessageToPlayer(f,0xCCFFCC00,iStr); }
    }
    format(iStr, sizeof(iStr), "10(( [Global OOC]: %s %s: %s ))", AdminLevelName(playerid),PlayerName(playerid), params);
    iEcho(iStr);
    return 1;
}



Re: Characters problem - ajam112 - 30.05.2014

Thank you, how about this?
pawn Код:
COMMAND:a(playerid, params[])
{
    if(PlayerInfo[playerid][power])
    {
        new iReason[ 500 ];
        if( sscanf ( params, "s", iReason))  return SCP(playerid, "[message]");
        format(iStr,sizeof(iStr),"[AdminChat] %s %s: %s",AdminLevelName(playerid), RPName(playerid), iReason);
        PlayerLoop(qqq) if(PlayerInfo[qqq][power]) SendMessageToPlayer(qqq,COLOR_ADMINCHAT,iStr);
        format( iStr, sizeof(iStr), "7{ [ADMIN] %s %s: %s }",AdminLevelName(playerid), PlayerName(playerid), iReason);
        iEcho( iStr );
    }
    else SendClientError(playerid, "You are not allowed to use this command!");
    return 1;
}



Re: Characters problem - Konstantinos - 30.05.2014

The same, you don't need sscanf for only 1 argument which is string:
pawn Код:
COMMAND:a(playerid, params[])
{
    if(!PlayerInfo[playerid][power]) return SendClientError(playerid, "You are not allowed to use this command!");
    if(isnull(params))  return SCP(playerid, "[message]");
    format(iStr,sizeof(iStr),"[AdminChat] %s %s: %s",AdminLevelName(playerid), RPName(playerid), params);
    PlayerLoop(qqq) if(PlayerInfo[qqq][power]) SendMessageToPlayer(qqq,COLOR_ADMINCHAT,iStr);
    format( iStr, sizeof(iStr), "7{ [ADMIN] %s %s: %s }",AdminLevelName(playerid), PlayerName(playerid), params);
    iEcho( iStr );
    return 1;
}
But let's say there is a command such as /kick <ID/Part Of Name> <reason> and in that case it would be:
pawn Код:
// an example:
new
    ID,
    reason[64];

if (sscanf(params, "rs[64]", ID, reason)) return // error message..