Raised This Month: $ Target: $400
 0% 

hero help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mega
Senior Member
Join Date: Aug 2005
Old 09-03-2005 , 13:15   hero help
Reply With Quote #1

Code:
//Mafia /* CVARS copy and paste to shconfig.cfg //Mafia mafia_level 10 // Level where this hero can be choosen mafia_galilmult 3.0 // His Galil Mult mafia_knifemult 3.0 // His Knife mafia_armor 150 // His body protection mafia_money 50000  // amout of money mafia starts with */ #include <amxmod> #include <Vexd_Utilities> #include <superheromod> //Global Variables new gHeroName[]="Mafia" new bool:gHasMafiaPower[SH_MAXSLOTS+1] //---------------------------------------------------------------------------------------------- public plugin_init() {     //Plugin Info     register_plugin("SUPERHERO Mafia","1.0","mega")         //DO NOT EDIT THESE CVARS. USE shconfig.cfg     register_cvar("mafia_level", "10")     register_cvar("mafia_galilmult", "3.0")     register_cvar("mafia_knifemult", "3.0")     register_cvar("mafia_armor","150")     register_cvar("mafia_money","50000")         //FIRE THIS EVENT TO CREATE THIS HERO     shCreateHero(gHeroName, "Mafia", "Get a tommygun, a knife, and get $50.000", false, "mafia_level")           // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS     register_srvcmd("mafia_init", "mafia_init")     shRegHeroInit(gHeroName, "mafia_init")        //DAMAGE      register_event("Damage", "mafia_damage", "b")    //EVENTS    register_event("ResetHUD", "newSpawn","b")    register_event("CurWeapon", "weaponChange","be","1=1")    register_event("Damage", "mafia_damage","b","2!0")    // MAFIA'S VARIABLE    shSetMaxArmor(gHeroName, "mafia_armor" )       //---------------------------------------------------------------------------------------------- public mafia_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 Mafia     read_argv(2,temp,5)     new hasPowers = str_to_num(temp)     //Got to remove powers from a Superman that lost his powers...     //This gets run if they had the power but don't anymore     if ( !hasPowers && gHasMafiaPower[id] && is_user_alive(id) ) {         shRemArmorPower(id)         mafia_weapons(id)         switchmodel(id)         }         else {         engclient_cmd(id,"drop","weapon_galil")     //Sets this variable to the current status     gHasMafiaPower[id] = (hasPowers != 0)         } } //---------------------------------------------------------------------------------------------- public plugin_precache() { precache_model("models/shmod/mafia_galil.mdl") precache_model("models/shmod/mafia_knife.mdl") precache_model("models/players/mafia/mafia.mdl") } //---------------------------------------------------------------------------------------------- public newSpawn(id) { if ( gHasMafiaPower[id] && is_user_alive(id) && shModActive() ) { set_task(0.1, "mafia_weapons", id) new clip, ammo, wpnid = get_user_weapon(id,clip,ammo) if (wpnid != CSW_GALIL && wpnid > 0) {  new wpn[32]  get_weaponname(wpnid,wpn,31)  engclient_cmd(id,wpn) } } } //---------------------------------------------------------------------------------------------- public newRound(id) {    if (gHasMafiaPower[id]) {    cs_set_user_money(id,get_cvar_num("mafia_money"))    } } //---------------------------------------------------------------------------------------------- public Money(id,num) // check money {    new userMoney = cs_get_user_money(id)    if (userMoney < 0)    {       client_print(id,print_center,"You have insufficient funds!")       return false    }    cs_set_user_money(id,userMoney)    return true } //---------------------------------------------------------------------------------------------- public mafia_weapons(id) { if ( is_user_alive(id) && shModActive() ) { shGiveWeapon(id,"weapon_galil") } } //---------------------------------------------------------------------------------------------- public switchmodel(id) { if ( !is_user_alive(id) || !gHasMafiaPower[id] ) return new clip, ammo, wpnid = get_user_weapon(id,clip,ammo) if (wpnid == CSW_GALIL) { // Weapon Model change thanks to [CCC]Taz-Devil Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/mafia_galil.mdl") if (wpnid == CSW_GALIL) { // Weapon Model change thanks to [CCC]Taz-Devil Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/mafia_knife.mdl") }           } } //---------------------------------------------------------------------------------------------- public weaponChange(id) { if ( !gHasMafiaPower[id] || !shModActive() ) return new wpnid = read_data(2) new clip = read_data(3) if ( wpnid != CSW_GALIL) return switchmodel(id) // Never Run Out of Ammo! if ( clip == 0 ) { shReloadAmmo(id)         } } //---------------------------------------------------------------------------------------------- public mafia_death() {     new id = read_data(2)     if ( !gHasMafiaPower[id] ) return } //---------------------------------------------------------------------------------------------- public mafia_damage(id) {     if (!shModActive() || !is_user_alive(id)) return     new damage = read_data(2)     new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)     new headshot = bodypart == 1 ? 1 : 0     if ( attacker <= 0 || attacker > SH_MAXSLOTS ) return     if ( gHasMafiaPower[attacker] && weapon == CSW_GALIL && is_user_alive(id) ) {         // do extra damage         new extraDamage = floatround(damage * get_cvar_float("mafia_galilmult") - damage)         if (extraDamage > 0) shExtraDamage( id, attacker, extraDamage, "galil", headshot )         if ( gHasMafiaPower[attacker] && weapon == CSW_KNIFE && is_user_alive(id) ) {         new extraDamage = floatround(damage * get_cvar_float("mafia_knifemult") - damage)     if (extraDamage > 0) shExtraDamage( id, attacker, extraDamage, "knife", headshot )              }             } } //----------------------------------------------------------------------------------------------


