Raised This Month: $ Target: $400
 0% 

Hero: The Mask


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
D o o m
Veteran Member
Join Date: Sep 2005
Location: Germany
Old 12-26-2005 , 12:25   Hero: The Mask
Reply With Quote #1

Hey everyone
This is the first hero by me which isn't a rip... I didn't take any code from other heroes, but I have a few problems with it:
1st: The cooldown doesn't work. (Fixed)
2nd: The damagemultiplyers doesn't seem to work. (Fixed)
3rd: The gravity thing works first the next round and not if you choose it.
4th: You first have to change your weapon that the speed works.
5th: Only Mp5navy has unlimited bullets and I wanna have it for glock, usp & mp5navy. (Fixed)

I don't get any errors while compiling it and there also doesn't occur any errors or problems in the console (with debugging), so I hope you can help me

Code:
// The Mask! -- From The Movie With Jim Carrey // Credit goes to Gorlag/Batman for help me with the cooldown and weaponchange part // Credit also goes to Emp` who helped me with the damage part // And also thanks to vittu for the finishing touch :D /* CVARS - copy and paste to shconfig.cfg //The Mask themask_level 10 themask_health 300              //How much hp he has themask_armor 999               //How much ap he has themask_speed 600               //How fast he is themask_gravity 0.30            //How much gravity he has themask_cooldown 60             //# of seconds for The Mask cooldown themask_uspmult 3               //Multiplyer for the USP themask_glock18mult 3.5         //Multiplyer for the Glock18 themask_mp5navymult 1.5         //Multiplyer for the Mp5navy */ #include <amxmod> #include <superheromod> // GLOBAL VARIABLES new gHeroName[]="The Mask" new bool:gHasTheMaskPowers[SH_MAXSLOTS+1] new gHasTheMaskUltimate[SH_MAXSLOTS+1] new bool:gDamage1[SH_MAXSLOTS+1] new bool:gDamage2[SH_MAXSLOTS+1] //---------------------------------------------------------------------------------------------- public plugin_init() {     // Plugin Info     register_plugin("SUPERHERO The Mask","1.0","-]Tical2k[- DooM")     // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG     register_cvar("themask_level", "10" )     register_cvar("themask_health", "300" )     register_cvar("themask_armor", "999" )     register_cvar("themask_speed", "600" )     register_cvar("themask_gravity", "0.30" )     register_cvar("themask_cooldown", "60" )     register_cvar("themask_uspmult", "300" )     register_cvar("themask_glock18mult", "300" )     register_cvar("themask_mp5navymult", "100" )     // FIRE THE EVENT TO CREATE THIS SUPERHERO!     shCreateHero(gHeroName, "Choose!", "You will have a menu with nice opportunities.", true, "themask_level" )     // INIT     register_srvcmd("themask_init", "themask_init")     shRegHeroInit(gHeroName, "themask_init")     // EVENTS     register_event("Damage", "themask_Damage", "b", "2!0")     register_event("CurWeapon", "WeaponChange", "be", "1=1")     register_event("DeathMsg", "Death", "a")     register_event("ResetHUD","NewRound","b")     // MENU     register_menucmd(register_menuid("The Mask's Opportunities"), 1023, "main_menu_action")     // KEYDOWN     register_srvcmd("themask_kd", "themask_kd")     shRegKeyDown(gHeroName, "themask_kd") } //---------------------------------------------------------------------------------------------- public themask_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 wolverine skills     read_argv(2,temp,5)     new hasPowers = str_to_num(temp)     //This gets run if they had the power but don't anymore     if ( !hasPowers && gHasTheMaskPowers[id] ) {         engclient_cmd(id, "drop", "weapon_usp")         engclient_cmd(id, "drop", "weapon_glock18")         engclient_cmd(id, "drop", "weapon_mp5navy")         shRemHealthPower(id)         shRemArmorPower(id)         shRemGravityPower(id)         shRemSpeedPower(id)         }                 //Sets this variable to the current status     gHasTheMaskPowers[id] = (hasPowers != 0) } //---------------------------------------------------------------------------------------------- public NewRound(id) {     gPlayerUltimateUsed[id] = false     gDamage1[id] = false     gDamage2[id] = false } //---------------------------------------------------------------------------------------------- public themask_kd() {     // First Argument is an id     new temp[6]     read_argv(1,temp,5)     new id = str_to_num(temp)     if ( !is_user_alive(id) ) return         if ( gPlayerUltimateUsed[id] )     {         playSoundDenySelect(id)         return     }     if ( gHasTheMaskUltimate[id]>0 ) return     show_main_menu(id)     ultimateTimer(id, get_cvar_num("themask_cooldown") * 1.0)         return } //---------------------------------------------------------------------------------------------- public show_main_menu(id) {     new menu_body[320]     new n = 0     new len = 319     if ( !gHasTheMaskPowers[id] || !is_user_alive(id) ) return     n += format(menu_body[n], len-n, "\rThe Mask's Opportunities^n", " ")     n += format(menu_body[n], len-n, "^n\w1. More HP")     n += format(menu_body[n], len-n, "^n2. More AP")     n += format(menu_body[n], len-n, "^n3. More Speed")     n += format(menu_body[n], len-n, "^n4. Lower Gravity")     n += format(menu_body[n], len-n, "^n5. More DMG for USP & Glock")     n += format(menu_body[n], len-n, "^n6. More DMG for Mp5navy")     n += format(menu_body[n], len-n, "^n^n0. Exit")     new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<9)     show_menu(id, keys, menu_body) } //---------------------------------------------------------------------------------------------- public main_menu_action(id, key) {     key++     if ( !shModActive() || !gHasTheMaskPowers[id] || !is_user_alive(id) ) return     switch(key){         case 1: {             themask_health(id)         }         case 2: {             themask_armor(id)         }         case 3: {             themask_speed(id)         }         case 4: {             themask_gravity(id)         }         case 5: {             themask_ability(id)             gDamage1[id] = true         }         case 6: {             themask_ability2(id)             gDamage2[id] = true         }         case 10: return         default: show_main_menu(id)     } } //---------------------------------------------------------------------------------------------- public WeaponChange(id) {     if ( !gHasTheMaskPowers[id] || !shModActive() ) return     new wpnid = read_data(2)     new clip = read_data(3)     if (wpnid != CSW_USP && wpnid != CSW_GLOCK18 && wpnid != CSW_MP5NAVY) return         // Never Run Out of Ammo!     if ( clip == 0 ) {         shReloadAmmo(id)     } } //---------------------------------------------------------------------------------------------- public themask_health(id) {     set_user_health(id, get_cvar_num("themask_health"))             // This is here that the person sees what he/she chose     new message[128]     format(message, 127, "The Mask - You decided to take more hp. Nice Choice!")     set_hudmessage(157,50,250,-1.0,0.3,0,0.25,1.0,0.0,0.0,4)     show_hudmessage(id, message) } //---------------------------------------------------------------------------------------------- public themask_armor(id) {     give_item(id, "item_assaultsuit")     set_user_armor(id, get_cvar_num("themask_armor"))             // This is here that the person sees what he/she chose     new message[128]     format(message, 127, "The Mask - You decided to take more ap. Nice Choice!")     set_hudmessage(255,255,255,-1.0,0.3,0,0.25,1.0,0.0,0.0,4)     show_hudmessage(id, message) } //---------------------------------------------------------------------------------------------- public themask_speed(id) {     server_cmd("sh_setmaxspeed ^"%s^" ^"%s^" ^"%s^"", gHeroName, "themask_speed", "[0]" )                 // This is here that the person sees what he/she chose     new message[128]     format(message, 127, "The Mask - You decided to take more speed. Nice Choice!")     set_hudmessage(255,255,0,-1.0,0.3,0,0.25,1.0,0.0,0.0,4)     show_hudmessage(id, message) } //---------------------------------------------------------------------------------------------- public themask_gravity(id) {     server_cmd("sh_setmingravity ^"%s^" ^"%s^"", gHeroName, "themask_gravity" )                 // This is here that the person sees what he/she chose     new message[128]     format(message, 127, "The Mask - You decided to take lower gravity. Nice Choice!")     set_hudmessage(157,250,180,-1.0,0.3,0,0.25,1.0,0.0,0.0,4)     show_hudmessage(id, message) } //---------------------------------------------------------------------------------------------- public themask_ability(id) {     if ( is_user_alive(id) ) {         shGiveWeapon(id, "weapon_usp")         shGiveWeapon(id, "weapon_glock18")             // This is here that the person sees what he/she chose         new message[128]         format(message, 127, "The Mask - You decided to take more dmg for USP & Glock18. Nice Choice!")         set_hudmessage(18,240,167,-1.0,0.3,0,0.25,1.0,0.0,0.0,4)         show_hudmessage(id, message)     } }   //---------------------------------------------------------------------------------------------- public themask_ability2(id) {     if ( is_user_alive(id) ) {         shGiveWeapon(id, "weapon_mp5navy")         // This is here that the person sees what he/she chose         new message[128]         format(message, 127, "The Mask - You decided to take more dmg for Mp5navy. Nice Choice!")         set_hudmessage(255,255,0,-1.0,0.3,0,0.25,1.0,0.0,0.0,4)         show_hudmessage(id, message)     } }   //---------------------------------------------------------------------------------------------- public themask_Damage(id) {       new damage = read_data(2)       new body, weapon, attacker = get_user_attacker(id, weapon, body)       new headshot = body == 1 ? 1 : 0       if ( attacker > 0 && attacker <= SH_MAXSLOTS && is_user_alive(attacker) && attacker != id ) {          if (gDamage1[attacker]){             if(weapon==CSW_USP){                new extraDamage = floatround(damage * get_cvar_float("themask_uspmult") - damage)                if (extraDamage > 0) shExtraDamage( id, attacker, extraDamage, "usp", headshot )                }             if(weapon==CSW_GLOCK18){                new extraDamage = floatround(damage * get_cvar_float("themask_glock18mult") - damage)                if (extraDamage > 0) shExtraDamage( id, attacker, extraDamage, "glock18", headshot )                }          }          else if (gDamage2[attacker] && weapon==CSW_MP5NAVY){             new extraDamage = floatround(damage * get_cvar_float("themask_mp5navymult") - damage)             if (extraDamage > 0) shExtraDamage( id, attacker, extraDamage, "mp5navy", headshot )          }       } } //---------------------------------------------------------------------------------------------- public Death() {     new id = read_data(2)     if ( !gHasTheMaskPowers[id] ) return } //---------------------------------------------------------------------------------------------
__________________
Heroes
:+: Deadpool :+:
D o o m is offline
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 12-26-2005 , 21:00  
Reply With Quote #2

