Raised This Month: $ Target: $400
 0% 

random_num


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
lexzor
Veteran Member
Join Date: Nov 2020
Old 01-08-2021 , 19:37   random_num
Reply With Quote #1

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], inumiPlayer
    
    winner 
random_num(1g_szCount)
    
    
get_players(playersinum"ch")
    
    for ( new 
0i<=inumi++){
        
        
iPlayer players[i]
        
        if (
g_szPlayerCount[iPlayer] == winner){
            
            new 
name[MAX_NAME_LENGTH]
            
get_user_name(iPlayernamecharsmax(name))
            
            
ColorChat(0GREEN"[^4%s^3]^1 The winner of giveaway is^3 %s^1!"tagname)
            
ColorChat(0GREEN"[^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 ?

Last edited by lexzor; 01-08-2021 at 19:53.
lexzor is offline
 



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 14:09.


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