Someone on other forum requested it, so i made, can someone find out what's wrong?
Mega is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 09-03-2005 , 14:57  
Reply With Quote #2

here's a hint, all your problems should be fixed with just 2 extra braces

Check your braces in plugin_init and the part of damage code

make sure you always have the right amount of braces for each part of the code. (if i told u how to fix it, then u would never learn it so the hints should be enough)
__________________
yang is offline
Send a message via AIM to yang
Om3gA
Veteran Member
Join Date: Feb 2005
Old 09-03-2005 , 16:18   Re: hero help
Reply With Quote #3

and do ya see here something worng

Code:
public switchmodel(id)
{
if ( !is_user_alive(id) || !gHasMafiaPower[id] ) return
new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)
if (wpnid == CSW_GALIL) {
// Weapon Model change thanks to [CCC]Taz-Devil
Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/mafia_galil.mdl")
if (wpnid == CSW_GALIL) {
// Weapon Model change thanks to [CCC]Taz-Devil
Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/mafia_knife.mdl")
}
          }
}
hint it starts with "GA" and ends with "LIL" and another hint its above thease lines

Code:
// Weapon Model change thanks to [CCC]Taz-Devil
Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/mafia_knife.mdl")
__________________
Om3gA is offline
Send a message via AIM to Om3gA Send a message via MSN to Om3gA Send a message via Yahoo to Om3gA Send a message via Skype™ to Om3gA
Mega
Senior Member
Join Date: Aug 2005
Old 09-03-2005 , 18:24  
Reply With Quote #4

ok it works ... but my money stays 800
and my player and knife mdl wont change


