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

[Solved] Golden AK47 bullet tracer doesn't work on Survivor


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 09-13-2015 , 09:21   [Solved] Golden AK47 bullet tracer doesn't work on Survivor
Reply With Quote #1

This is the code of golden ak47 im currently using:
PHP Code:
/*
[ZP] Extra Item: Golden Ak 47
Team: Humans

Description: This plugin adds a new weapon for Human Teams.
Weapon Cost: 30

Features:
- This weapon do more damage
- This weapon has zoom
- Launch Lasers
- This weapon has unlimited bullets

Credits:

KaOs - For his Dual MP5 mod

Cvars:


- zp_goldenak_dmg_multiplier <5> - Damage Multiplier for Golden Ak 47
- zp_goldenak_gold_bullets <1|0> - Golden bullets effect ?
- zp_goldenak_custom_model <1|0> - Golden ak Custom Model
- zp_goldenak_unlimited_clip <1|0> - Golden ak Unlimited Clip 

*/



#include <amxmodx>
#include <engine>    // Added by Shidla
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <zombieplague>
#include <colorchat>

#define is_valid_player(%1) (1 <= %1 <= 32)
#define ENG_NULLENT        -1    // Added by Shidla
#define EV_INT_WEAPONKEY    EV_INT_impulse    // Added by Shidla
#define GAK_WEAPONKEY    666    // Added by Shidla
new const g_GAKEnt[] = "weapon_ak47"

new AK_V_MODEL[64] = "models/ReverseZM/v_golden_ak47.mdl"
new AK_P_MODEL[64] = "models/ReverseZM/p_golden_ak47.mdl"
new AK_W_MODEL[64] = "models/ReverseZM/w_golden_ak47.mdl"    // Added by Shidla

/* Pcvars */
new cvar_dmgmultipliercvar_goldbullets,  cvar_custommodelcvar_uclip

// Item ID
new g_itemid

new bool:g_HasAk[33]

new 
g_hasZoom33 ]
new 
bullets33 ]

const 
Wep_ak47 = ((1<<CSW_AK47))

public 
plugin_init()
{
    
    
/* CVARS */
    
cvar_dmgmultiplier register_cvar("zp_goldenak_dmg_multiplier""3.20")
    
cvar_custommodel register_cvar("zp_goldenak_custom_model""1")
    
cvar_goldbullets register_cvar("zp_goldenak_gold_bullets""1")
    
cvar_uclip register_cvar("zp_goldenak_unlimited_clip""0")
    
    
// Register The Plugin
    
register_plugin("[ZP] Extra: Golden Ak 47""1.1""AlejandroSk / Shidla")
    
register_cvar("Shidla""[ZP] Golden AK [w_ model added]"FCVAR_SERVER|FCVAR_SPONLY)
    
// Register Zombie Plague extra item
    
g_itemid zp_register_extra_item("Golden Ak 47"30ZP_TEAM_HUMAN)
    
// Death Msg
    
register_event("DeathMsg""Death""a")
    
// Weapon Pick Up
    
register_event("WeapPickup","checkModel","b","1=19")
    
// 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_forwardFM_CmdStart"fw_CmdStart" )
    
RegisterHam(Ham_Item_AddToPlayerg_GAKEnt"fw_GAK47AddToPlayer")    // Added by Shidla
    
    
register_forward(FM_SetModel"fw_SetModel")    // Added by Shidla
    
}

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

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

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

public 
plugin_precache()
{
    
precache_model(AK_V_MODEL)
    
precache_model(AK_P_MODEL)
    
precache_model(AK_W_MODEL)    // Added by Shidla
    
precache_sound("weapons/zoom.wav")
}

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

public 
checkModel(id)
{
    if ( 
zp_get_user_zombie(id) )
        return 
PLUGIN_HANDLED
    
    
new szWeapID read_data(2)
    
    if ( 
szWeapID == CSW_AK47 && g_HasAk[id] == true && get_pcvar_num(cvar_custommodel) )
    {
        
set_pev(idpev_viewmodel2AK_V_MODEL)
        
set_pev(idpev_weaponmodel2AK_P_MODEL)
    }
    return 
PLUGIN_HANDLED
}

