SA-MP Forums Archive
[Ajuda] Include Zcmd e Sscanf - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Include Zcmd e Sscanf (/showthread.php?tid=380569)



Include Zcmd e Sscanf - Lucas_Pawno - 26.09.2012

Galeras tou tendo Problemas com a Return desse Comando. Ele sempre retorna nunca dб certo.

Код:
CMD:sos(playerid, params[])
{
    new Texto[126], snd[MAX_PLAYER_NAME];
    GetPlayerName(playerid,snd,sizeof(snd));
    if(sscanf(params, "s[126]", Texto)) return SendClientMessage(playerid, VERMELHO_ESCURO, "[x] Use /sos [Dъvida aqui]");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][pAdmin] > 0)
        {
            format(String, sizeof(String), "{FA5282}[ HELP ] por %s [%d]: %s", snd, playerid, Texto);
            GameTextForPlayer(i, "~r~NOVATO PEDIU AJUDA!", 3000, 3);
            SendClientMessage(i, 0xEAEA00AA, String);
        }
    }
    SendClientMessage(playerid, VERMELHO_ESCURO, "[ > ] Pedido de ajuda enviado com sucesso!");
    return 1; 
}
Esse jб funfa
Код:
CMD:setlevel(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2000) return SendClientMessage(playerid, VERMELHO_ESCURO, "[x] Vocк nгo й Administrador!");
    new qnt, string[126], pname[MAX_PLAYER_NAME], giverid;
    if(sscanf(params, "ud", giverid, qnt)) return SendClientMessage(playerid, VERMELHO_ESCURO, "[x] Uso: /setlevel [ID] [level]");
    if(!IsPlayerConnected(giverid)) return SendClientMessage(playerid, VERMELHO_ESCURO, "[x] Jogador nгo conectado.");
    GetPlayerName(giverid, pname, MAX_PLAYER_NAME);
 	format(string, sizeof(string), "{00FF00}[NVC Admin] Vocк setou o level do Jogador %s para %d .", pname, qnt);
 	SendClientMessage(playerid, AZUL, string);
   	format(string, sizeof(string), "{00FF00}[NVC Admin] O  administrador  %s setou seu level para %d .", nome(playerid), qnt);
 	SendClientMessage(giverid, AZUL, string);
    print(string);
    DOF2_SetInt(arquivo, "Level", qnt);
    SetPlayerScore(giverid, qnt);
    DOF2_SaveFile();
    return 1;
}



Re: Include Zcmd e Sscanf - Maklister - 26.09.2012

Falae bruninho_step

O Cara que copiou meu Gm ... Serб que tem algo parecido entre seu code й o original da BCV ?

pawn Код:
CMD:sos(playerid, params[])
{
    new Texto[126], snd[MAX_PLAYER_NAME];
    GetPlayerName(playerid,snd,sizeof(snd));
    if(sscanf(params, "s[126]", Texto)) return SendClientMessage(playerid, VERMELHO_ESCURO, "[x] Use /Sos [Duvida]");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][pAdmin] > 0)
        {
            format(String, sizeof(String), "{FF0000}[ PEDIDO DE AJUDA ] {FFFF40}%s [%d] diz:{FFFFFF} %s", snd, playerid, Texto);
            GameTextForPlayer(i, "Pedido de ajuda ~n~recebido", 3000, 3);
            SendClientMessage(i, 0xEAEA00AA, String);
        }
    }
    SendClientMessage(playerid, VERMELHO_ESCURO, "[ » ]{949494} Pedido de Ajuda Enviado, espere algum Moderador / Administrador responder ...");
    return 1;
}
Prova do meu code:



Se liga:

http://creativecommons.org/licenses/by-nc-nd/3.0/br/


Re: Include Zcmd e Sscanf - [BOPE]Seu._.Madruga - 26.09.2012

eu tinha atй respondido, mais nem vo responder porque й o noob, e legal saber que й o bruninho_step vou tirar ele da administraзгo da NWD hoje!


Re: Include Zcmd e Sscanf - Lucas_Pawno - 26.09.2012

Sim sou eu , estou criando meu servidor e achei seu gm otimo para base


Re: Include Zcmd e Sscanf - Schocc - 26.09.2012

ae tente isto
pawn Код:
CMD:sos(playerid, params[])
{
    new IDx, Texto[126], snd[MAX_PLAYER_NAME];
    GetPlayerName(playerid,snd,sizeof(snd));
    if(sscanf(params, "si", Texto, IDx)) return SendClientMessage(playerid, VERMELHO_ESCURO, "[x] Use /sos [Dъvida aqui]");
        if(PlayerInfo[IDx][pAdmin] > 0)
        {
            format(String, sizeof(String), "{FA5282}[ HELP ] por %s [%d]: %s", snd, playerid, Texto);
            GameTextForPlayer(IDx, "~r~NOVATO PEDIU AJUDA!", 3000, 3);
            SendClientMessage(IDx, 0xEAEA00AA, String);
        }
    }
    SendClientMessage(playerid, VERMELHO_ESCURO, "[ > ] Pedido de ajuda enviado com sucesso!");
    return 1;
}



Re: Include Zcmd e Sscanf - Maklister - 26.09.2012

