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

Adding guns models to a plugin.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
luci2k
Junior Member
Join Date: Jan 2020
Old 01-21-2020 , 12:35   Adding guns models to a plugin.
Reply With Quote #1

i have this plugin on my server that gives terrorist ak47+deagle + 150hp and i want to add this skins from the link bellow :
https://cs-site.ru/cs/gunmodels/deag...lja-cs-16.html (for deagle)
https://cs-site.ru/cs/gunmodels/ak-4...lya-cs-16.html (for ak47)
The models have custom csgo sounds, if its possible to add them that would be nice if not thats fine .

Code:
#include < amxmodx >
#include < cstrike >
#include < fakemeta_util > 
#include < hamsandwich >
#include < fun >

#define PLUGIN "New Dr"
#define VERSION "1.0"
#define AUTHOR "50Cent # HackeR"


public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	// Add your code here...
	RegisterHam(Ham_Spawn, "player", "Inceput_runda", 1);
}

public Inceput_runda(id) {
	if( get_user_team( id ) == 1 ) {
		fm_set_user_health(id, 150)
		give_item(id, "weapon_ak47")
		give_item(id, "weapon_deagle")
		cs_set_user_bpammo(id, CSW_AK47,90)
		cs_set_user_bpammo(id, CSW_DEAGLE, 35)
	}
}
luci2k is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 01-22-2020 , 00:42   Re: Adding guns models to a plugin.
Reply With Quote #2

Models in what file should be?
alferd is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-22-2020 , 07:35   Re: Adding guns models to a plugin.
Reply With Quote #3

Quote:
Originally Posted by alferd View Post
Models in what file should be?
I mean, you can just make the plugin and he can edit it by himself pretty easily.

If the sounds are built in the models, you don't add them manually in the plugin. The only thing that needs to be done manually is precaching the sounds so players can download them.
__________________

Last edited by OciXCrom; 01-22-2020 at 07:36.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 01-23-2020 , 00:09   Re: Adding guns models to a plugin.
Reply With Quote #4

This plugin is for you

Plugin for Ak-47:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <amxmisc>
#include <xs>
#include <engine>

#define PLUGIN "Ak-47"
#define VERSION "1.0"
#define AUTHOR "AlferD"

#define CLIP 30

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

#define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31)))
#define Set_BitVar(%1,%2) %1 |= (1 << (%2 & 31))
#define UnSet_BitVar(%1,%2) %1 &= ~(1 << (%2 & 31))

new const CSW_NEWPN CSW_AK47
new const weapon_newpn[] = "weapon_ak47"

new V_MODEL[64] = "models/v_ak47_new.mdl"
new P_MODEL[64] = "models/p_ak47_new.mdl"

/* Pcvars */
new cvar_dmgmultipliercvar_goldbullets,  cvar_custommodelcvar_costg_has_weapon

new Fload:g_clip[33]

new 
bullets33 ]

new 
bool:g_HasG[33]

new 
msg_CurWeapon

// Sprite
new m_spriteTexture

const Wep_g = ((1<<CSW_AK47))

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
/* CVARS */
    
cvar_dmgmultiplier register_cvar("Ak_dmg_multiplier""6")
    
cvar_custommodel register_cvar("Ak_custom_model""1")
    
cvar_goldbullets register_cvar("Ak_gold_bullets""0")
    
cvar_cost register_cvar("Ak_cost""2500")
    
    
RegisterHam(Ham_Item_PostFrameweapon_newpn"Fw_Item_PostFrame");
    
RegisterHam(Ham_Weapon_Reloadweapon_newpn"Fw_Weapon_Reload");
    
RegisterHam(Ham_Weapon_Reloadweapon_newpn"Fw_Weapon_Reload_Post"1);
         
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
     
    
// Register The Buy Cmd
    
register_clcmd"weapons_ak47""Buy");
    
// 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
    
register_forwardFM_CmdStart"fw_CmdStart" )
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)
    
msg_CurWeapon get_user_msgid("CurWeapon");
}

public 
Do_RegisterHam(id)
{
    
RegisterHamFromEntity(Ham_TraceAttackid"Fw_TraceAttack_Player");
}

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

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

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

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

public 
plugin_precache()
{
    
precache_model(V_MODEL)
    
precache_model(P_MODEL)
    
m_spriteTexture precache_model("sprites/dot.spr")
}

