Raised This Month: $ Target: $400
 0% 

[HELP] Get player/bot id and randomize?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 09-27-2015 , 15:23   Re: [HELP] Get player/bot id and randomize?
Reply With Quote #6

This is valid?

PHP Code:
#include < amxmodx >
#include < fun >
#include < cstrike >
#Include < hamsandwich >

new random_weapons[][] =
{
    
"weapon_awp",
    
"weapon_m249"
}

public 
plugin_init()
{
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn"1);
}

public 
client_disconnect(id)
{
    if( 
g_iLastChoosenPlayer == id )
    {
        
g_iLastChoosenPlayer 0
    
}
}

public 
fw_PlayerSpawn(id)
{
    
random_player();
    new 
sizeof_weapons random(sizeof random_weapons);
    
give_item(idrandom_weapons[sizeof_weapons]);
    
cs_set_user_bpammo(idget_weaponid(random_weapons[sizeof_weapons]), 90);  
}

public 
random_player()
{
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum"ac")
    if( 
iNum <= )
    {
        return 
iPlayers[0]
    }
    new 
iRandomNum random(iNum)
    new 
iRandomPlayer iPlayersiRandomNum ]
    if( 
iRandomPlayer == g_iLastChoosenPlayer )
    {
        
iPlayersiRandomNum ] = iPlayers[ --iNum ]
        
iRandomPlayer iPlayersrandom(iNum) ]
    }
    
g_iLastChoosenPlayer  iRandomPlayer
    
return iRandomPlayer

__________________









Last edited by CrazY.; 09-27-2015 at 20:36.
CrazY. 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 22:04.


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