anti-blocker error in UO

Talk about anything related with the servers

Moderator: Core Staff

profinuyasha
CJ Newbie
CJ Newbie
Posts: 88
Joined: February 21st, 2006, 1:06 am
Contact:

anti-blocker error in UO

Post by profinuyasha » March 26th, 2006, 4:22 am

in my script, 1 of thread keep gettin error


cannot cast undefined to bool: if(!range)

called from: loadPossave();
called from: self thread checksave();
called from: wait 0.01;

Code: Select all

watchMeleeKey() // for saving position
{
	self endon("ufa_jump_threads");

	for(;;)
	{
		if(self meleeButtonPressed() && self.sessionstate == "playing" && self isOnGround())
		{
			catch_next = false;

			for(i=0; i<=0.25; i+=0.01) // allows 0.25 seconds for the next keypress
			{
				if(catch_next && self meleeButtonPressed())
				{
					self thread savePosition();
					wait 2; // avoid overloading the server
					break;
				}
				else if(!(self meleeButtonPressed()))
					catch_next = true; // button was pressed/released once

				wait 0.01;
			}
		}

		wait 0.05;
	}
}
watchMeleeKey_save() // for saving position
{
	self endon("ufa_jump_threads");

	for(;;)
	{
		if(self meleeButtonPressed() && self.sessionstate == "playing")
		{
			catch_next = false;

			for(i=0; i<=0.25; i+=0.01) // allows 0.25 seconds for the next keypress
			{
				if(catch_next && self meleeButtonPressed())
				{
					self thread savePosition();
					wait 1; // avoid overloading the server
					break;
				}
				else if(!(self meleeButtonPressed()))
					catch_next = true; // button was pressed/released once

				wait 0.01;
			}
		}

		wait 0.05;
	}
}
watchUseKey() // for loading position
{
	self endon("ufa_jump_threads");

	for(;;)
	{
		if(self useButtonPressed())
		{
			catch_next = false;

			for(i=0; i<=0.25; i+=0.01)
			{
				if(catch_next && self useButtonPressed())
				{
					self thread checksave();
					wait 3.5;
					break;
				}
				else if(!(self useButtonPressed()))
					catch_next = true;

				wait 0.01;
			}
		}

		wait 0.05;
	}
}

savePosition()
{
	self.saved_origin = self.origin;
	self.saved_angles = self.angles;
	self iprintln("^2S^9ave ^2P^9osition^0: (^2" + (int)self.saved_origin[0] + "^0,^2" + (int)self.saved_origin[1] + "^0,^2" + (int)self.saved_origin[2] + "^0)");
}

checksave()
{
	if (getcvar("ufa_jump"))
		{
		loadPossave();		
		}
		else
		{
		loadPosition();
		}
}

loadPosition()
{
	thread positions();
	if(!isDefined(self.saved_origin))
	{
		self iprintln("^1Error! ^3No Saved Position Available!");
		return;
	}
	else
	{
		self setPlayerAngles(self.saved_angles); // angles need to come first
		self setOrigin(self.saved_origin);
		self iprintln("^5L^9oad ^5P^9osition^0: (^5" + (int)self.saved_origin[0] + "^0,^5" + (int)self.saved_origin[1] + "^0,^5" + (int)self.saved_origin[2] + "^0)");
	}
}

loadPossave()
{
	thread positions();
	if(!isDefined(self.saved_origin))
	{
		self iprintln("^1Error! ^3No Saved Position Available!");
		return;
	}
	else
		if(self positions(70))
			{
			self iprintlnbold("A player is currently standing on that location!");
			self iprintlnbold("Try again in a few sec.");
			return;
			}

		else
			{
			self setPlayerAngles(self.saved_angles); // angles need to come first
			self setOrigin(self.saved_origin);
		self iprintln("^4L^9oad ^4P^9osition^0: (^4" + (int)self.saved_origin[0] + "^0,^4" + (int)self.saved_origin[1] + "^0,^4" + (int)self.saved_origin[2] + "^0)");
			}
}

positions(range)
{
	if (!range)
		return true;

	// Get all players and pick out the ones that are playing
	allplayers = getentarray("player", "classname");
	players = [];
	for(i = 0; i < allplayers.size; i++)
	{
		if(allplayers[i].sessionstate == "playing")
			players[players.size] = allplayers[i];
	}

	// Get the players that are in range
	sortedplayers = sortByDist(players, self);

	// Need at least 2 players (myself + one team mate)
	if(sortedplayers.size<2)
		return false;

	// First player will be myself so check against second player
	distance = distance(self.saved_origin, sortedplayers[1].origin);
	if( distance <= range )
		return true;
	else
		return false;
}

