[Ajuda]Passando para sscanf
#1

bom galera to em dъvida como passo esse comando para sscanf alguem me da um help.
pawn Код:
CMD:so(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        new length = strlen(cmd);
        while ((idx < length) && (cmd[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[64];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = cmd[idx];
            idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result))
        {
            SendClientMessage(playerid, COLOR_GRAD2, "USE: (/so)cio [socio chat]");
            return true;
        }
        format(string, sizeof(string), "*Socio %s: %s", sendername, result);
        if (PlayerInfo[playerid][pSocio] >= 1)
        {
            SendSocioMessage(COLOR_YELLOW, string);
        }
        printf("Socio %s: %s", sendername, result);
    }
    return true;
}
Reply
#2

Assim:

pawn Код:
CMD:so(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new Texto[128];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(sscanf(params, "s[128]", Texto)) return SendClientMessage(playerid, COLOR_GRAD2, "USE: (/so)cio [socio chat]");
        format(string, sizeof(string), "*Socio %s: %s", sendername, Texto);
        if (PlayerInfo[playerid][pSocio] >= 1)
        {
            SendSocioMessage(COLOR_YELLOW, string);
        }
        printf("Socio %s: %s", sendername, Texto);
    }
    return true;
}
Reply
#3

acho que ficaria assim:
pawn Код:
CMD:so(playerid, params[])
{
    new oi;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(sscanf(params,"s[128]", oi)) return SendClientMessage(playerid, -1,"USE: (/so)cio [socio chat]"); // blackdonelly "-"
    format(string, sizeof(string), "*Socio %s: %s", sendername, oi);
    if (PlayerInfo[playerid][pSocio] >= 1)
    {
        SendSocioMessage(COLOR_YELLOW, string);
    }
    printf("Socio %s: %s", sendername, oi);
    return 1;
}
PS: Nгo mecho muito com SSCANF / ZCMD entгo corrija-me se eu estiver errado.
Reply
#4

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

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

Com o meu nгo precisa disso!
Reply
#7

Como tambйm nгo precisa do
PHP код:
IsPlayerConnected 
Claro que para digitar um comando o cara tem que estar conectado.
Reply
#8

Quote:
Originally Posted by sanalex
Посмотреть сообщение
Com o meu nгo precisa disso!
Edai? ele quer um cуdigo que funcione =]

@EDIT \/

E ou meu nгo funciona . ok. desculpe sr fodгo.
odeio esse povo que quer brigar por qualquer coisa PQP!
e tabem tanto faz usar [128] na new ou nos " "
Reply
#9

Exato, e o meu FUNCIONA!
Reply
#10

Sanalex, seu cуdigo estб errado.
o certo й assim:
PHP код:
if(sscanf(params"s[128]"Texto)) 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)