public 
checkWeapon(id)
{
    new 
plrClipplrAmmoplrWeap[32]
    new 
plrWeapId
    
    plrWeapId 
get_user_weapon(idplrClip plrAmmo)
    
    if (
plrWeapId == CSW_AK47 && g_HasAk[id])
    {
        
checkModel(id)
    }
    else 
    {
        return 
PLUGIN_CONTINUE
    
}
    
    if (
plrClip == && get_pcvar_num(cvar_uclip))
    {
        
// If the user is out of ammo..
        
get_weaponname(plrWeapIdplrWeap31)
        
// Get the name of their weapon
        
give_item(idplrWeap)
        
engclient_cmd(idplrWeap
        
engclient_cmd(idplrWeap)
        
engclient_cmd(idplrWeap)
    }
    return 
PLUGIN_HANDLED
}



public 
fw_TakeDamage(victiminflictorattackerFloat:damage)
{
    if ( 
is_valid_playerattacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )
    {
        
SetHamParamFloat(4damage get_pcvar_floatcvar_dmgmultiplier ) )
    }
}

public 
fw_CmdStartiduc_handleseed )
{
    if( !
is_user_aliveid ) ) 
        return 
PLUGIN_HANDLED
    
    
if( ( get_ucuc_handleUC_Buttons ) & IN_ATTACK2 ) && !( pevidpev_oldbuttons ) & IN_ATTACK2 ) )
    {
        new 
szClipszAmmo
        
new szWeapID get_user_weaponidszClipszAmmo )
        
        if( 
szWeapID == CSW_AK47 && g_HasAk[id] == true && !g_hasZoom[id] == true)
        {
            
g_hasZoom[id] = true
            cs_set_user_zoom
idCS_SET_AUGSG552_ZOOM)
            
emit_soundidCHAN_ITEM"weapons/zoom.wav"0.202.400100 )
        }
        
        else if ( 
szWeapID == CSW_AK47 && g_HasAk[id] == true && g_hasZoom[id])
        {
            
g_hasZoomid ] = false
            cs_set_user_zoom
idCS_RESET_ZOOM)
            
        }
        
    }
    return 
PLUGIN_HANDLED
}


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(idpteam15)
        
        if ((
bullets[id] > clip) && (wpnid == CSW_AK47) && g_HasAk[id]) 
        {
            new 
vec1[3], vec2[3]
            
get_user_origin(idvec11// origin; your camera point.
            
get_user_origin(idvec23// termina; where your bullet goes (4 is cs-only)
            
            
            //BEAMENTPOINTS
            
message_beginMSG_BROADCAST,SVC_TEMPENTITY)
            
write_byte (6)     //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])
            
message_end()
        }
    
        
bullets[id] = clip
    
}
    
}

public 
zp_extra_item_selected(playeritemid)
{
    if ( 
itemid == g_itemid )
    {
        if ( 
user_has_weapon(playerCSW_AK47) )
        {
            
drop_prim(player)
        }
        
        
give_item(player"weapon_ak47")
        new 
name[32]
        
get_user_name(playername31)
        
client_print_color(0print_chat"^4[ReverseZM]^3 %s^1 bought^4 Golden AK-47"name)
        
g_HasAk[player] = true;
    }
}

