Jump to content

Function:spawnAllPlayers with Exceptions - War OF Empire -


laserlaser

Recommended Posts

Hello,this my new function.Really good,and easy.Something useful.

Ex use:

spawnAllPlayers(x,y,z,"Bikers","laserlaser") 
((( Here, it just does not respawn player "Bikers" and player "laserlaser" ))) 

spawnAllPlayers(x,y,z,[string playerNames ...]) 

The Function:

function spawnAllPlayer(x,y,z,...) 
    local ex = {...} 
    local players = getElementsByType("player") 
    local exPlayer = 0 
    for k,v in ipairs(players) do 
        exPlayer = 0 
        for a,c in ipairs(ex) do 
            if tostring(getPlayerName(v)) == tostring(c) then 
                exPlayer=1 
            end 
        end 
        if exPlayer ~=1 then 
            spawnPlayer(v,x,y,z) 
        end 
    end 
end 

- War Of Empire LUA Team -

Link to comment
could you please add all of these functions to the wiki instead of posing them here?

it will be MUCH better :)

you do realise that it is the same function with 2 loops that he exploits over and over and for any purpose (remove accounts, respawn cars, now players)?

honestly, i wouldnt want to see this kind of code on the wiki. dude doesnt even know about booleans.

Link to comment
better wiki than here.

putting this in useful functions (NOT in client/server function list as these aren't build-in functions) won't hurt so much

Better here than wiki or resources. The useful functions page contains what it says, a list of functions that are useful. This is just a simple snippet that 99.99% of scripters won't ever need, and if they do need it for whatever reason, it's so simple that they can probably do it by themselves.

No offense to the creator, it's nice of you sharing your scripts but maybe you should try and write stuff that are more general or that address very common problems.

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