Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-24-2006, 08:45 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Gift Script: Trainer Protection System

Well, seeing as how the folks down at the new Graal hacking site (which I won't mention the name nor the URL) have been releasing their trainers publically, so I figure the Graal developers should make some trainer protection public as well, for every server to be able to use to work on and implement into their own protection systems against players that only wish to cheat in this game and make things hard on the staff and players. I took the liberty of coding this system both in GS1 and GS2, for both the servers that are GS2 enabled and those that are not.

NOTE: I can only post once every 8 hours, so if anything, look back at this post for any edits that I make have for replies to anyones comments. Any notes of improvement and so forth would be appreciated, seeing as how this is something for everyone to be able to derive and hopefully make their servers as trainer-proof as possible

NOTE #2: Special thanks to Liren for helping me debug some checks to make sure that the protection wouldn't call you a hacker if you weren't actually hacking (I.E using trainers).

NOTE #3: This will protect against any and all types of trainers that deal with warping the player from one spot to another, so as long as that spot involves warping the player to a spot inside the current level of that player.




GS1 Version:


PHP Code:
// NPC made by Gambet
if ( actionserverside ) {
 if ( !
strequals#p(0),triggered ) {
   
sendtorc [Trainer Protection#a is attempting to bypass the triggeraction for the trainer protection NPC!;
 
} else {
   
sendtorc [Trainer Protection#a is using a postion-warping trainer!;
   //You can insert auto-jail functions here and before the else statement.
   //Also note that the above sendtorcs may spam RC, so you would want to
   //either add an auto-jail function, auto-ban function, auto-dc function,
   //or simply a check so that it doesn't spam RC multiple times. I'll leave
   //that part up to you since it's very simple, and it really depends on
   //how your server works.
  
}
}
//#CLIENTSIDE
if ( created ) {
  
timeout 0.05;
}
if ( 
playerenters ) {
  
setstring this.lastplayerx,#v(playerx);
  
setstring this.lastplayery,#v(playery);
  
setstring this.playerx,#v(playerx);
  
setstring this.playery,#v(playery);
}
if ( 
timeout ) {
  if ( !
strequals#s(this.playerx),#v(playerx) ) || !strequals( #s(this.playery),#v(playery) ) ) {
    
setstring this.lastplayerx,#s(this.playerx);
    
setstring this.lastplayery,#s(this.playery);
    
setstring this.playerx,#v(playerx);
    
setstring this.playery,#v(playery);
  
}
  if ( 
strtofloat#s(this.lastplayerx) ) + 3 <= strtofloat( #s(this.playerx) ) || strtofloat( #s(this.lastplayery) ) + 3 <= strtofloat( #s(this.playery) ) ) {
    
triggeraction 0,0,serverside,WEAPONNAME,triggered;
  }
  
timeout 0.05;



GS2 Version:


PHP Code:
// NPC made by Gambet
function onActionServerSide()
{
 if ( 
params[0] != triggered ) {
  
sendtorc"[Trainer Protection] " player.account " is attempting to bypass the triggeraction for the trainer protection NPC!" ); 
 } else {
   
sendtorc"[Trainer Protection] " player.account " is using a postion-warping trainer!" );
   
//You can insert auto-jail functions here and before the else statement.
   //Also note that the above sendtorcs may spam RC, so you would want to
   //either add an auto-jail function, auto-ban function, auto-dc function,
   //or simply a check so that it doesn't spam RC multiple times. I'll leave
   //that part up to you since it's very simple, and it really depends on
   //how your server works.
  
}
}
//#CLIENTSIDE
function onCreated()
{
 
setTimer(0.05);
}
function 
onPlayerEnters()
{
  
this.lastplayerx this.playerx;
  
this.lastplayery this.playery;
  
this.playerx player.x;
  
this.playery player.y;
}
function 
onTimeout()
{
 if ( 
this.playerx != player.|| this.playery != player.) {
  
this.lastplayerx this.playerx;
  
this.lastplayery this.playery;
  
this.playerx player.x;
  
this.playery player.y;
 }
 if ( 
this.lastplayerx <= this.playerx || this.lastplayery <= this.playery ) {
  
triggeraction00"serverside"name"triggered" );
 }
 
setTimer(0.05);



Feel free to use the above code as you please. The more protection that is implemented to the servers on Graal, the more fun the players can have while playing, without having to worry about hackers and trainer users.


Final NOTE: The above detection system will detect also when staff warp around the level or if any server has any teleporting spells/npcs which allow the player to go from one spot in the level to the next. For the staff warping problem, I would suggest setting up an array containing staff guilds and/or staff accounts in which this system will disregard and won't call them a hacker for warping around. For the special spells/npcs problem, I would suggest editing them to fit this system, so as to not have players get in trouble for trainer using, when in fact they did not.


Enjoy.

Last edited by Gambet; 07-25-2006 at 05:19 AM..
Reply With Quote
 


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 07:50 PM.


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