View Single Post
  #6  
Old 07-06-2009, 09:01 PM
Zeice
Sarnak
 
Join Date: Oct 2008
Location: USA
Posts: 92
Default

Yeah, so that definitely didn't work. I figured it out though. Not bad for my first attempt at doing anything with the code. However, as far as keeping it to your own stats I couldn't figure out how to do that. This atleast allows it to only work on clients and pets, which for me is the biggest thing.

SQL:

Code:
INSERT INTO commands VALUES ('mystats', '0', 'Allows player to view pet and client stats, but not npc');
File changes:

Code:
command.h
---------------

ADD

void command_mystats(Client *c, const Seperator *sep);

AFTER

void command_showstats(Client *c, const Seperator *sep);
Code:
command.cpp
----------------

ADD
		command_add("mystats","- Show details about you or your pet",50,command_mystats) ||

AFTER

		command_add("showstats","- Show details about you or your target",50,command_showstats) ||


ADD

void command_mystats(Client *c, const Seperator *sep)
{
	if (c->GetTarget() != 0 )
		if (c->GetTarget()->IsClient())
		c->GetTarget()->ShowStats(c);
	else if (c->GetTarget()->IsPet())
		c->GetTarget()->ShowStats(c);
	else
		c->ShowStats(c);
}


AFTER

void command_showstats(Client *c, const Seperator *sep)
{
	if (c->GetTarget() != 0 )
		c->GetTarget()->ShowStats(c);
	else
		c->ShowStats(c);
}
Reply With Quote