Jump to content

help correct script


Kenix

Recommended Posts

  
selectTimer = setTimer(function() zombieturn(getRandomPlayer(source)) end, 20000, 1) 
  

c the first 2 times did not wheel and the 3 is already running when running the rules and when not in what could be the problem? that can block it.

help please :(

Link to comment
  
function playerzmtake () 
       
       
      local array = {} 
     for i,pl in ipairs(getElementsByType("player")) do 
          array[i]=pl 
     end 
     if #array>0 then 
               local c = math.random(1,#array) 
    end 
end 
  

now I still have the code but it also works = (

help please.

Link to comment

I don't know why the first example does not work for you, it should be ok if there is a 'zombieturn' function that should recieve a player element as it's parameter. Btw, there are no any parameters in getRandomPlayer function, so the 'source' you passed there is useless.

And what about the second example.. I guess it does not work because your function does return nothing, so that could be a problem, may be you forgot to put 'return c' ? Btw, you can replace it with just one-line function:

function getRndPlayer() 
  return getElementsByType( "player" )[math.random( 1, #getElementsByType( "player" ) )]; 
end; 

But eh, what actually do you want to do, can you explain it lil bit better... ?

Link to comment
I don't know why the first example does not work for you, it should be ok if there is a 'zombieturn' function that should recieve a player element as it's parameter. Btw, there are no any parameters in getRandomPlayer function, so the 'source' you passed there is useless.

And what about the second example.. I guess it does not work because your function does return nothing, so that could be a problem, may be you forgot to put 'return c' ? Btw, you can replace it with just one-line function:

function getRndPlayer() 
  return getElementsByType( "player" )[math.random( 1, #getElementsByType( "player" ) )]; 
end; 

But eh, what actually do you want to do, can you explain it lil bit better... ?

I would like to select any player and he did call 'zombieturn' function of just one.

at the expense of getRandomPlayer I only used here to see prices ...

Link to comment
how can it return multiple players when it simply cant?

check other parts of your script, maybe you're calling it twice.

Yes you are right, I found the problem on my bad it kills the timer after the completion of maps :D

  
if isTimer(selectTimer) then killTimer(selectTimer) end 
  

Link to comment
how can it return multiple players when it simply cant?

check other parts of your script, maybe you're calling it twice.

Yes you are right, I found the problem on my bad it kills the timer after the completion of maps :D

  
if isTimer(selectTimer) then killTimer(selectTimer) end 
  

i fixed Thank all very much. :D

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...