SA-MP Forums Archive
[Tutorial] Making Special Message system - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Making Special Message system (/showthread.php?tid=608974)



Making Special Message system - GTLS - 07.06.2016

INTRODUCTION

Do you place
Код:
foreach(player, i)
{
  if(PlayerInfo[playerid][pHelper] == 1)
   {

    ...bla bla
   }
}
at each special message command in your server? well, there is another easy way to do it and i will teach you how to.i know, most of Scripters here knows already what i am going to tell here, but this is not for them, its for New Scripters..

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(colorstring[]); 
Step 2
.

PHP код:
//Now put this with your public call backs
public SendHelperMessage(colorstring[])
{
    foreach(
Playeri)
    {
            if(
PlayerInfo[i][pAdmin] >= || PlayerInfo[i][pHelper] >= 1)
            {
                
SendClientMessage(icolorstring); // 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(playeridparams[])
{
   
// bla code
  
SendHelperMessage(COLOR_HELP"%s"params);
 return 
1;

Isnt that easy now? you dont have to write foreach commands each time for same chats. you can create it for anything like if player is in event, or is VIP, or is in a Faction etc..

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


Re: Making Special Message system - Vince - 07.06.2016

This does not even work and it might not even compile. At the very least you get a "number of arguments" warning. The message in step 3 still has to be formatted.


Re: Making Special Message system - PrO.GameR - 07.06.2016

No, this won't even help advanced scripters, cuz it wastes 2 minutes of their time reading thru it and commenting this is poppycock
This also won't help newbies as they copy paste then come back flooding scripting help with "help sth bla bla" as this didn't help them, generated a dipload of errors for them so they thought they did it wrong, not you.


Re: Making Special Message system - Crystallize - 07.06.2016

Lmao copy pasted from survival gamemodes.


Re: Making Special Message system - zSuYaNw - 09.06.2016

are you tested it?


Re: Making Special Message system - Luicy. - 09.06.2016

I don't see why just not
PHP код:
for(new targetid 0targetid MAX_PLAYERStargetid++)
    if(
IsPlayerConnected(targetid) && HelperVar 0)
         
SendClientMessage(..); 



Re: Making Special Message system - HydraHumza - 09.06.2016

Just open and saw ur foreach still using old version strange...


Re: Making Special Message system - GeorgeMcReary - 14.06.2016

There were some warnings if i use it but program is running good. i made a SetPaintBallMessage using your example and it is working now. Thanks GTLS :P