AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HUD disappears [HELP] (https://forums.alliedmods.net/showthread.php?t=237037)

skunew 03-16-2014 14:26

HUD disappears [HELP]
 
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;
}

connoisseur 03-16-2014 14:46

Re: HUD disappears [HELP]
 
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.

skunew 03-16-2014 15:36

Re: HUD disappears [HELP]
 
This sometime work good sometime bad :/

YamiKaitou 03-16-2014 15:49

Re: HUD disappears [HELP]
 
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


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

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