Raised This Month: $ Target: $400
 0% 

Add model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Oneshox
BANNED
Join Date: May 2010
Location: Germany
Old 06-05-2010 , 04:42   Add model
Reply With Quote #1

someone can add here in this code an custom g3sg1 model ?

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

new g_sniper
new cvar_sniperdmg
new bool:g_HasSniper[33]

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

public plugin_init()
{
	register_plugin("[ZP] L4D2 Sniper", "0.1", "Russiaboy")
	g_sniper = zp_register_extra_item("[L4D2] SNiper", 35, ZP_TEAM_HUMAN)

	cvar_sniperdmg = register_cvar("zp_l4d2_sniper_dmg", "2")

	RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
}

public zp_extra_item_selected(player, itemid)
{
	if (itemid == g_sniper)
	{
		give_item(player, "weapon_g3sg1")
		cs_set_user_bpammo(player, CSW_G3SG1, 200)
		client_print(player, print_chat, "[SS] You bought a L4D2 Sniper!")

		g_HasSniper[player] = true;
	}
}

public client_connect(id)
{
	g_HasSniper[id] = false;
}

public client_disconnect(id)
{
	g_HasSniper[id] = false;
}

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

public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
    if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_G3SG1 && g_HasSniper[attacker] )
    {
        SetHamParamFloat(4, damage * get_pcvar_float( cvar_sniperdmg ) )
    }
}
Oneshox is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 06-05-2010 , 08:33   Re: Add model
Reply With Quote #2

Code:
#include < amxmodx >

new g_szModelV [ ] = "models/shit.mdl"
new g_szModelP [ ] = "models/crap.mdl"

public plugin_precache ( )
{
    precache_model ( g_szModelV )
    precache_model ( g_szModelP )
}

public plugin_init ( )
{
    ... some code...
    
    register_event ( "CurWeapon", "EV_CurWeapon", "be", "1=1", "2=24" )
    
    ... some code...
}

public EV_CurWeapon ( Player )
{
    ... some checks....
    
    // Dont check if players current weapon is g3sg1.I already do that in  plugin_init
    
    entity_set_string ( Player, EV_SZ_viewmodel, g_szModelV )
    entity_set_string ( Player, EV_SZ_weaponmodel, g_szModelP )
}
__________________


Last edited by NiHiLaNTh; 06-05-2010 at 08:37. Reason: typo
NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-05-2010 , 09:19   Re: Add model
Reply With Quote #3

It would be more appropriate to use Ham_Item_Deploy, called only one time on weapon deploy. ;)
__________________

Last edited by Arkshine; 06-05-2010 at 09:22.
Arkshine 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 05:18.


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