sortByDist(points, startpoint, maxdist, mindist)
{
	if(!isdefined(points))
		return undefined;
	if(!isdefineD(startpoint))
		return undefined;

	if(!isdefined(mindist))
		mindist = -1000000;
	if(!isdefined(maxdist))
		maxdist = 1000000; // almost 16 miles, should cover everything.

	sortedpoints = [];

	max = points.size-1;
	for(i = 0; i < max; i++)
	{
		nextdist = 1000000;
		next = undefined;

		for(j = 0; j < points.size; j++)
		{
			thisdist = distance(startpoint.origin, points[j].origin);
			if(thisdist <= nextdist && thisdist <= maxdist && thisdist >= mindist)
			{
				next = j;
				nextdist = thisdist;
			}
		}

		if(!isdefined(next))
			break; // didn't find one that fit the range, stop trying

		sortedpoints[i] = points[next];

		// shorten the list, fewer compares
		points[next] = points[points.size-1]; // replace the closest point with the end of the list
		points[points.size-1] = undefined; // cut off the end of the list
	}

	sortedpoints[sortedpoints.size] = points[0]; // the last point in the list

	return sortedpoints;
}

PlayerinRange(range)
{
	if(!range)
		return true;

	// Get all players and pick out the ones that are playing
	allplayers = getentarray("player", "classname");
	players = [];
	for(i = 0; i < allplayers.size; i++)
	{
		if(allplayers[i].sessionstate == "playing")
			players[players.size] = allplayers[i];
	}

	// Get the players that are in range
	sortedplayers = sortByDist(players, self);

	// Need at least 2 players (myself + one team mate)
	if(sortedplayers.size<2)
		return false;

	// First player will be myself so check against second player
	distance = distance(self.origin, sortedplayers[1].origin);
	if( distance <= range )
		return true;
	else
		return false;
}
Image
Image
DYOR :-)

leveller
CJ Fan
CJ Fan
Posts: 156
Joined: June 25th, 2005, 12:24 pm

Post by leveller » March 26th, 2006, 12:29 pm

PlayerinRange(range)
{
if(!range)
return true;

// Get all players and pick out the ones that are playing
allplayers = getentarray("player", "classname");
players = [];
for(i = 0; i < allplayers.size; i++)
{
if(allplayers.sessionstate == "playing")
players[players.size] = allplayers;
}

// Get the players that are in range
sortedplayers = sortByDist(players, self);

// Need at least 2 players (myself + one team mate)
if(sortedplayers.size<2)
return false;

// First player will be myself so check against second player
distance = distance(self.origin, sortedplayers[1].origin);
if( distance <= range )
return true;
else
return false;
}



Why is that portion of code there?

you already did a range check here

positions(range)
{
if (!range)
return true;

// Get all players and pick out the ones that are playing
allplayers = getentarray("player", "classname");
players = [];
for(i = 0; i < allplayers.size; i++)
{
if(allplayers.sessionstate == "playing")
players[players.size] = allplayers;
}

// Get the players that are in range
sortedplayers = sortByDist(players, self);

// Need at least 2 players (myself + one team mate)
if(sortedplayers.size<2)
return false;

// First player will be myself so check against second player
distance = distance(self.saved_origin, sortedplayers[1].origin);
if( distance <= range )
return true;
else
return false;
}


i think its adressed from somewhere, but never defined.

so it can never be boolean if its not beeing defined.





.

profinuyasha
CJ Newbie
CJ Newbie
Posts: 88
Joined: February 21st, 2006, 1:06 am
Contact:

Post by profinuyasha » March 26th, 2006, 3:47 pm

okay, how to make it to defined to boolean?
Image
Image
DYOR :-)

leveller
CJ Fan
CJ Fan
Posts: 156
Joined: June 25th, 2005, 12:24 pm

Post by leveller » March 26th, 2006, 3:58 pm

my best guess is, delete this section.

Code: Select all

PlayerinRange(range) 
{ 
if(!range) 
return true; 

// Get all players and pick out the ones that are playing 
allplayers = getentarray("player", "classname"); 
players = []; 
for(i = 0; i < allplayers.size; i++) 
{ 
if(allplayers[i].sessionstate == "playing") 
players[players.size] = allplayers[i]; 
} 

// Get the players that are in range 
sortedplayers = sortByDist(players, self); 

// Need at least 2 players (myself + one team mate) 
if(sortedplayers.size<2) 
return false; 

// First player will be myself so check against second player 
distance = distance(self.origin, sortedplayers[1].origin); 
if( distance <= range ) 
return true; 
else 
return false; 
}




