Jump to content
offbtdrummr

How to make a point system

Recommended Posts

I need a way to make a point system per player. 

I.E.:

 

A sniper gets a kill, he gets 1 point. He can use the point to obtain better gear, removing the point.

 

What is the best way to do this?

 

Another idea was to create a system that gives you a point when you die, but your points are shared by the team. 

 

Share this post


Link to post
Share on other sites

I don't know which the best way is, but there's actually two pretty simple ways that come to my mind right away:
 
1.) setVariable on the player
2.) broadcast kills to the server
 
Either way, you need to setup a "Killed" and "Respawn" event handler:
 

Example with "setVariable" (untested):

fnc_eh_killed =
{
	_killer = _this select 1;
	[{player setVariable ["kills", (player getVariable "kills") + 1];}, "BIS_fnc_call", _killer, false, true] call BIS_fnc_MP;
	//Sending code through the network is discouraged,
	//better put it in a function and invoke that through BIS_fnc_MP.
};

fnc_eh_respawn =
{
	player setVariable ["kills", 0];

	systemChat "adding Killed EH";
	player addEventHandler ["Killed", fnc_eh_killed];
};

player setVariable ["kills", 0];
systemChat "adding Respawn EH";
player addEventHandler ["Respawn", fnc_eh_respawn];
systemChat "adding Killed EH";
player addEventHandler ["Killed", fnc_eh_killed];

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

×