happydayz

Enigma Exile Update Respect/Poptabs [18/03/16]

13 posts in this topic

Enigma Exile Update Respect/Poptabs

 

Currently with Exile there is no means of updating poptabs/respect of a player from clientside code that saves to the database.

This fixes that dilemna.

 

https://github.com/happydayz-enigma/Enigma_Exile_UpdateRP

 

Update: 18/03/16 - Add support for Advanced Banking

 

Say you wanted to add 10000 poptabs to a player - You could try and use:

Spoiler

			_target = player;
			_playerscore = _target getVariable ['ExileScore', 0];
			_newscorevalue = _playerscore + 10000;
			
			_target setVariable ['ExileScore', _newscorevalue];
			
			_target setVariable['PLAYER_STATS_VAR',[_target getVariable ['ExileMoney', 0],_newscorevalue],true];
			ExileClientPlayerScore = _newscorevalue;
			(owner _target) publicVariableClient 'ExileClientPlayerScore';
			
			format['setAccountScore:%1:%2', _newscorevalue, (getPlayerUID _target)] call ExileServer_system_database_query_fireAndForget;

 

 

The player would show that they have an extra 10k poptabs on xm8.....But this would NOT save to the database as call ExileServer_system_database_query_fireAndForget; is NOT a client recognised function. So once player logged off/server restarted they would roll back to their old amount of poptabs/respect.

This addon adds the ability to update any players poptabs/respect and save it to the database.

 

HOW TO INSTALL:

 

Spoiler



------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------HOW TO INSTALL ENIGMA Update Respect and Poptabs-----------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------


First add the startup paramaters @Enigma to your server!

Copy the @Enigma Folder to your Server Root!

An alternative method is to open the @Enigma\addons folder and transfer any file ending with .pbo into your @ExileServer\addons\ folder where it will be loaded up automatically.


HOW TO USE:


Then in any of your scripts that you run on a client you can simply run the following code:

//	_addrespect = Whatever total value you want it to be!		
//example --- _addpoptabs = 10000;

			_newScore = ExileClientPlayerScore + _addrespect;
			ENIGMA_UpdateStats = [player,0,_newScore];
			publicVariableServer "ENIGMA_UpdateStats";


//_addpoptabs = Whatever you want it to be!
//
example --- _addpoptabs = 10000;
			_newPoptabs = ExileClientPlayerMoney + _addpoptabs;
			ENIGMA_UpdateStats = [player,_newPoptabs];
			publicVariableServer "ENIGMA_UpdateStats";


//You can remove respect or poptabs simply by changing the plus to a minus!

 

 

HOW TO USE:

 

Then in any of your scripts that you run on a client you can simply run the following code:

Spoiler

//	_addrespect = Whatever total value you want it to be!		
//example --- _addpoptabs = 10000;

			_newScore = ExileClientPlayerScore + _addrespect;
			ENIGMA_UpdateStats = [player,0,_newScore];
			publicVariableServer "ENIGMA_UpdateStats";


//_addpoptabs = Whatever you want it to be!
//
example --- _addpoptabs = 10000;
			_newPoptabs = ExileClientPlayerMoney + _addpoptabs;
			ENIGMA_UpdateStats = [player,_newPoptabs];
			publicVariableServer "ENIGMA_UpdateStats";


//You can remove respect or poptabs simply by changing the plus to a minus!

 

 

 

Edited by happydayz
Update
  • Like 2

Share this post


Link to post
Share on other sites

Thank you for your fast reply and your upload. :D

Just as a thought why not execute the ExileServer_system_database_query_fireAndForget via a remote exec call ?

Haven't tested it but this could work:

//Add 1000 poptabs
_target = player;
_money = ExileClientPlayerMoney + 1000;
ExileClientPlayerMoney = ExileClientPlayerMoney + 1000;
_target setVariable['PLAYER_STATS_VAR',[_money,_target getVariable ['ExileScore', 0]],true];
format['setAccountMoney:%1:%2', _money, (getPlayerUID _target)] remoteExecCall ["ExileServer_system_database_query_fireAndForget",2,false];

 

Edited by Kellojo

Share this post


Link to post
Share on other sites
Advertisement

I'm sure most of the server admins out there use Infistar and with that you can add poptabs that save to the database or is this intended to be used with a script that rewards poptabs to a player for something?.

Edited by BetterDeadThanZed

Share this post


Link to post
Share on other sites

this is great learning stuff for me, thanks a lot =)

as for compatibility with the latest update you can check the old and current ExileServer_system_database_query_fireAndForget and see if there are any changes

Share this post


Link to post
Share on other sites

Added support for Advanced banking. Remove any old version of Enigma_exile_custom you have and install the new version (includes name change)

  • Like 1

Share this post


Link to post
Share on other sites
On 3/17/2016 at 9:41 AM, happydayz said:

Added support for Advanced banking. Remove any old version of Enigma_exile_custom you have and install the new version (includes name change)

Hello, when I use your example script my total money get's set to the amount that I want to be added. 

_addpoptabs = 10000;
_newPoptabs = ExileClientPlayerMoney + _addpoptabs;
ENIGMA_UpdateStats = [player,_newPoptabs];
publicVariableServer "ENIGMA_UpdateStats";

Instead of adding 10000 poptabs it sets my total amount to 10000. I'm trying to make a paycheck script but I'm kinda stuck.

Share this post


Link to post
Share on other sites
Guest

Hi, this script still working? Or someone can giveme a link with instructions or point me in correct direction to update poptabs with the easiest way?

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.