public 
Buy(id)
{

    if ( !
is_user_alive(id) )
    {
        return 
PLUGIN_HANDLED
    
}
    
    new 
money cs_get_user_money(id)
    
    if (
money >= get_pcvar_num(cvar_cost))
    {
        
Set_BitVar(g_has_weaponid)
        new 
weapon give_item(idweapon_newpn)
        
cs_set_user_money(idmoney get_pcvar_num(cvar_cost))
        
cs_set_weapon_ammo(weaponCLIP)
        
g_HasG[id] = true
        set_task
(1.0"lr")
                
        
engfunc(EngFunc_MessageBeginMSG_ONE_UNRELIABLEmsg_CurWeapon, {000}, id)
        
write_byte(1)
        
write_byte(CSW_NEWPN)
        
write_byte(CLIP)
        
message_end()
    }
    
    else
    {
        
set_task(1.0"lr")
        
client_print(idprint_center"you have insufficient funds!")
    }
    return 
PLUGIN_HANDLED
}

public 
checkModel(id)
{
    if ( !
g_HasG[id] )
        return 
PLUGIN_HANDLED
    
    
new szWeapID read_data(2)
    
    if ( 
szWeapID == CSW_NEWPN && g_HasG[id] == true && get_pcvar_num(cvar_custommodel) )
    {
        
set_pev(idpev_viewmodel2V_MODEL)
        
set_pev(idpev_weaponmodel2P_MODEL)
    }
    return 
PLUGIN_HANDLED
}

public 
checkWeapon(id)
{
    new 
plrAmmo
    
new plrWeapId
    
    plrWeapId 
get_user_weapon(idplrAmmo)
    
    if (
plrWeapId == CSW_NEWPN && g_HasG[id])
    {
        
checkModel(id)
    }
    else 
    {
        return 
PLUGIN_CONTINUE
    
}
    
    return 
PLUGIN_HANDLED
}



public 
fw_TakeDamage(victiminflictorattackerFloat:damage)
{
    if ( 
is_valid_playerattacker ) && get_user_weapon(attacker) == CSW_NEWPN && g_HasG[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 )
    }
    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_NEWPN) && g_HasG[id]) 
        {
            new 
vec1[3], vec2[3]
            
get_user_origin(idvec11// origin; your camera point.
            
get_user_origin(idvec24// termina; where your bullet goes (4 is cs-only)
            
            
            //BEAMENTPOINTS
            
message_beginMSG_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_shortm_spriteTexture )
            
write_byte(1// framestart
            
write_byte(5// framerate
            
write_byte(2// life
            
write_byte(10// width
            
write_byte(0// noise
            
write_byte255 )     // r, g, b
            
write_byte215 )       // r, g, b
            
write_byte)       // r, g, b
            
write_byte(200// brightness
            
write_byte(150// speed
            
message_end()
        }
        
        
bullets[id] = clip
    
}
    
}

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

public 
Fw_Item_PostFrame(weapon)
{
    if(!
pev_valid(weapon))
        return 
HAM_IGNORED
    
    
static id
    id 
pev(weaponpev_owner)
    
    if(
is_user_alive(id) && Get_BitVar(g_has_weaponid))
    {    
        static 
Float:flNextAttackflNextAttack get_pdata_float(id835);
        static 
bpammobpammo cs_get_user_bpammo(idCSW_NEWPN);
        static 
i_clipi_clip get_pdata_int(weapon514);
        static 
fInReloadfInReload get_pdata_int(weapon544);
        
        if(
fInReload && flNextAttack <= 0.0)
        {
            static 
temp1temp1 min(CLIP i_clipbpammo);

            
set_pdata_int(weapon51i_clip temp14);
            
cs_set_user_bpammo(idCSW_NEWPNbpammo temp1);
            
            
set_pdata_int(weapon5404);
            
            
fInReload 0
        
}        
    }
    
    return 
HAM_IGNORED    
}

public 
Fw_Weapon_Reload(weapon)
{
    static 
idid pev(weaponpev_owner);
    
    if(!
is_user_alive(id))
        return 
HAM_IGNORED
        
    
if(!Get_BitVar(g_has_weaponid))
        return 
HAM_IGNORED
    
    g_clip
[id] = -1;
    
    static 
bpammobpammo cs_get_user_bpammo(idCSW_NEWPN);
    static 
i_clipi_clip get_pdata_int(weapon514);
    
    if(
bpammo <= 0)
        return 
HAM_SUPERCEDE
    
    
if(i_clip >= CLIP)
        return 
HAM_SUPERCEDE        
        
    g_clip
[id] = i_clip;

    return 
HAM_HANDLED
}

public 
lr(id)
{
    
client_print(idprint_center"Plugin By: AlferD")
    
client_print(idprint_center"WebSite: www.king0goldcs.ir")
}

public 
Fw_Weapon_Reload_Post(weapon)
{
    static 
id;
    
id pev(weaponpev_owner);
    
    if(!
is_user_alive(id))
        return 
HAM_IGNORED
    
    
if(!Get_BitVar(g_has_weaponid))
        return 
HAM_IGNORED

    
if (g_clip[id] == -1)
        return 
HAM_IGNORED
    
    set_pdata_int
(weapon51g_clip[id], 4);
    
set_pdata_int(weapon5414);

    return 
HAM_HANDLED

Plugin for Deagle:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <amxmisc>
#include <xs>
#include <engine>

#define PLUGIN "Deagle"
#define VERSION "1.0"
#define AUTHOR "AlferD"

#define CLIP 7

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

#define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31)))
#define Set_BitVar(%1,%2) %1 |= (1 << (%2 & 31))
#define UnSet_BitVar(%1,%2) %1 &= ~(1 << (%2 & 31))

new const CSW_NEWPN CSW_DEAGLE
new const weapon_newpn[] = "weapon_deagle"

new V_MODEL[64] = "models/v_deagle_new.mdl"
new P_MODEL[64] = "models/p_deagle_new.mdl"

/* Pcvars */
new cvar_dmgmultipliercvar_goldbullets,  cvar_custommodelcvar_costg_has_weapon

new Fload:g_clip[33]

new 
bullets33 ]

new 
bool:g_HasDeagle[33]

new 
msg_CurWeapon

// Sprite
new m_spriteTexture

const Wep_deagle = ((1<<CSW_DEAGLE))

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
/* CVARS */
    
cvar_dmgmultiplier register_cvar("Deagle_dmg_multiplier""6")
    
cvar_custommodel register_cvar("Deagle_custom_model""1")
    
cvar_goldbullets register_cvar("Deagle_gold_bullets""0")
    
cvar_cost register_cvar("Deagle_cost""650")
    
    
RegisterHam(Ham_Item_PostFrameweapon_newpn"Fw_Item_PostFrame");
    
RegisterHam(Ham_Weapon_Reloadweapon_newpn"Fw_Weapon_Reload");
    
RegisterHam(Ham_Weapon_Reloadweapon_newpn"Fw_Weapon_Reload_Post"1);
         
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
     
    
// Register The Buy Cmd
    
register_clcmd"weapons_deagle""Buy");
    
// 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
    
register_forwardFM_CmdStart"fw_CmdStart" )
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)
    
