AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Spawn event/hamsandwich.inc error! (https://forums.alliedmods.net/showthread.php?t=92886)

Simpler 05-21-2009 15:48

Spawn event/hamsandwich.inc error!
 
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 05-21-2009 16:04

Re: Spawn event/hamsandwich.inc error!
 
I solved the first problem myself. I wrote "ResetHud" instead of "ResetHUD" :oops:

Anyways i still need to know why i get errors from the hamsandwich.inc,
thanks!

hleV 05-21-2009 17:19

Re: Spawn event/hamsandwich.inc error!
 
You're doing it wrong.
Code:
// Wrong method register_event("ResetHUD", "ResetHUD", "a");   // Right method RegisterHam(Ham_Spawn, "player", "PlayerSpawned", 1);

ConnorMcLeod 05-21-2009 17:26

Re: Spawn event/hamsandwich.inc error!
 
Put #include <amxmodx> first.

Simpler 05-22-2009 04:16

Re: Spawn event/hamsandwich.inc error!
 
Quote:

Originally Posted by hleV (Post 831920)
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 :)

hleV 05-22-2009 04:27

Re: Spawn event/hamsandwich.inc error!
 
ResetHUD isn't for spawn. It gets called when you spawn, but not only then, so use Ham.

Arkshine 05-22-2009 04:38

Re: Spawn event/hamsandwich.inc error!
 
Quote:

Why can't i use ResetHUD?
See http://forums.alliedmods.net/showthread.php?t=42159

Simpler 05-22-2009 04:48

Re: Spawn event/hamsandwich.inc error!
 
Thanks alot for the help, i get the point now :)


All times are GMT -4. The time now is 01:34.

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