Chat nгo da resultado ! -
Felpz - 22.06.2017
Galera eu fiz um chat pra cada organizaзгo, PCC, CV, BOPE, ETC, Sу que quando vou no sv e coloco primeiro ! TEXTO, nгo sai mensagem nenhuma !
PHP код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '!' && text[1] != '!')
{
for(new i = 0; i <= HighestID; i ++)
{
if(IsPlayerConnected(i))
{
if(Player[playerid][pPoliciaMilitar] >= 1)
{
static VarF[128];
format(VarF, sizeof(VarF), "{4682B4}( PMERJ ){FFFFFF} %s diz: %s, cambio.", NomeJogador(playerid), text[1]);
SendClientMessage(i, CorBranca, VarF);
return 0;
}
}
Re: Chat nгo da resultado ! -
IlanZ - 22.06.2017
PHP код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '!' || text[1] != '!')
{
for(new i; i < MAX_PLAYERS+1; i ++)
{
if(IsPlayerConnected(i) && Player[i][pPoliciaMilitar] >= 1)
{
new VarF[128];
format(VarF, sizeof(VarF), "{4682B4}( PMERJ ){FFFFFF} %s diz: %s, cambio.", NomeJogador(playerid), text);
SendClientMessage(i, CorBranca, VarF);
}
}
}
return 0;
}
Operador lуgico:
&& = e
|| = ou
No caso ali, tu tava botando, se o texto0 e o texto1 for igual a '!'.
Re: Chat nгo da resultado ! -
renatog - 22.06.2017
Quote:
Originally Posted by IlanZ
PHP код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '!' || text[1] != '!')
{
for(new i; i < MAX_PLAYERS+1; i ++)
{
if(IsPlayerConnected(i) && Player[i][pPoliciaMilitar] >= 1)
{
new VarF[128];
format(VarF, sizeof(VarF), "{4682B4}( PMERJ ){FFFFFF} %s diz: %s, cambio.", NomeJogador(playerid), text);
SendClientMessage(i, CorBranca, VarF);
}
}
}
return 0;
}
Operador lуgico:
&& = e
|| = ou
No caso ali, tu tava botando, se o texto0 e o texto1 for igual a '!'.
|
Na verdade ele ta checando se o text[1] NГO й igual a '!' para evitar de mandar mensagens "!!!!!!".
O problema deve estar aqui:
Код:
if(Player[playerid][pPoliciaMilitar] >= 1)
Primeiro pq ta usando playerid, provavelmente deveria ser:
Код:
if(Player[i][pPoliciaMilitar] >= 1)
Porйm, como nгo sei como й sua enum, recomendo que vocк mesmo verifique se essa condiзгo estб certa.
Re: Chat nгo da resultado ! -
Felpz - 23.06.2017
Quote:
Originally Posted by IlanZ
PHP код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '!' || text[1] != '!')
{
for(new i; i < MAX_PLAYERS+1; i ++)
{
if(IsPlayerConnected(i) && Player[i][pPoliciaMilitar] >= 1)
{
new VarF[128];
format(VarF, sizeof(VarF), "{4682B4}( PMERJ ){FFFFFF} %s diz: %s, cambio.", NomeJogador(playerid), text);
SendClientMessage(i, CorBranca, VarF);
}
}
}
return 0;
}
Operador lуgico:
&& = e
|| = ou
No caso ali, tu tava botando, se o texto0 e o texto1 for igual a '!'.
|
Funcionou vlw !!
Quote:
Originally Posted by renatog
Na verdade ele ta checando se o text[1] NГO й igual a '!' para evitar de mandar mensagens "!!!!!!".
O problema deve estar aqui:
Код:
if(Player[playerid][pPoliciaMilitar] >= 1)
Primeiro pq ta usando playerid, provavelmente deveria ser:
Код:
if(Player[i][pPoliciaMilitar] >= 1)
Porйm, como nгo sei como й sua enum, recomendo que vocк mesmo verifique se essa condiзгo estб certa.
|
Tava tinha esquecido de por if(Player[
i][pPoliciaMilitar] >= 1), estava colocando assim if(Player[
playerid][pPoliciaMilitar] >= 1), kkkkkkkk