Raised This Month: $ Target: $400
 0% 

Spawn event/hamsandwich.inc error!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Simpler
Junior Member
Join Date: May 2009
Location: Sweden
Old 05-21-2009 , 15:48   Spawn event/hamsandwich.inc error!
Reply With Quote #1

Hi there,
I just started learning some basic scripting and i wanted to catch the spawn event. First i registered the "ResetHud" event but the plugin didn't work, nothing happened on spawn,, see source code:

PHP Code:
/* Script generated by Pawn Studio */

#include <hamsandwich>
#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN    "New Plugin"
#define AUTHOR    "Unknown"
#define VERSION    "1.0"

new autoHealhealAmount;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
autoHeal register_cvar("amx_autoheal""1")
    
healAmount register_cvar("amx_healamount""40000")
    
    
register_event("ResetHud""PlayerSpawn""b")
    
//RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
}

public 
PlayerSpawn()
{
    if (
get_pcvar_num(autoHeal))
    {
        
set_user_health(idhealAmount)
        
        
client_print(idprint_chat,"You where healed by %i HP"healAmount)
    }
    
    else  if(!
get_pcvar_num(autoHeal))
    {
        
client_print(idprint_chat"Erorr!")
    }

If you see why it doesn't work please tell me, i really need to know what i do wrong. But i got another error that seems more confusing. I tried the hamsandwich version of catching the spawn event, but then i got errors again but those where from the hamsandwich.inc file. They were as following:

Quote:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

C:\Program Files\AMX Mod X\files\base\scripting\include\hamsandwich.in c(47) : error 017: undefined symbol "AMXX_VERSION_NUM"
C:\Program Files\AMX Mod X\files\base\scripting\include\hamsandwich.in c(361) : error 017: undefined symbol "get_func_id"
C:\Program Files\AMX Mod X\files\base\scripting\include\hamsandwich.in c(361) : warning 215: expression has no effect
C:\Program Files\AMX Mod X\files\base\scripting\include\hamsandwich.in c(361) : warning 215: expression has no effect
C:\Program Files\AMX Mod X\files\base\scripting\include\hamsandwich.in c(361) : error 001: expected token: ";", but found ")"
C:\Program Files\AMX Mod X\files\base\scripting\include\hamsandwich.in c(361) : error 029: invalid expression, assumed zero
C:\Program Files\AMX Mod X\files\base\scripting\include\hamsandwich.in c(361) : fatal error 107: too many error messages on one line

Compilation aborted.
5 Errors.
Could not locate output file C:\Users\bRAVE\Desktop\Pawn Studio\Script Sma\autoHeal.amx (compile failed).

Compilation Time: 0,09 sec
That seems weird in my opinion, you got an idea why i get errors from the include file? Is it outdated or what can it be?

I'd really appreciate help!
/Simpler
Simpler is offline
Send a message via MSN to Simpler
Simpler
Junior Member
Join Date: May 2009
Location: Sweden
Old 05-21-2009 , 16:04   Re: Spawn event/hamsandwich.inc error!
Reply With Quote #2

I solved the first problem myself. I wrote "ResetHud" instead of "ResetHUD"

Anyways i still need to know why i get errors from the hamsandwich.inc,
thanks!
Simpler is offline
Send a message via MSN to Simpler
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-21-2009 , 17:19   Re: Spawn event/hamsandwich.inc error!
Reply With Quote #3

You're doing it wrong.
Code:
// Wrong method register_event("ResetHUD", "ResetHUD", "a");   // Right method RegisterHam(Ham_Spawn, "player", "PlayerSpawned", 1);
__________________
hleV is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-21-2009 , 17:26   Re: Spawn event/hamsandwich.inc error!
Reply With Quote #4

Put #include <amxmodx> first.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Simpler
Junior Member
Join Date: May 2009
Location: Sweden
Old 05-22-2009 , 04:16   Re: Spawn event/hamsandwich.inc error!
Reply With Quote #5

Quote:
Originally Posted by hleV View Post
You're doing it wrong.
Code:
// Wrong method register_event("ResetHUD", "ResetHUD", "a");   // Right method RegisterHam(Ham_Spawn, "player", "PlayerSpawned", 1);
Why can't i use ResetHUD?

Quote:
Originally Posted by ConnorMcLeod
Put #include <amxmodx> first.
Thanks, i get no errors from hamsandwich now
Simpler is offline
Send a message via MSN to Simpler
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-22-2009 , 04:27   Re: Spawn event/hamsandwich.inc error!
Reply With Quote #6

ResetHUD isn't for spawn. It gets called when you spawn, but not only then, so use Ham.
__________________
hleV is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-22-2009 , 04:38   Re: Spawn event/hamsandwich.inc error!
Reply With Quote #7

Quote:
Why can't i use ResetHUD?
See http://forums.alliedmods.net/showthread.php?t=42159
Arkshine is offline
Simpler
Junior Member
Join Date: May 2009
Location: Sweden
Old 05-22-2009 , 04:48   Re: Spawn event/hamsandwich.inc error!
Reply With Quote #8

Thanks alot for the help, i get the point now
Simpler is offline
Send a message via MSN to Simpler
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 01:34.


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