Jump to content
winter

[Tutorial] Automatic Message

Recommended Posts

Hello, 

Here is a tutorial on how to add automatic text to your server.

Difficulty: Easy

Source:  https://altisdev.com/topic/4895/tutorial-message-automatique 

Author: Newbie / BenjaminSansNom

First go to the root of your Mission and open your Init.sqf: Exemple.Altis / Init.sqf and after this line:

[] execVM "KRON_Strings.sqf";  

Add:

[] spawn life_fnc_autoMessages; // Message Auto  

Open function.h and at the end of class Functions {};

Add:

class autoMessages {}; // Message Auto

Your class should give something like this:

class Functions  
	{  
		file = "core\functions";  
		class calWeightDiff {};  
		class fetchCfgDetails {};  
		class handleInv {};  
		class hudSetup {};  
		class hudUpdate {};  
		class tazeSound {};  
		class animSync {};  
		class simDisable {};  
		class keyHandler {};  
		class dropItems {};  
		class handleDamage {};  
		class numberText {};  
		class handleItem {};  
		class accType {};  
		class receiveItem {};  
		class giveDiff {};  
		class receiveMoney {};  
		class playerTags {};  
		class clearVehicleAmmo {};  
		class pullOutVeh {};  
		class nearUnits {};  
		class actionKeyHandler {};  
		class playerCount {};  
		class fetchDeadGear {};  
		class loadDeadGear {};  
		class isnumeric {};  
		class escInterupt {};  
		class onTakeItem {};  
		class fetchVehInfo {};  
		class pushObject {};  
		class onFired {};  
		class revealObjects {};  
		class nearestDoor {};  
		class inventoryClosed {};  
		class inventoryOpened {};  
		class isUIDActive {};  
		class saveGear {};  
		class loadGear {};  
		class stripDownPlayer {};  
		class nearATM {};  
		class autoMessages {}; // Message Auto  
	};   

** Then go to / core / functions **

and creates a file fn_autoMessages.sqf

And copy this code:

/*  
    File: fn_autoMessages.sqf  
    Author: BenjaminSansNom  

    Description:  
    Auto messages in game every X seconds  
*/  

[] spawn {  
    // Add a line in this array to add a message  
    _messages = [  
        "Les serveurs ont un coût, vous pouvez contribuer à son financement en faisant un don ici:<br/> <t color='#e32828' size='1.5'>www.dreamlife.fr/dons</t>",  
        "Notre TeamSpeak est:<br/><t color='#e32828' size='1.5'>ts.dreamlife.fr</t>"  
    ];  

    _refreshTime = 300; // Time between each message (in seconds)  

    _i = 0;  
    while {true} do {  
        _count = count _messages;  
        _message = _messages select _i;  
        hint parseText format["<t color='#ffffff' size='2'>Dream</t><t color='#c45454' size='2'>Life</t><br/><br/><img shadown='false' size='6' image='images\logo.paa'/><br/><br/>%1", _message];  
        sleep _refreshTime;  
        if (_i == (_count - 1)) then {  
            _i = 0;  
        } else {  
            _i = _i + 1;  
        };  
    };  
};  

Just change the line to change a message.

