Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Kinda having trouble (https://forums.graalonline.com/forums/showthread.php?t=77344)

Ryyan 10-28-2007 04:24 AM

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.

Googi 10-28-2007 09:17 AM

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.

xAndrewx 10-28-2007 09:48 AM

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.

Switch 10-28-2007 10:35 PM

Quote:

Originally Posted by Googi (Post 1355042)
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());
 }



xAndrewx 10-28-2007 11:13 PM

serverwarp isn't serverside !!!! :(

Inverness 10-29-2007 12:07 AM

Quote:

Originally Posted by xAndrewx (Post 1355162)
serverwarp isn't serverside !!!! :(

Yea, the NPC-Server isn't supposed to go anywhere :D

Angel_Light 11-02-2007 02:36 PM

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

coreys 11-03-2007 01:49 AM

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.

Kyranki 11-14-2007 03:08 AM

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?

pokeSMOT 02-07-2008 09:31 PM

Andrew, your script helped out. Thx ^_^


All times are GMT +2. The time now is 07:29 PM.

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