Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-23-2010, 02:59 AM
iSlayer iSlayer is offline
Snk for manager
iSlayer's Avatar
Join Date: Feb 2010
Location: Room 7, Era Hotel, Era
Posts: 202
iSlayer will become famous soon enough
Creating a First Login

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
__________________
Snk for manager




Quote:
Originally Posted by Admins View Post
Snk for manager of Era

Last edited by iSlayer; 08-23-2010 at 03:13 AM..
Reply With Quote
  #2  
Old 08-23-2010, 03:03 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
function onPlayerOnline(). think there may be a function onPlayerLogin().
Reply With Quote
  #3  
Old 08-23-2010, 03:12 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You put the code in the Control-NPC:

PHP Code:
function onActionPlayerOnline() {
  
// Code here..

__________________
Quote:
Reply With Quote
  #4  
Old 08-23-2010, 03:14 AM
iSlayer iSlayer is offline
Snk for manager
iSlayer's Avatar
Join Date: Feb 2010
Location: Room 7, Era Hotel, Era
Posts: 202
iSlayer will become famous soon enough
And then it will work?
__________________
Snk for manager




Quote:
Originally Posted by Admins View Post
Snk for manager of Era
Reply With Quote
  #5  
Old 08-23-2010, 03:27 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Maybe onActionPlayerOnline, but as one scripter to another try first, if you fail then ask for help, not will it work then, I know I got a lot hell from people when I did that when I started scripting, ( my favorite teacher Inverness mostly. :P)
Reply With Quote
  #6  
Old 08-23-2010, 10:41 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by iSlayer View Post
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 =.
__________________
Skyld
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:47 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.