PDA

View Full Version : Little help with TakeMoneyFromPP


ChaosSlayerZ
10-23-2012, 11:22 PM
I am writing a little script for npc who sells items and services, but is not an actual merchant (so people can't sell to him)

However instead of giving money to npc I want script to just take money from the player.

So I need:
1. check if player has enough money
2. take the money

Now:

a=$client->GetCarriedMoney();

if (a> 999 )
{
$client->TakeMoneyFromPP(999, updateclient=false);
}

else
{
quest::say("You don't have enough cash on you to obtain this service!");
}



Does this look right to you? (I don't have a server running atm and can't test it unfortunately)
Also - updateclient=false ? is that right? or should it be true?

Uleat
10-23-2012, 11:48 PM
I didn't fully check this out, but I believe 'updateclient' is a client-specific requirement. (If someone can validate this... Ti = true, SoF+ = false)

If you're catering to a specfic client(ele), you might be able to avoid any checks and keep it hard-coded.

ChaosSlayerZ
10-23-2012, 11:50 PM
ok if I want this to work for all clients, can just omit that part?

Uleat
10-24-2012, 12:03 AM
Disregard..as long as you're not using the merchant interface, I think it will just be updateclient = true.

Client updates are only sent to clients that don't subtract merchant purchases automatically.


If you ARE using a merchant interface, then you will have to determine the client type.

ChaosSlayerZ
10-24-2012, 12:08 AM
oh no, this is just for a regular npc which I specifically want to be a non merchant - as I said in the 1st post - i want player be able to buy, but not sell - so player just tell npc what they want to get and npc takes cash from them.
I am just trying to avoid the hassle of having players giving npc the cash directly which is always cumbersome.

Uleat
10-24-2012, 12:17 AM
Then, yes, it needs to be true. Otherwise it would only deduct the server money and the client would still show the pre-purchase amount. (Sorry for confusion.)

ChaosSlayerZ
10-24-2012, 12:33 AM
no problem, thank you for looking it over ;)