Kellojo

Remove X Poptabs with function?

6 posts in this topic

Hey Exile Community,

Im currently working on a script for exile and im stuck. 

As seen in the title I want/need a function that is able to remove 200 poptabs from player x for example. I know there has to be a function to do this but I am unable to find it...

Some hints would be nice.

 

PS: Thanks to everyone who is going to help me :D

Kind regards

Kellojo

Edited by Kellojo

Share this post


Link to post
Share on other sites
ExileClientPlayerMoney = ExileClientPlayerMoney - 200;

 

1 person likes this

Share this post


Link to post
Share on other sites
Advertisement

@CEN Thank you very much :)

Edit:

Tested it on a test server and it did not work... 

Code used:

player addAction ["Add me some Pop tabs... (random number)", {ExileClientPlayerMoney = ExileClientPlayerMoney + (round random 1000);}];

 

Edited by Kellojo

Share this post


Link to post
Share on other sites

#push

I tryed this sor far without any success:

//Method 1
player addAction ["Add me some Pop tabs... (random number)", {ExileClientPlayerMoney = ExileClientPlayerMoney + (round random 1000);}];

//Method 2
player addAction ["Add 500 pop tabs", {playerMoney = playerMoney + 500;}];


//Method 3
FNC_ETG_AddMoney = {
	_currentAccountBalance = player getVariable ["ExileMoney", 0];
	_currentAccountBalance = _currentAccountBalance + 1000;
	player setVariable ["ExileMoney", _currentAccountBalance];
	format["setAccountMoney:%1:%2", _currentAccountBalance, getPlayerUID player] call ExileServer_system_database_query_fireAndForget;
};

player addAction ["Add 1000 pop tabs", {[] call FNC_ETG_AddMoney;}];
FNC_Money = {
	_target = player;
	_value = 1000;
	_playerMoney = _target getVariable ['ExileMoney', 0];
	_newMoney = _playerMoney + _value;
	_target setVariable ['ExileMoney', _newMoney];
	_target setVariable['PLAYER_STATS_VAR',[_newMoney,_target getVariable ['ExileScore', 0]],true];
	format['setAccountMoney:%1:%2', _newMoney, (getPlayerUID _target)] call ExileServer_system_database_query_fireAndForget;
};

player addAction [ "Add 1000 poptabs", {[] call FNC_Money;} ];

Tryed this aswell... no luck

Edited by Kellojo
new method tryed...

Share this post


Link to post
Share on other sites

I'm not home ATM so can't post it but you can't update pop tabs this way. You need to get the exile money variable for the player and then update that. The problem is it's inline local so if u don't buy or sell something it won't update the database. I wrote my own server side addon that uses exile code to update pop tabs to database when the value is passed to it. I will try to remember to upload when I get home. Will ask devs to maybe add a few common functions to the server files for things like msgs respect and pop tabs so you can pass info to them from client scripts. 

1 person likes this

Share this post


Link to post
Share on other sites

Ok so this is how exile gets respect/poptabs of the player and then updates it. Now this will work fine executed client side EXCEPT that the "Call ExileServer_system_database_query_fireAndForget cannot be called by the player and that is the crucial line... it updates the database with the new amount of poptabs/respect. This means that the player will see their respect/poptabs increase by the amount 10k in this example, BUT it wont be saved. so if they log off/server restarts... the amount is reset to the old amount. 

So this is how it gets updated:

			_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;

 

 

I have Created a new Topic here --- http://www.exilemod.com/topic/7577-update-respectpoptabs-and-save-to-database/

 

This expains how to use my addon and where to get it from.

Or go straight to the source ---- https://github.com/happydayz-enigma/Enigma_Exile_Custom

Goodluck :)

 

Edited by happydayz
1 person likes this

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.