Jump to content
Sign in to follow this  
unidad2pete

multiplayer money system

Recommended Posts

Hi;

I want to create a AddEventHandler for add to killer 100 points to variable "mymoney" only for killer.

in init.sqf:

mymoney = 0;
player addMPEventHandler ["MPKilled",{ _this select 1 exec "killed.sqf"}];

in killed.sqf

mymoney = mymoney + 100;

The result is 100 for killer and victim, apparently, killer and victim call killed.sqf and each adds 100 points. My intention was that only the killer call killed.sqf

If I call killed.sqf with another action only with the killer, this add 100 correctly and only for killer.

As I can do?

Edited by unidad2pete

Share this post


Link to post
Share on other sites

You have to make sure that the script only runs on the killers machine dude.

player addMPEventHandler ["MPKilled",{

_killer = _this select 1;

	if (_killer == player) then {
	 	_killer execVM "killed.sqf";
		};
}
];

alt:

player addMPEventHandler ["MPKilled",{

_killer = _this select 1;

	if (_killer == player) then {
	 	mymoney = mymoney + 100;
		};
}
];

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×