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(id, random_weapons[sizeof_weapons]);
cs_set_user_bpammo(id, get_weaponid(random_weapons[sizeof_weapons]), 90);
}
public random_player()
{
new iPlayers[32], iNum
get_players(iPlayers, iNum, "ac")
if( iNum <= 1 )
{
return iPlayers[0]
}
new iRandomNum = random(iNum)
new iRandomPlayer = iPlayers[ iRandomNum ]
if( iRandomPlayer == g_iLastChoosenPlayer )
{
iPlayers[ iRandomNum ] = iPlayers[ --iNum ]
iRandomPlayer = iPlayers[ random(iNum) ]
}
g_iLastChoosenPlayer = iRandomPlayer
return iRandomPlayer
}
__________________