_messages = [

To select the time between each message, change this variable:

_refreshTime = 300; // Time between each message (in seconds)

To change the header of the message you need to change this also to add an image you need to change the logo location:

<t color='#ffffff' size='2'>Dream</t><t color='#c45454' size='2'>Life</t><br/><br/><img size='6' shadow='0' image='images\logo.paa'/><br/><br/> 

If you are interested in seeing what it looks like i have attached a photo.

All Done!

BenjaminSansNom.png

This tutorial was taken from - https://altisdev.com/topic/4895/tutorial-message-automatique with translations by me.

  • Like 3

Share this post


Link to post
Share on other sites
3 hours ago, mew said:

@winter  where the script come from? i would like to know, and the author would like it too, just respect.

are you a admin of the forum?

if not please be confortable to report content. let us do our job and focus to rebuild and help the forum.

  • Like 1

Share this post


Link to post
Share on other sites

For anyone wanting to use an image like this the pixel size is:

Width: 248 Height: 124.

Just took some pain getting, no need for someone else to waste the same time :') :D

Share this post


Link to post
Share on other sites
1 hour ago, !TS JORDAN said:

For anyone wanting to use an image like this the pixel size is:

Width: 248 Height: 124.

Just took some pain getting, no need for someone else to waste the same time :') :D

thanks ;o,O;O;O;O;O;O;O;O;OO;O;O;O;O;OO very nice :D

Share this post


Link to post
Share on other sites

Don't work .

There is the working version :

 

First go to the root of your Mission and open your Init.sqf: Exemple.Altis / Init.sqf and after this line:

[] execVM "KRON_Strings.sqf";  

Add:

[] execVM "core\functions\fn_autoMessages.sqf";

** Then go to / core / functions **

and creates a file fn_autoMessages.sqf

And copy this code:

/*  
    File: fn_autoMessages.sqf  
    Author: BenjaminSansNom  

    Description:  
    Auto messages in game every X seconds 

	Don't forget to add "," if you add more messages , exemple :
	 _messages = [
			"My awesome server",
			"Give more money",
			"Give more more money"
		     ]
*/  

[] spawn {  
    // Add a line in this array to add a message  
    _messages = [  
        "Les serveurs ont un coût, vous pouvez contribuer à son financement en faisant un don ici:<br/> <t color='#e32828' size='1.5'>www.dreamlife.fr/dons</t>",  
        "Notre TeamSpeak est:<br/><t color='#e32828' size='1.5'>ts.dreamlife.fr</t>"  
    ];  

    _refreshTime = 300; // Time between each message (in seconds)  

    _i = 0;  
    while {true} do {  
        _count = count _messages;  
        _message = _messages select _i;  
        hint parseText format["<t color='#ffffff' size='2'>Dream</t><t color='#c45454' size='2'>Life</t><br/><br/><img shadown='false' size='6' image='images\logo.paa'/><br/><br/>%1", _message];  
        sleep _refreshTime;  
        if (_i == (_count - 1)) then {  
            _i = 0;  
        } else {  
            _i = _i + 1;  
        };  
    };  
};  
  • Like 1

Share this post


Link to post
Share on other sites
On 15/10/2016 at 11:53 PM, Magikarp said:

Don't work .

There is the working version :

 

First go to the root of your Mission and open your Init.sqf: Exemple.Altis / Init.sqf and after this line:

[] execVM "KRON_Strings.sqf";  

Add:

[] execVM "core\functions\fn_autoMessages.sqf";

** Then go to / core / functions **

and creates a file fn_autoMessages.sqf

And copy this code:

/*  
    File: fn_autoMessages.sqf  
    Author: BenjaminSansNom  

    Description:  
    Auto messages in game every X seconds 

	Don't forget to add "," if you add more messages , exemple :
	 _messages = [
			"My awesome server",
			"Give more money",
			"Give more more money"
		     ]
*/  

[] spawn {  
    // Add a line in this array to add a message  
    _messages = [  
        "Les serveurs ont un coût, vous pouvez contribuer à son financement en faisant un don ici:<br/> <t color='#e32828' size='1.5'>www.dreamlife.fr/dons</t>",  
        "Notre TeamSpeak est:<br/><t color='#e32828' size='1.5'>ts.dreamlife.fr</t>"  
    ];  

    _refreshTime = 300; // Time between each message (in seconds)  

    _i = 0;  
    while {true} do {  
        _count = count _messages;  
        _message = _messages select _i;  
        hint parseText format["<t color='#ffffff' size='2'>Dream</t><t color='#c45454' size='2'>Life</t><br/><br/><img shadown='false' size='6' image='images\logo.paa'/><br/><br/>%1", _message];  
        sleep _refreshTime;  
        if (_i == (_count - 1)) then {  
            _i = 0;  
        } else {  
            _i = _i + 1;  
        };  
    };  
};  

Thanks a lot :)

Share this post


Link to post
Share on other sites

Yeah, even with the link you originally posted, and then the scripts that you posted.  The string that goes into the init.sqf that you posted is incorrect and will throw errors via your RPT.  With the link to the tutorial and your copy of the tutorial you screwed up the init.sqf line under KRON_STRINGS.  Should be [] spawn life_fnc_autoMessages; // Message Auto instead of your class autoMessages {}; // Message Auto.  I think you just double posted the functions.hpp line.  Good info though.

Share this post


Link to post
Share on other sites
On 12/10/2016 at 10:08 AM, !TS JORDAN said:

For anyone wanting to use an image like this the pixel size is:

Width: 248 Height: 124.

Just took some pain getting, no need for someone else to waste the same time :') :D

lol yes indeed thanks for the tip my man.

Share this post


Link to post
Share on other sites
33 minutes ago, Vase said:

how do i get my image on there tells me image not found?

mpmission folder > images

Share this post


Link to post
Share on other sites

i am trying to make this work with UPM notification instead of showing a normal hint how would i go about doing that? 

["DATA TRANSFER","Please be aware that information from this session may be transfered to third party services such as Battlemetrics.com."] call UPM_fnc_showNotification ;

 

where would i place this?

Share this post


Link to post
Share on other sites
On 3/24/2019 at 12:32 PM, Aura said:

i am trying to make this work with UPM notification instead of showing a normal hint how would i go about doing that? 

["DATA TRANSFER","Please be aware that information from this session may be transfered to third party services such as Battlemetrics.com."] call UPM_fnc_showNotification ;

 

where would i place this?

If you mean to do this to all automated messages, you would need to edit this line from the tutorial:

hint parseText format["<t color='#ffffff' size='2'>Dream</t><t color='#c45454' size='2'>Life</t><br/><br/><img shadown='false' size='6' image='images\logo.paa'/><br/><br/>%1", _message];

Otherwise if you are just asking where to put that, you could do it after they press spawn or whatever you like, it's just a message on their screen.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...