Read local and gang chat
#1

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

Can you be more specific what you want by "reading chat"?
Reply
#3

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]
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)