Buy

Category: Objects / Creation
Since engine version: 4.9.1.0 GWE

Description

Buys an object for iForPlr, deducting the wealth of iPayPlr. The function will fail if the paying player does not have enough money or the object is currently not available in the home base material.

Syntax

object Buy (id idBuyObj, int iForPlr, int iPayPlr, object pToBase, bool fShowErrors);

Parameters

idBuyObj:
Type of object to be bought
iForPlr:
Owner (player number) of the new object
iPayPlr:
Number of the player who pays for the object
pToBase:
[opt] Target object in which the new object is placed
fShowErrors:
[opt] If not 0, failure messages such as "Buying not possible" are displayed, e.g. if there is not enough money.

Example

Buy(CNKT, 0, 0, FindBase(0), 1);
Buys a rock at the base of the first player.
See also: FindBase, GetBase, GetWealth, Sell
Sven2, November 2001