Code:
//Mafia! /* CVARS copy and paste to shconfig.cfg //Mafie mafia_level 10 // Level where this hero can be choosen mafia_galilmult 3.0 // His Galil Mult mafia_knifemult 3.0 // His Knife mafia_armor 150 // His body protection mafia_money 50000  // amout of money mafia starts with */ #include <amxmod> #include <Vexd_Utilities> #include <superheromod> //Global Variables new gHeroName[]="Mafia" new bool:gHasMafiaPower[SH_MAXSLOTS+1] //---------------------------------------------------------------------------------------------- public plugin_init() {     //Plugin Info     register_plugin("SUPERHERO Mafia","1.0","mega")         //DO NOT EDIT THESE CVARS. USE shconfig.cfg     register_cvar("mafia_level", "10")     register_cvar("mafia_galilmult", "3.0")     register_cvar("mafia_knifemult", "3.0")     register_cvar("mafia_armor","150")     register_cvar("mafia_money","50000")         //FIRE THIS EVENT TO CREATE THIS HERO     shCreateHero(gHeroName, "Mafia", "Get a tommygun, a knife, and get $50.000", false, "mafia_level")           // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS     register_srvcmd("mafia_init", "mafia_init")     shRegHeroInit(gHeroName, "mafia_init")    //EVENTS    register_event("ResetHUD", "newSpawn","b")    register_event("CurWeapon", "weaponChange","be","1=1")    register_event("Damage", "mafia_damage", "b","2!0")    //DEATH    register_event("DeathMsg", "mafia_death", "a")    // MAFIA'S VARIABLE    shSetMaxArmor(gHeroName, "mafia_armor" ) }     //---------------------------------------------------------------------------------------------- public mafia_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 Mafia     read_argv(2,temp,5)     new hasPowers = str_to_num(temp)     //Reset thier shield restrict status     //Shield restrict MUST be before weapons are given out     shResetShield(id)     //Got to remove powers from a Superman that lost his powers...     //This gets run if they had the power but don't anymore     if ( !hasPowers && gHasMafiaPower[id] && is_user_alive(id) ) {         shRemArmorPower(id)         mafia_weapons(id)         switchmodel(id)         }         else {         engclient_cmd(id,"drop","weapon_galil")     //Sets this variable to the current status     gHasMafiaPower[id] = (hasPowers != 0)         } } //---------------------------------------------------------------------------------------------- public plugin_precache() { precache_model("models/shmod/mafia_galil.mdl") precache_model("models/shmod/mafia_knife.mdl") precache_model("models/player/mafia/mafia.mdl") } //---------------------------------------------------------------------------------------------- public newSpawn(id) { if ( gHasMafiaPower[id] && is_user_alive(id) && shModActive() ) { set_task(0.1, "mafia_weapons", id) new clip, ammo, wpnid = get_user_weapon(id,clip,ammo) if (wpnid != CSW_GALIL && wpnid > 0) {  new wpn[32]  get_weaponname(wpnid,wpn,31)  engclient_cmd(id,wpn) } } } //---------------------------------------------------------------------------------------------- public newRound(id) {    if (gHasMafiaPower[id]) {    cs_set_user_money(id,get_cvar_num("mafia_money"))    } } //---------------------------------------------------------------------------------------------- public Money(id,num) // check money {    new userMoney = cs_get_user_money(id)    if (userMoney < 0)    {       client_print(id,print_center,"You have insufficient funds!")       return false    }    cs_set_user_money(id,userMoney)    return true } //---------------------------------------------------------------------------------------------- public mafia_weapons(id) { if ( is_user_alive(id) && shModActive() ) { shGiveWeapon(id,"weapon_galil") } } //---------------------------------------------------------------------------------------------- public switchmodel(id) { if ( !is_user_alive(id) || !gHasMafiaPower[id] ) return new clip, ammo, wpnid = get_user_weapon(id,clip,ammo) if (wpnid == CSW_GALIL) { // Weapon Model change thanks to [CCC]Taz-Devil Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/mafia_galil.mdl") if (wpnid == CSW_KNIFE) { // Weapon Model change thanks to [CCC]Taz-Devil Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/mafia_knife.mdl") }           } } //---------------------------------------------------------------------------------------------- public weaponChange(id) { if ( !gHasMafiaPower[id] || !shModActive() ) return new wpnid = read_data(2) new clip = read_data(3) if ( wpnid != CSW_GALIL) return switchmodel(id) // Never Run Out of Ammo! if ( clip == 0 ) { shReloadAmmo(id)         } } //---------------------------------------------------------------------------------------------- public mafia_death() {     new id = read_data(2)     if ( !gHasMafiaPower[id] ) return } //---------------------------------------------------------------------------------------------- public mafia_damage(id) {     if (!shModActive() || !is_user_alive(id)) return     new damage = read_data(2)     new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)     new headshot = bodypart == 1 ? 1 : 0     if ( attacker <= 0 || attacker > SH_MAXSLOTS ) return     if ( gHasMafiaPower[attacker] && weapon == CSW_GALIL && is_user_alive(id) ) {                 // do extra damage         new extraDamage = floatround(damage * get_cvar_float("mafia_galilmult") - damage)     if (extraDamage > 0) shExtraDamage( id, attacker, extraDamage, "galil", headshot )         } else     if ( gHasMafiaPower[attacker] && weapon == CSW_KNIFE && is_user_alive(id) ) {         new extraDamage = floatround(damage * get_cvar_float("mafia_knifemult") - damage)     if (extraDamage > 0) shExtraDamage( id, attacker, extraDamage, "knife", headshot )             } } //----------------------------------------------------------------------------------------------
Mega is offline
D o o m
Veteran Member
Join Date: Sep 2005
Location: Germany
Old 09-03-2005 , 18:37  
Reply With Quote #5

