Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   serverwarp() doesn't work serverside (https://forums.graalonline.com/forums/showthread.php?t=81234)

Switch 08-15-2008 01:26 AM

serverwarp() doesn't work serverside
 
So I was testing some stuff on jothegreat55555's server, and I tried to make a relog/disconnector (to work on other people), and it doesn't work serversided.

This is the errors in RC that I get
PHP Code:

Script: Function serverwarp not found at line 4 in script of SwitchTest (in level lc_a1.nw at pos (00))
Script: Function serverwarp not found at line 8 in script of SwitchTest (in level lc_a1.nw at pos (00)) 

The first line is using "/relog", the second is using "/disconnect" (obviously).

This is the script I'm using
PHP Code:

function onActionServerSide() {
  if (
params[0] == "/relog") {
    
with (findPlayer(params[1]))
      
serverwarp(servername);
  }
  if (
params[0] == "/disconnect") {
    
with (findPlayer(params[1]))
      
serverwarp("Login");
  }
}

//#CLIENTSIDE
function onPlayerChats() {
  
temp.token player.chat.tokenize();
  if (
player.chat.starts("/relog"))
    
triggerserver("gui",this.name,temp.token[0],temp.token[1]);
  if (
player.chat.starts("/disconnect"))
    
triggerserver("gui",this.name,temp.token[0],temp.token[1]);


My question is, is there any way that it will work serversided, or can it be implemented to be serversided?

Not really necassery, I just think it's kind of odd how switching servers seems to be more like something serversided, not clientsided.

xXziroXx 08-15-2008 01:38 AM

Have a clientsided timeout read a random variable, say client.reconnect, then if its true - first unset the variable, then serverwarp. Piece a cake.

EDIT: And it's obviously the client that handles server changes, since it's the client that manually change servers - why would that ever be serversided?

Tigairius 08-15-2008 01:40 AM

Quote:

Originally Posted by Switch (Post 1414443)
Not really necassery, I just think it's kind of odd how switching servers seems to be more like something serversided, not clientsided.

just put something like this in a system weapon:

PHP Code:

//#CLIENTSIDE
function onActionclientside() {
  switch(
params[0]) {
    case 
"reconnect":
      
serverwarp(servername);
     break;
  }


then serverside just do
PHP Code:

with (findPlayer(params[1])) 
  
triggerclient("gui"systemweaponnpcname"reconnect"); 


Switch 08-15-2008 01:44 AM

Quote:

Originally Posted by xXziroXx (Post 1414447)
Have a clientsided timeout read a random variable, say client.reconnect, then if its true - first unset the variable, then serverwarp. Piece a cake.

EDIT: And it's obviously the client that handles server changes, since it's the client that manually change servers - why would that ever be serversided?

heh, dont wanna mess with that
And also, it's SERVER changing. :p
Quote:

Originally Posted by Tigairius (Post 1414449)
just put something like this in a system weapon:
PHP Code:

function onActionclientside() {
  switch(
params[0]) {
    case 
"reconnect":
      
serverwarp(servername);
     break;
  }


then serverside just do
PHP Code:

with (findPlayer(params[1])) 
  
triggerserver("gui"systemweaponnpcname"reconnect"); 


Was gonna do that, but not sure they want me to :p

Chompy 08-15-2008 01:54 AM

Quote:

Originally Posted by cbk1994 (Post 1414454)
For that script, just keep it clientside anyway.

It's a script to reconnect and disconnect other players. ;p

cbk1994 08-15-2008 02:09 AM

Quote:

Originally Posted by Chompy (Post 1414462)
It's a script to reconnect and disconnect other players. ;p

Oh, I read over it too fast :P

Tolnaftate2004 08-15-2008 03:06 AM

You guys really win the obfuscation award.

PHP Code:

addweapon("disc or rec"); 

PHP Code:

//#CLIENTSIDE
function onCreated() { serverwarp("Login or Your-Server"); destroy(); } 


xXziroXx 08-15-2008 04:01 AM

That destroy() won't be called since the player no longer is on the server. :p

cbk1994 08-15-2008 04:02 AM

Quote:

Originally Posted by xXziroXx (Post 1414496)
That destroy() won't be called since the player no longer is on the server. :p

Yes it would, it lags a bit. But, it's not a good practice in my opinion.

Tigairius 08-15-2008 04:08 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1414477)
You guys really win the obfuscation award.

PHP Code:

addweapon("disc or rec"); 

PHP Code:

//#CLIENTSIDE
function onCreated() { serverwarp("Login or Your-Server"); destroy(); } 


I don't like to use an entire weapon for the sake of doing a temporary task.

Tolnaftate2004 08-15-2008 04:57 AM

Quote:

Originally Posted by xXziroXx (Post 1414496)
That destroy() won't be called since the player no longer is on the server. :p

The player object still exists for a while after logoff.

Quote:

Originally Posted by cbk1994 (Post 1414498)
Yes it would, it lags a bit. But, it's not a good practice in my opinion.

And this lag is of no harm to a player who is not really playing the game....

Quote:

Originally Posted by Tigairius (Post 1414500)
I don't like to use an entire weapon for the sake of doing a temporary task.

And I don't like insecure triggers!

xXziroXx 08-15-2008 05:02 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1414512)
And I don't like insecure triggers!

So how come you and everyone else ignored my suggestion? Just cram it into a script that already uses a .05 timeout and check for client.reconnect there.

cbk1994 08-15-2008 05:07 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1414512)
And this lag is of no harm to a player who is not really playing the game....

I basically meant that once calling serverwarp(), the player stays on the server for a few seconds.

Tolnaftate2004 08-15-2008 05:07 AM

Quote:

Originally Posted by xXziroXx (Post 1414515)
So how come you and everyone else ignored my suggestion? Just cram it into a script that already uses a .05 timeout and check for client.reconnect there.

Because... client. variables can be set by a... client...
I could kick you off indefinitely, I guess maybe that's why.

Also, I was not arguing with you cbk, just statin' facts.

xXziroXx 08-15-2008 05:08 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1414519)
Because... client. variables can be set by a... client...
I could kick you off indefinitely, I guess maybe that's why.

Yeah, but it's a such a likely scenario. :rolleyes:


Then how about checking for clientr.reconnect, and if it is true, reconnect the player. Then, have it set to false upon login in the Control-NPC? Happy now?

DustyPorViva 08-15-2008 05:14 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1414512)
And I don't like insecure triggers!

So make them secure? I'm pretty sure something was recently added to help achieve this level of security...
Callstack Access?

Tolnaftate2004 08-15-2008 05:20 AM

Quote:

Originally Posted by DustyPorViva (Post 1414526)
So make them secure? I'm pretty sure something was recently added to help achieve this level of security...
Callstack Access?

Callstack access does nothing for triggers. Good try though!

DustyPorViva 08-15-2008 05:23 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1414529)
Callstack access does nothing for triggers. Good try though!

Perhaps, my point remains though... you can't dismiss triggers simply because of security. Just make them more secure.

Inverness 08-15-2008 09:23 AM

So someone tell me how that trigger would be insecure, how it would be abused, and what level of script access would be needed to abuse it.


All times are GMT +2. The time now is 10:38 PM.

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