Raised This Month: $ Target: $400
 0% 

a limit on the rounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Joker2020
Junior Member
Join Date: Aug 2020
Old 09-01-2020 , 13:47   a limit on the rounds
Reply With Quote #1

hi, I tried to make a limit on the purchase of awp by rounds, but I did not succeed, so I could buy 1 time in 3 rounds, please help me

where added himself marked so //added

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>

new g_pCvar_Price;
new 
g_Round_counter;   //added

public plugin_init() 
{
         
register_plugin("Buy AWP""0.0.1""dinnk.");
         
register_event("HLTV""RoundStart""a""1=0""2=0");  //added
         
register_cvar("amx_f_every_rounds","3");  //added
    
         
register_clcmd("say /awp""CmdAwp");
    
         
g_pCvar_Price register_cvar("awp_deagle_price""150");
         
g_Round_counter get_cvar_num("amx_f_every_rounds");  //added
}

public 
RoundStart(){  //added
    
g_Round_counter++

public 
CmdAwp(id){

    if(
g_Round_counter >= get_cvar_num("amx_f_every_rounds")){  //added
    
g_Round_counter 0
         
         
new iMoney cs_get_user_money(id);
         new 
iPrice get_pcvar_num(g_pCvar_Price);
    
         if( !
is_user_alive(id) )
         {
                 
client_print(idprint_chat"* You need to be alive !");
             return 
PLUGIN_HANDLED;
         }
    
         if( 
iMoney iPrice )
         {
             
client_print(idprint_chat"* You need more money ! ($%i)"iPrice);
             return 
PLUGIN_HANDLED;
         }
    
         
give_item(id"weapon_awp");
         
give_item(id"weapon_deagle");
         
cs_set_user_bpammo(idCSW_AWP30);
         
cs_set_user_bpammo(idCSW_DEAGLE35);
    
         
client_print(idprint_chat"* You bought an AWP & Deagle for $%i !"iPrice);
         
cs_set_user_money(idiMoney iPricetrue);
         return 
PLUGIN_HANDLED;

Joker2020 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:44.


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