Jump to content
Sign in to follow this  
ADELIJAH

player count

Recommended Posts

Does anyone have the code that counts the number of players inside the maze? I know there's one on the forum, but over time it gives the bug "FUCNCTION. LUA STACK OVERFLOW in the code lines" the V3ctor one that is only used in the after enter functions and before_leave seems promising because it only works when someone enters or leaves, unlike map_copy_run which updates all the time, but it doesn't work

resource/abandonedcity\ctrl.lua:48: )' expected near º'

SetPortalName("<darkswamp>", string.format("%d player(s) inside", GetMapActivePlayer(GetChaMapCopу(role)) - 1))

Share this post


Link to post
Share on other sites

Hello @ADELIJAH,

 

1) Count players in after_enter_<map>() and before_leave_<map>() functions;

2) Use the GetMapActivePlayer() function (garner2 map);

3) Use the DealAllActivePlayerInMap() function and write a custom script for the function to count players. 

 

Try this script for resource\abandonedcity\ctrl.lua:

function after_enter_abandonedcity(role, map_copy)
	SetPortalName("<darkswamp>", GetMapActivePlayer(map_copy) + 1 .. " player(s) inside")  
end

function before_leave_abandonedcity(role)
	SetPortalName("<darkswamp>", GetMapActivePlayer(GetChaMapCopу(role)) - 1 .. " player(s) inside")  
end

 

 


Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...