Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-28-2007, 04:24 AM
Ryyan Ryyan is offline
Is Graal dead yet?
Ryyan's Avatar
Join Date: Jul 2006
Location: USA
Posts: 37
Ryyan is on a distinguished road
Unhappy Kinda having trouble

Im trying to make a simple kick script.
You know... so only one account can use a specific command and kick someone from the level...

I.E.

I want it to be like /kick (account)
but the problem is i dont know how to make it kick the account i say.
Reply With Quote
  #2  
Old 10-28-2007, 09:17 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
If you just want to move them to another level, just use findPlayer(account).setlevel2(levelname.nw,x,y);

If you want to kick them off the server, the process is a bit more convoluted. You have to use triggerclient instead of setlevel2 to trigger a weapon the player has to use the serverwarp command to send them to Login1.
__________________
Reply With Quote
  #3  
Old 10-28-2007, 09:48 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
you'd substring it.

HTML Code:
function onActionServerside() {
  if (params[0] == "kick") {
    findPlayer(player.chat.substring(5).trim()).setlevel2("level.nw", x, y);
  }
}
//#CLIENTSIDE
function onPlayerChats() {
  if (player.chat.starts(":kick")) {
    triggerserver("weapon", this.name, "kick");
  }
}
So, first we check if the player is saying ':kick', if yes it will look for the player that is stated after the ':kick' command. Here's an example:
':kick xAndrewx', would kick me.
__________________

Last edited by xAndrewx; 10-28-2007 at 11:19 PM..
Reply With Quote
  #4  
Old 10-28-2007, 10:35 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Googi View Post
If you just want to move them to another level, just use findPlayer(account).setlevel2(levelname.nw,x,y);

If you want to kick them off the server, the process is a bit more convoluted. You have to use triggerclient instead of setlevel2 to trigger a weapon the player has to use the serverwarp command to send them to Login1.
Easier:

PHP Code:
function onActionServerSide() {
 
with(findplayer(params[0)) {
  
serverwarp("Login");
 }
}
//#CLIENTSIDE
function onPlayerChats() {
 if (
player.chat.starts("/disconnect")) {
  
triggerserver("gui",this.name,player.chat.substring(12).trim());
 }

__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #5  
Old 10-28-2007, 11:13 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
serverwarp isn't serverside !!!!
__________________
Reply With Quote
  #6  
Old 10-29-2007, 12:07 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by xAndrewx View Post
serverwarp isn't serverside !!!!
Yea, the NPC-Server isn't supposed to go anywhere
__________________
Reply With Quote
  #7  
Old 11-02-2007, 02:36 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
add this like a weapon

PHP Code:
function onActionServerSide()
{

  if ( 
params0] == "Kick")
    
findPlayerparams1]).setLevel2"onlinestartlocal.nw"3232);

  else if ( 
params0] == "DC")
  {

    
withfindPlayerparams1]))
    {

      
triggerclient"gui"this.name"DC"params1]);
    }
  }  
}

//#CLIENTSIDE
function onPlayerChatschat
{

  if ( 
chat.starts"/kick"))
    
triggerserver"gui"this.name"Kick"player.chat.substring(6).trim()); 

  else if ( 
chat.starts"/dc"))
    
triggerserver"gui"this.name"DC"player.chat.substring(4).trim()); 

}

function 
onActionClientSide() 
{

  if ( 
params0] == "DC"
  {

    
serverWarp"Login1");
  }

Commands:
/kick account
/dc account

Examples:
/kick Angel_Light
/dc Angel_Light
__________________
Deep into the Darkness peering...
Reply With Quote
  #8  
Old 11-03-2007, 01:49 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
What I've always found as the best way to do it is have a weapon that goes like this:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
serverwarp("login");
  
destroy();

And then in the DC command just add that weapon to the player that needs to be disconnected.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #9  
Old 11-14-2007, 03:08 AM
Kyranki Kyranki is offline
Freelance Coder
Join Date: Aug 2007
Location: At the end of the rainbow, in the pot of gold.
Posts: 202
Kyranki is on a distinguished road
Send a message via AIM to Kyranki Send a message via MSN to Kyranki
You're all extremely overcomplicating the process save for Andrew. There's no need for these really advanced examples or things to disconnect players. Could you be more specific in what sort of kicking you're in need of?
__________________
Stan.
Reply With Quote
  #10  
Old 02-07-2008, 09:31 PM
pokeSMOT pokeSMOT is offline
Registered User
Join Date: Jun 2006
Posts: 35
pokeSMOT is on a distinguished road
Andrew, your script helped out. Thx ^_^
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 08:53 PM.


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