Raised This Month: $ Target: $400
 0% 

Five round function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
layka_LUBII
Senior Member
Join Date: Jul 2012
Old 12-17-2014 , 10:19   Five round function
Reply With Quote #1

Hello, I need plugin
I want. that evry 5 round show function event_startround()

Thank you

public event_startround()
{
new index, num, x, i, players[32]

get_players(players, num)

index = random_num(0, num - 1)

for(x = index + 1; ; x++)
{
if(x >= num) x = 0

i = players[x]

if ( cs_get_user_team(i) == CS_TEAM_T )
{
set_task(1.0,"vitekmenu",i);

break;
}

if(x == index) break
}
}

Last edited by layka_LUBII; 12-17-2014 at 11:00.
layka_LUBII is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 12-17-2014 , 11:05   Re: Five round function
Reply With Quote #2

Code:
new g_iroundcount public event_startround() { if (g_iroundcount++ % 5) return //your code here... }

Last edited by jimaway; 12-17-2014 at 11:10.
jimaway is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 12-17-2014 , 12:00   Re: Five round function
Reply With Quote #3

Quote:
Originally Posted by jimaway View Post
Code:
new g_iroundcount public event_startround() { if (g_iroundcount++ % 5) return //your code here... }
// your code here
gets called every round except 5, 10, 15 ... ?
.Dare Devil. is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 12-18-2014 , 07:51   Re: Five round function
Reply With Quote #4

Quote:
Originally Posted by .Dare Devil. View Post
// your code here
gets called every round except 5, 10, 15 ... ?
no, modulo finds the remainder of division. that remainder is 0 when the roundcount is 5, 10, 15 etc. meaning the if statement fails (0 is false), the function is not exited and code gets executed
jimaway is offline
layka_LUBII
Senior Member
Join Date: Jul 2012
Old 12-17-2014 , 11:46   Re: Five round function
Reply With Quote #5

Thank you
working 100%
layka_LUBII 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 15:27.


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