SA-MP Forums Archive
[Ajuda] Comando - 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] Comando (/showthread.php?tid=344335)



[Ajuda] Comando - Luciano* - 20.05.2012

Galera, eu uso o seguinte codigo para /MP

pawn Код:
CMD:mp(playerid,params[])
{
    static giveid,texto[128],mandou[MAX_PLAYER_NAME],recebeu[MAX_PLAYER_NAME],string[128];
    if(sscanf(params, "us[128]", giveid, texto))return SendClientMessage(playerid, -1, "[INFO] Correto: /mp [ID] [Mensagem]");
    if(!IsPlayerConnected(giveid))return SendClientMessage(playerid, -1, "[ERRO] Player nгo conectado!");
    GetPlayerName(giveid,recebeu,sizeof(recebeu));
    GetPlayerName(playerid,mandou,sizeof(mandou));
    format(string,sizeof(string),"{FF54BF}MP Enviada para %s :{FFFF00} %s",recebeu,texto);
    SendClientMessage(playerid,-1,string);
    format(string,sizeof(string),"{FF0000}MP Recebida de %s: {FFFF00} %s",mandou,texto);
    SendClientMessage(giveid,-1,string);
    return true;
}
Eu queria saber como faзo um comando para bloquear a MP (Nao receber), e um para desbloquear (Receber novamente)

+rep.


Re: [Ajuda] Comando - .FuneraL. - 20.05.2012

pawn Код:
new MPBlock[MAX_PLAYERS];

// No Comando da MP

if(MPBlock[playerid] == 1) return SendClientMessage(playerid, -1, "[ERRO]: Jogador Estб com a PM Bloqueada, Mensagem Falhou");
//Code
MPBlock[playerid] = 0;

// OnPlayerConnect

MPBlock[playerid] = 0;

// Comando

CMD:blockpm(playerid)
{
     SendClientMessage(playerid, -1, "[INFO]: PM Bloqueada");
     MPBlock[playerid] = 1;
     return 1;
}

CMD:desblockpm(playerid)
{
     SendClientMessage(playerid, -1, "[INFO]: PM Desbloqueada");
     MPBlock[playerid] = 0;
     return 1;
}
Acho que й isto.

@Edit - Obrigado. ^^



Re : [Ajuda] Comando - Luciano* - 20.05.2012

Funcionou, muito obrigado amigo.

+rep.

#Edit-- Sу faltou um " ); " no final do SendClientMessage , arrume caso alguem precise deste codigo tambйm rs.


Re: [Ajuda] Comando - Jake_Dunlapp - 20.05.2012

Hauhauhuaha Rep + Pro Luciano E Pro Funeral Vo Usar No Meu Gm


Re: [Ajuda] Comando - mengueh - 20.05.2012

Quote:
Originally Posted by Jake_Dunlapp
Посмотреть сообщение
Hauhauhuaha Rep + Pro Luciano E Pro Funeral Vo Usar No Meu Gm
Vйi, tenta nгo copiar codes direto sem ao menos estudar ele, para aprender o que cada funзгo faz.. '-'


Re : [Ajuda] Comando - Luciano* - 22.05.2012

Man, deu um problema...

Tipo, se eu dar /blockpm eu vou tentar mandar pra min mesmo diz que minha mp esta bloqueada ai ta certo, mais quando outra pessoa manda, a mensagem vai normal porque?

Resumindo- O codigo sу esta funcionando se caso eu mesmo mandar pra min, se outra pessoa mandar nao acontece nada.


Re: [Ajuda] Comando - ViniBorn - 22.05.2012

Nesse tipo de comando eu prefiro usar bool ...