.

profinuyasha
CJ Newbie
CJ Newbie
Posts: 88
Joined: February 21st, 2006, 1:06 am
Contact:

Post by profinuyasha » March 26th, 2006, 6:38 pm

i did this...still same error

if(!range)

one thing...how can i make it defined to boolean?
Image
Image
DYOR :-)

leveller
CJ Fan
CJ Fan
Posts: 156
Joined: June 25th, 2005, 12:24 pm

Post by leveller » March 26th, 2006, 7:41 pm

one thing...how can i make it defined to boolean?
just go back to the original "save position mod", and start your renaming from there.

profinuyasha
CJ Newbie
CJ Newbie
Posts: 88
Joined: February 21st, 2006, 1:06 am
Contact:

Post by profinuyasha » March 26th, 2006, 8:34 pm

i got it

it had to defined first then it will work

if(!isdefined(Range))
return true;

thats how i wrote and it 100% work!
Image
Image
DYOR :-)

profinuyasha
CJ Newbie
CJ Newbie
Posts: 88
Joined: February 21st, 2006, 1:06 am
Contact:

Post by profinuyasha » March 27th, 2006, 1:28 am

leveller, another question: How to make anti-kill will kick people after 3rd warn without admin to kick people?
Image
Image
DYOR :-)

profinuyasha
CJ Newbie
CJ Newbie
Posts: 88
Joined: February 21st, 2006, 1:06 am
Contact:

Post by profinuyasha » April 9th, 2006, 2:16 am

HELLO!??!?!?!?!!? WHY NOBODY ANSWER THIS THREAD?! GODDAMN!
Image
Image
DYOR :-)

User avatar
Grom
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 738
Joined: March 30th, 2005, 12:29 pm
Location: Norway

Post by Grom » April 9th, 2006, 10:59 am

Chill dude, you wont get any faster help if you shout out like that :roll:

Not sure if I understand your question, but for the kicking part, after a player has killed "x" certain kills, I guess you need PB for this.

profinuyasha
CJ Newbie
CJ Newbie
Posts: 88
Joined: February 21st, 2006, 1:06 am
Contact:

Post by profinuyasha » April 10th, 2006, 3:02 am

Grom wrote:Chill dude, you wont get any faster help if you shout out like that :roll:

Not sure if I understand your question, but for the kicking part, after a player has killed "x" certain kills, I guess you need PB for this.
i have been patient for 1-2 week, i just want to get AKK enabled then i dont need to worry about friendlyfire
Image
Image
DYOR :-)

leveller
CJ Fan
CJ Fan
Posts: 156
Joined: June 25th, 2005, 12:24 pm

Post by leveller » April 10th, 2006, 1:47 pm

leveller wrote:
one thing...how can i make it defined to boolean?
just go back to the original "save position mod", and start your renaming from there.
Read that part again!


i'm not going to waste time fix something that wasnt broken.

for some unkown reason you took the akk mod, started shiftting things around and renamed alot of things.
thats all fine by me, but dont come complaining that the mod isnt working and you need help fixing it.
i'm not your mother.

looking the way you altered things, and came up with your own solutions,
its clear you dont even have the basic understanding of scripting.
thats why i wrote :
just go back to the original "save position mod", and start your renaming from there.
profinuyasha wrote:i have been patient for 1-2 week, i just want to get AKK enabled then i dont need to worry about friendlyfire
then download the D*mn original akk mod and run the D*mn thing.


.

profinuyasha
CJ Newbie
CJ Newbie
Posts: 88
Joined: February 21st, 2006, 1:06 am
Contact:

Post by profinuyasha » April 10th, 2006, 3:48 pm

ur AKK can only run on COD, not UO....
Image
Image
DYOR :-)

leveller
CJ Fan
CJ Fan
Posts: 156
Joined: June 25th, 2005, 12:24 pm

Post by leveller » April 10th, 2006, 5:10 pm

profinuyasha wrote:ur AKK can only run on COD, not UO....
omg i even took the time to check it for ya, only to confirm what i already knew.

It works in uo

It works in uo

It works in uo

It works in uo


maybe throw out a mod or 2, you might have in your dir, and it should work fine.


.

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » April 11th, 2006, 12:54 am

leveller wrote: i'm not your mother.
Lol, Nicley said Leveller :P
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest