SA-MP Forums Archive
How to target everyuser in the game? - 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: How to target everyuser in the game? (/showthread.php?tid=339466)



How to target everyuser in the game? - NewerthRoleplay - 03.05.2012

Title says all, it's for a noob system, only for those who have allowed themselves to view the noob messages.


Re: How to target everyuser in the game? - antonio112 - 03.05.2012

I still can't understand what exactly you need?


Re: How to target everyuser in the game? - Mauzen - 03.05.2012

Loop through all players, check if they allow that messages, and if so, send them that message. Shouldnt be that hard at all.
Example:

pawn Код:
for (new i = 0; i < MAX_PLAYERS; i++) {
    if (!IsPlayerConnected(i) || !noobMode[i]) continue;
    SendClientMessage(i, color, message);
}



Re: How to target everyuser in the game? - Marricio - 03.05.2012

pawn Код:
new allownoobmessages[MAX_PLAYERS]

//OnPlayerConnect
allownoobmessages[playerid] = 1;

CMD:allownoobmessage( playerid, params[] )
// bracket goes here, sorry i dont have it in my keyboard
     if( allownoobmessages[playerid] == 1 )
         allownoobmessages[playerid] = 0;
     else
          allownoobmessages[playerid] = 1;
     return 1;
// closing bracket


stock SendNoobMessage( color, string[] )
// bracket
    for( new i = 0; i!=MAX_PLAYERS;i++ )
        if( allownoobmessages[i] == 1 && IsPlayerConnected( playerid ) )
            SendClientMessage( playerid, color, string );
     return 1;
// closing bracket
Sorry for identation and all, i dont have PAWNO in this computer, either can do brackets.

Note you need to reset the variable when a player disconnects, this is just a snippet, you can do the noob chat command yourself with it.


Re: How to target everyuser in the game? - Mauzen - 05.05.2012

I love that guys asking a question and then never coming back when its answered.


Re: How to target everyuser in the game? - NewerthRoleplay - 07.05.2012

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
I love that guys asking a question and then never coming back when its answered.
I live the guy that comments without actually helping just so that he can make a point, not my fault I haven't had spare time recently