msg_CurWeapon get_user_msgid("CurWeapon");
}

public 
Do_RegisterHam(id)
{
    
RegisterHamFromEntity(Ham_TraceAttackid"Fw_TraceAttack_Player");
}

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

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

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

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

public 
plugin_precache()
{
    
precache_model(V_MODEL)
    
precache_model(P_MODEL)
    
m_spriteTexture precache_model("sprites/dot.spr")
}

public 
Buy(id)
{

    if ( !
is_user_alive(id) )
    {
        return 
PLUGIN_HANDLED
    
}
    
    new 
money cs_get_user_money(id)
    
    if (
money >= get_pcvar_num(cvar_cost))
    {
        
Set_BitVar(g_has_weaponid)
        new 
weapon give_item(idweapon_newpn)
        
cs_set_user_money(idmoney get_pcvar_num(cvar_cost))
        
cs_set_weapon_ammo(weaponCLIP)
        
g_HasDeagle[id] = true
        set_task
(1.0"lr")
                
        
engfunc(EngFunc_MessageBeginMSG_ONE_UNRELIABLEmsg_CurWeapon, {000}, id)
        
write_byte(1)
        
write_byte(CSW_NEWPN)
        
write_byte(CLIP)
        
message_end()
    }
    
    else
    {
        
set_task(1.0"lr")
        
client_print(idprint_center"you have insufficient funds!")
    }
    return 
PLUGIN_HANDLED
}

public 
checkModel(id)
{
    if ( !
g_HasDeagle[id] )
        return 
PLUGIN_HANDLED
    
    
new szWeapID read_data(2)
    
    if ( 
szWeapID == CSW_NEWPN && g_HasDeagle[id] == true && get_pcvar_num(cvar_custommodel) )
    {
        
set_pev(idpev_viewmodel2V_MODEL)
        
set_pev(idpev_weaponmodel2P_MODEL)
    }
    return 
PLUGIN_HANDLED
}