Quote:
Originally Posted by Lucas_Pawno
Посмотреть сообщение
Sim sou eu , estou criando meu servidor e achei seu gm otimo para base
Quem disse MEU gm Taloko se roubouu nгo й seuu e meuuu

Otimo para estudos ? quem disse que ele й para estudos Fii se liga, Code roubado, Como se quer ir pra frente desse jeito ?


Re: Include Zcmd e Sscanf - Lucas_Pawno - 26.09.2012

Amigo apresentou dois erros:

pawn Код:
(5278) : warning 209: function "cmd_sos" should return a value
(5279) : error 021: symbol already defined: "SendClientMessage"
(5280) : error 010: invalid function or declaration
Linhas:
pawn Код:
}
    SendClientMessage(playerid, VERMELHO_ESCURO, "[ > ] Pedido de ajuda enviado com sucesso!");
    return 0;
Creio que seja a SSCANF dando conflitos, porque metade dos comandos funcionam e outra metade nгo funciona!


Re: Include Zcmd e Sscanf - Schocc - 26.09.2012

tenta assim vou sair tenta arumar ae
pawn Код:
CMD:sos(playerid, params[])
{
    new IDx, Texto[126], snd[MAX_PLAYER_NAME];
    GetPlayerName(playerid,snd,sizeof(snd));
    if(sscanf(params, "si", Texto, IDx)) return SendClientMessage(playerid, VERMELHO_ESCURO, "[x] Use /sos [Dъvida aqui]");
        if(PlayerInfo[IDx][pAdmin] > 0)
        {
            format(String, sizeof(String), "{FA5282}[ HELP ] por %s [%d]: %s", snd, playerid, Texto);
            GameTextForPlayer(IDx, "~r~NOVATO PEDIU AJUDA!", 3000, 3);
            SendClientMessage(IDx, 0xEAEA00AA, String);
        }
    }
    SendClientMessage(playerid, VERMELHO_ESCURO, "[ > ] Pedido de ajuda enviado com sucesso!");
    return 1;
}
vlw


Re: Include Zcmd e Sscanf - Maklister - 26.09.2012

Quote:
Originally Posted by Lucas_Pawno
Посмотреть сообщение
Amigo apresentou dois erros:

pawn Код:
(5278) : warning 209: function "cmd_sos" should return a value
(5279) : error 021: symbol already defined: "SendClientMessage"
(5280) : error 010: invalid function or declaration
Linhas:
pawn Код:
}
    SendClientMessage(playerid, VERMELHO_ESCURO, "[ > ] Pedido de ajuda enviado com sucesso!");
    return 0;
Creio que seja a SSCANF dando conflitos, porque metade dos comandos funcionam e outra metade nгo funciona!
EDITED


Re: Include Zcmd e Sscanf - Q.I - 26.09.2012

Quote:
Originally Posted by Murilo_sousa
Посмотреть сообщение
Falae bruninho_step

O Cara que copiou meu Gm ... Serб que tem algo parecido entre seu code й o original da BCV ?

pawn Код:
CMD:sos(playerid, params[])
{
    new Texto[126], snd[MAX_PLAYER_NAME];
    GetPlayerName(playerid,snd,sizeof(snd));
    if(sscanf(params, "s[126]", Texto)) return SendClientMessage(playerid, VERMELHO_ESCURO, "[x] Use /Sos [Duvida]");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][pAdmin] > 0)
        {
            format(String, sizeof(String), "{FF0000}[ PEDIDO DE AJUDA ] {FFFF40}%s [%d] diz:{FFFFFF} %s", snd, playerid, Texto);
            GameTextForPlayer(i, "Pedido de ajuda ~n~recebido", 3000, 3);
            SendClientMessage(i, 0xEAEA00AA, String);
        }
    }
    SendClientMessage(playerid, VERMELHO_ESCURO, "[ » ]{949494} Pedido de Ajuda Enviado, espere algum Moderador / Administrador responder ...");
    return 1;
}
Prova do meu code:



Se liga:

http://creativecommons.org/licenses/by-nc-nd/3.0/br/
mais espera ae como ele teve acesso ao seu gm ?

notei a observar que ate o total de strings e igual.


#edit eu nao testei o codigo mais eu compilei assim e nao deu erro olha

pawn Код:
#define VERMELHO_ESCURO 0xFF0000AA

enum Info
{
    pAdmin
};


new PlayerInfo[MAX_PLAYERS][Info];

CMD:sos(playerid, params[])
{
    new String[128];
    new Texto[126], snd[MAX_PLAYER_NAME];
    GetPlayerName(playerid,snd,sizeof(snd));
    if(sscanf(params, "s[126]", Texto)) return SendClientMessage(playerid, VERMELHO_ESCURO, "[x] Use /sos [Dъvida aqui]");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][pAdmin] > 0)
        {
            format(String, sizeof(String), "{FA5282}[ HELP ] por %s [%d]: %s", snd, playerid, Texto);
            GameTextForPlayer(i, "~r~NOVATO PEDIU AJUDA!", 3000, 3);
            SendClientMessage(i, 0xEAEA00AA, String);
        }
    }
    SendClientMessage(playerid, VERMELHO_ESCURO, "[ > ] Pedido de ajuda enviado com sucesso!");
    return 1;
}