Author Topic: /healall help  (Read 3715 times)

Vortrex

  • Full Member
  • ***
  • Posts: 267
  • Karma: +54/-73
    • View Profile
Re: /healall help
« Reply #15 on: September 19, 2014, 07:43:00 pm »
You're not getting my point. Hell, even if you had a maximum of 50 players that could connect, you are still looking for players that aren't connected (unless the server is full).

128 was just an example number. It's actually the default amount unless you set it otherwise.

rwwpl

  • Full Member
  • ***
  • Posts: 126
  • Karma: +18/-6
  • LU-DM Team
    • View Profile
    • LU-DM Team
Re: /healall help
« Reply #16 on: September 20, 2014, 09:50:33 am »
I haven't used a for loop to get players in a long time. Is there a preceding "i" variable somewhere in your command script? The locals say you have two, one is NULL and the other is 1.

A bit off topic, but it might help:
Instead of looping through the maximum players, why don't you just create a table, and store all the players in that?

Here is what I use when scripting:
Code: [Select]
function onScriptLoad( )
{
Players <- { };
}

function onPlayerConnect( player )
{
Players[ player.ID ] <- player;
}

function onPlayerPart( player , reason )
{
Players[ player.ID ] <- null;
}

THEN, when you need to grab all the players and set health, you just loop through the table:
Code: [Select]
foreach( ii , iv in Players )
{
iv.Health = 100;
}

This code works ;) Thanks

 

© Liberty Unleashed Team.