Also, you can't do...
PHP Code:
function onCreated() {
if (playerdead) // yada yaa
}
That was a GS1 event, in GS2 it's a null temp variable and won't work that way. Also, setlevel2() is used wrong as well. The first parameters for the function should be the level name and then the x and y to place the player at. It also needs to be serverside. I would suggest reading the wiki to try and find a few good tutorials on scripting as well as trying to findout which functions and things are serverside only as such.