AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Tried many things. (https://forums.alliedmods.net/showthread.php?t=30026)

TheNewt 06-20-2006 19:31

Tried many things.
 
Eh, I'm at a loss once again.

I keep getting a ShowHUD error, within the game (I have debug on).
No compiling errors. Just an error in the game.

Code:
public ShowHUD(id) {     new Message[51]     format (Message, 50, "Level: %i XP: %i", g_PlayerLevel[id], g_PlayerXP[id]);     message_begin(MSG_BROADCAST, gmsgStatusText, {150,150,150}, id)     write_string(Message)     message_end() }

Code:

Plugin called message_begin with and invalid message id (0).
Run time error 10: native error (native "message_being")
[0] textmBSlsI.sma::ShowHUD (line 146)

Am I missing something?
I checked through it several times

And yeah this is based off the Animal Mod's ShowHUD... Thanks XunTric lol

jtp10181 06-20-2006 19:39

that means gmsgStatusText is 0, you need to set it up in plugin_ini

TheNewt 06-20-2006 19:43

Oh, set it up in the plugin_init?

Code:
    gmsgStatusText = get_user_msgid("StatusText")
tis what I have set up in the plugin_init

jtp10181 06-20-2006 20:15

i double checked the amxx source and I was right, it means that is 0. Maybe you have another var in the plugin overwriting memory and messing up that var.

TheNewt 06-20-2006 20:50

Grr!
 
Gah, okay yeah I fixed it by moving the gmsgStatusText up to a higher point on the plugin_init, but it still doesn't show the XP/Levels in the HUD... >.<

-edit: NVM FIXED IT, needed to add a write_byte(0) to the message func ^_^


All times are GMT -4. The time now is 08:04.

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