Ricky Phelps Posted June 18, 2013 Share Posted June 18, 2013 I have this array at the top of my server script: hiddenSpawn = {1093, -358, 74, 0} and then I have function which is called in my onPlayerJoin hook: function startNewRound() roundStatus = 2 currentHidden = getRandomPlayer() setPlayerTeam(currentHidden, hiddenTeam) for loopIndex, playerID in ipairs(getElementsByType("player")) do if playerID == currentHidden then spawnPlayer(playerID, hiddenSpawn[0], hiddenSpawn[1], hiddenSpawn[2], hiddenSpawn[3], 0) addPedClothes(playerID, "glasses04dark", "glasses04", 15) addPedClothes(playerID, "croupier", "valet", 17) else local randomSpawn = math.random(#defenderSpawns) spawnPlayer(playerID, defenderSpawns[randomSpawn][0], defenderSpawns[randomSpawn][1], defenderSpawns[randomSpawn][2], defenderSpawns[randomSpawn][3], 179) setPlayerTeam(playerID, defenderTeam) end setCameraTarget(playerID) end end When I spawn, I'm getting the following warning: hidden\hidden_server.lua:54: Bad argument @ 'spawnPlayer' Line 54 is: spawnPlayer(playerID, hiddenSpawn[0], hiddenSpawn[1], hiddenSpawn[2], hiddenSpawn[3], 0) When I used outputChatBox on the values, they printed out fine but I got the same warning on outputChatBox. I also tried changing the values to 0 and it worked fine so it's a problem with the variables. I'm new to MTA, coming from another online GTA:SA modification, and I'm stuck on this little problem. I would appreciate it if somebody could guide me through this issue. Thanks, Ricky Phelps Link to comment
xXMADEXx Posted June 18, 2013 Share Posted June 18, 2013 Tables start with argument 1, not argument 0. spawnPlayer(playerID, hiddenSpawn[1], hiddenSpawn[2], hiddenSpawn[3], hiddenSpawn[4], 0) Link to comment
Moderators IIYAMA Posted June 19, 2013 Moderators Share Posted June 19, 2013 or when you wrote it a lot of times on your script. (like 10 times etc.) Also possible, but not recommended. hiddenSpawn = {[0]=1093, -358, 74, 0} Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now