Raised This Month: $ Target: $400
 0% 

register_event("ResetHUD", ....... -resolved again


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
stupok
Veteran Member
Join Date: Feb 2006
Old 09-28-2006 , 18:28   register_event("ResetHUD", ....... -resolved again
Reply With Quote #1

I get the following error when compiling this code:
Code:
(41) : error 035: argument type mismatch (argument 1)
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "ZombieAdder" #define VERSION "1.0" #define AUTHOR "Kamil" new g_pcvarzombies new g_pcvarzombiehp public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     g_pcvarzombies = register_cvar("addzombies", "25")     g_pcvarzombiehp = register_cvar("zombiehp", "300")     register_event("ResetHUD", "zombie_health", "e")         if(get_pcvar_num(g_pcvarzombies))         set_addzombies() } public set_addzombies() {     for (new i = 1; i <= get_pcvar_num(g_pcvarzombies); i++)     {         set_task(float(i) * 0.5, "addzombies")     } } public addzombies() {     server_cmd("addcustombot Zombie Domo 9.9") } public zombie_health(id) {     if(is_user_bot(id))     {         set_user_health(id, get_cvar_num(g_pcvarzombiehp))     }             return PLUGIN_CONTINUE }

Last edited by stupok; 09-28-2006 at 21:53.
stupok is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 09-28-2006 , 18:34   Re: register_event("ResetHUD", .......
Reply With Quote #2

The mismatch is coming from get_cvar_num. That is "old" way of getting a cvar's value, it expects a string argument that is the cvar's name, ie: get_cvar_num("zombiehp"). Since you are using cvar ids, use get_pcvar_num instead.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 09-28-2006 , 18:44   Re: register_event("ResetHUD", .......
Reply With Quote #3

Thank you very much for the extremely fast and to the point reply.

It compiled with no errors.
stupok is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 09-28-2006 , 19:54   Re: register_event("ResetHUD", ....... -new issue
Reply With Quote #4

Bah, compiled with no errors but it doesn't do its job...

I'm trying to set all bots health to 300 or whatever the zombiehp cvar says. Is health supposed to be a float or an integer?

What am I doing wrong?
stupok is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 09-28-2006 , 20:05   Re: register_event("ResetHUD", ....... -new issue
Reply With Quote #5

try
Code:
	register_event("ResetHUD", "zombie_health", "b")
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`
stupok
Veteran Member
Join Date: Feb 2006
Old 09-28-2006 , 21:52   Re: register_event("ResetHUD", ....... -new issue
Reply With Quote #6

Thank you so much for the quick reply Emp` I just finished having lots of fun in my server with this plugin now working
stupok is offline
TheNewt
Donor
Join Date: Jun 2006
Location: Where I live.
Old 09-30-2006 , 00:28   Re: register_event("ResetHUD", ....... -resolved again
Reply With Quote #7

Code:
register_event("ResetHUD", "zombie_health", "e")
Code:
public zombie_health(id) {     if(is_user_bot(id)) {         set_user_health(id, get_cvar_num(g_pcvarzombiehp))     }     return PLUGIN_CONTINUE }

Won't this cuase it so that every time the Hud is reset, the npc will get his HP restored? O.o
Read this before using ResetHUD to make sure your using the correct event.
http://forums.alliedmods.net/showthread.php?t=42159
If I'm not mistaken, doesn't ResetHUD also activate even in the middle of the round? So wouldn't the 'zombies' heal in the middle of the round?
O.o
__________________
Quote:
toe3_ left the chat room. (G-lined (AUTO Excessive connections from a single host.))

Last edited by TheNewt; 09-30-2006 at 00:32.
TheNewt is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 09-30-2006 , 14:12   Re: register_event("ResetHUD", ....... -resolved again
Reply With Quote #8

RestHUD is also called when using sv_restart <#> and when starting a demo recording, I don't know what you mean by "in the middle of a round." Anyway, this plugin is meant for TS (The Specialists) where there aren't any rounds to speak of, so that drops out. Also, I don't plan on recording a demo, but even if I would, I wouldn't mind having the bots' health be reset to the given value.

Just in case you were wondering, the purpose of the plugin is so that all of the bots or 'zombies' will spawn with a different amount of hp than 100 every time they spawn.

As far as I know, the plugin works flawlessly, except for the inconvenience that when you change the zombiehp cvar, the zombie won't receive the given amount of hp until it dies.
stupok 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 04:49.


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