AlliedModders

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

layka_LUBII 12-17-2014 10:19

Five round function
 
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
}
}

jimaway 12-17-2014 11:05

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

layka_LUBII 12-17-2014 11:46

Re: Five round function
 
Thank you
working 100%

.Dare Devil. 12-17-2014 12:00

Re: Five round function
 
Quote:

Originally Posted by jimaway (Post 2236450)
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 ... ?

jimaway 12-18-2014 07:51

Re: Five round function
 
Quote:

Originally Posted by .Dare Devil. (Post 2236475)
// 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


All times are GMT -4. The time now is 15:27.

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