Jump to content

Simple script probleme bad argument


Alazam

Recommended Posts

Hello i have a little problem i want to create a team when the ressource start and all player who join the server go in this team

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("Connected", source) 
setPlayerTeam ( source, team ) 
end 

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

Please i need some help :mrgreen:

Link to comment

You mean something like this ?

local team = createTeam("team", 0, 0, 0) 
  
function Jointeam(player) 
            setPlayerTeam(player, team 
            outputChatBox("Connected", player, 0, 0, 0, true) 
        end 
    end 
addEventHandler("onPlayerJoin", getRootElement(), jointeam) 

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