Raised This Month: $ Target: $400
 0% 

7errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-08-2006 , 13:08   7errors
Reply With Quote #1

i got 7 errors in this VERRY litle plugin
Code:
* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <fun> #define PLUGIN "recover_hp" #define VERSION "1.0" #define AUTHOR "wouter" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("Damage", "recover_hp", "be")     register_cvar("amxx_recoverhp", "1")     register_cvar("amxx_recoverhp_amount", "Float:fvalue = 0.5")         if ( ! get_cvar_num("amxx_recoverhp") )           return PLUGIN_HANDLED         new recover_amount = Float: get_cvar_float("amxx_recoverhp_amount")     new damage = read_data(2) // tag mismatch     new health = get_user_health(id) // undivined symbol "id"         public recover_hp(id) { // invalide expresion, asumed zero ; undifined symbol "recover_hp"         if ( health <= 100) {             set_user_health(id, health + damage*recover_amount); // undefined symbol "id" ; expresion has no effext ; expected token: ; but found } ; invalid expresion, asumed zero         }         else if (health >= 100) {             return PLUGIN_HANDLED         }     } }



http://forums.alliedmods.net/showthread.php?t=25082
wouter is offline
Rixorster
Senior Member
Join Date: Jul 2005
Old 03-08-2006 , 14:00  
Reply With Quote #2

First of all, you cant put any other stuff expect register_ commands in plugin_init >_<
Code:
public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("Damage", "recover_hp", "be")     register_cvar("amxx_recoverhp", "1")     register_cvar("amxx_recoverhp_amount", "Float:fvalue = 0.5")   }
and then you gotta make some stuff which i cant remember or im just too tired to write now, i got fever >_>
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 03-08-2006 , 14:02  
Reply With Quote #3

Quote:
Originally Posted by Rixorster
First of all, you cant put any other stuff expect register_ commands in plugin_init
That's incorrect.

1. missed "/" at the top.

2. register_cvar("amxx_recoverhp_amount", "Float:fvalue = 0.5") - what? just put "0.5"

3. new Float:recover_amount = get_cvar_float("amxx_recoverhp_amount")

4. new damage = read_data(2) - you can read data arguments only inside event-handlers

5. new health = get_user_health(id) - id isn't defined

6. recover_hp - declare that public function outside plugin_init

7. health < 100 and health >= 100

8. set_user_health(id, health + damage*recover_amount) - 2nd parameter must be integer, not a float value

9. plugin_init must return a value in your case, for example return PLUGIN_CONTINUE

Probably a bit more errors than you expected. ;)
VEN is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-08-2006 , 14:31  
Reply With Quote #4

Quote:
Originally Posted by VEN
Quote:
Originally Posted by Rixorster
First of all, you cant put any other stuff expect register_ commands in plugin_init
That's incorrect.

1. missed "/" at the top.
==> copy/paste mistace
wouter is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-08-2006 , 14:35  
Reply With Quote #5

no copy/paste misstakes?:
ctrl+a (select all)
ctrl+c (copy)
ctrl+v (paste)
[ --<-@ ] Black Rose is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-08-2006 , 14:54  
Reply With Quote #6

i always select with the mouse then ctrl+c and ctrl+v
wouter is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-08-2006 , 14:58  
Reply With Quote #7

Quote:
Originally Posted by VEN
4. new damage = read_data(2) - you can read data arguments only inside event-handlers
but wish is the correct way to get the dammage? because i was searching on this forum but i found like 100 differant ways(all not working) my latest try
Code:
public dmg(id){   new weapon, bodypart, attacker = get_user_attacker(id,weapon,bodypart)   if(attacker==id)   new damage = read_data(2) }
wouter is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 03-08-2006 , 15:55  
Reply With Quote #8

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <fun> #define PLUGIN "recover_hp" #define VERSION "1.0" #define AUTHOR "wouter" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("Damage", "recover_hp", "be")       register_cvar("amxx_recoverhp", "1")     register_cvar("amxx_recoverhp_amount", "0.5")                   }   public recover_hp(id) {         new health = get_user_health(id);         new damage = read_data(2);         new recover_amount = get_cvar_num("amxx_recoverhp_amount");                  if ( health < 100) {             set_user_health(id, health + (damage*recover_amount)); // you need () for order of operations         } }

zenified
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-08-2006 , 15:56  
Reply With Quote #9

Quote:
Originally Posted by Zenith77
zenified
will try this out soon
wouter is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-08-2006 , 16:13  
Reply With Quote #10

it comiles and gives no errors in debug mode, gonne test it online in the weekend , first some school
wouter 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 20:19.


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