public 
checkWeapon(id)
{
    new 
plrAmmo
    
new plrWeapId
    
    plrWeapId 
get_user_weapon(idplrAmmo)
    
    if (
plrWeapId == CSW_NEWPN && g_HasDeagle[id])
    {
        
checkModel(id)
    }
    else 
    {
        return 
PLUGIN_CONTINUE
    
}
    
    return 
PLUGIN_HANDLED
}



public 
fw_TakeDamage(victiminflictorattackerFloat:damage)
{
    if ( 
is_valid_playerattacker ) && get_user_weapon(attacker) == CSW_NEWPN && g_HasDeagle[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 )
    }
    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_NEWPN) && g_HasDeagle[id]) 
        {
            new 
vec1[3], vec2[3]
            
get_user_origin(idvec11// origin; your camera point.
            
get_user_origin(idvec24// termina; where your bullet goes (4 is cs-only)
            
            
            //BEAMENTPOINTS
            
message_beginMSG_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_shortm_spriteTexture )
            
write_byte(1// framestart
            
write_byte(5// framerate
            
write_byte(2// life
            
write_byte(10// width
            
write_byte(0// noise
            
write_byte255 )     // r, g, b
            
write_byte215 )       // r, g, b
            
write_byte)       // r, g, b
            
write_byte(200// brightness
            
write_byte(150// speed
            
message_end()
        }
        
        
bullets[id] = clip
    
}
    
}

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

public 
Fw_Item_PostFrame(weapon)
{
    if(!
pev_valid(weapon))
        return 
HAM_IGNORED
    
    
static id
    id 
pev(weaponpev_owner)
    
    if(
is_user_alive(id) && Get_BitVar(g_has_weaponid))
    {    
        static 
Float:flNextAttackflNextAttack get_pdata_float(id835);
        static 
bpammobpammo cs_get_user_bpammo(idCSW_NEWPN);
        static 
i_clipi_clip get_pdata_int(weapon514);
        static 
fInReloadfInReload get_pdata_int(weapon544);
        
        if(
fInReload && flNextAttack <= 0.0)
        {
            static 
temp1temp1 min(CLIP i_clipbpammo);

            
set_pdata_int(weapon51i_clip temp14);
            
cs_set_user_bpammo(idCSW_NEWPNbpammo temp1);
            
            
set_pdata_int(weapon5404);
            
            
fInReload 0
        
}        
    }
    
    return 
HAM_IGNORED    
}

public 
Fw_Weapon_Reload(weapon)
{
    static 
idid pev(weaponpev_owner);
    
    if(!
is_user_alive(id))
        return 
HAM_IGNORED
        
    
if(!Get_BitVar(g_has_weaponid))
        return 
HAM_IGNORED
    
    g_clip
[id] = -1;
    
    static 
bpammobpammo cs_get_user_bpammo(idCSW_NEWPN);
    static 
i_clipi_clip get_pdata_int(weapon514);
    
    if(
bpammo <= 0)
        return 
HAM_SUPERCEDE
    
    
if(i_clip >= CLIP)
        return 
HAM_SUPERCEDE        
        
    g_clip
[id] = i_clip;

    return 
HAM_HANDLED
}

public 
lr(id)
{
    
client_print(idprint_center"Plugin By: AlferD")
    
client_print(idprint_center"WebSite: www.king0goldcs.ir")
}

public 
Fw_Weapon_Reload_Post(weapon)
{
    static 
id;
    
id pev(weaponpev_owner);
    
    if(!
is_user_alive(id))
        return 
HAM_IGNORED
    
    
if(!Get_BitVar(g_has_weaponid))
        return 
HAM_IGNORED

    
if (g_clip[id] == -1)
        return 
HAM_IGNORED
    
    set_pdata_int
(weapon51g_clip[id], 4);
    
set_pdata_int(weapon5414);

    return 
HAM_HANDLED

Download Models

Plugin you (Change):
PHP Code:
#include < amxmodx >
#include < cstrike >
#include < fakemeta_util > 
#include < hamsandwich >
#include < fun >

#define PLUGIN "New Dr"
#define VERSION "1.0"
#define AUTHOR "50Cent # HackeR"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
RegisterHam(Ham_Spawn"player""Inceput_runda"1);
}

public 
Inceput_runda(id) {
    if( 
get_user_teamid ) == ) {
        
fm_set_user_health(id150)
        
give_item(id"weapons_ak47")
        
give_item(id"weapons_deagle")
        
cs_set_user_bpammo(idCSW_AK47,90)
        
cs_set_user_bpammo(idCSW_DEAGLE35)
    }


Last edited by alferd; 01-23-2020 at 00:23.
alferd 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 14:10.


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