AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   round events (https://forums.alliedmods.net/showthread.php?t=243106)

pob18 06-29-2014 16:33

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

menu name:

1. get deagle + ak47 [1 time each x rounds]

Flick3rR 06-29-2014 16:45

Re: round events
 
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.

pob18 06-29-2014 17:03

Re: round events
 
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

Freezo Begin 06-29-2014 17:11

Re: round events
 
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     } }

Flick3rR 06-29-2014 17:36

Re: round events
 
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




All times are GMT -4. The time now is 21:12.

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