AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ShowSyncHudMsg - HudSyncObject -1 is invalid... (https://forums.alliedmods.net/showthread.php?t=54181)

regalis 04-19-2007 04:22

ShowSyncHudMsg - HudSyncObject -1 is invalid...
 
Hi i got a problem with "ShowSyncHudMsg" and don't see where the mistake is hidden.

Code:

#include <amxmodx>

new g_MsgSync;

public plugin_init()
{
    g_MsgSync = CreateHudSyncObj();
}


public function(id)
{
  set_hudmessage(192, 192, 192, -1.0, 0.45, 2, 0.02, 10.0, 0.01, 0.1, next_hudchannel(id));
  ShowSyncHudMsg(id, g_MsgSync, "blabla HUD-Message");
}

Now if my function is executed it gives me an runtime Error which says this
Quote:

L 04/19/2007 - 10:14:38: HudSyncObject -1 is invalid
L 04/19/2007 - 10:14:38: [AMXX] Displaying debug trace (plugin "test.amxx")
L 04/19/2007 - 10:14:38: [AMXX] Run time error 10: native error (native "ShowSyncHudMsg")
L 04/19/2007 - 10:14:38: [AMXX] [0] test.sma::function (line 207)
Why the heck is my HudSyncObject == -1 ?? :cry:

I appreciate any help!
Thanks regalis

pRED* 04-19-2007 05:07

Re: ShowSyncHudMsg - HudSyncObject -1 is invalid...
 
Why don't you just use show_hudmessage?

regalis 04-19-2007 05:21

Re: ShowSyncHudMsg - HudSyncObject -1 is invalid...
 
I use it right now, but i thought this is new and new things are better ;)

I understand that this way...if a plugin uses a hudchannel and mine would like to use the same(with show_hudmessage) with these new SyncObject it will switch to the next free channel...does i misunderstood something?


Thanks for your suggestion ;)
greetz regalis

pRED* 04-19-2007 06:22

Re: ShowSyncHudMsg - HudSyncObject -1 is invalid...
 
You can still do that with show_hudmessage.

The last parameter of set_hudmessage is the 'channel' one. That can either be 1 of 4 channels or set it to -1 and it will try find you a free channel to display the hud message in

regalis 04-19-2007 06:28

Re: ShowSyncHudMsg - HudSyncObject -1 is invalid...
 
Quote:

Originally Posted by pRED* | NZ (Post 467106)
You can still do that with show_hudmessage.

The last parameter of set_hudmessage is the 'channel' one. That can either be 1 of 4 channels or set it to -1 and it will try find you a free channel to display the hud message in

Didn't know that -1 will search a free hudchannel!
Ok, then i will shred this f*ck*ng HudSyncObject *gg*

Thank you very much! You helped me a lot ;)

greetz regalis

Zenith77 04-19-2007 06:53

Re: ShowSyncHudMsg - HudSyncObject -1 is invalid...
 
Quote:

Originally Posted by pRED* | NZ (Post 467106)
You can still do that with show_hudmessage.

The last parameter of set_hudmessage is the 'channel' one. That can either be 1 of 4 channels or set it to -1 and it will try find you a free channel to display the hud message in

That still doesn't stop other plugins from using that "free" [for a limited time] hud message you poo nugget.

regalis 04-19-2007 07:03

Re: ShowSyncHudMsg - HudSyncObject -1 is invalid...
 
Quote:

Originally Posted by Zenith77 (Post 467115)
That still doesn't stop other plugins from using that "free" [for a limited time] hud message you #!%?$.

Hmm, then i should use ShowSyncHudMsg?
Now im confused :P

Can you tell me what i have done wrong in my code above?
Why is HudSyncObject = -1? :(
And what should it be!?..0o

Thanks for helping :)
regalis


PS: If you need more code i'll be back in the evening, now i have to go offline because of reallife shit :(

VEN 04-19-2007 07:12

Re: ShowSyncHudMsg - HudSyncObject -1 is invalid...
 
Try replace plugin_init() with plugin_precache() - i'm not saying that this is a solution but i'm trying to find where is the problem.

regalis 04-19-2007 07:30

Re: ShowSyncHudMsg - HudSyncObject -1 is invalid...
 
I'll try that in the evening...when i'm back home...thanks :)
I'll report if it works or not...if it works the documentary is wrong ;)

greetz regalis

Zenith77 04-19-2007 11:48

Re: ShowSyncHudMsg - HudSyncObject -1 is invalid...
 
Some other plugins may have already reserved HudObj's, try disabling some. And add a check in plugin_init() to see if it's -1.


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

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