Quote:
1st: The cooldown doesn't work.
2nd: The damagemultiplyers doesn't seem to work.
3rd: The gravity thing works first the next round and not if you choose it.
4th: You first have to change your weapon that the speed works.
5th: Only Mp5navy has unlimited bullets and I wanna have it for glock, usp & mp5navy.
1. You have to use gPlayerUltimateUsed. When the ultimateTimer is started, gPlayerUltimateUsed[id] is true, after the timer is up gPlayerUltimateUsed[id] is false.
2. You didn't register a damage event, which will get called upon when someone gets damaged, so that you can add extra damage. Those damage methods you wrote won't work properly unless the functions are hooked to the damage event.
3. Do you want the gravity for the mask hero to be set regardless if there is another hero with an even lower gravity?
4. Do you want the speed for the mask hero to be set regardless if there is another hero with an even faster speed?
5.
Code:
if ( wpnid != CSW_USP | CSW_GLOCK18 | CSW_MP5NAVY ) return
Replace this with:
Code:
if (wpnid != CSW_USP && wpnid != CSW_GLOCK18 && wpnid != CSW_MP5NAVY) return
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 12-27-2005 , 00:06   Re: Hero: The Mask
Reply With Quote #3

Quote:
Originally Posted by Doom
Code:
    n += format(menu_body[n], len-n, "\rThe Mask's Opportunities^n", " ")
    n += format(menu_body[n], len-n, "^n\w1. More HP")
    n += format(menu_body[n], len-n, "^n2. More AP")
    n += format(menu_body[n], len-n, "^n3. More Speed")
    n += format(menu_body[n], len-n, "^n4. Lower Gravity")
    n += format(menu_body[n], len-n, "^n5. More DMG for USP & Glock")
    n += format(menu_body[n], len-n, "^n6. More DMG for Mp5navy")
    n += format(menu_body[n], len-n, "^n^n0. Exit")
