Characters problem
#1

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)