google-site-verification: googlebaca44933768a824.html Lua ZOMFG!!1 (not related to hax) - Old Royal Hack Forum

Announcement

Collapse
No announcement yet.

Lua ZOMFG!!1 (not related to hax)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Lua ZOMFG!!1 (not related to hax)

    trying to convert from SourcePawn to Lua, and I just can't get it right. if you know Lua and is willing to help, I'd appreciate it.

    Code:
    public get_playercount(bool:zombie = true)
    {
    	new num
    	
    	for(new x = 1; x <= MaxClients; x++)
    		if(zombie && global[x] || !zombie && !global[x])
    			num++
    			
    	return num
    }
    Code:
    function get_playercount(zombie = true) -- I am right?
    	local num
    	
    	for k, v in pairs(player.GetAll()) do
    		if zombie == nil and .. or zombie != nil and ... then -- yes, I have no clue of how to handle global variables on Lua so .. means global[v] and ... means !global[v]
    			num = num + 1 -- ok, Lua math is also weird as fuck. why can't I simply do num++ or even num += 1?
    		end
    	end
    
    	return num
    end
Working...
X