Jump to content
  • 0

check if map contains player


oblinez

Question


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   1
  • Joined:  02/23/14
  • Last Seen:  

hello guys, I'm trying to make a condition to check if there is a player on the map, but the condition enters an infinite loop, I need the NPC to show a waitingroom if there is a player on the map and another if there is no player on the map, but it has to be in real time

 

do{waitingroom "PvP in progress",0;}while(getareausers("force_4-1",86,113,113,86) > 0)

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  924
  • Reputation:   167
  • Joined:  04/05/13
  • Last Seen:  

delwaitingroom and create new waitingroom msg when player enter the maps by script.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.01
  • Content Count:  81
  • Reputation:   17
  • Joined:  07/18/16
  • Last Seen:  

while(1) {
    waitingroom "Status: "+( (getmapusers(.yourmap$) == 0)?"No Player":"Having Player"),0;
    sleep 1000;
    delwaitingroom;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

OnInit:
OnTimer1000:
	initnpctimer;
	delwaitingroom;
	waitingroom "Status: "+( (getmapusers(.yourmap$) == 0)?"No Player":"Having Player"),0;
	end;

avoid using those infinite while(1) tricks... its not resource friendly...

Link to comment
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
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

×
×
  • Create New...