07.06.2016, 05:15
INTRODUCTION
Do you place
Код:
foreach(player, i) { if(PlayerInfo[playerid][pHelper] == 1) { ...bla bla } }
HOW TO DO IT?
Step 1.
Firstly, Decide for what you want to create it?for admins? or for Helpers? or some special cases players??
here i will give you Helper as example.
PHP код:
//put this with your other forwards
forward SendHelperMessage(color, string[]);
Step 2
.PHP код:
//Now put this with your public call backs
public SendHelperMessage(color, string[])
{
foreach(Player, i)
{
if(PlayerInfo[i][pAdmin] >= 1 || PlayerInfo[i][pHelper] >= 1)
{
SendClientMessage(i, color, string); // Here you can use your own color variable too or direct color code. if you do add direct color code, then no need to define color in public.
}
}
}
Step 3
PHP код:
// Finally Use that in your commands so each time you dont have to write foreach loop.
CMD:helpme(playerid, params[])
{
// bla code
SendHelperMessage(COLOR_HELP, "%s", params);
return 1;
}
This was my first official tutorial here. i'll now add more tutorials to help new ones now.
Hope this helped some new scripter.. XD