i think you can replace it with this
Code:
    n += format(menu_body[n], len-n, "\rThe Mask's Opportunities^n^n\w 1. More HP^n 2. More AP^n 3. More Speed^n 4. Lower Gravity^n 5. More DMG for USP & Glock^n 6. More DMG for Mp5navy^n^n 0. Exit")
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
D o o m
Veteran Member
Join Date: Sep 2005
Location: Germany
Old 12-27-2005 , 03:54  
Reply With Quote #4

Thank you 2

(@Gorlag/Batman)
I found the part with the ultimate thing, but didn't really understand it and so I tried a bit and got now this code which works for the cooldown
I also found the part for the damage, but there's a few problems. I tried putting CSW_WEAPONNAME (CSW_USP and so on) and also "weapon_usp" in for the part of weaponDescription, but it told me that damage, attacker and so on are undefined things and so I tried using the parts from a hero with a damage event, but that didn't work. So I hope you can help me with it
To 3 & 4: If there is another hero who is faster or has a lower gravity, it should use this gravity/speed, if this is possible.
Thanks for the weaponchange part. It works without any problems

(@Emp`)
Thanks, but it's easier for me with this menu The reason is that it's easier to add things for me and it's easier to survey it ;) But thanks for your help

*EDIT*
The new hero is in the main post, just edited it ;)
__________________
Heroes
:+: Deadpool :+:
D o o m is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 12-27-2005 , 13:12  
Reply With Quote #5

i dont know how you want to do this, but lets say they dont pick a power right away, and when theyre dieing they pick hp. dont know if you want them to be able to do that so ya...

for your extra damage, you need to register the event for damage in the init
Code:
	register_event("Damage", "TheMask_damage", "b", "2!0")
youll also need to make some new bools
Code:
new bool:gDamage1[SH_MAXSLOTS+1]//when player picks usp and glock damage
new bool:gDamage2[SH_MAXSLOTS+1]// when player picks mp5 damage
youll want to make it so when they choose the appropriate damage that they get their gDamage1[id] = true or gDamage2[id] = true
and on new spawn youll want to turn these both to false

then youll want to change the damage thing to something like this:
Code:
public TheMask_damage(id) 
{
		new damage = read_data(2)
		new body, weapon, aid = get_user_attacker(id, weapon, body)
		new headshot = body == 1 ? 1 : 0

		if ( aid > 0 && aid <= SH_MAXSLOTS && is_user_alive(aid) && aid != id ) {
			if (gDamage1[aid]){
				if(weapon==CSW_USP){
					new extraDamage = floatround(damage * get_cvar_float("TheMask_uspmult") - damage)
					if (extraDamage > 0) sh_extradamage( id, attacker, extraDamage, "usp", headshot )
					}
				if(weapon==CSW_GLOCK18){
					new extraDamage = floatround(damage * get_cvar_float("TheMask_glock18mult") - damage)
					if (extraDamage > 0) sh_extradamage( id, attacker, extraDamage, "glock18", headshot )
					}
			}
			else if (gDamage2[aid] && weapon==CSW_MP5NAVY){
				new extraDamage = floatround(damage * get_cvar_float("TheMask_mp5navymult") - damage)
				if (extraDamage > 0) sh_extradamage( id, attacker, extraDamage, "mp5navy", headshot )
			}
		}
}
then youll want to get rid of your
Code:
public TheMask_damage2(id)
{
    server_cmd("sh_extradamage ^"%d^" ^"%d^" ^"%d^" ^"%s^" ^"%d^"", id, attacker, damage, weaponDescription, headshot )
}
and i think there was something where your not suppose to put capitals in the cvar names
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
D o o m
Veteran Member
Join Date: Sep 2005
Location: Germany
Old 12-27-2005 , 16:56  
Reply With Quote #6

Thanks Emp`, but now is sh_extradamage undefined and so it can't compile the file (...)

*EDIT*
And why shouldn't the cvars be in capitals? Does it matter?
__________________
Heroes
:+: Deadpool :+:
D o o m is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 12-27-2005 , 17:29  
Reply With Quote #7

oops sorry was using module includes, change em to shExtraDamage

and i forgot the reason for not capitalizing the cvars
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
D o o m
Veteran Member
Join Date: Sep 2005
Location: Germany
Old 12-28-2005 , 05:31  
Reply With Quote #8

Hm... The shExtraDamage is okay now... But it says attacker undefined and I so I defined it like in every other code

Code:
      new damage = read_data(2)
      new body, weapon, aid = get_user_attacker(id, weapon, body)
      new headshot = body == 1 ? 1 : 0
Changed that to
Code:
      new damage = read_data(2)
      new body, weapon, attacker, aid = get_user_attacker(id, weapon, body)
      new headshot = body == 1 ? 1 : 0
But then the extra damage still don't work...

Do you have an idea?
__________________
Heroes
:+: Deadpool :+:
D o o m is offline
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 12-28-2005 , 06:07  
Reply With Quote #9

new body, weapon, aid = get_user_attacker(id, weapon, body)

(extraDamage > 0) sh_extradamage( id, attacker, extraDamage, "usp", headshot )



aid or attacker choose one and use it
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
D o o m
Veteran Member
Join Date: Sep 2005
Location: Germany
Old 12-28-2005 , 07:01  
Reply With Quote #10

Thanks vittu

It works now perfectly

I didn't know what the aid meant, because I've never seen this in a code and not in the .inc file...

Do you think, it's good enough to post in NewSubmissions?

*EDIT*
Oh, I forgot about point 3 & 4. Can someone help with this?
The thing with the speed isn't definatly needed, if this can't be fixed, but the gravity should...
__________________
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 00:22.


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