[SOLVED]Best way to randomly choose a random player from the enemy team?
Hi. I would like to request a code snippet where you can randomly choose a random enemy player. I am trying to create a "smite" like plugin where a random enemy player gets smitten. Thanks!
|
Re: [Snippet request]Best way to randomly choose a random player from the enemy team?
Search around a bit, this has been covered. Are you trying to avoid duplicates or any other conditions?
|
Re: [Snippet request]Best way to randomly choose a random player from the enemy team?
I made this code using the other parts of the plugin I am editing right now(cypis' killstreak plugin)
The thing is this bombs EVERY enemy on the map, I only need a single random enemy to get bombed. Can you help me with this one, please? Code:
public CreatePredator2(id) |
Re: [Snippet request]Best way to randomly choose a random player from the enemy team?
PHP Code:
PHP Code:
|
Re: [Snippet request]Best way to randomly choose a random player from the enemy team?
Quote:
PHP Code:
|
Re: [Snippet request]Best way to randomly choose a random player from the enemy team?
Thanks guys, I'm gonna try this out.
EDIT: Working fine now, except compiler tells me that iPlayers //this line return iPlayers[random(iPnum)] should return a value. How do I fix that?(Sorry extra noob scripter here) |
Re: [Snippet request]Best way to randomly choose a random player from the enemy team?
PHP Code:
PHP Code:
|
Re: [Snippet request]Best way to randomly choose a random player from the enemy team?
Best to avoid using magic numbers. I'd do the below or use cstrike for CS_TEAM_T.
PHP Code:
|
Re: [Snippet request]Best way to randomly choose a random player from the enemy team?
Quote:
|
Re: [Snippet request]Best way to randomly choose a random player from the enemy team?
enum numerates the variables starting from 0 if no other default value is assigned.
|
| All times are GMT -4. The time now is 21:03. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.