HasGold(int, object)

Determines if a player has more than a certain amount of gold on them.

int HasGold(
    int nAmount,
    object oGoldHolder
);

Parameters

nAmount

The amount of gold to check.

oGoldHolder

The person to check how much gold they carry.


Description

Returns TRUE if oGoldHolder has nAmount or more gold on them, otherwise returns FALSE.



Remarks

This is a wrapper function for GetGold().

Does not remove any gold from the inventory during the check.


Requirements

#include "NW_I0_PLOT"

Version

1.22

Example

// This example will check the player who is currently speaking 
// to see if they have enough gold to purchase something for 
// 250 GP.
 
#include "NW_I0_PLOT"
 
// Do they have enough gold to buy it?
if (HasGold (250, GetPCSpeaker()))
{
    // do something here.
}
else
{
    // poor, make the NPC insult them
}

See Also

functions: GetGold
categories: Inventory Functions | Money Functions


 author: Tom Cassiotis, editor: Charles Feduke, additional contributor(s): Ivan Hawkes
 Send comments on this topic.