Sign in to follow this  
Klauser

anitcheat

Recommended Posts

Hmm, I will be honest I am not GSC expert, literally I cant stand GSC :P

Calling the script might have to be done, @D4edalus will know more on this 

Share this post


Link to post
Share on other sites

if you dont call the function it wont do anything. its like expecting Koaja to jump, while i'm not even telling him to :D

check some gsc tutorials.. or read into the new experience mod how things are done there. you want to start a new thread after a player connects.

<insert more magic here>
player thread fpsWatch();

https://think-clan.com/think_view_tutorial?tutorial=gsc_scripting_tutorial_1___welcome_message

Share this post


Link to post
Share on other sites
16 minutes ago, D4edalus said:

if you dont call the function it wont do anything. its like expecting Koaja to jump, while i'm not even telling him to :D

check some gsc tutorials.. or read into the new experience mod how things are done there. you want to start a new thread after a player connects.

<insert more magic here>
player thread fpsWatch();

https://think-clan.com/think_view_tutorial?tutorial=gsc_scripting_tutorial_1___welcome_message

You tell me to jump off a cliff all the time though.... :> On topic, I should look into this sometime, It might help :P

Share this post


Link to post
Share on other sites
13 minutes ago, D4edalus said:

wanted to write a gsc quickstart tutorial for some time now. havent tested the code inside yet. 

@Chuma87

https://github.com/callofduty4x/CoD4x_Server/blob/master/scriptdocumentation/ScriptingGuide.md

Thnks for the link...

So, if fpskick.gsx founds in code folder, on the function "Codecallback_Startgametype()" i should call fpskick...
 

thread code/fpskick::init();

can be?
I'll try it later, so i'll not bother you

Share this post


Link to post
Share on other sites

If your script file is inside main_shared/code/fpskick.gsc then yes :)

  • Like 1

Share this post


Link to post
Share on other sites

For the above script, use this. Until you update the wiki.

 

init()
{
  for(;;)
  {
    self waittill("connected", player); // waits until a new player connects - player stored in "player" variable
    player thread welcome(); // execute a new thread for "player"
  }
}

welcome()
{
  // "player" is referenced as "self" now
  self waittill("spawned_player"); // waits until the player spawned
  self iprintlnbold("Welcome " + self.name); // writes the welcome message bold and centered on the players screen
}

Issue was in initiation, waittill wouldnt work, adding self waittill works.

Share this post


Link to post
Share on other sites
14 hours ago, Chuma87 said:

So, if fpskick.gsx founds in code folder, on the function "Codecallback_Startgametype()" i should call fpskick...

This doesn't work, i restart and clear my server, and only create on main_shared, fpskick.gsc, and on main_shared/maps/mp_gametypes, _callbacksetup.gsc.
In function codecallback_startgametype, i wrote "thread fpsWatch2::init();" after "welcome::init();" and nothing...only works welcome message. And i tried with 125 fps for kick....

fpsWatch2.gsc 
 

fpsWatch2()
{
	self endon( "disconnect" );
	
	warnTime = 20;
	
	for( ;; )
	{
		fps = self GetCountedFPS();
		
		if( fps > 300 )
		{
			warnTime--;
			self iPrintLnBold( "333 FPS is not allowed. Change or you will be kicked in " + warnTime + "seconds!" );
			self.lastWarnTime = getTime();
		}
		
		else if( warnTime < 20 && isDefined( self.lastWarnTime ) && getTime() - self.lastWarnTime > 60000  ) // Reset the counter if player was under 333 fps for 1 minute
			warnTime = 20;
		
		if( warnTime == 0 )
			exec( "kick " + self getEntityNumber() + " 333 FPS is not allowed" );
			
		wait 1;
	}
}

_callbacksetup.gsc lines
 

CodeCallback_StartGameType()
{
	// If the gametype has not beed started, run the startup
	if(!isDefined(level.gametypestarted) || !level.gametypestarted)
	{
		[[level.callbackStartGameType]]();

		level.gametypestarted = true; // so we know that the gametype has been started up
		thread welcome::init();
		thread fpswatch2::init();
	}
}

 

 

Edited by Chuma87

Share this post


Link to post
Share on other sites

Read the part about context and threads in the scripting guide I posted

 

In your case self is undefined inside the fpswatch thread, but you expect it to be a player

Share this post


Link to post
Share on other sites
8 hours ago, D4edalus said:

In your case self is undefined inside the fpswatch thread, but you expect it to be a player

 

i hope not to be a problem for you, where should define self?

i'm reading now your posted guide, and this, i'll be a master scripter? NOT

Share this post


Link to post
Share on other sites

It works!!!!

fpsWatch.gsx

init()
{
    for(;;)
    {
        level waittill("connected", player); 
        player thread fpsWatch2(); 
    }
}

