AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hud Sprite Not Working (https://forums.alliedmods.net/showthread.php?t=299915)

siriusmd99 07-30-2017 08:35

Hud Sprite Not Working
 
Why hud sprite deosnt work. When i call function nothing happens, no error console/logs.
Sprite precaches but this function doesnt work. It's working only in CSO?

P.S.I used client print to debug and the lines in the function are parsed from start to end but there nothing appears on screen.
It doesnt even show in log or console some kind of error like "invalid message id .." or something. Just nothing happens like the lines are empty....

PHP Code:

public DisplaySprite(id, const iSprite) {    
    if(!
is_user_connected(id))
    return 
PLUGIN_CONTINUE;
    
    static 
origin[3];
    
get_user_origin(idorigin);
    
    
message_begin(MSG_PVSSVC_TEMPENTITYorigin);
    
write_byte(TE_SPRITE);
    
write_coord(origin[0]);
    
write_coord(origin[1]);
    
write_coord(origin[2]+65);
    
write_short(iSprite); 
    
write_byte(10);
    
write_byte(250);
    
message_end();
    
    return 
PLUGIN_CONTINUE;



TBagT 07-30-2017 10:57

Re: Hud Sprite Not Working
 
Not too much to go on, but for starters, do you call this function by set_task ?
Next try:
PHP Code:

public DisplaySprite(id, const iSprite) { 

:arrow:
PHP Code:

public DisplaySprite(id, const iSprite[ ]) { 

If you're using set_task
:arrow:
PHP Code:

public DisplaySprite( const iSprite[ ], id ) { 

Check how many frames does your sprite have, because TE_SPRITE only plays one cycle of the sprite.

siriusmd99 07-30-2017 14:46

Re: Hud Sprite Not Working
 
Quote:

Originally Posted by TBagT (Post 2538689)
Next try:
PHP Code:

public DisplaySprite(id, const iSprite) { 

:arrow:
PHP Code:

public DisplaySprite(id, const iSprite[ ]) { 

If you're using set_task
:arrow:
PHP Code:

public DisplaySprite( const iSprite[ ], id ) { 


Your script is wrong. write_short is writing byte here, not string. It writes precached model's id.
I'm not using task and whats the point of reversing parameters order?

Quote:

Check how many frames does your sprite have, because TE_SPRITE only plays one cycle of the sprite.
Only one frame.

Natsheh 07-31-2017 09:50

Re: Hud Sprite Not Working
 
Show the sprite your trying to play it might depends on the frames and on how the function is called

write_short(iSprite);
write_byte(10); and try enlarging the scale to 50...
write_byte(250);


All times are GMT -4. The time now is 22:44.

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