Backsage Posted August 9, 2015 Share Posted August 9, 2015 Hi again. Need a little help. When the mission timer expires, it's supposed to warp me, but it doesn't. I get the errors: [2015-08-09 00:20:58] ERROR: Loading script failed: tdm-panel\server.lua:362: '=' expected near 'local' [2015-08-09 00:21:37] ERROR: Client (Backsage) triggered serverside event onTimerExpired, but event is not added serverside [2015-08-09 00:21:37] ERROR: Client (Backsage) triggered serverside event onTimerExpired2, but event is not added serverside And when I die, I get these errors: [2015-08-09 00:21:46] ERROR: Client (Backsage) triggered serverside event onRound5Player2Killed, but event is not added serverside [2015-08-09 00:21:46] ERROR: Client (Backsage) triggered serverside event onRound5Player1Killed, but event is not added serverside The round5spawnplayer and round5spawnplayer2 are supposed to warp me to a position specified in the table cor, but it doesn't because I get those errors. It seems I don't get those errors when I comment out those functions and the whole script works perfectly again. But now I want it to warp me when I die. Client side: function onTimeElapsed1() destroyElement(timeBeforeRoundStartsTimer) triggerServerEvent("onTimerExpired", getLocalPlayer(), cor[1][1], cor[1][2], cor[1][3], cor[2][1], cor[2][2], cor[2][3], player, player2) triggerServerEvent("onTimerExpired2", getLocalPlayer(), cor[1][1], cor[1][2], cor[1][3], cor[2][1], cor[2][2], cor[2][3], teamplayers, teamplayers2) end addEventHandler ( "onClientMissionTimerElapsed", root, onTimeElapsed1 ) function round5() for k, v in ipairs(colshape) do for k, v1 in ipairs (teamplayers) do for k, v2 in ipairs (teamplayers2) do if (isElementWithinColShape(v2, v) and isElementWithinColShape(v1, v)) then playerInCol = true if (TimeLimitPersonWithTheMostRepawnsLoses == true) then if (getElementHealth(v2) == 0) then removeEventHandler("onClientRender", root, function() round5player2text(text1) end) PlayerTeam2CurrentRespawns = PlayerTeam2CurrentRespawns + 1 --triggerServerEvent("onRound5Player2Killed", getLocalPlayer(), PlayerTeam2CurrentRespawns) triggerServerEvent("onRound5Player2Killed", getLocalPlayer(), player2) elseif (getElementHealth(v1) == 0) then removeEventHandler("onClientRender", root, function() round5player1text(text1) end) PlayerTeam1CurrentRespawns = PlayerTeam1CurrentRespawns + 1 --triggerServerEvent("onRound5Player1Killed", getLocalPlayer(), PlayerTeam1CurrentRespawns) triggerServerEvent("onRound5Player1Killed", getLocalPlayer(), player) end end end end end end end addEventHandler("onClientPlayerWasted", root, round5) Server side: function playerwarp(x, y, z, x2, y2, z2, player, player2) setElementPosition(player, x, y, z) setElementPosition(player2, x2, y2, z2) end function playerwarp2(x, y, z, x2, y2, z2, tplayers, tplayers2) for k, v in ipairs (tplayers) do setElementPosition(v, x, y, z) end for k, v in ipairs (tplayers2) do setElementPosition(v, x2, y2, z2) end end addEvent("onTimerExpired", true) addEventHandler("onTimerExpired", root, playerwarp) addEvent("onTimerExpired2", true) addEventHandler("onTimerExpired2", root, playerwarp2) function round5spawnplayer(player2, teamplayers2, cor) local plrSkin = getElementModel(player2) local plrSkin2 = getElementModel(teamplayers2) plr local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if player2 then setTimer( spawnPlayer, 2000, 1, player2, x, y, z, 0, plrSkin, 0, 1) elseif teamplayers2 then setTimer( spawnPlayer, 2000, 1, teamplayers, x, y, z, 0, plrSkin2, 0, 1) end end addEvent("onRound5Player2Killed", true) addEventHandler("onRound5Player2Killed", root, round5spawnplayer) function round5spawnplayer2(player, teamplayers, cor) local plrSkin = getElementModel(player) local plrSkin2 = getElementModel(teamplayers) local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if player then setTimer( spawnPlayer, 2000, 1, player, x, y, z, 0, plrSkin, 0, 1) elseif teamplayers then setTimer( spawnPlayer, 2000, 1, teamplayers, x, y, z, 0, plrSkin2, 0, 1) end end addEvent("onRound5Player1Killed", true) addEventHandler("onRound5Player1Killed", root, round5spawnplayer2) I don't understand why I'm getting these errors when the events are already added server side. EDIT: I found out why I was getting those errors But now I have a new error. [2015-08-09 00:34:10] WARNING: tdm-panel\server.lua:360: Bad argument @ 'getElementModel' [Expected element at argument 1, got number '0'] [2015-08-09 00:34:10] ERROR: tdm-panel\server.lua:362: attempt to get length of local 'cor' (a nil value) [2015-08-09 00:34:10] WARNING: tdm-panel\server.lua:375: Bad argument @ 'getElementModel' [Expected element at argument 1, got number '0'] [2015-08-09 00:34:10] ERROR: tdm-panel\server.lua:377: attempt to get length of local 'cor' (a nil value) EDIT: All bugs fixed. Everything working perfectly. Thank you! Link to comment
DNL291 Posted August 9, 2015 Share Posted August 9, 2015 The first or the second argument of the function 'round5spawnplayer' and 'round5spawnplayer2' is returning 0. And cor is not returning a table for some reason. Link to comment
Backsage Posted August 9, 2015 Author Share Posted August 9, 2015 The first or the second argument of the function 'round5spawnplayer' and 'round5spawnplayer2' is returning 0.And cor is not returning a table for some reason. Yeah, I don't know why I'm getting those errors. It still works, so it's obviously getting the coordinates from the cor table. But thanks for your help anyway. EDIT: Not working again. It works for players, but not for players in teams. Client side: function round5() if (getElementDimension(player) == 1 and getElementDimension(player2) == 1) then if (TimeLimitPersonWithTheMostRepawnsLoses == true) then if (getElementHealth(player2) == 0) then PlayerTeam2CurrentRespawns = PlayerTeam2CurrentRespawns + 1 triggerServerEvent("onRound5Player2Killed", getLocalPlayer(), player2, cor) elseif (getElementHealth(player) == 0) then PlayerTeam1CurrentRespawns = PlayerTeam1CurrentRespawns + 1 triggerServerEvent("onRound5Player1Killed", getLocalPlayer(), player, cor) end end for k, v1 in ipairs (teamplayers) do for k, v2 in ipairs (teamplayers2) do if (getElementDimension(v2) == 1 and getElementDimension(v1) == 1) then if (TimeLimitPersonWithTheMostRepawnsLoses == true) then if (getElementHealth(v2) == 0) then PlayerTeam2CurrentRespawns = PlayerTeam2CurrentRespawns + 1 triggerServerEvent("onRound5Team2Killed", getLocalPlayer(), teamplayers2, cor) elseif (getElementHealth(v1) == 0) then PlayerTeam1CurrentRespawns = PlayerTeam1CurrentRespawns + 1 triggerServerEvent("onRound5Team1Killed", getLocalPlayer(), teamplayers, cor) end end end end end end end addEventHandler("onClientPlayerWasted", root, round5) Server side: function round5spawnplayer(player2, cor) local plrSkin = getElementModel(player2) local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if player2 then setTimer( spawnPlayer, 2000, 1, player2, x, y, z, 0, plrSkin, 0, 1) end end addEvent("onRound5Player2Killed", true) addEventHandler("onRound5Player2Killed", root, round5spawnplayer) function round5spawnplayer2(player, cor) local plrSkin = getElementModel(player) local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if player then setTimer( spawnPlayer, 2000, 1, player, x, y, z, 0, plrSkin, 0, 1) end end addEvent("onRound5Player1Killed", true) addEventHandler("onRound5Player1Killed", root, round5spawnplayer2) function round5spawnplayer3(teamplayers2, cor) for k, vskin in ipairs (teamplayers2) do local plrSkin2 = getElementModel(vskin) end local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if teamplayers2 then for k, v in ipairs (teamplayers2) do setTimer( spawnPlayer, 2000, 1, v, x, y, z, 0, plrSkin2, 0, 1) end end end addEvent("onRound5Team2Killed", true) addEventHandler("onRound5Team2Killed", root, round5spawnplayer3) function round5spawnplayer4(teamplayers, cor) for k, vskin in ipairs (teamplayers) do local plrSkin2 = getElementModel(vskin) end local rndTeleport = math.random(1, #cor) local x, y, z = cor[rndTeleport][1], cor[rndTeleport][2], cor[rndTeleport][3] if teamplayers then for k, v in ipairs (teamplayers) do setTimer( spawnPlayer, 2000, 1, v, x, y, z, 0, plrSkin2, 0, 1) end end end addEvent("onRound5Team1Killed", true) addEventHandler("onRound5Team1Killed", root, round5spawnplayer4) Edit: fixed by making the functions seperate. function round5() if (getElementDimension(player) == 1 and getElementDimension(player2) == 1) then if (TimeLimitPersonWithTheMostRepawnsLoses == true) then if (getElementHealth(player2) == 0) then PlayerTeam2CurrentRespawns = PlayerTeam2CurrentRespawns + 1 triggerServerEvent("onRound5Player2Killed", getLocalPlayer(), player2, cor) elseif (getElementHealth(player) == 0) then PlayerTeam1CurrentRespawns = PlayerTeam1CurrentRespawns + 1 triggerServerEvent("onRound5Player1Killed", getLocalPlayer(), player, cor) end end end end addEventHandler("onClientPlayerWasted", root, round5) function round5teams() for k, v1 in ipairs (teamplayers) do for k, v2 in ipairs (teamplayers2) do if (getElementDimension(v2) == 1 and getElementDimension(v1) == 1) then if (TimeLimitPersonWithTheMostRepawnsLoses == true) then if (getElementHealth(v2) == 0) then PlayerTeam2CurrentRespawns = PlayerTeam2CurrentRespawns + 1 triggerServerEvent("onRound5Team2Killed", getLocalPlayer(), teamplayers2, cor) elseif (getElementHealth(v1) == 0) then PlayerTeam1CurrentRespawns = PlayerTeam1CurrentRespawns + 1 triggerServerEvent("onRound5Team1Killed", getLocalPlayer(), teamplayers, cor) end end end end end end addEventHandler("onClientPlayerWasted", root, round5teams) 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