Raised This Month: $ Target: $400
 0% 

HUD disappears [HELP]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
skunew
Member
Join Date: Dec 2013
Old 03-16-2014 , 14:26   HUD disappears [HELP]
Reply With Quote #1

I have plugin. This plugin after dead show random hud from "cytaty.ini" and i wont to this hud must be for 20 second but this hud disappears when some other plugin show other hud. PLS HELP maybe use Director Hud Message? Pls change this sma i form poland sorry for bad eng

Quote:
/* Script generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>
#include <csx>

#define PLUGIN "Cytaty"
#define AUTHOR "DarkGL"
#define VERSION "1.0"

#define MAX_CYTAT_LEN 256
#define CYTATY_END "----end----"

new Array:szCytatyHandle,
SyncHudObj,
pCvarBlack,
gMsgScreenFade;

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

szCytatyHandle = ArrayCreate(MAX_CYTAT_LEN,32);

SyncHudObj = CreateHudSyncObj();

pCvarBlack = register_cvar("cytaty_black_screen","1");

gMsgScreenFade = get_user_msgid("ScreenFade");

loadCytaty()
}

public loadCytaty(){
new szConfig[256];

formatex(szConfig [ get_configsdir(szConfig,charsmax( szConfig ) ) ], charsmax( szConfig ) , "/cytaty.ini",szConfig);

new szNewCytat[MAX_CYTAT_LEN],szLine[MAX_CYTAT_LEN],iLen;

for(new i=0;read_file(szConfig, i, szLine, charsmax( szLine ), iLen);i++){
if(szLine[0] == '/' || szLine[0] == '#'){
continue;
}

if(equal(szLine,CYTATY_END)){
ArrayPushString(szCytatyHandle,szNewCytat);
szNewCytat = "";
continue;
}

add(szNewCytat,MAX_CYTAT_LEN - 1,szLine);
}
}



public client_death(iKiller,iVictim,weapon,hitplace, TK) {

if(!iKiller || !iVictim || !is_user_connected(iVictim) || iKiller == iVictim || TK) return ;

new szCytat[MAX_CYTAT_LEN];

ArrayGetString(szCytatyHandle,random_num( 0 , ArraySize(szCytatyHandle) - 1 ) , szCytat , MAX_CYTAT_LEN );

if(get_pcvar_num(pCvarBlack)) Display_Fade(iVictim,(1<<12) * 3,(1<<12) * 5,0x0001,0,0,0,255)

set_hudmessage(0, 255, 0, 0.05, 0.17, 0, 6.0, 20.0, 0.1, 0.2, 2)
ShowSyncHudMsg(iVictim, SyncHudObj, szCytat);

}

public plugin_end(){
ArrayDestroy(szCytatyHandle);
}

stock Display_Fade(id,duration,holdtime,fadetype,re d,green,blue,alpha)
{
if(!is_user_connected(id)) return PLUGIN_CONTINUE;

message_begin( MSG_ONE, gMsgScreenFade,{0,0,0},id );
write_short( duration ); // Duration of fadeout
write_short( holdtime ); // Hold time of color
write_short( fadetype ); // Fade type
write_byte ( red ); // Red
write_byte ( green ); // Green
write_byte ( blue ); // Blue
write_byte ( alpha ); // Alpha
message_end();

return PLUGIN_CONTINUE;
}
skunew is offline
connoisseur
Senior Member
Join Date: Jan 2012
Old 03-16-2014 , 14:46   Re: HUD disappears [HELP]
Reply With Quote #2

Code:
set_hudmessage(0, 255, 0, 0.05, 0.17, 0, 6.0, 20.0, 0.1, 0.2, 2)
->
Code:
set_hudmessage(0, 255, 0, 0.05, 0.17, 0, 6.0, 20.0, 0.1, 0.2, -1)
This will automatically look for any available channel to show the HUD and will not coincide with any other plugin occupying the channel.
connoisseur is offline
skunew
Member
Join Date: Dec 2013
Old 03-16-2014 , 15:36   Re: HUD disappears [HELP]
Reply With Quote #3

This sometime work good sometime bad :/
skunew is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-16-2014 , 15:49   Re: HUD disappears [HELP]
Reply With Quote #4

There are only 4 HUD channels. There is nothing you can do to prevent another plugin from sending a message on a channel you are already using unless you recode EVERY plugin you have and manually select the channel and NOT select the one you want to use for this plugin. dHUD messages encounter the same thing, just not as often as there are 8 channels
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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