Read local and gang chat - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Read local and gang chat (
/showthread.php?tid=562088)
Read local and gang chat -
sirvanec - 06.02.2015
Hi, can you guys to create a code that helps me to read local and gang chat. /l and /g
Gang system i'm using this fs
https://sampforum.blast.hk/showthread.php?tid=243214
Thanks!
Re: Read local and gang chat -
CalvinC - 06.02.2015
Can you be more specific what you want by "reading chat"?
Re: Read local and gang chat -
sirvanec - 06.02.2015
for example when admin use /localspec command it will show what players say in local chat. or /gangspec it shows everything that players write with /g [chat]
Re: Read local and gang chat -
CalvinC - 06.02.2015
You can create a MAX_PLAYERS variable and set it to 1 when you do /localspec, and another for /gangspec.
pawn Код:
new Spec[MAX_PLAYERS][2];
Then when you send a message, loop through all players and check if that variable is set to 1, if so, send them the message too.
Example with the gang chat loop, you can do this:
pawn Код:
for(new pID; pID < MAX_PLAYERS; pID++)
{
if(IsPlayerConnected(pID)) {
switch(Spec[pID][0])
{
case 0: SendClientMessage(pID, GetPlayerColor(playerid), string);
case 1: SendClientMessage(pID, GetPlayerColor(playerid), string);
}
}
}
Also, using the foreach include would be more efficient as a player loop.