Kick wrong player

Have a question about modding, modelling or skinning? Have a tutorial to post? Post here!

Moderator: Core Staff

Post Reply
Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

Kick wrong player

Post by Moustache » May 29th, 2010, 6:20 pm

This script kicks the wrong player. It kicks someone that connects to the server.
So if someone has 1 = true and his time = 60 or bigger then the player that connects gets kicked. Instead of the player that has time = 60 or bigger.

custom_public.gcs

Code: Select all

onNewConnection()
{
	self endon( "disconnect" );
	for(;;)
	{
		level waittill("connected", player);
		player thread promod_ruleset\player::setkick();
	}
}
player.gcs

Code: Select all

setkick()
{
	for(;;)
	{
		wait 10;

		if( 1 == "true" )
		{
			self.time+=10;

			if(self.time == 40)
			{
				self IPrintLnBold("You are getting ^1kicked ^7in 20 seconds");
			}

			else if(self.time >= 60)
			{
				IPrintLn("^1" + self.name + " ^7is kicked");
				Kick(self.clientid);
			}
		}
		else  if( 1 != "true" )
		{
			self.time = 0;
		}
	}
}

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Kick wrong player

Post by Drofder2004 » May 29th, 2010, 7:40 pm

What are you trying to achieve by doing "1 == true"

0 = False
1 = True

Your if statements are redundant...
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

Re: Kick wrong player

Post by Moustache » June 1st, 2010, 12:55 pm

I forgot to set self.time = 0 before the loop.
Fail @ me :oops: again...

Thanxs for trying to help me :)

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Kick wrong player

Post by Drofder2004 » June 1st, 2010, 7:09 pm

I am still confused by your 1 == "true" statement, but good luck with it...
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Post Reply

Who is online

Users browsing this forum: No registered users and 37 guests