SphereCommunity
random 1 player in region - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: General Help (/Forum-General-Help)
+--- Thread: random 1 player in region (/Thread-random-1-player-in-region)

Pages: 1 2


RE: random 1 player in region - Skul - 09-03-2012 10:32 AM

(08-30-2012 08:46 PM)Alias Wrote:  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 ?

Looks like you mentioned you wanted to parse f_luckyplayer on 1 'random' player in the region, that's why I coded that above script for you.

Oh damn, I see, I'm running the script over and over... should use vars and erase, oh well. TAGs will clutter your spheredata.scp. Here, try this one out:
Code:
[function luckyplayer]
region.allchars f_luckyplayer_choose_rnd
if (<var0.luckyplayers>)
  local.player=<eval {1 <var0.luckyplayers>}>
  local.player=<var0.luckyplayer.<dlocal.player>>
  uid.<local.player>.f_luckplayer //this will give f_luckyplayer to a random player in the region
  for x 1 <var0.luckyplayers>
    var.luckyplayer.<dlocal.x>=
  endfor
  var.luckyplayers=
endif

[function f_luckyplayer_choose_rnd]
if (<isplayer>)
  var0.luckyplayers += 1
  var.luckyplayer.<dvar0.luckyplayers>=<uid>
endif



RE: random 1 player in region - Ben - 09-03-2012 10:46 AM

Thats why I used the CLEARTAGS function Wink