hello. i want to make a giveaway plugin. i want that a player with a specific flag start the giveaway. when a giveaway is started, then players open the menu and join the giveaway. ok until now, but i'm trying to create a random chooser which select a player which have a boolean on true. i don t know how to do that. that where i'm stuck.
PHP Code:
public randomchooser(id){
static winner
new players[MAX_PLAYERS + 1], inum, iPlayer
winner = random_num(1, g_szCount)
get_players(players, inum, "ch")
for ( new i = 0; i<=inum; i++){
iPlayer = players[i]
if (g_szPlayerCount[iPlayer] == winner){
new name[MAX_NAME_LENGTH]
get_user_name(iPlayer, name, charsmax(name))
ColorChat(0, GREEN, "[^4%s^3]^1 The winner of giveaway is^3 %s^1!", tag, name)
ColorChat(0, GREEN, "[^4%s^3]^1 Congratulations!", tag)
}
}
}
how can i make that plugin read all players who have joinet the giveaway and make it to choose a random player who joined the giveaway ?