It's not an excellent idea using the object "player", since that is already reserved for the current player.
PHP Code:
if(params[0]==jail)
{
... also won't work because jail should be "jail" with it being a string value.
... isn't really good practice, you should be using player.chat =.
PHP Code:
setlevel2 jail_darkrival2.nw,30,30;
... should be:
PHP Code:
setlevel2("jail_darkrival2.nw", 30, 30);
to be new engine scripting. The same applies for savelog2() and such.
Most of what's there is a mix of old gscript and new gscript, so you should iron those kinks out and work purely in new gscript.