SA-MP Forums Archive
Function for a specific group - 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: Function for a specific group (/showthread.php?tid=662533)



Function for a specific group - KaliDobrev - 04.01.2019

Hello, how do I make "SetPlayerMarkerForPlayer" show to a certain group of players?:
Код:
if(PLAYER_TEMP[i][pt_WORKING_IN] == WORK_POLICE)



Re: Function for a specific group - AidanRO - 04.01.2019

Considering that you want to do something related to a function, I will try my best to show you an example.

pawn Код:
FunctionName( playerid, var1 ){
    foreach( new i : OnDutyCops ){
        //Example:
        SetPlayerMarkerForPlayer( i, var1, COLOR_LIGHTRED ) ;
        SCMEx( i, COLOR_YELLOWG, "debug: Player %d location marked with COLOR_LIGHTRED", var1 ) ;
    }}
    return 1 ;
}
The way foreach works is documented on the forums, basically is initiating the array in your enums file / part of the gamemode, and then you add a player to the OnDutyCops every time he does /duty and remove him when he goes off-duty. Is a better practice, and better than for( new i; etc. ) stuff.


Re: Function for a specific group - KaliDobrev - 04.01.2019

ty