Raised This Month: $ Target: $400
 0% 

[HELP] Random Selections


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
lis_16
Senior Member
Join Date: Feb 2008
Old 03-23-2011 , 17:42   Re: [HELP] Random Selections
Reply With Quote #2

Try this:

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

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"




#define OFFSET_TEAM 114
#define fm_get_user_team(%1) get_pdata_int(%1, OFFSET_TEAM)


new g_msg_teaminfo


enum
{
    
CS_TEAM_UNASSIGNED 0,
    
CS_TEAM_T,
    
CS_TEAM_CT,
    
CS_TEAM_SPECTATOR
}


new const 
g_teaminfo[][] = 

    
"UNASSIGNED"
    
"TERRORIST",
    
"CT",
    
"SPECTATOR" 
}


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent("nowa_runda"2"1=Round_Start")
    
g_msg_teaminfo get_user_msgid("TeamInfo")

}



public 
nowa_runda(){
    new  
graczelosowanie
    gracze
=get_playersnum()
    static 
players[32], pnum
    get_players
(playerspnum"a")
    if(
pnum>0)
    
losowanie=players[random(pnum)]
    for(new 
id=0id<=graczeid++){
        if(
is_user_connected(id) && is_user_alive(id) && id==losowanie){
            
fm_set_user_team(idCS_TEAM_CT)
        }
        else{
            if(
is_user_connected(id) && is_user_alive(id)){
            
fm_set_user_team(idCS_TEAM_T)
        }
    }
}

    
}


stock fm_set_user_team(indexteamupdate 1)
{
    
set_pdata_int(indexOFFSET_TEAMteam)
    if(
update)
    {
        
emessage_begin(MSG_ALLg_msg_teaminfo)
        
ewrite_byte(index)
        
ewrite_string(g_teaminfo[team])
        
emessage_end()
    }
    return 
1

lis_16 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:34.


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