Raised This Month: $ Target: $400
 0% 

round events


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pob18
Member
Join Date: Jun 2014
Old 06-29-2014 , 16:33   round events
Reply With Quote #1

how to use round events in this menu? (with cvars)

menu name:

1. get deagle + ak47 [1 time each x rounds]
pob18 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-29-2014 , 16:45   Re: round events
Reply With Quote #2

Explain more detailed what are you trying to achieve. But from what I understood, you can use a bool and reset it on new round event, via loop trough all players in the server.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
pob18
Member
Join Date: Jun 2014
Old 06-29-2014 , 17:03   Re: round events
Reply With Quote #3

What exatly i want, is create a function that will check cvar before givirng the deagle with ak47...
Like, you can get the weapon only x(cvar) times x(cvar) in one round
pob18 is offline
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 06-29-2014 , 17:11   Re: round events
Reply With Quote #4

create a new var then make event for new round and add cvar then set the var in new round ++ and check it if (var == ....) and give weapons
Code:
#include <amxmodx> new rounds_count,round_give; public plugin_init() {     register_plugin("x", "0.0", "Freezo")         register_event("HLTV", "newround", "a", "1=0", "2=0");         round_give = register_cvar("round_give","3") } public newround(){     rounds_count++;         if (rounds_count == get_pcvar_num(round_give)){         // do what you wan't :v     } }

Last edited by Freezo Begin; 06-29-2014 at 17:16.
Freezo Begin is offline
Old 06-29-2014, 17:26
Flick3rR
This message has been deleted by Flick3rR. Reason: Stupid
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-29-2014 , 17:36   Re: round events
Reply With Quote #6

Maybe something like this. I'm too tired to explain everything, just made the code. I hope you will get it. If you can't, maybe someone could explain it before me. If not, I could do this.
Take a look.
PHP Code:
#include <amxmodx>
#include <fun>

new CountRounds[33], CountUses[33]
new 
cvarMaxUsescvarPerRounds
new MaxUsesPerRounds
new UserID

public plugin_init() {
    
register_clcmd("say /ak""cmdAK"//Test for counts of uses
    
    
cvarMaxUses register_cvar("max_uses_cvar""3")
    
cvarPerRounds register_cvar("for_x_rounds_cvar""2")
    
    
    
register_event("HLTV""NewRound""a""1=0""2=0")
}

public 
cmdAK(id)
{
    
MaxUses get_pcvar_num(cvarMaxUses)
    
PerRounds get_pcvar_num(cvarPerRounds)
    
    if(
CountUses[id] >=  MaxUses && CountRounds[id] <= PerRounds)
    {
        
client_print(idprint_chat"You have already used ak47 max times (%d) for %d rounds"MaxUsesPerRounds)
        return 
PLUGIN_HANDLED
    
}
    
    
CountUses[id]++
    
UserID get_user_userid(id)
    
give_item(id"weapon_ak47")
    
client_print(idprint_chat"You successfully got ak47!")
    
    return 
PLUGIN_CONTINUE
}

public 
NewRound()
{
    new 
id find_player("k"UserID)
    
    if(!
is_user_connected(id))
        return 
PLUGIN_HANDLED
        
    
if(CountRounds[id] >= PerRounds)
    {
        
CountRounds[id] = 0
        CountUses
[id] = 0
    
}
        
    
CountRounds[id]++
    
    return 
PLUGIN_CONTINUE

__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Reply


Thread Tools
Display Modes

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 21:12.


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