Raised This Month: $ Target: $400
 0% 

Every x rounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dasha
Senior Member
Join Date: Apr 2012
Location: \%STEAM -> $_SESSION
Old 07-08-2012 , 19:01   Every x rounds
Reply With Quote #1

Can't find a tut about it, there's one about round events, but can't combine it with what I need..so I ask for help

I will leave a example so you can understand what I need :L

PHP Code:

new cvar_1cvar_2cvar_3

public plugin_init() {
    
    
register_clcmd("say cvar1""cmdCvar1")
    
register_clcmd("say cvar2""cmdCvar2")
    
register_clcmd("say cvar3""cmdCvar3")

    
cvar_1 register_cvar("cvar3""2")
    
cvar_2 register_cvar("cvar2""3")
    
cvar_3 register_cvar("cvar3""5")
}

public 
cmdCvar1(id) {
    
    
// round event ( cvar_1 is "2", so you can get awp every 2 rounds
    
    
give_item(id"weapon_awp")
    
}

public 
cmdCvar2(id) {
    
    
// round event ( cvar_2 is "3", so you can get scout every 3 rounds
    
    
give_item(id"weapon_scout"
}

public 
cmdCvar3(id) {
    
    
// round event ( cvar_3 is "5", so you can get famas every 5 rounds
    
    
give_item(id"weapon_famas"

That's all
dasha is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-08-2012 , 19:07   Re: Every x rounds
Reply With Quote #2

Use counter variables in combination with this.
__________________
Bugsy is offline
dasha
Senior Member
Join Date: Apr 2012
Location: \%STEAM -> $_SESSION
Old 07-09-2012 , 12:57   Re: Every x rounds
Reply With Quote #3

Would be better if you show an example.

Last edited by dasha; 07-09-2012 at 12:57.
dasha is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 07-09-2012 , 13:39   Re: Every x rounds
Reply With Quote #4

Have a global round-counter i.e. new g_rndCnt
At the beginning of each round g_rndCnt++
Then to figure out if its the proper round do....
Code:
// globals
new g_rndCnt

// Event_Spawn- whatever you want to hook spawn to
g_rndCnt++

// cmdCvar functions
if(g_rndCnt % get_pcvar_num(cvar_2) == 0)
// Execution for weapon_scout
This will check if its the proper round. If you want more informatio on the % operator. Look up modulus. Its a VERY popular operation. Won't be hard to find stuff on it.
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 07-09-2012 at 13:45.
Liverwiz is offline
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 15:16.


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