Randomization player
Hello everyone, I apologize for the English, please tell me how can I make a random distribution of roles?
I need to call the function, implement the issuance of roles for the players. There is a certain but, the role is assigned g_iRole [iClient] = Role_Name There is a counter of how many roles need to be given to players, that is, based on the number of roles, it is necessary to randomly assign them to the players. my counter roles: Code:
void CalculateRoles() Thank you very much for those who can help |
Re: Randomization player
I tried to do this, but I'm not sure if this is a normal solution. Someone does not give a role at all.
Code:
void InitRoles() |
Re: Randomization player
I wanted to show one "random" way shuffle players, using adt_array with custom sort.
But I'm bit lost about "roles", how those need work... I let that part out for now. You see in this Console output how it does. Code:
map : de_dust2 at: 0 x, 0 y, 0 z Code sample is here. PHP Code:
|
Re: Randomization player
Quote:
and let's say for 30 players you need to distribute 2 roles to 3 players out of 30 players |
Re: Randomization player
Check out how it's done in TTT
Detective, Traitor, Innoncent https://forums.alliedmods.net/showthread.php?p=2357981 |
All times are GMT -4. The time now is 19:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.