Hello again. I am trying to come to grips with MTA's script handling/event handling system. Well, I made a simple script to play around with and whenever a portion of it runs, I get the following errors(Note: It works fine when joining.):
The script:
-- Learning MTA's script system
function playerSpawnAt(x, y, z)
outputChatBox("Calling: playerSpawnAt("..x..", "..y..", "..z..")", source)
spawnPlayer(source, x, y, z)
setCameraTarget(source, source)
fadeCamera(source, true)
end
function doOnJoin()
outputChatBox("Calling: doOnJoin()", source)
playerSpawnAt(2031, -1405, 17.4)
end
function doOnDeath()
outputChatBox("Calling: doOnDeath()", source)
setTimer(playerSpawnAt, 2000, 1, 2031, -1405, 17.4)
end
addEventHandler("onPlayerJoin", getRootElement(), doOnJoin)
addEventHandler("onPlayerWasted", getRootElement(), doOnDeath)
Any ideas? Would be awesome if someone can explain to me the why's & how's.