Thread: Level 255 bug
View Single Post
  #1  
Old 06-09-2003, 02:15 AM
Merth
Dragon
 
Join Date: May 2003
Location: Seattle, WA
Posts: 609
Default Level 255 bug

Some people on my server found themselves to be level 255, even though #level is built to prevent > 65 as an argument. The bug happens when a lower priveleged user targets an NPC and types #level 255.

The bug is in client.cpp, and here's the fix if you want it. (Note, I decided to make it so server ops can set level > 65 on a target)

Code:
bool Client::PrivUser(const Seperator* sep){
...
if ((strcasecmp(sep->arg[0], "#level") == 0)) {
	int16 level = atoi(sep->arg[1]);
	if ((level <= 0) || ((level > 65) && (this->admin < 100)) ) {
		Message(0, "Error: #Level: Invalid Level");
	}
	else if (admin < 100) {
		this->SetLevel(level, true);
	}
	else if (!target) {
		Message(0, "Error: #Level: No target");
	}
	else {
		if (!target->IsNPC() && ((this->admin < 200) && (level > 65))) {
			Message(0, "Error: #Level: Invalid Level");
		}
		else
		{
			target->SetLevel(level, true);
		}
	}

...
Reply With Quote