[Ajuda] Chat - 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] Chat (
/showthread.php?tid=652056)
Chat -
Jorgeeee - 02.04.2018
Gente tenho a organizaзгo no meu servidor rpg e o chat que eu fiz й /chatplc, /chatajudantes porйm eu queria deixar um comando sу e tipo inves de chatplc queria deixar o @ sem /, e que envie para as respectivas organizaзхes setadas, se eu for setado na plc usar @ e a msg vai pra plc e usar @ para ajudante e ir sу para ajudante
Re: Chat -
XandyMello - 02.04.2018
PHP код:
#include <a_samp>
#define PlayerName(%0) name[%0]
new
name[MAX_PLAYERS][MAX_PLAYER_NAME], //velocidade
VarORG[MAX_PLAYERS][...] //Var de sua ORG
;
public OnPlayerConnect(playerid)
{
static
NICK[MAX_PLAYER_NAME];
GetPlayerName(playerid, NICK, MAX_PLAYER_NAME);
name[playerid][0] = EOS;
strins(name, NICK, 0);
return 11;
}
public OnPlayerText(playerid, text[])
{
if(text[0] == '@')
{
new i = MAX_PLAYERS;
while(i--){ //ou foreach
if(!IsPlayerConnected(i)) continue;
if(VarORG[playerid] == VarORG[i]){ //Se a ORG do cara й igual a minha
static string[128]; //
format(string, sizeof string, "[CHAT] %s: %s", PlayerName(playerid), text[1]);
SendClientMessage(i, -1, string);
}
}
//.... return false;/;;;likjoyh
}
return true;
}
Resumo: Para verificar se o primeiro digito do cara й um @, basta utilizar:
PHP код:
if(text[0] == '@')