Page 1 of 2

anti-blocker error in UO

Posted: March 26th, 2006, 4:22 am
by profinuyasha
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;
}

Posted: March 26th, 2006, 12:29 pm
by leveller
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.





.

Posted: March 26th, 2006, 3:47 pm
by profinuyasha
okay, how to make it to defined to boolean?

Posted: March 26th, 2006, 3:58 pm
by leveller
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; 
}




.

Posted: March 26th, 2006, 6:38 pm
by profinuyasha
i did this...still same error

if(!range)

one thing...how can i make it defined to boolean?

Posted: March 26th, 2006, 7:41 pm
by leveller
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.

Posted: March 26th, 2006, 8:34 pm
by profinuyasha
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!

Posted: March 27th, 2006, 1:28 am
by profinuyasha
leveller, another question: How to make anti-kill will kick people after 3rd warn without admin to kick people?

Posted: April 9th, 2006, 2:16 am
by profinuyasha
HELLO!??!?!?!?!!? WHY NOBODY ANSWER THIS THREAD?! GODDAMN!

Posted: April 9th, 2006, 10:59 am
by Grom
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.

Posted: April 10th, 2006, 3:02 am
by profinuyasha
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

Posted: April 10th, 2006, 1:47 pm
by leveller
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.


.

Posted: April 10th, 2006, 3:48 pm
by profinuyasha
ur AKK can only run on COD, not UO....

Posted: April 10th, 2006, 5:10 pm
by leveller
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.


.

Posted: April 11th, 2006, 12:54 am
by Nightmare
leveller wrote: i'm not your mother.
Lol, Nicley said Leveller :P