AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   reload sounds & ZP (https://forums.alliedmods.net/showthread.php?t=105188)

One 10-02-2009 06:12

reload sounds & ZP
 
hey,

i never played or used ZP. so i think this can take more time to read the all code of ZP & use it to see how this works.

http://forums.alliedmods.net/showthr...=101137&page=2

so can anyone just give me any tipps what i have to do to make my plug-in compatible with ZP?
you just need to say what i have todo. no code.

Arkshine 10-02-2009 06:20

Re: reload sounds & ZP
 
Just see the .inc file.

One 10-02-2009 06:29

Re: reload sounds & ZP
 
Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

#define MAX_PLAYERS 32

new g_iconstatus, g_pcv_iloc
new g_user_icons[MAX_PLAYERS+1][16]
new g_RadioTimer[33]
public plugin_init()
{
    register_plugin("Reload sounds", "1.0", "One")
   
    register_forward(FM_PlayerPreThink, "preThink")
    register_event("AmmoX", "draw_icon", "be")
    register_event("DeathMsg", "event_death", "a")
    g_pcv_iloc = register_cvar("amx_weapon_location", "1")
   
    check_icon_loc()
}
public draw_icon(id)
{
    static iwpn, clip, ammo, icon_color[3]
   
    iwpn = get_user_weapon(id, clip, ammo)
   
   
    if ((ammo == 0 && clip == 0))
        icon_color = {255, 0, 0}
    else if ( ammo==0 && iwpn!=CSW_KNIFE)
        icon_color = {255, 160, 0}
    else
        icon_color = {0, 160, 0}
   
   
    message_begin(MSG_ONE,g_iconstatus,{0,0,0},id)
    write_byte(2)
    write_string(g_user_icons[id])
    write_byte(icon_color[0])
    write_byte(icon_color[1])
    write_byte(icon_color[2])
    message_end()
}
public remove_weapon_icon(id)
{
    message_begin(MSG_ONE,g_iconstatus,{0,0,0},id)
    write_byte(0)
    write_string(g_user_icons[id])
    message_end()
}
public event_death()
{
    new id = read_data(2)
   
    if (!is_user_bot(id))
        remove_weapon_icon(id)
}
public check_icon_loc()
{
    new value = get_pcvar_num(g_pcv_iloc)
   
    if (value == 1)
        g_iconstatus = get_user_msgid("StatusIcon")
    else if (value == 2)
        g_iconstatus = get_user_msgid("Scenario")
    else
        g_iconstatus = 0
   
    return PLUGIN_CONTINUE
}
public plugin_precache()
{
    precache_sound("Reloading01.wav")
    precache_sound("Reloading02.wav")
    precache_sound("Reloading03.wav")
    precache_sound("Reloading04.wav")
}
public preThink(id)
{
    if(g_RadioTimer[id] == 1)
                return PLUGIN_HANDLED
    new  clip, ammo
    new button = pev(id,pev_button)
    static  iwpn
    iwpn = get_user_weapon(id, clip, ammo)
    remove_weapon_icon(id)
   
    check_icon_loc()
   
    static sprite[16]//, iwpn, clip, ammo

    iwpn = get_user_weapon(id, clip, ammo)
   
    switch(iwpn)
    {
            case CSW_P228:        sprite="d_p228";
            case CSW_SCOUT:        sprite="d_scout";
            case CSW_HEGRENADE:        sprite="d_grenade";
            case CSW_XM1014:        sprite="d_xm1014";
            case CSW_MAC10:        sprite="d_mac10";
            case CSW_AUG:        sprite="d_aug";
            case CSW_SMOKEGRENADE:    sprite="d_flashbang";
            case CSW_ELITE:        sprite="d_elite";
            case CSW_FIVESEVEN:        sprite="d_fiveseven";
            case CSW_UMP45:        sprite="d_ump45";
            case CSW_SG550:        sprite="d_sg550";
            case CSW_GALIL:        sprite="d_galil";
            case CSW_FAMAS:        sprite="d_famas";
            case CSW_USP:        sprite="d_usp";
            case CSW_MP5NAVY:        sprite="d_mp5navy";
            case CSW_M249:        sprite="d_m249";
            case CSW_M3:            sprite="d_m3";
            case CSW_M4A1:        sprite="d_m4a1";
            case CSW_TMP:        sprite="d_tmp";
            case CSW_G3SG1:        sprite="d_g3sg1";
            case CSW_FLASHBANG:        sprite="d_flashbang";
            case CSW_DEAGLE:        sprite="d_deagle";
            case CSW_SG552:        sprite="d_sg552";
            case CSW_AK47:        sprite="d_ak47";
            case CSW_KNIFE:        sprite="d_knife";
            case CSW_P90:        sprite="d_p90";
            case CSW_GLOCK18:        sprite="d_glock18";
            case CSW_AWP:        sprite="d_awp";
    }         
    if(!(iwpn == CSW_C4)&&!(iwpn == CSW_KNIFE)&&!(iwpn == CSW_FLASHBANG)&&!(iwpn == CSW_HEGRENADE)&&!(iwpn == CSW_SMOKEGRENADE)&& button & IN_RELOAD && get_user_weapon(id, ammo,clip) && clip >= 1 && ammo <= 5 && !zp_get_user_zombie( id ))
    {       
        new players[32],total, team_name[10]
        get_user_team(id,team_name, 9)
        get_players(players, total ,"ce", team_name)
        new name[32]
        get_user_name(id,name,31)
        for(new a=0; a < total; ++a)
        {
            client_print(players[a],print_chat,"%s (RADIO): Reloading.",name)
       
            switch(random_num(0,2))
            {
                case 0:
                {
                    emit_sound(id, CHAN_ITEM, "Reloading01.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
                }
                case 1:
                {
                    emit_sound(id, CHAN_ITEM, "Reloading02.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
                }
                case 2:
                {
                    emit_sound(id, CHAN_ITEM, "Reloading03.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
                }
                case 3:
                {
                    emit_sound(id, CHAN_ITEM, "Reloading04.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
                }
            }
            g_RadioTimer[id] = 1
            set_task(2.0,"radiotimer",id)
            g_user_icons[id] = sprite
   
            draw_icon(id)
        }
    }
    return FMRES_HANDLED
}
public radiotimer(id)
{
    g_RadioTimer[id] = 0
    return PLUGIN_HANDLED
}
public client_connect(id)
{
    g_RadioTimer[id] = 0
}
public client_disconnect(id)
{
    g_RadioTimer[id] = 0
}/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1031\\ f0\\ fs16 \n\\ par }
*/

lol ? just this ?

Arkshine 10-02-2009 06:45

Re: reload sounds & ZP
 
I was meant you have to take a look at natives/forward and adapting your code. I guess it's only for humans, so you have to add some checks.

One 10-02-2009 06:47

Re: reload sounds & ZP
 
Quote:

Originally Posted by Arkshine (Post 949915)
I was meant you have to take a look at natives/forward and adapting your code. I guess it's only for humans, so you have to add some checks.

not enough ?

if(!(iwpn == CSW_C4)&&!(iwpn == CSW_KNIFE)&&!(iwpn == CSW_FLASHBANG)&&!(iwpn == CSW_HEGRENADE)&&!(iwpn == CSW_SMOKEGRENADE)&& button & IN_RELOAD && get_user_weapon(id, ammo,clip) && clip >= 1 && ammo <= 5 && !zp_get_user_zombie( id ))

Arkshine 10-02-2009 06:56

Re: reload sounds & ZP
 
Think more :/. You could just set g_RadioTimer[id] on 1 when a zombie spawns. You have forwards, use them. Also the icon stuff has nothing to do with zombie...

One 10-02-2009 07:06

Re: reload sounds & ZP
 
ok ty. i think i got it now.


All times are GMT -4. The time now is 22:34.

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