The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
random 1 player in region
Author Message
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #1
random 1 player in region
Hi Bye i have problem, how to choose 1 player random in region and give this funtion f_luckyplayer to player who was randomy choosed ?
(This post was last modified: 08-30-2012 08:46 PM by Alias.)
08-30-2012 08:46 PM
Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #2
RE: random 1 player in region
Code:
[function luckyplayer]
region.allchars luckyplayer_choose_rnd

[function luckyplayer_choose_rnd]
if (<isplayer>)
  local.players += 1
  local.player.<dlocal.players>=<uid>
endif
if (<local.players>)
  local.player=<eval {1 <local.players>}>
  local.player=<local.player.<dlocal.player>>
  uid.<local.player>.f_luckyplayer //gives f_luckyplayer to random player.
endif
Add this code to your script and type .luckyplayer

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
08-31-2012 05:21 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #3
RE: random 1 player in region
Ok tyvm Smile
08-31-2012 06:36 AM
Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #4
RE: random 1 player in region
Now i test it, and it give's this funtion to all players in region ... Maybe becouse i am using it throw the stone ? Here how i did ...
[function f_start_round]
OBJ=04000ddfd
obj.timerf 5,f_luckyplayer
08-31-2012 07:35 PM
Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #5
RE: random 1 player in region
sorry for triple posting, but still need help with this funtion Confused
09-02-2012 05:02 AM
Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #6
RE: random 1 player in region
use:
Code:
obj.luckyplayer

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
09-02-2012 05:03 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #7
RE: random 1 player in region
Funtion it self give to all region players f_luckyplayer
Its not giving only 1 player Confused
(This post was last modified: 09-02-2012 05:26 AM by Alias.)
09-02-2012 05:26 AM
Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #8
RE: random 1 player in region
Sorry for double post but i really need this funtion to work, to end my event ;S
(This post was last modified: 09-02-2012 09:00 PM by Alias.)
09-02-2012 08:59 PM
Find all posts by this user Like Post Quote this message in a reply
Ben
Sphere Developer
*****

Posts: 612
Likes Given: 2
Likes Received: 123 in 70 posts
Joined: Mar 2010
Reputation: 18

SphereCommunity

Post: #9
RE: random 1 player in region
The problem with the function is that it fires on every character in the region and it uses local variables to gather information... Skul, you should know better lol Tongue

This is untested and I'm sure it can be done in a better way, but I just wrote it on the fly hoping it solves your problem right away Smile

Code:
[function luckyplayer]
region.allclients luckyplayer_choose_rnd
if (<region.tag0.luckyplayers>)
  local.player=<eval {1 <region.tag0.luckyplayers>}>
  local.player=<region.tag0.luckyplayer.<dlocal.player>>
  uid.<local.player>.f_luckyplayer
endif
region.cleartags luckyplayers

[function luckyplayer_choose_rnd]
region.tag0.luckyplayers += 1
region.tag.luckyplayer.<dregion.tag0.luckyplayers>=<uid>

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
09-02-2012 11:42 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #10
RE: random 1 player in region
Tyvm Ben this is working perfecly Smile, and tyvm Skul you too Smile
09-03-2012 01:17 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)