Jump to content

help correct script


Kenix

Recommended Posts

Posted
  
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 :(

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted
  
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.

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

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... ?

Posted
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 ...

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

DakiLLa use your version of it better than others but still at times choose not to single player. :(

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

how can it return multiple players when it simply cant?

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

?

Posted
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 
  

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted
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

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

Next time use "EDIT" button, thanks.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...