[Ajuda] Comando
#1

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

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. ^^
Reply
#3

Funcionou, muito obrigado amigo.

+rep.

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

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

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.. '-'
Reply
#6

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

Nesse tipo de comando eu prefiro usar bool ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)