Hint for switchmodel:

You forgot a line between
Code:
Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/mafia_galil.mdl")
and
Code:
if (wpnid == CSW_KNIFE) {
If you have more than one model you have to write it a bit different than, if you have 2 models for one gun
I don't think, that there is a hero who uses more than one model for guns, so if you don't know what you have to write there, say it and I'll tell you what is missing..

And for the Playermodel is missing a lot.. You never defined it.. You only precached it, but you don't use it in the code..
Lemme copy something from Master Chief..
Code:
public masterchief_morph(id)
{
	if ( gmorphed[id] || !is_user_alive(id) ) return

	#if defined AMXX_VERSION
	cs_set_user_model(id, "masterchief")
	#else
	CS_SetModel(id, "masterchief")
	#endif
You see the last 5 lines at this code.. Here it is defined, if I'm right
__________________
Heroes
:+: Deadpool :+:
D o o m is offline
Mega
Senior Member
Join Date: Aug 2005
Old 09-03-2005 , 18:39  
Reply With Quote #6

lol, didn't know u needed to morph to use playermodel :s
Mega is offline
D o o m
Veteran Member
Join Date: Sep 2005
Location: Germany
Old 09-03-2005 , 18:42  
Reply With Quote #7

I'm not sure, if you need the whole morphthing, but you definately have to define the playermodel and you only precached it..
__________________
Heroes
:+: Deadpool :+:
D o o m is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 09-03-2005 , 19:48  
Reply With Quote #8

actually you do not need to define the playermodel for it to work, you just need to precache it :p
__________________
yang is offline
Send a message via AIM to yang
Mega
Senior Member
Join Date: Aug 2005
Old 09-03-2005 , 19:55  
Reply With Quote #9

ok, but help

my money ain't working and the knife and player model either
Mega is offline
D o o m
Veteran Member
Join Date: Sep 2005
Location: Germany
Old 09-04-2005 , 02:25  
Reply With Quote #10

Okay, if you say it rockell I already said I'm not 100% sure

For the moneything you should look again at Bill Gates.. I've seen a few things what you need for the money what you haven't in your code ;)

If you wanna get the models get loaded you have to load the switchmodel(id) in your code (and that's now sure ) At more than one place ;)
__________________
Heroes
:+: Deadpool :+:
D o o m 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 06:28.


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