Sign in to follow this  
Followers 0

ExileMoney & ExileScore

2 posts in this topic

Hey guys.

I'm currently trying to modify a script.

I want to give the player money + respect for killing AI.

I know there are already missions that do that and i have read the scripts, but i still got a problem.

This is my current code that runs on creating the unit:

_unit addMPEventHandler ["MPKilled",
	//_victim = _this select 0;
	_killer = _this select 1;
	_playerObj = _killer;

	if ((!isNull _playerObj) && {((getPlayerUID _playerObj) != "") && {_playerObj isKindOf "Exile_Unit_Player"}}) then
		_money = _playerObj getVariable ["ExileMoney", 0];
		_respect = _playerObj getVariable ["ExileScore", 0];
		_moneyChange = 5;
		_repChange = 1;

		if ((_moneyChange!=0) || (_repChange!=0)) then
			if (_moneyChange!=0) then
				private ["_msgType", "_msgParams"];
				_money = (_money + _moneyChange) max 0;
				_playerObj setVariable ["ExileMoney",_money];
				_msgType = "moneyReceivedRequest";
				_msgParams = [str _money, "killing AI"];
				[_playerObj, _msgType, _msgParams] call ExileServer_system_network_send_to;

			if (_repChange!=0) then
				_respect = _respect + _repChange;
				_playerObj setVariable ["ExileScore",_respect];
				// [_playerObj, "showFragRequest", [ [["AI KILL",_repChange]] ] ] call ExileServer_system_network_send_to;
				ExileClientPlayerScore = _respect;
				(owner _playerObj) publicVariableClient "ExileClientPlayerScore";
				ExileClientPlayerScore = nil;
			format["setAccountMoneyAndRespect:%1:%2:%3", _money, _respect, (getPlayerUID _playerObj)] call ExileServer_system_database_query_fireAndForget;

 Its working fine, its giving money and respect to the player who kills the AI.

The problem is, all other players on the server are getting the respect set to "any".

The respect from all other players is not realy changed, the database is normal.

But when they open the XM8, the respect is "any".

That problem is only for respect. Money is not getting bugged.

Is there maybe someone here who finds the problem in my code? :/


Sorry for my bad english, i hope its not to hard to understand.

Edited by Backslash

Share this post

Link to post
Share on other sites

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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.