AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Help / Support ZP Golden Items Issue (Fix) (https://forums.alliedmods.net/showthread.php?t=330273)

NTARIS 01-27-2021 08:08

ZP Golden Items Issue (Fix)
 
GOT THIS ISSUE WITH GOLDEN AWP AS EXPLAINED BELOW:


THE PROBLEM IS THAT THE BP AMMO OF GOLDEN AWP ARE 10/0,SHOULD BE (10/30).
So what happens in game is that the awp gots 0 spare bullets to reload.(10/0).

Also i discovered that if i buy first the normal awp from zp extra items menu that exists by default
and then after that as second purchase i buy the golden awp from zp extra items menu the goldens's awp magazine's works fine as (10/30).

SOMTHING IS NOT ADDED TO ORIGINAL CODE CAN ANYONE FIX THAT SO WE CAN PUBLISH A FIXED VERSION PLEASE?


Code:

/*
[ZP] Extra Item: Golden AWP
Team: Humans
*/



#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <zombieplague>

#define is_valid_player(%1) (1 <= %1 <= 32)

new awp_V_MODEL[64] = "models/zombie_plague/v_goldenawp.mdl"

/* Pcvars */
new cvar_dmgmultiplier, cvar_goldbullets,  cvar_custommodel, cvar_uclip

// Item ID
new g_itemid

new bool:g_Hasawp[33]

new bullets[ 33 ]

// Sprite
new m_spriteTexture

const Wep_awp = ((1<<CSW_AWP))

public plugin_init()
{
       
        /* CVARS */
        cvar_dmgmultiplier = register_cvar("zp_awp_dmg_multiplier", "7")
        cvar_custommodel = register_cvar("zp_awp_custom_model", "1")
        cvar_goldbullets = register_cvar("zp_awp_gold_bullets", "1")
        cvar_uclip = register_cvar("zp_awp_unlimited_clip", "0")       
        // Register The Plugin
        register_plugin("[ZP] Extra: Golden AWP", "1.0", "alejandrox")
        // Register Zombie Plague extra item
        g_itemid = zp_register_extra_item("Golden AWP (High Damage)", 1, ZP_TEAM_HUMAN)
        // Death Msg
        register_event("DeathMsg", "Death", "a")
        // Weapon Pick Up
        register_event("WeapPickup","checkModel","b","1=18")
        // Current Weapon Event
        register_event("CurWeapon","checkWeapon","be","1=1")
        register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
        // Ham TakeDamage
        RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
        register_forward( FM_CmdStart, "fw_CmdStart" )
        RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
       
}

public client_connect(id)
{
        g_Hasawp[id] = false
}

public client_disconnect(id)
{
        g_Hasawp[id] = false
}

public Death()
{
        g_Hasawp[read_data(2)] = false
}

public fwHamPlayerSpawnPost(id)
{
        g_Hasawp[id] = false
}

public plugin_precache()
{
        precache_model(awp_V_MODEL)
        m_spriteTexture = precache_model("sprites/dot.spr")
        precache_sound("weapons/zoom.wav")
}

public zp_user_infected_post(id)
{
        if (zp_get_user_zombie(id))
        {
                g_Hasawp[id] = false
        }
}

public checkModel(id)
{
        if ( zp_get_user_zombie(id) )
                return PLUGIN_HANDLED
       
        new szWeapID = read_data(2)
       
        if ( szWeapID == CSW_AWP && g_Hasawp[id] == true && get_pcvar_num(cvar_custommodel) )
        {
                set_pev(id, pev_viewmodel2, awp_V_MODEL)
        }
        return PLUGIN_HANDLED
}

public checkWeapon(id)
{
        new plrClip, plrAmmo, plrWeap[32]
        new plrWeapId
       
        plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
       
        if (plrWeapId == CSW_AWP && g_Hasawp[id])
        {
                checkModel(id)
        }
        else
        {
                return PLUGIN_CONTINUE
        }
       
        if (plrClip == 0 && get_pcvar_num(cvar_uclip))
        {
                // If the user is out of ammo..
                get_weaponname(plrWeapId, plrWeap, 31)
                // Get the name of their weapon
                give_item(id, plrWeap)
                engclient_cmd(id, plrWeap)
                engclient_cmd(id, plrWeap)
                engclient_cmd(id, plrWeap)
        }
        return PLUGIN_HANDLED
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
    if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_AWP && g_Hasawp[attacker] )
    {
        SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
    }
}

