it should compile now, ignore the loose indentation warning
test in game and tell me if it works as you want
sorry for being late, i was pretty busy these days
Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <hamsandwich>
#include <zp50_items>
#include <zp50_core>
#include <zp50_class_survivor>
#include <zp50_class_nemesis>
#include <cstrike>
#define ITEM_COST 10
#define ITEM_NAME "Radar"
#define PLUGIN "Zombie Plague extra item - Radar"
#define VERSION "1.4"
#define AUTHOR "Sonic Son'edited Cold-Sky"
new g_msgHostageAdd, g_msgHostageDel, g_maxplayers, g_ItemID;
new player_has_radar[33];
new zp_radar_beep;
new zp_radar_show_dead;
new cvar_zp_radar_beep;
new cvar_zp_radar_single_round;
new cvar_zp_radar_show_dead;
new const sound_radar_beep[] = "zombie_plague/nes_8bit_alien3_radar_beep1.wav"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "event_round_start", "a")
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
g_msgHostageAdd = get_user_msgid("HostagePos")
g_msgHostageDel = get_user_msgid("HostageK")
cvar_zp_radar_beep = register_cvar("zp_radar_beep", "1")
cvar_zp_radar_single_round = register_cvar("zp_radar_single_round", "0")
cvar_zp_radar_show_dead = register_cvar("zp_radar_show_dead", "0")
g_maxplayers = get_maxplayers()
g_ItemID = zp_items_register(ITEM_NAME, ITEM_COST)
for (new i = 1; i<=g_maxplayers;i++) player_has_radar[i] = false;
set_task (2.0,"radar_scan",_,_,_,"b");
}
public plugin_precache()
{
precache_sound(sound_radar_beep)
}
public plugin_cfg()
{
new cfgdir[32]
get_localinfo("amxx_configsdir",cfgdir,sizeof cfgdir)
server_cmd("exec %s/zp_radar.cfg", cfgdir)
}
public event_round_start()
{
if (get_pcvar_num(cvar_zp_radar_beep) == 1)
zp_radar_beep=true;
else
zp_radar_beep=false;
if (get_pcvar_num(cvar_zp_radar_show_dead) == 1)
zp_radar_show_dead=true;
else
zp_radar_show_dead=false;
}
public zp_extra_item_selected(player, itemid)
{
if (itemid == g_ItemID) player_has_radar[player] = true;
}
public radar_scan()
{
new zombie_count = 0;
new human_count = 0;
new zombie_list[32];
new human_list[32];
new ZombieCoords[3];
new HumanCoords[3];
new id, i;
for (new id=1; id<=g_maxplayers; id++)
{
if (zp_radar_show_dead)
{
if (zp_core_is_zombie(id))
{
zombie_count++;
zombie_list[zombie_count]=id;
}
else
{
human_count++;
human_list[human_count]=id;
}
}
else
{
if (is_user_connected(id))
{
if(zp_core_is_zombie(id))
{
zombie_count++;
zombie_list[zombie_count]=id;
}
else
{
human_count++;
human_list[human_count]=id;
}
}
}
}
for (id=1; id<=g_maxplayers; id++)
{
if ((!is_user_alive(id))||(!player_has_radar[id])) continue;
if(zp_core_is_zombie(id))
{
for (i=1;i<=zombie_count;i++)
{
get_user_origin(zombie_list[i], ZombieCoords)
message_begin(MSG_ONE_UNRELIABLE, g_msgHostageAdd, {0,0,0}, id)
write_byte(id)
write_byte(i)
write_coord(ZombieCoords[0])
write_coord(ZombieCoords[1])
write_coord(ZombieCoords[2])
message_end()
message_begin(MSG_ONE_UNRELIABLE, g_msgHostageDel, {0,0,0}, id)
write_byte(i)
message_end()
}
}
else
{
for (i=1;i<=human_count;i++)
{
get_user_origin(human_list[i], HumanCoords)
message_begin(MSG_ONE_UNRELIABLE, g_msgHostageAdd, {0,0,0}, id)
write_byte(id)
write_byte(i)
write_coord(HumanCoords[0])
write_coord(HumanCoords[1])
write_coord(HumanCoords[2])
message_end()
message_begin(MSG_ONE_UNRELIABLE, g_msgHostageDel, {0,0,0}, id)
write_byte(i)
message_end()
}
}
if (zp_radar_beep) emit_sound(id, CHAN_ITEM, sound_radar_beep, 1.0, ATTN_NORM, 0, PITCH_NORM);
}
}
public zp_fw_core_infect_post(id, infector)
{
if(zp_class_nemesis_get(id))
{
player_has_radar[id] = false;
}
else
{
player_has_radar[id] = false;
}
}
public zp_fw_core_cure_post(id)
{
if(zp_class_survivor_get(id))
{
player_has_radar[id] = false;
}
else
{
player_has_radar[id] = false;
}
}
public fw_PlayerKilled(victim, attacker, shouldgib)
{
player_has_radar[victim] = false;
}
public zp_round_ended(winteam)
{
if (get_pcvar_num(cvar_zp_radar_single_round)==1)
for (new id=1; id<=g_maxplayers; id++)
player_has_radar[id] = false;
}
public zp_fw_items_select_pre(id, itemid, ignorecost)
{
// This is not our item
if (itemid != g_ItemID)
return ZP_ITEM_AVAILABLE;
// Radar only available to humans
if (zp_core_is_zombie(id))
return ZP_ITEM_DONT_SHOW;
// Player already has Radar
if (cs_get_user_nvg(id))
return ZP_ITEM_DONT_SHOW;
return ZP_ITEM_AVAILABLE;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/