Thread: CS_OnBuyAttempt
View Single Post
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 02-13-2016 , 10:21   CS_OnBuyAttempt
Reply With Quote #1

Hi i am again here

A player have reported to me that function is broken:

PHP Code:
public CS_OnBuyAttempt(id,iItem)
{
    if((
iItem == CSI_DEFUSER) && !cs_get_user_defuse(id))
    {
        new 
iMoney cs_get_user_money(id);
        
        if(
iMoney >= 200)
        {
            
cs_set_user_money(id,iMoney 200);
        }
    }

This is a small fix to discount money if player will buy a defuse, but the problem is for Team TR side.
The money will be deduced if TR not have defuse, and i know that i can add a team check to fix that.

But the real problem is that player have defuser command in autobuy.txt, and CS is trying to buy a defuse even if he is TR.

Ps. It is possible to add a team in function header, soo i not need to retreive cs_get_user_team?

Thanks for read, and sorry if is not a valid issue here.

__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY