Raised This Month: $ Target: $400
 0% 

*Help with hero to get exlpoding shots with new deagle model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
minibel
Junior Member
Join Date: Jan 2006
Old 01-26-2006 , 14:59   *Help with hero to get exlpoding shots with new deagle model
Reply With Quote #1

It's my first time makin a hero so i tried taking some parts from other heros and combining it and i managed to get the speed,health and armor working but it doesn't seem to load the deagle model along with a knife one and i've got no idea how you do the explodin part for the deagle. I've tried like 5 times and kept starting again incase i did somethin wrong cus i don't know if i have or not seemin im a newbie at scriptin. Anyways i read all the tutorials and looked at most of the FAQs but still couldn't get it to work so i'd really appreciate if you manage to for me.

Heres the codes and i don't care if you complain about it cus it's my first time and ill just learn form my mistakes. Also please could you make it just for admin, thx.

CVARS - copy and paste to shconfig.cfg

Code:
//cj (Admin only) cj_level 80       // The level players have to be to obtain him - Default cj_gravity 1.0   // The amount of gravity he has - Default cj_armor 2000    // The amount of armor he has - Default cj_health 2000    // The amount of health he has - Default cj_speed 4000    // How fast Cj can run */ #include <amxmod> #include <superheromod> #include <vexd_utilities> // VARIABLES new gHeroName[]="Cj" new gHasCjPower[SH_MAXSLOTS+1] //---------------------------------------------------------------------------------------------- public plugin_init() {     // Plugin Info     register_plugin("cj", "1.0", "[MpA]minibel")     // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG     register_cvar("cj_level", "80")     register_cvar("cj_gravity", "1.0")     register_cvar("cj_armor", "2000")     register_cvar("cj_health", "2000")     register_cvar("cj_speed", "4000")     // FIRE THE EVENT TO CREATE THIS SUPERHERO!     shCreateHero(gHeroName, "Indestructible", "Admin only", false, "cj_level")     // REGISTER EVENTS THIS HERO WILL RESPOND TO!     register_srvcmd("cj_init", "cj_init")     shRegHeroInit(gHeroName, "Cj_init")     // Let Server know about Cjs Variable     shSetMaxHealth(gHeroName, "Cj_health" )     shSetMinGravity(gHeroName, "Cj_gravity" )     shSetMaxArmor(gHeroName, "Cj_armor" )     shSetMaxSpeed(gHeroName, "Cj_speed", "[0]" ) } //---------------------------------------------------------------------------------------------- public plugin_precache() {      precache_model("models/shmod/cj_deagle.mdl")    precache_model("models/shmod/p_cj_deagle.mdl")    precache_model("models/shmod/v_cj_knife.mdl")    precache_model("models/shmod/p_cj_knife.mdl") } //------------------------------------------------------------------------------------------------ public Cj_init() {     // First Argument is an id     new temp[6]     read_argv(1,temp,5)     new id = str_to_num(temp)     // 2nd Argument is 0 or 1 depending on whether the id has Destroyer     read_argv(2,temp,5)     new hasPowers = str_to_num(temp)     // Got to take away powers from a user that dropped Cj     if ( !hasPowers && is_user_connected(id) ) {         shRemHealthPower(id)         shRemGravityPower(id)         shRemArmorPower(id)         shRemSpeedPower(id)     //Reset thier shield restrict status     //Shield restrict MUST be before weapons are given out     shResetShield(id)     if ( is_user_alive(id) ) {         if ( hasPowers ) {             cj_weapons(id)             switchmodel(id)         }         //This gets run if they had the power but don't anymore         else if ( !hasPowers && gHasMadnessPower[id] ) {             engclient_cmd(id, "drop", "weapon_deagle")             shRemHealthPower(id)             shRemArmorPower(id)     } } //---------------------------------------------------------------------------------------------- public newSpawn(id) {     if ( shModActive() && gHasCjPower[id] && is_user_alive(id) ) {         set_task(0.1, "cj_weapons", id)         new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)         if (wpnid != CSW_deagle && wpnid > 0) {             new wpn[32]             get_weaponname(wpnid, wpn, 31)             engclient_cmd(id, wpn)         }     } } //---------------------------------------------------------------------------------------------- public cj_weapons(id) {     if ( shModActive() && is_user_alive(id) ) {         shGiveWeapon(id,"weapon_deagle")     } //---------------------------------------------------------------------------------------------- public switchmodel(id) {    if ( !is_user_alive(id) || !gHasCjPower[id] ) return    new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)    if (wpnid == CSW_Deagle) {       Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/cj_deagle.mdl")      } } //---------------------------------------------------------------------------------------------- public weaponChange(id) {     if ( !gHasCjPower[id] || !shModActive() ) return     new wpnid = read_data(2)     new clip = read_data(3)     if ( wpnid != CSW_Deagle ) return     switchmodel(id) //---------------------------------------------------------------------------------------------- public client_connect(id) {     gHasCjPower[id] = false } //----------------------------------------------------------------------------------------------
minibel is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 01-26-2006 , 17:15  
Reply With Quote #2

you need to register an event such as a spawn event to make it work. dunno how? look at morpheus it has an register_event to react on spawning. In addition you need to register a Curweapon event that switches the weapon model when you switch guns.
__________________
yang is offline
Send a message via AIM to yang
minibel
Junior Member
Join Date: Jan 2006
Old 01-26-2006 , 18:14  
Reply With Quote #3

ok thanks. Do you mean like tho cus i tried it and it still didn't work

-----
public plugin_init()
{

// Plugin Info
register_plugin("cj", "1.0", "[MpA]minibel")

// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
register_cvar("cj_level", "80")
register_cvar("cj_gravity", "1.0")
register_cvar("cj_armor", "2000")
register_cvar("cj_health", "2000")
register_cvar("cj_speed", "4000")

// FIRE THE EVENT TO CREATE THIS SUPERHERO!
shCreateHero(gHeroName, "Indestructible", "Admin only", false, "cj_level")

// REGISTER EVENTS THIS HERO WILL RESPOND TO!
register_srvcmd("cj_init", "cj_init")
shRegHeroInit(gHeroName, "Cj_init")

----------> register_event("ResetHUD", "newSpawn","b")
----------> register_event("CurWeapon", "weaponChange","be","1=1")

// Let Server know about Cjs Variable
shSetMaxHealth(gHeroName, "Cj_health" )
shSetMinGravity(gHeroName, "Cj_gravity" )
shSetMaxArmor(gHeroName, "Cj_armor" )
shSetMaxSpeed(gHeroName, "Cj_speed", "[0]" )
}
minibel is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 01-26-2006 , 21:35  
Reply With Quote #4

pretty much o.O.
__________________
yang is offline
Send a message via AIM to yang
minibel
Junior Member
Join Date: Jan 2006
Old 01-27-2006 , 08:54  
Reply With Quote #5

sry but it still doesn't work. The model doesnt load at all. plz cud u help me
minibel is offline
minibel
Junior Member
Join Date: Jan 2006
Old 01-27-2006 , 15:19  
Reply With Quote #6

can someone plz help me its really annoying.
Ive done everything ive been told to do but it still doesnt load the model or give me it at the beginning of the round.
Plz cud u tell me wots wrong with the codes.
Code:
CVARS - copy and paste to shconfig.cfg 

//cj (Admin only) 
cj_level 80       // The level players have to be to obtain him - Default 
cj_gravity 1.0   // The amount of gravity he has - Default
cj_armor 2000	 // The amount of armor he has - Default 
cj_health 2000    // The amount of health he has - Default 
cj_speed 4000    // How fast Cj can run
*/ 

#include <amxmod> 
#include <vexd_utilities>
#include <superheromod>


// VARIABLES 
new gHeroName[]="cj"
new gHascjPower[SH_MAXSLOTS+1] 
//---------------------------------------------------------------------------------------------- 
public plugin_init() 
{ 

    // Plugin Info 
	register_plugin("cj", "1.0", "[MpA]minibel") 

    // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG 
	register_cvar("cj_level", "80") 
	register_cvar("cj_gravity", "1.0") 
	register_cvar("cj_armor", "2000") 
	register_cvar("cj_health", "2000") 
	register_cvar("cj_speed", "4000") 

    // FIRE THE EVENT TO CREATE THIS SUPERHERO! 
    shCreateHero(gHeroName, "Indestructible", "Admin only", false, "cj_level") 

    // REGISTER EVENTS THIS HERO WILL RESPOND TO! 
    shRegHeroInit(gHeroName, "cj_init") 

	register_event("ResetHUD", "newSpawn","b")
	register_event("CurWeapon", "weaponChange","be","1=1")	

    // Let Server know about Cjs Variable 
    shSetMaxHealth(gHeroName, "Cj_health" ) 
    shSetMinGravity(gHeroName, "Cj_gravity" ) 
    shSetMaxArmor(gHeroName, "Cj_armor" ) 
    shSetMaxSpeed(gHeroName, "Cj_speed", "[0]" ) 
} //-----------------------------------------------------------------------------------------
public plugin_precache() 
{  
precache_model("models/shmod/v_deagle.mdl") 
} 
//-----------------------------------------------------------------------------------------
public Cj_init() 
{ 


    // First Argument is an id 
    new temp[6] 
    read_argv(1,temp,5) 
    new id = str_to_num(temp) 

    // 2nd Argument is 0 or 1 depending on whether the id has the hero 
    read_argv(2,temp,5) 
    new hasPowers = str_to_num(temp) 
	
    gHascjPower[id] = (hasPowers != 0)

	if ( !is_user_alive(id) ) return

	if ( gHascjPower[id] ) {
	giveGun(id)
	switchmodel(id)
}
else {
engclient_cmd(id,"drop","weapon_deagle")
        shRemHealthPower(id) 
        shRemGravityPower(id) 
        shRemArmorPower(id) 
        shRemSpeedPower(id) 
    }
} 
//-----------------------------------------------------------------------------------------
public newSpawn(id)
{
if ( gHascjPower[id] && is_user_alive(id) && shModActive() ) {
set_task(0.1, "giveGun", id)

		new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)
		if (wpnid != CSW_DEAGLE && wpnid > 0) {
			new wpn[32]
			get_weaponname(wpnid,wpn,31)
			engclient_cmd(id, wpn)
		}
	}
}
//-----------------------------------------------------------------------------------------
public givegun(id)
{
	if ( is_user_alive(id) && shModActive() ) {
		shGiveWeapon(id,"weapon_deagle")
	}
//---------------------------------------------------------------------------------------------- 
public switchmodel(id) 
{ 
   if ( !is_user_alive(id) || !gHascjPower[id] ) return 
   new clip, ammo, wpnid = get_user_weapon(id,clip,ammo) 
   if (wpnid == CSW_DEAGLE) { 
      Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/v_deagle.mdl")  
   } 
} 

//-----------------------------------------------------------------------------------------
public weaponChange(id)
{
	if ( !gHascjPower[id] || !shModActive() ) return

	new wpnid = read_data(2)
	new clip = read_data(3)

	if ( wpnid != CSW_DEAGLE ) return

	switchmodel(id)

	if ( clip == 0 ) {
	shReloadAmmo(id)
}
//-----------------------------------------------------------------------------------------
minibel is offline
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 01-27-2006 , 16:37  
Reply With Quote #7

lets see 3 errors with that code
Code:
public givegun(id)
{
   if ( is_user_alive(id) && shModActive() ) {
      shGiveWeapon(id,"weapon_deagle")
   }
//----------------------------------------------------------------------------------------------
need to add another } to that to close the event, also its case sensitive make it giveGun to match how u called the event in the code(or change the 2 places where it runs the the giveGun to givegun)
Code:
public weaponChange(id)
{
   if ( !gHascjPower[id] || !shModActive() ) return

   new wpnid = read_data(2)
   new clip = read_data(3)

   if ( wpnid != CSW_DEAGLE ) return

   switchmodel(id)

   if ( clip == 0 ) {
   shReloadAmmo(id)
}
//-----------------------------------------------------------------------------------------
same thing close the event ur missin a }
__________________
If at first you don't succeed, then skydiving isn't for you.
G-Dog is offline
Send a message via AIM to G-Dog
K-OS
Senior Member
Join Date: Jan 2006
Location: Netherlands
Old 01-27-2006 , 18:32  
Reply With Quote #8

Code:
      new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)
      if (wpnid != CSW_DEAGLE && wpnid > 0) {
         new wpn[32]
         get_weaponname(wpnid,wpn,31)
         engclient_cmd(id, wpn)
      }
This is quite useless.
__________________

This is my BOOMSTICK!!
K-OS is offline
minibel
Junior Member
Join Date: Jan 2006
Old 01-27-2006 , 19:16  
Reply With Quote #9

sry for bein annoyin but it still dont work and i just tried changing morpheus model to the deagle one i want but doesnt change. U still see his mp5. I just changed the mdl code in precache and switchmodel and changed mp5 to deagle

This is how my heros codes now look like

Code:
CVARS - copy and paste to shconfig.cfg 

//cj (Admin only) 
cj_level 80       // The level players have to be to obtain him - Default 
cj_gravity 1.0   // The amount of gravity he has - Default
cj_armor 2000	 // The amount of armor he has - Default 
cj_health 2000    // The amount of health he has - Default 
cj_speed 4000    // How fast Cj can run
*/ 

#include <amxmod> 
#include <vexd_utilities>
#include <superheromod>


// VARIABLES 
new gHeroName[]="cj"
new gHascjPower[SH_MAXSLOTS+1] 
//---------------------------------------------------------------------------------------------- 
public plugin_init() 
{ 

    // Plugin Info 
	register_plugin("cj", "1.0", "[MpA]minibel") 

    // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG 
	register_cvar("cj_level", "80") 
	register_cvar("cj_gravity", "1.0") 
	register_cvar("cj_armor", "2000") 
	register_cvar("cj_health", "2000") 
	register_cvar("cj_speed", "4000") 

    // FIRE THE EVENT TO CREATE THIS SUPERHERO! 
    shCreateHero(gHeroName, "Indestructible", "Admin only", false, "cj_level") 

    // REGISTER EVENTS THIS HERO WILL RESPOND TO! 
    shRegHeroInit(gHeroName, "cj_init") 

	register_event("ResetHUD", "newSpawn","b")
	register_event("CurWeapon", "weaponChange","be","1=1")	

    // Let Server know about Cjs Variable 
    shSetMaxHealth(gHeroName, "Cj_health" ) 
    shSetMinGravity(gHeroName, "Cj_gravity" ) 
    shSetMaxArmor(gHeroName, "Cj_armor" ) 
    shSetMaxSpeed(gHeroName, "Cj_speed", "[0]" ) 
} 
//-----------------------------------------------------------------------------------------
public plugin_precache() 
{  
precache_model("models/shmod/v_deagle.mdl") 
} 
//-----------------------------------------------------------------------------------------
public Cj_init() 
{ 


    // First Argument is an id 
    new temp[6] 
    read_argv(1,temp,5) 
    new id = str_to_num(temp) 

    // 2nd Argument is 0 or 1 depending on whether the id has the hero 
    read_argv(2,temp,5) 
    new hasPowers = str_to_num(temp) 
	
    gHascjPower[id] = (hasPowers != 0)

	if ( !is_user_alive(id) ) return

	if ( gHascjPower[id] ) {
	giveGun(id)
	switchmodel(id)
}
else {
engclient_cmd(id,"drop","weapon_deagle")
        shRemHealthPower(id) 
        shRemGravityPower(id) 
        shRemArmorPower(id) 
        shRemSpeedPower(id) 
    }
} 
//-----------------------------------------------------------------------------------------
public newSpawn(id)
{
if ( gHascjPower[id] && is_user_alive(id) && shModActive() ) {
set_task(0.1, "giveGun", id)

new clip, ammo, wpnid = get_user_weapon(id,clip,ammo) 
      if (wpnid != CSW_DEAGLE && wpnid > 0) { 
         new wpn[32] 
         get_weaponname(wpnid,wpn,31) 
         engclient_cmd(id, wpn) 
       

		}
	}
}
//-----------------------------------------------------------------------------------------
public givegun(id)
{
if ( is_user_alive(id) && shModActive() ) } {
		shGiveWeapon(id,"weapon_deagle")
	}
//---------------------------------------------------------------------------------------------- 
public switchmodel(id) 
{ 
   if ( !is_user_alive(id) || !gHascjPower[id] ) return 
   new clip, ammo, wpnid = get_user_weapon(id,clip,ammo) 
   if (wpnid == CSW_DEAGLE) { 
      Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/v_deagle.mdl")  
   } 
} 

//-----------------------------------------------------------------------------------------
public weaponChange(id)
{
	if ( !gHascjPower[id] || !shModActive() ) return

	new wpnid = read_data(2)
	new clip = read_data(3)

	if ( wpnid != CSW_DEAGLE ) return

	switchmodel(id)

	if ( clip == 0 ) {
	shReloadAmmo(id)
	}
}
//--------------------------------------------------------------
and i tried putting the } in the missin places but didnt change anything and i looked at morpheus and he didnt hav closin brackets so i left it
minibel is offline
K-OS
Senior Member
Join Date: Jan 2006
Location: Netherlands
Old 01-27-2006 , 19:26  
Reply With Quote #10

change
Code:
public givegun(id)
{
    if ( is_user_alive(id) && shModActive() ) } {
        shGiveWeapon(id,"weapon_deagle")
}
to
Code:
public givegun(id)
{
    if ( is_user_alive(id) && shModActive() )
        shGiveWeapon(id,"weapon_deagle")
}
__________________

This is my BOOMSTICK!!
K-OS 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 12:29.


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