public make_tracer(id)
{
        if (get_pcvar_num(cvar_goldbullets))
        {
                new clip,ammo
                new wpnid = get_user_weapon(id,clip,ammo)
                new pteam[16]
               
                get_user_team(id, pteam, 15)
               
                if ((bullets[id] > clip) && (wpnid == CSW_AWP) && g_Hasawp[id])
                {
                        new vec1[3], vec2[3]
                        get_user_origin(id, vec1, 1) // origin; your camera point.
                        get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
                       
                       
                        //BEAMENTPOINTS
                        message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
                        write_byte (0)    //TE_BEAMENTPOINTS 0
                        write_coord(vec1[0])
                        write_coord(vec1[1])
                        write_coord(vec1[2])
                        write_coord(vec2[0])
                        write_coord(vec2[1])
                        write_coord(vec2[2])
                        write_short( m_spriteTexture )
                        write_byte(1) // framestart
                        write_byte(5) // framerate
                        write_byte(2) // life
                        write_byte(10) // width
                        write_byte(0) // noise
                        write_byte( 255 )    // r, g, b
                        write_byte( 215 )      // r, g, b
                        write_byte( 0 )      // r, g, b
                        write_byte(200) // brightness
                        write_byte(150) // speed
                        message_end()
                }
       
                bullets[id] = clip
        }
       
}

public zp_extra_item_selected(player, itemid)
{
        if ( itemid == g_itemid )
        {
                if ( user_has_weapon(player, CSW_AWP) )
                {
                        drop_prim(player)
                }
               
                give_item(player, "weapon_awp")
                client_print(player, print_chat, "[ZP] You bought Golden AWP")
                g_Hasawp[player] = true;
        }
}

stock drop_prim(id)
{
        new weapons[32], num
        get_user_weapons(id, weapons, num)
        for (new i = 0; i < num; i++) {
                if (Wep_awp & (1<<weapons[i]))
                {
                        static wname[32]
                        get_weaponname(weapons[i], wname, sizeof wname - 1)
                        engclient_cmd(id, "drop", wname)
                }
        }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ fbidis\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset0 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ ltrpar\\ lang1034\\ f0\\ fs16 \n\\ par }
*/


NTARIS 01-28-2021 15:53

Re: ZP Golden Items Issue (Fix)
 
I donate money to whom fix this since nobody reply here for free.im kind person and i will share the fix for free.

Celena Luna 01-28-2021 21:59

Re: ZP Golden Items Issue (Fix)
 
Nothing wrong with the code, you didn't give the player bpammo in the first place.

PHP Code:

public zp_extra_item_selected(playeritemid)
{
    if ( 
itemid == g_itemid )
    {
        if ( 
user_has_weapon(playerCSW_AWP) )
        {
            
drop_prim(player)
        }
        
        
give_item(player"weapon_awp")
        
client_print(playerprint_chat"[ZP] You bought Golden AWP")
        
g_Hasawp[player] = true;
    }


you give them weapon only
Fix it to this
PHP Code:

public zp_extra_item_selected(playeritemid)
{
    if ( 
itemid == g_itemid )
    {
        if ( 
user_has_weapon(playerCSW_AWP) )
        {
            
drop_prim(player)
        }
        
        
give_item(player"weapon_awp")
        
cs_set_user_bpammo(playerCSW_AWP30//Give them 30 BPAmmo
        
client_print(playerprint_chat"[ZP] You bought Golden AWP")
        
g_Hasawp[player] = true;
    }


and it will give you 30 bpammo

NTARIS 01-29-2021 05:24

Re: ZP Golden Items Issue (Fix)
 
Celena Luna! Contact me for donation.

This what i was looking for.Now actually we must take the credits from the original coder alejandrox because in his golden ak plugin he forgot also to do the same in the first place.And all golden items dealing with the same issue.Contact me in pm luna i want to donate you.

IT WORKS FINE/I published this to the original thread to help people and also update the .sma attachement for everybody.I will not upload the .sma file here since i cant change the title of thread and this is going to make a lot confusion.

Celena Luna 02-02-2021 03:35

Re: ZP Golden Items Issue (Fix)
 
Quote:

Originally Posted by NTARIS (Post 2734745)
Celena Luna! Contact me for donation.

This what i was looking for.Now actually we must take the credits from the original coder alejandrox because in his golden ak plugin he forgot also to do the same in the first place.And all golden items dealing with the same issue.Contact me in pm luna i want to donate you.

IT WORKS FINE/I published this to the original thread to help people and also update the .sma attachement for everybody.I will not upload the .sma file here since i cant change the title of thread and this is going to make a lot confusion.

I am fine, you could just donate to the forum to keep alive instead :wink:
I just wandering around and saw the post so I just want to help out. It is quite simple too

NTARIS 02-03-2021 16:53

Re: ZP Golden Items Issue (Fix)
 
O RIGHT!,
Celena Luna you seem kind heart girl.I will donate to forum then.


All times are GMT -4. The time now is 14:12.

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