fpsWatch2()
{
	for (;;)
	{
		self endon( "disconnect" );
		wait 10;
		fps = self GetCountedFPS();
		if (fps > 250)
		{
			exec( "kick " + self getEntityNumber() + " 333 FPS is not allowed" );
		wait 1;
		}
	}
}

 

Share this post


Link to post
Share on other sites

Good job! So did my tutorial make you a masterscripter after all :P ?

You should change >250 to >300. The FPS function can be quite inaccurate, and otherwise it might happen that you kick inoccent players. 

Share this post


Link to post
Share on other sites
2 hours ago, D4edalus said:

Good job! So did my tutorial make you a masterscripter after all :P ?

 

Thanks for the guide - it did help me understand better on scripting

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, D4edalus said:

Good job! So did my tutorial make you a masterscripter after all :P ?

You should change >250 to >300. The FPS function can be quite inaccurate, and otherwise it might happen that you kick inoccent players. 

 

You're right, i was testing the parameters, and I forgot to leave it at +300.
Now i will investigate how to make the 3rd kick = ban.

Share this post


Link to post
Share on other sites
On 5/3/2017 at 8:02 AM, leiizko said:

First function will change player's FPS to 250, second one will kick him after 20 seconds.


fpsWatch2()
{
	self endon( "disconnect" );
	
	warnTime = 20;
	
	for( ;; )
	{
		fps = self GetCountedFPS();
		
		if( fps > 300 )
		{
			warnTime--;
			self iPrintLnBold( "333 FPS is not allowed. Change or you will be kicked in " + warnTime + "seconds!" );
			self.lastWarnTime = getTime();
		}
		
		else if( warnTime < 20 && isDefined( self.lastWarnTime ) && getTime() - self.lastWarnTime > 60000  ) // Reset the counter if player was under 333 fps for 1 minute
			warnTime = 20;
		
		if( warnTime == 0 )
			exec( "kick " + self getEntityNumber() + " 333 FPS is not allowed" );
			
		wait 1;
	}
}

 

 

Look the ss, for the player with 333fps this happens, when warntime = 0, the server disconnects the player, but he doesn't figure "kick for 333fps".

I suspect it si the warntime = 20 when start this script...How can i solve it?

shot0001.jpg

Edited by Chuma87

Share this post


Link to post
Share on other sites

i believe that is a server bug. noticed that behaviour too, but it only happens sometimes for me.

Share this post


Link to post
Share on other sites
24 minutes ago, D4edalus said:

i believe that is a server bug. noticed that behaviour too, but it only happens sometimes for me.

 

Important info: the server with this script is a dedicated server, in my PC

Share this post


Link to post
Share on other sites

It's a server bug, kicking/banning sometimes just shows as lagging out for the player. It's not script releated, doing it over rcon or any other method usually results in same behaviour

Share this post


Link to post
Share on other sites

I made a script that will tell them  over 250 fps is not allowed and changes it to 250;

(I used what was previously posted in this thread and modified it)

its called by callbacksetup.gsc or gsx which ever you have

look for this in callbacksetup

CodeCallback_StartGameType()
{

    // If the gametype has not beed started, run the startup
    if(!isDefined(level.gametypestarted) || !level.gametypestarted)
    {
        [[level.callbackStartGameType]]();

        level.gametypestarted = true; // so we know that the gametype has been started up

thread maps\mp\gametypes\_fpswatch::init(); // this is the code to call fpswatch place it here

 

the script file is named  _fpswatch.gsx and contains

init()
{
    for(;;)
    {
        level waittill("connected", player);
        player thread fpsWatch2();
    }
}

fpsWatch2()
{
    for (;;)
    {
        self endon( "disconnect" );
        wait 10;
        fps = self GetCountedFPS();
        if (fps > 300)
        {
     IprintLnBold(self," more then 250 fps is not allowed");
    IprintLnBold(self," so we will change it to 250");
wait 15;
self setClientDvar( "com_maxfps", 250 );


        wait 1;
        }
    }
}

Share this post


Link to post
Share on other sites

I could not edit my post

but change if (fps > 300)  to if (fps > 251)

Share this post


Link to post
Share on other sites
On 12/3/2017 at 8:25 PM, leiizko said:

It's a server bug, kicking/banning sometimes just shows as lagging out for the player. It's not script releated, doing it over rcon or any other method usually results in same behaviour

If i delete this lines, the server works

...
	warnTime = 20;
	
			warnTime--;
			self iPrintLnBold( "333 FPS is not allowed. Change or you will be kicked in " + warnTime + "seconds!" );
			self.lastWarnTime = getTime();
...

Maybe is the "wartime = 20", but if i delete this, the server cannot warm the player that it will be kicked.

The upladed image corresponds to the script without alert

 

17310540_10212449892873486_2057025286_o.jpg

Share this post


Link to post
Share on other sites

Yes, I am also facing same problem.There is talk in community that paid hack are available.Player using paid hack are not detectable through screenshot and but still they know location of every player.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this