Raised This Month: $ Target: $400
 0% 

random_num


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
lexzor
Veteran Member
Join Date: Nov 2020
Old 01-09-2021 , 06:50   Re: random_num
Reply With Quote #5

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <ColorChat>
#include <nvault>

#define PLUGIN "giveaway"
#define VERSION "1.0"
#define AUTHOR "lexzor"

#define YT_FLAG ADMIN_LEVEL_F

new key MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0;

new const 
tag[] = "JoiNET"

new bool:g_bGwJoined[MAX_PLAYERS 1]
new 
bool:g_bGwStarted

new g_bCount 0
new g_bPlayerCount[MAX_PLAYERS +1]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_menu("gwmenu"key"gwmenu_handler")
    
register_menu("gwstart"key"gwstart_handler")
    
}

public 
gwmenu(id){
    static 
szMenu[650], ilen
    
    ilen 
+= formatex(szMenu[ilen], charsmax(szMenu), "\y[%s]\w YouTube Giveaway"tag)
    
    
    if (
get_user_flags(id) & YT_FLAG)
        
ilen += formatex(szMenu[ilen], charsmax(szMenu), "\r1.\w Start giveaway"tag)
    else
        
ilen += formatex(szMenu[ilen], charsmax(szMenu), "\r1.\w Start a giveaway - \d [YT ONLY]")
    
    
ilen += formatex(szMenu[ilen], charsmax(szMenu), "\r2.\w Join giveaway")
    
    
ilen += formatex(szMenu[ilen], charsmax(szMenu), "\r0.\y Exit")
    
}

public 
gwmenu_handler(idkey){
    
    switch(
key){
        
        case 
1:{
            
            if(
get_user_flags(id) & YT_FLAG)
                
gwstart(id)
            else
                
ColorChat(idGREEN"[^4%s^3]^1 You have to be an^4 YouTuber to start a giveaway^1!"tag)
            
        }
        
        case 
2:{
            
            if(
g_bGwStarted)
                
gwjoin(id)
            else if (!
g_bGwStarted)
                
ColorChat(idGREEN"[^4%s^3]^1 There doesn't exist^4 an started giveaway^1!"tag)
            
        }
        
        case 
0:{
            
            return
            
        }
        
    }
    
}

public 
gwstart(id){
    
    new 
szMenu[650], ilen
    ilen 
0
    
    ilen 
+= formatex(szMenu[ilen], charsmax(szMenu), "\y[%s]\w YouTube Giveaway"tag)
    
    if(!
g_bGwStarted)
        
ilen += formatex(szMenu[ilen], charsmax(szMenu), "\r1.\w Start a giveaway")
    else if (
g_bGwStarted)
        
ilen += formatex(szMenu[ilen], charsmax(szMenu), "\r1.\d Giveaway running")
    
    
    if (
g_bGwStarted)
        
ilen += formatex(szMenu[ilen], charsmax(szMenu), "\r2.\y Choose a random player")
    else if (!
g_bGwStarted)
        
ilen += formatex(szMenu[ilen], charsmax(szMenu), "\r2.\d Choose a random player")
    
    
ilen += formatex(szMenu[ilen], charsmax(szMenu), "\r0.\y Exit")
}

public 
gwstart_handler(idkey){
    
    switch(
key){
        
        case 
1:{
            
            
g_bGwStarted true
            
        
}
        
        case 
2:{
            
            
randomchooser(id)
            
        }
        
    }
    
    
}

public 
gwjoin(id){
    
    
    
g_bCount++
    
    
g_bPlayerCount[id] = g_bCount
    
}


public 
randomchooser(id){
    
    static 
winner
    
new players[MAX_PLAYERS 1], inumiPlayer
    
    winner 
random_num(1g_bCount)
    
    
get_players(playersinum)
    
    for ( new 
0i<=inumi++){
        
        
iPlayer players[i]
        
        if (
g_bPlayerCount[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)
            
        }
        
    }
    
    

this is what i did until now.

i don't understand what this is:

PHP Code:
 if ( g_JoinedGiveaway & ( << ( id 31 ) ) ) 
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