Raised This Month: $51 Target: $400
 12% 

Suggestion / Subplugin Request [REQ][Addon] Radar for Nem & Sur


Post New Thread Reply   
 
Thread Tools Display Modes
M@RSH@L
Member
Join Date: Jan 2012
Old 08-22-2015 , 09:06   Re: [REQ][Addon] Radar for Nem & Sur
Reply With Quote #11

this plugin is only work for humans but i added 2 lines to make it available to Survivor:

added in zp_fw_items_select_pre :

PHP Code:
if (zp_class_survivor_get(id)) 
        return 
ZP_ITEM_AVAILABLE
and i tested it , works fine as extra
__________________
M@RSH@L is offline
Send a message via Yahoo to M@RSH@L Send a message via Skype™ to M@RSH@L
Depresie
Veteran Member
Join Date: Nov 2013
Old 08-22-2015 , 09:45   Re: [REQ][Addon] Radar for Nem & Sur
Reply With Quote #12

sorry, i have put false instead of true at nemesis and survivor
not survivors and nemesis should recieve it automaticaly
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] = true;
    }
    else
    {
        player_has_radar[id] = false;
    }
}

public zp_fw_core_cure_post(id)
{
    if(zp_class_survivor_get(id))
    {
        player_has_radar[id] = true;
    }
    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 }
*/

Last edited by Depresie; 08-22-2015 at 09:47.
Depresie is offline
M@RSH@L
Member
Join Date: Jan 2012
Old 08-22-2015 , 10:50   Re: [REQ][Addon] Radar for Nem & Sur
Reply With Quote #13

Now it work, but it just show myself in radar as red (enemy ) and dont show no one else
__________________
M@RSH@L is offline
Send a message via Yahoo to M@RSH@L Send a message via Skype™ to M@RSH@L
Depresie
Veteran Member
Join Date: Nov 2013
Old 08-22-2015 , 13:56   Re: [REQ][Addon] Radar for Nem & Sur
Reply With Quote #14

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] = true;
    }
    else
    {
        player_has_radar[id] = false;
    }
}

public zp_fw_core_cure_post(id)
{
    if(zp_class_survivor_get(id))
    {
        player_has_radar[id] = true;
    }
    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 }
*/
Depresie is offline
M@RSH@L
Member
Join Date: Jan 2012
Old 08-22-2015 , 15:21   Re: [REQ][Addon] Radar for Nem & Sur
Reply With Quote #15

wow, Well done mate its work great

is there anyway to remove dead zombies or humans from radar ?

is it possible to remove useless codes !
__________________
M@RSH@L is offline
Send a message via Yahoo to M@RSH@L Send a message via Skype™ to M@RSH@L
Depresie
Veteran Member
Join Date: Nov 2013
Old 08-22-2015 , 16:43   Re: [REQ][Addon] Radar for Nem & Sur
Reply With Quote #16

Code:
if (zp_core_is_zombie(id))
---->
Code:
if(zp_core_is_zombie(id) && is_user_alive(id))
Depresie is offline
M@RSH@L
Member
Join Date: Jan 2012
Old 08-23-2015 , 03:16   Re: [REQ][Addon] Radar for Nem & Sur
Reply With Quote #17

GJ

Thanks Depresie for your Help
__________________
M@RSH@L is offline
Send a message via Yahoo to M@RSH@L Send a message via Skype™ to M@RSH@L
Dr Zayd
Senior Member
Join Date: Jun 2014
Location: forums.alliedmods.net
Old 08-31-2015 , 10:06   Re: [REQ][Addon] Radar for Nem & Sur
Reply With Quote #18

can you make it for ZPA or ZP6.2 / 6.4 ?
Dr Zayd is offline
Reply



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 03:26.


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