// Added by Shidla
public fw_SetModel(entitymodel[])
{
    
// Entity is not valid
    
if(!is_valid_ent(entity))
        return 
FMRES_IGNORED;
        
    
// Entity model is not w_ak47
    
if(!equal(model"models/w_ak47.mdl")) 
        return 
FMRES_IGNORED;
        
    
// Get classname
    
static szClassName[33]
    
entity_get_string(entityEV_SZ_classnameszClassNamecharsmax(szClassName))
        
    
// Not a Weapon box
    
if(!equal(szClassName"weaponbox"))
        return 
FMRES_IGNORED
    
    
// Some vars
    
static iOwneriStoredGalilID
    
    
// Get owner
    
iOwner entity_get_edict(entityEV_ENT_owner)
    
    
// Get drop weapon index (galil) to use in fw_Galil_AddToPlayer forward
    
iStoredGalilID find_ent_by_owner(ENG_NULLENT"weapon_ak47"entity)
    
    
// Entity classname is weaponbox, and galil has founded
    
if(g_HasAk[iOwner] && is_valid_ent(iStoredGalilID))
    {
        
// Setting weapon options
        
entity_set_int(iStoredGalilIDEV_INT_WEAPONKEYGAK_WEAPONKEY)

        
// Reset user vars
        
g_HasAk[iOwner] = false
        
        
// Set weaponbox new model
        
entity_set_model(entityAK_W_MODEL)
        
        return 
FMRES_SUPERCEDE
    
}

    return 
FMRES_IGNORED
}

// Added by Shidla
public fw_GAK47AddToPlayer (GAK47id)
{
    
// Make sure that this is M79
    
if( is_valid_ent(GAK47) && is_user_connected(id) && entity_get_int(GAK47EV_INT_WEAPONKEY) == GAK_WEAPONKEY)
    {
        
// Update
        
g_HasAk[id] = true

        
// Reset weapon options
        
entity_set_int(GAK47EV_INT_WEAPONKEY0)

        return 
HAM_HANDLED
    
}

    return 
HAM_IGNORED
}

stock drop_prim(id
{
    new 
weapons[32], num
    get_user_weapons
(idweaponsnum)
    for (new 
0numi++) {
        if (
Wep_ak47 & (1<<weapons[i])) 
        {
            static 
wname[32]
            
get_weaponname(weapons[i], wnamesizeof wname 1)
            
engclient_cmd(id"drop"wname)
        }
    }


Problem: bullet tracer works on normal humans and tryders but not on SURVIVORS...any idea why?

Humans:


Survivors:

Last edited by Chihuahuax; 09-19-2015 at 03:55.
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
Old 09-13-2015, 10:33
thekiller123
This message has been deleted by thekiller123.
Depresie
Veteran Member
Join Date: Nov 2013
Old 09-13-2015 , 13:31   Re: Golden AK47 bullet tracer doesn't work on Survivor
Reply With Quote #2

the issue occurs because of the unlimited clip code, i had the same issue for sniper
here you have the fix
https://forums.alliedmods.net/showthread.php?t=264590
Depresie is offline
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 09-13-2015 , 19:50   Re: Golden AK47 bullet tracer doesn't work on Survivor
Reply With Quote #3

In_attack2? lol
I think im juz gonna disable the survivor unlimited clip haha (gonna use VIP's unlimited clip)
Thx for letting me understand the issue

Last edited by Chihuahuax; 09-13-2015 at 19:50.
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
Depresie
Veteran Member
Join Date: Nov 2013
Old 09-13-2015 , 20:20   Re: Golden AK47 bullet tracer doesn't work on Survivor
Reply With Quote #4

it is a check, so the tracer wont be spawned if the weapon is executing secondary attack
i couldnt find a better way at that time, but since it works, i dont see the problem
Depresie is offline
A k c 3 n 7
Junior Member
Join Date: Oct 2014
Location: Romania
Old 09-18-2015 , 12:35   Re: Golden AK47 bullet tracer doesn't work on Survivor
Reply With Quote #5

add akgold natives for running weapon in survivor round
A k c 3 n 7 is offline
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 09-18-2015 , 23:55   Re: Golden AK47 bullet tracer doesn't work on Survivor
Reply With Quote #6

Quote:
Originally Posted by A k c 3 n 7 View Post
add akgold natives for running weapon in survivor round
the unlimited clip code is the problem it has nothing to do with survivor
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
Depresie
Veteran Member
Join Date: Nov 2013
Old 09-20-2015 , 15:47   Re: Golden AK47 bullet tracer doesn't work on Survivor
Reply With Quote #7

Quote:
Originally Posted by A k c 3 n 7 View Post
add akgold natives for running weapon in survivor round
why do you write solutions about things that you have no ideea?
Depresie 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 08:55.


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