Raised This Month: $ Target: $400
 0% 

Stimpack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarlD
Senior Member
Join Date: Aug 2004
Old 04-24-2007 , 14:37   Stimpack
Reply With Quote #1

/home/groups/amxmodx/tmp3/phpwENvvC.sma(45) : error 035: argument type mismatch (argument 1)
/home/groups/amxmodx/tmp3/phpwENvvC.sma(73) : warning 209: function "stimpack_action" should return a value
/home/groups/amxmodx/tmp3/phpwENvvC.sma(78 ) : warning 203: symbol is never used: "Player"

This plugin is a replica of the stimpack in starcraft. When you use a stimpack theres a cool starcraft marine sound and it takes 10hp from ya. what it is supposed to do as well is make you go faster and do double the damage. I'm having a little bit of trouble with that.

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fun> new Player[32] new bool:UsedStimpack[32] public plugin_precache() {     precache_sound("StimPack/tmaSti01.wav")     return PLUGIN_CONTINUE } public plugin_init() {         register_plugin("Stim Pack", "01", "DarlD")     register_clcmd("stimpack","stimpack_action",ADMIN_ALL,"Bind to use the Stim Pack")     register_cvar("stim_speed","200")// this is the default speed to be added each dose     register_cvar("stim_pack","1")// this is the on off cmd     register_cvar("stim_DD","1")// enable or disable the double damage that comes with the stim pack (default on)     register_cvar("stim_DD_time","10")// time for the Double Damage to last (default 10 seconds)         if ( get_cvar_num("stim_pack") == 1 && get_cvar_num("stim_DD") == 1 ) {                 register_event("Damage","DD","b")     } }       public DD(id) {         new Dmg = read_data(2)     new Weap, NewDmg, PartHit     new Attacker = get_user_attacker(id, Weap, PartHit)     new Health = get_user_health(id)     new alive = is_user_alive(id)     if (alive) {                 NewDmg = (Health - Dmg)         if(NewDmg < 1) {                         set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE);             message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0)                 write_byte(Attacker)             write_byte(id)             write_byte(random_num(0,1))             write_string(Weap)             message_end()         }         set_user_health(id, NewDmg)     }     return PLUGIN_CONTINUE } public stimpack_action(id) {         new onoff = get_cvar_num("stim_pack")     if (onoff==0)         return PLUGIN_HANDLED         new health = get_user_health(id)     if ( health <= 10) {                 client_print(id,print_chat,"[Stim Pack] You don't have enough health left!")         return PLUGIN_HANDLED         }else if ( health >= 11 && !UsedStimpack[id]) {                 client_cmd(id,"spk StimPack/tmaSti01.wav", "c")         set_task(1.5,"stopsound")         client_print(id,print_chat,"[Stim Pack] Awwww yeah... You have used a Stim Pack")         set_user_health(id, health - 10)                 }else{         return PLUGIN_HANDLED     } } public stopsound(id) {     client_cmd(id,"stopsound")     return PLUGIN_HANDLED }
__________________

Last edited by DarlD; 04-24-2007 at 14:43.
DarlD is offline
Send a message via MSN to DarlD
DarlD
Senior Member
Join Date: Aug 2004
Old 04-24-2007 , 15:53   Re: Stimpack
Reply With Quote #2

Anyone?
__________________
DarlD is offline
Send a message via MSN to DarlD
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 04-24-2007 , 16:11   Re: Stimpack
Reply With Quote #3

Weap is the weapon id, not the weapon name
you would need somehow find the weapon name by the weapon id

or make a custom one like write_string("Stim")
__________________
http://www.nican132.com
I require reputation!
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
DarlD
Senior Member
Join Date: Aug 2004
Old 04-24-2007 , 17:45   Re: Stimpack
Reply With Quote #4

I deceided to make this pluging simpler by just changing the speed of the player when he reaches a certain amount of HP for a certain amount of time.

here is the coding:

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Stimpack", "1", "|GGW| Meta")     // Cvars     register_cvar("Stimpack_Health","15") //Defines at how much hp the plugin should start     register_cvar("Stimpack_time", "15") //Defines for how long the buzz should last     register_cvar("Stimpack","1")//enable or disable     register_cvar("Stimpack_speed","400")     register_cvar("NormalSpeed","0")     // Events     register_event("Damage","Damage_event","b")     register_event("DeathMsg","Reset","a") } public plugin_precache() {     precache_sound("misc/tmaSti01.wav")     return PLUGIN_CONTINUE } public Damage_event(id){         if (get_cvar_num("Stimpack") == 0)         return PLUGIN_HANDLED             if (!is_user_alive(id))         return PLUGIN_HANDLED     }else{         new n_speed = get_user_maxspeed(id)         new health = get_user_health(id)         new low_health = get_cvar_num("Stimpack_Health")         new speed = get_cvar_num("Stimpack_speed")         new timer = get_cvar_num("Stimpack_time")                 if (health <= low_health){             set_cvar_num("NormalSpeed", n_speed)             client_print(id,print_chat,"Low Health Detected | Stimpack Administered! Awwww yeah")             set_user_maxspeed(id, speed)             client_cmd(id,"spk misc/tmaSti01.wav")             set_task(timer,"Stimpack_Reset")     }         return PLUGIN_CONTINUE } public Stimpack_Reset(id) {     new n_speed2 = get_cvar_num("NormalSpeed")         set_user_maxspeed(id, n_speed2)     client_print(id,print_chat,"Stimpack effect has faded.")         return PLUGIN_CONTINUE }

I get these errors when I try to compile:
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(30) : warning 209: function "Damage_event" should return a value
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(30) : error 010: invalid function or declaration
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(37) : error 010: invalid function or declaration
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(44) : error 010: invalid function or declaration
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(50) : warning 213: tag mismatch
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(55) : warning 203: symbol is never used: "health"
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(55) : warning 203: symbol is never used: "low_health"
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(55) : warning 203: symbol is never used: "n_speed"
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(55) : warning 203: symbol is never used: "speed"
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(55) : warning 203: symbol is never used: "timer"

Help?
__________________
DarlD is offline
Send a message via MSN to DarlD
DarlD
Senior Member
Join Date: Aug 2004
Old 04-24-2007 , 17:48   Re: Stimpack
Reply With Quote #5

I was able to fix all of those problems by deleting the }else{
but I still get some warnings

/home/groups/amxmodx/tmp3/phpBHzeKK.sma(31) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phpBHzeKK.sma(32) : warning 213: tag mismatch
/home/groups/amxmodx/tmp3/phpBHzeKK.sma(40) : warning 213: tag mismatch
/home/groups/amxmodx/tmp3/phpBHzeKK.sma(42) : warning 213: tag mismatch
/home/groups/amxmodx/tmp3/phpBHzeKK.sma(50) : warning 213: tag mismatch

anyway I could get rid of em?
__________________
DarlD is offline
Send a message via MSN to DarlD
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 04-24-2007 , 18:01   Re: Stimpack
Reply With Quote #6

I suggest you get familiar with understanding the native. To look in the function wiki to see the how to use the native and what return type or what type of parameter it take.

Ie Floats, Integers. Cause you were mixing up usage where it require floats.

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Stimpack", "1", "|GGW| Meta")     // Cvars     register_cvar("Stimpack_Health","15") //Defines at how much hp the plugin should start     register_cvar("Stimpack_time", "15") //Defines for how long the buzz should last     register_cvar("Stimpack","1")//enable or disable     register_cvar("Stimpack_speed","400")     register_cvar("NormalSpeed","0")     // Events     register_event("Damage","Damage_event","b")     register_event("DeathMsg","Reset","a") } public plugin_precache() {     precache_sound("misc/tmaSti01.wav")     return PLUGIN_CONTINUE } public Damage_event(id){     if (get_cvar_num("Stimpack") && is_user_alive(id))     {         new Float:n_speed = get_user_maxspeed(id)         new health = get_user_health(id)         new low_health = get_cvar_num("Stimpack_Health")         new Float:speed = get_cvar_float("Stimpack_speed")         new Float:timer = get_cvar_float("Stimpack_time")         if (health <= low_health){             set_cvar_float("NormalSpeed", n_speed)             client_print(id,print_chat,"Low Health Detected | Stimpack Administered! Awwww yeah")             set_user_maxspeed(id, speed)             client_cmd(id,"spk misc/tmaSti01.wav")             set_task(timer,"Stimpack_Reset")         }    } } public Stimpack_Reset(id) {     new Float:n_speed2 = get_cvar_float("NormalSpeed")     set_user_maxspeed(id, n_speed2)     client_print(id,print_chat,"Stimpack effect has faded.")     return PLUGIN_CONTINUE }
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
DarlD
Senior Member
Join Date: Aug 2004
Old 04-24-2007 , 18:54   Re: Stimpack
Reply With Quote #7

Thanks! I got one more problem thought, when someone gets low hp, the sound file starts but never stops, its as if it were looped! anyway i could fix it?
__________________
DarlD is offline
Send a message via MSN to DarlD
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 04-24-2007 , 19:25   Re: Stimpack
Reply With Quote #8

OMG, give me my soul back NOW!
__________________
regalis is offline
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 04-24-2007 , 19:29   Re: Stimpack
Reply With Quote #9

You would have to do execute "stopsound" at the player console
Get the sound length, make a set_task with that length, and execute the "stopsound" after the X seconds
I don't know if that is the best way to do it...


And I would not do this function at damage_event,
1 bullet = 1 damage event
You might flood the user, set a limit, like this message can only show every 10 secs
__________________
http://www.nican132.com
I require reputation!
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
BioI-Iazard
Senior Member
Join Date: Sep 2005
Location: Calgary, Alberta
Old 04-25-2007 , 20:46   Re: Stimpack
Reply With Quote #10

as well with this plugin the time part isnt working properly either... like the stim should end at a defined time but instead it keeps going until the weapon is switched.
__________________
Loved by Many ....
Hated by Some ....
Respected by All !!!!
BioI-Iazard 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:39.


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