Quote:
Originally Posted by iSlayer
Well I posted a thread a while back about function firstLogin(pl) but i was told that theres no inbuilt command for it so I made this script
PHP Code:
function onPlayerOnline() { if(clientr.firstlogin = true) { clientr.firstlogin = false; // Adds all the default flags } else { destroy(); } }
Will this work correctly? And if not how can i improve it
|
Firstly,
clientr.firstlogin will not be true unless you set it, because like
firstLogin(), it isn't a built-in object.
Secondly, there is reverse logic here. Because flags are unset by default, you should be checking that a flag isn't set and then set it once you have added all the default flags.
Thirdly, do not use
destroy(), because if you put that in your Control-NPC (or any other database NPC), the NPC will destroy itself from the server every time your flag is not met. You don't need an
else condition; don't put it there if you don't need it.
And finally, you
compare flags using == and you
assign flags using =.