Jump to content

42 bad argument createTeam


Alazam

Recommended Posts

hello i have a little probleme i have test to create a team and attribute to player when they connect

function loadMap(startedMap)

mapRoot = getResourceRootElement(startedMap)

end

addEventHandler("onGamemodeMapStart", getRootElement(), loadMap)

function joinHandler()

local spawn = getElementsByType("spawnpoint", mapRoot)

local x,y,z,r

for key, value in pairs(spawn) do

x = getElementData(value, "posX")

y = getElementData(value, "posY")

z = getElementData(value, "posZ")

r = getElementData(value, "rot")

end

spawnPlayer(source, x, y, z)

fadeCamera(source, true)

setCameraTarget(source, source)

outputChatBox("Connecter", source)

setPlayerTeam ( source, selection )

end

function teamselect ()

createTeam ( selection, 0, 0, 0 )

end

addEventHandler("onGamemodeMapStart", getRootElement(), teamselect)

Thank for help

Link to comment

And how ?

  
 function joinHandler() 
    local spawn = getElementsByType("spawnpoint", mapRoot) 
    local x,y,z,r 
    for key, value in pairs(spawn) do 
        x = getElementData(value, "posX") 
        y = getElementData(value, "posY") 
        z = getElementData(value, "posZ") 
        r = getElementData(value, "rot") 
end 
    spawnPlayer(source, x, y, z) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
    outputChatBox("Connecter", source) 
    setPlayerTeam ( source, selection ) 
end 
  
addEventHandler("onPlayerJoin", getRootElement(), joinHandler) 
  
  

normally with that all player who join go to the team created in

  
function teamselect () 
createTeam ( selection, 0, 0, 0 ) 
end 
addEventHandler("onGamemodeMapStart", getRootElement(), teamselect) 

no?

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