AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ShadowIdX (https://forums.alliedmods.net/showthread.php?t=275297)

safetymoose 11-26-2015 18:23

ShadowIdX
 
So i'm using ShadowIdX to remove the shadows of the players using the following code:

PHP Code:

msg_shadow get_user_msgid ("ShadowIdx"

PHP Code:

message_begin (MSG_ONE_UNRELIABLEmsg_shadow_id);
write_long (0);
message_end (); 

Now the problem i am facing is that the console starts flooding sprite errors after i enable shadows again through:

PHP Code:

message_begin (MSG_ONE_UNRELIABLEmsg_shadow_id);
write_long (1);
message_end (); 

The console floods this error:
PHP Code:

Sprite:  no pSprite!!!
Sprite:  no pSprite!!!
Sprite:  no pSprite!!!
Sprite:  no pSprite!!! 

And the players dont have their shadows restored. What am i doing wrong?

NiHiLaNTh 11-26-2015 18:35

Re: ShadowIdX
 
Shouldn't you send this message to all players? Currently you are hiding only for the one person.

safetymoose 11-26-2015 18:38

Re: ShadowIdX
 
Yes i am sending it to all players. All players receive the message, but the problem is it fails to restore the shadows and spits out messages that sprites are missing. I'm guessing that the sprite missing is the shadow sprite?

The current code was my second method, the first method i used MSG_BROADCAST and 0 as id.
PHP Code:

message_begin (MSG_BROADCASTmsg_shadow_0);
write_long (1);
message_end (); 

still the same result...

safetymoose 11-27-2015 13:15

Re: ShadowIdX
 
I have confirmed that the "Sprite: no pSprite!!!" error happens when i try toggle the shadows back on using
PHP Code:

message_begin (MSG_BROADCASTmsg_shadow_0);
write_long (1);
message_end (); 

Is there something wrong with this function, does it unprecache the shadow sprite? Can anyone help me get around this?

NiHiLaNTh 11-27-2015 19:41

Re: ShadowIdX
 
looking to the reverse-engineered client.dll, it seems that the only message param is sprite index.
It means, that when you want to hide it, you need to send 0 as a param.
But when you need to show it, you need to send sprite (sprites/shadow_circle.spr) index.

Also it seems I was mistaken at the beginning. You can safely send it to the one player, instead of sending to everyone.

safetymoose 11-27-2015 21:32

Re: ShadowIdX
 
You're right, i precached the shadow sprite and i set it as a parameter, and it works perfectly. This also brings an opportunity to introduce custom shadow sprites.

Thank you very much NiHiLaNTh :)

wicho 01-15-2016 02:52

Re: ShadowIdX
 
Sorry to revive but i use a code to hide the players shadows but i have the same problem as safetymoose the console start flooding this message Sprite: no pSprite!!!, how I can fix it?

code:

PHP Code:

#include < amxmodx > 

#pragma semicolon 1 

#define PLUGIN "No Shadows" 
#define VERSION "0.0.1" 

public plugin_init() 

    
register_pluginPLUGINVERSION"ConnorMcLeod" ); 

    
set_msg_block(get_user_msgid("ShadowIdx"), BLOCK_SET); 



safetymoose 01-15-2016 14:55

Re: ShadowIdX
 
I got that error message when it tried to activate the shadows again using the wrong sprite index.

Here is how you should enable/disable player's shadows correctly:

PHP Code:

// Get the path of the shadow sprite
new shadow_spr[] = "sprites/shadow_circle.spr"
new gShadowSpr
new msg_shadow

// In plugin_precache, precache the sprite to get the index
public plugin_precache()
{
          
msg_shadow get_user_msgid ("ShadowIdx")
          
gShadowSpr precache_model(shadow_spr)
}


// And when you want to enable/disable shadows, just send the correct message
message_begin (MSG_BROADCASTmsg_shadow_0);
write_long (0);  // 0 - disable, gShadowSpr - enable
message_end (); 



All times are GMT -4. The time now is 18:05.

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