AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to Detect ? (https://forums.alliedmods.net/showthread.php?t=307351)

instinctpt1 05-06-2018 12:10

How to Detect ?
 
How to detect :

If a Player has bought a weapon or not :shock:
And if has bought then what is the weapon or index ??

Natsheh 05-06-2018 12:51

Re: How to Detect ?
 
#include cstrike

PHP Code:

/**
 * Called when a client attempts to purchase an item.
 *
 * @note This is called immediately when the client issues a buy command. The
 *       game has not yet checked if the client can actually buy the weapon.
 * @note For a list of possible item ids see the CSI_* constants.
 *
 * @param index     Client index
 * @param item      Item id
 *
 * @return          PLUGIN_CONTINUE to let the buy attempt continue
 *                  PLUGIN_HANDLED to block the buy attempt
 */
forward CS_OnBuyAttempt(indexitem);

/**
 * Called when a client purchases an item.
 *
 * @note This is called right before the user receives the item and before the
 *       money is deducted from their cash reserves.
 * @note For a list of possible item ids see the CSI_* constants.
 *
 * @param index     Client index
 * @param item      Item id
 *
 * @return          PLUGIN_CONTINUE to let the buy continue
 *                  PLUGIN_HANDLED to block the buy
 */
forward CS_OnBuy(indexitem); 

Sometimes navigating in the includes files is not bad as you think.

Edit : this is for amx v183 dev

instinctpt1 05-06-2018 12:55

Re: How to Detect ?
 
Thnx natsheh <3

iceeedr 05-06-2018 13:07

Re: How to Detect ?
 
Quote:

Originally Posted by Natsheh (Post 2590964)
#include cstrike

PHP Code:

/**
 * Called when a client attempts to purchase an item.
 *
 * @note This is called immediately when the client issues a buy command. The
 *       game has not yet checked if the client can actually buy the weapon.
 * @note For a list of possible item ids see the CSI_* constants.
 *
 * @param index     Client index
 * @param item      Item id
 *
 * @return          PLUGIN_CONTINUE to let the buy attempt continue
 *                  PLUGIN_HANDLED to block the buy attempt
 */
forward CS_OnBuyAttempt(indexitem);

/**
 * Called when a client purchases an item.
 *
 * @note This is called right before the user receives the item and before the
 *       money is deducted from their cash reserves.
 * @note For a list of possible item ids see the CSI_* constants.
 *
 * @param index     Client index
 * @param item      Item id
 *
 * @return          PLUGIN_CONTINUE to let the buy continue
 *                  PLUGIN_HANDLED to block the buy
 */
forward CS_OnBuy(indexitem); 

Sometimes navigating in the includes files is not bad as you think.

Important, only in 1.8.3.

Bugsy 05-06-2018 13:19

Re: How to Detect ?
 
Pre 1.8.3 can use this

instinctpt1 05-06-2018 13:40

Re: How to Detect ?
 
Quote:

Originally Posted by Bugsy (Post 2590971)
Pre 1.8.3 can use this

Yeah i know that but was thinking for another way without any external include, now glad to know that it is by default in 1.8.3 :)


All times are GMT -4. The time now is 04:39.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.