Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
//=================
// declare variables
new players[32]
new playercount, i
new CsTeams:team
//=================
public plugin_init()
{
register_plugin("AWP Battle!", "1.0", "Buildy") // register plugin
register_logevent("round_start", 2, "0=World triggered", "1=Round_Start") //hook round start
register_event("DeathMsg", "on_Death", "a") //hook death event
register_event("CurWeapon","pistol","be")
}
public round_start()
{
set_hudmessage(255, 255, 255, -1.0, 0.35, _, _, 4.3, _, _, 4)
show_hudmessage(0,"****AWP Battle****") // display
set_hudmessage(0, 0, 255, -1.0, -1.0, _, _, 3.7, _, _, 3) // Awp battle
show_hudmessage(0,"Coded by: Buildy.") // greeting
server_cmd("amx_restrict on usp") // restrict weapons
get_players(players, playercount, "a") // get list of players ids
for(i=0; i<playercount; i++)
{
//new ammo, clip, weapon = get_user_weapon(players[i], clip, ammo) // get weapon
//if (weapon == 16 || 17) // pistol?
//{
//team = cs_get_user_team(players[i]) // get players team
//if (team == CS_TEAM_T) // drop pistol
//{
// client_cmd(players[i], "weapon_glock18;drop")
//} else if (team == CS_TEAM_CT)
//{
// client_cmd(players[i], "weapon_usp;drop")
//}
//}
pistol() // remove pistol
give_item(players[i], "weapon_awp") // give everyone an awp
}
}
public on_Death()
{
new sPass[1]
sPass[0] = read_data(2) // player id
set_task(0.5, "spawnagain", _, sPass, 1) // respawn
set_task(0.7, "spawnagain", _, sPass, 1)
set_task(0.7, "awp", _, sPass, 1) // awp giveaway
pistol()
}
//========================
// my functions
//========================
public spawnagain(sPass[])
{
spawn(sPass[0]); // spawn player by id
}
public awp(sPass[])
{
give_item(sPass[0], "weapon_awp") // give item awp to player by id
}
public pistol()
{
new ammo, clip, weapon = get_user_weapon(players[i], clip, ammo) // get weapon
if (weapon == 16 || 17) // pistol?
{
team = cs_get_user_team(players[i]) // get players team
if (team == CS_TEAM_T) // drop pistol
{
client_cmd(players[i], "weapon_glock18;drop")
} else if (team == CS_TEAM_CT)
{
client_cmd(players[i], "weapon_usp;drop")
}
}
}