Remove money from client
I'm trying to figure out how to remove a certain platinum amount from the client in the server code. It looks like m_pp.platinum is what i use to designate the clients platinum but its not recognizing m_pp when i compile. ( error message: 'm_pp' : undeclared identifier) I'm guessing I need to use a #include to another file but I cant figure out which one. Am I doing this wrong?
|
m_pp is a private member of the Client class (see zone/client.h), so if you were trying to manipulate m_pp.platinum within a method/function of the Client class, it should work.
If you are trying to do this from within a method from another class, then you would need a pointer to a client object, then you could use Code:
Client::TakeMoneyFromPP(uint64 copper, bool updateclient=false); |
I'm trying to add a check and plat removal for spawning a bot, I just cant figure out how to use the above takemoneyfrompp to check for the clients pp amount and then to remove the pp. I want to set the price equal to the clients level. This is all within bot.cpp
|
Well, if you want to do it where the #bot spawn command is processed in bot.cpp, you could add this around line 12424:
Code:
if(!c->HasMoney(c->GetLevel() * 1000)) Code:
Bot* TempBot = LoadBot(botId, &TempErrorMessage); Note that the HasMoney/TakeMoneyFromPP methods take copper as an argument, so 1000 is 1 platinum. |
awesome, thanks a lot!
|
I'm trying to use updateclient=true but updateclient isnt recognized, any way I can update the client money after the bot has spawned?
EDIT - NM i figured it out, just saw you updated your posted code, thanks again |
All times are GMT -4. The time now is 03:26 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.