Raised This Month: $ Target: $400
 0% 

Solved [HELP] JBE EDIT add restrict to the used days mods


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 07-16-2016 , 09:52   [HELP] JBE EDIT add restrict to the used days mods
Reply With Quote #1

i need to add restriction to the used day mods for 3 votes .so the the players will can't vote for the restricted days mode. and thnx

PHP Code:
public jbe_register_day_mode(szLang[32], iBlockiTime)
{
    
param_convert(1);
    new 
aDataDayMode[DATA_DAY_MODE];
    
copy(aDataDayMode[LANG_MODE], charsmax(aDataDayMode[LANG_MODE]), szLang);
    
aDataDayMode[MODE_BLOCK_DAYS] = iBlock;
    
aDataDayMode[MODE_TIMER] = iTime;
    
ArrayPushArray(g_aDataDayModeaDataDayMode);
    
g_iDayModeListSize++;
    return 
g_iDayModeListSize 1;

PHP Code:
public jbe_vote_day_mode_start()
{
    
g_iDayModeVoteTime g_iAllCvars[DAY_MODE_VOTE_TIME] + 1;
    new 
aDataDayMode[DATA_DAY_MODE];
    for(new 
ig_iDayModeListSizei++)
    {
        
ArrayGetArray(g_aDataDayModeiaDataDayMode);
        if(
aDataDayMode[MODE_BLOCKED]) aDataDayMode[MODE_BLOCKED]--;
        
aDataDayMode[VOTES_NUM] = 0;
        
ArraySetArray(g_aDataDayModeiaDataDayMode);
    }
    for(new 
iPlayer 1iPlayer <= g_iMaxPlayersiPlayer++)
    {
        if(
IsNotSetBit(g_iBitUserAliveiPlayer)) continue;
        
SetBit(g_iBitUserVoteDayModeiPlayer);
        
g_iBitKilledUsers[iPlayer] = 0;
        
g_iMenuPosition[iPlayer] = 0;
        
jbe_menu_block(iPlayer);
        
set_pev(iPlayerpev_flagspev(iPlayerpev_flags) | FL_FROZEN);
        
set_pdata_float(iPlayerm_flNextAttackfloat(g_iDayModeVoteTime), linux_diff_player);
        
UTIL_ScreenFade(iPlayer004000255);
    }
    
set_task(1.0"jbe_vote_day_mode_timer"TASK_VOTE_DAY_MODE_TIMER__"a"g_iDayModeVoteTime);

PHP Code:
public jbe_vote_day_mode_timer()
{
    if(!--
g_iDayModeVoteTimejbe_vote_day_mode_ended();
    for(new 
iPlayer 1iPlayer <= g_iMaxPlayersiPlayer++)
    {
        if(
IsNotSetBit(g_iBitUserVoteDayModeiPlayer)) continue;
        
Show_DayModeMenu(iPlayerg_iMenuPosition[iPlayer]);
    }

PHP Code:
public jbe_vote_day_mode_ended()
{
    for(new 
iPlayer 1iPlayer <= g_iMaxPlayersiPlayer++)
    {
        if(
IsNotSetBit(g_iBitUserVoteDayModeiPlayer)) continue;
        
ClearBit(g_iBitUserVoteDayModeiPlayer);
        
ClearBit(g_iBitUserDayModeVotediPlayer);
        
show_menu(iPlayer0"^n");
        
jbe_informer_offset_down(iPlayer);
        
jbe_menu_unblock(iPlayer);
        
set_pev(iPlayerpev_flagspev(iPlayerpev_flags) & ~FL_FROZEN);
        
set_pdata_float(iPlayerm_flNextAttack0.0linux_diff_player);
        
UTIL_ScreenFade(iPlayer51251200002551);
    }
    new 
aDataDayMode[DATA_DAY_MODE], iVotesNum;
    for(new 
iPlayeriPlayer g_iDayModeListSizeiPlayer++)
    {
        
ArrayGetArray(g_aDataDayModeiPlayeraDataDayMode);
        if(
aDataDayMode[VOTES_NUM] >= iVotesNum)
        {
            
iVotesNum aDataDayMode[VOTES_NUM];
            
g_iVoteDayMode iPlayer;
        }
    }
    
ArrayGetArray(g_aDataDayModeg_iVoteDayModeaDataDayMode);
    
aDataDayMode[MODE_BLOCKED] = aDataDayMode[MODE_BLOCK_DAYS];
    
ArraySetArray(g_aDataDayModeg_iVoteDayModeaDataDayMode);
    
ExecuteForward(g_iHookDayModeStartg_iReturnDayModeg_iVoteDayMode0);

PHP Code:
public jbe_day_mode_start(iDayModeiAdmin)
{
    new 
aDataDayMode[DATA_DAY_MODE];
    
ArrayGetArray(g_aDataDayModeiDayModeaDataDayMode);
    
formatex(g_szDayModecharsmax(g_szDayMode), aDataDayMode[LANG_MODE]);
    if(
aDataDayMode[MODE_TIMER])
    {
        
g_iDayModeTimer aDataDayMode[MODE_TIMER] + 1;
        
set_task(1.0"jbe_day_mode_timer"TASK_DAY_MODE_TIMER__"a"g_iDayModeTimer);
    }
    if(
iAdmin)
    {
        if(
g_iDayMode == 2jbe_free_day_ended();
        else
        {
            
g_iBitUserFree 0;
            
g_szFreeNames "";
            
g_iFreeLang 0;
        }
        
g_iDayMode 3;
        if(
task_exists(TASK_CHIEF_CHOICE_TIME)) remove_task(TASK_CHIEF_CHOICE_TIME);
        
g_iChiefId 0;
        
g_szChiefName "";
        
g_iChiefStatus 0;
        
g_iBitUserWanted 0;
        
g_szWantedNames "";
        
g_iWantedLang 0;
        
g_iBitShock 0;
        
g_iBitMachete 0;
        
g_iBitSharpening 0;
        
g_iBitScrewdriver 0;
        
g_iBitBalisong 0;
        
g_iBitLatchkey 0;
        
g_iBitKokain 0;
        
g_iBitFrostNade 0;
        
g_iBitClothingGuard 0;
        
g_iBitHingJump 0;
        
g_iBitDoubleJump 0;
        
g_iBitAutoBhop 0;
        
g_iBitDoubleDamage 0;
        
g_iBitUserVoice 0;
        for(new 
iPlayer 1iPlayer <= g_iMaxPlayersiPlayer++)
        {
            if(
IsNotSetBit(g_iBitUserAliveiPlayer)) continue;
            
g_iBitKilledUsers[iPlayer] = 0;
            
show_menu(iPlayer0"^n");
            if(
g_iBitWeaponStatus && IsSetBit(g_iBitWeaponStatusiPlayer))
            {
                
ClearBit(g_iBitWeaponStatusiPlayer);
                if(
get_user_weapon(iPlayer) == CSW_KNIFE)
                {
                    new 
iActiveItem get_pdata_cbase(iPlayerm_pActiveItemlinux_diff_player);
                    if(
iActiveItem 0ExecuteHamB(Ham_Item_DeployiActiveItem);
                }
            }
            if(
task_exists(iPlayer+TASK_REMOVE_SYRINGE))
            {
                
remove_task(iPlayer+TASK_REMOVE_SYRINGE);
                if(
get_user_weapon(iPlayer))
                {
                    new 
iActiveItem get_pdata_cbase(iPlayerm_pActiveItemlinux_diff_player);
                    if(
iActiveItem 0ExecuteHamB(Ham_Item_DeployiActiveItem);
                }
            }
            if(
pev(iPlayerpev_renderfx) != kRenderFxNone || pev(iPlayerpev_rendermode) != kRenderNormal)
            {
                
jbe_set_user_rendering(iPlayerkRenderFxNone000kRenderNormal0);
                
g_eUserRendering[iPlayer][RENDER_STATUS] = false;
            }
            if(
g_iBitUserFrozen && IsSetBit(g_iBitUserFrozeniPlayer))
            {
                
ClearBit(g_iBitUserFrozeniPlayer);
                if(
task_exists(iPlayer+TASK_FROSTNADE_DEFROST)) remove_task(iPlayer+TASK_FROSTNADE_DEFROST);
                
set_pev(iPlayerpev_flagspev(iPlayerpev_flags) & ~FL_FROZEN);
                
set_pdata_float(iPlayerm_flNextAttack0.0linux_diff_player);
                
emit_sound(iPlayerCHAN_AUTO"jb_engine/shop/defrost_player.wav"VOL_NORMATTN_NORM0PITCH_NORM);
                new 
Float:vecOrigin[3]; pev(iPlayerpev_originvecOrigin);
                
CREATE_BREAKMODEL(vecOrigin__10g_pModelGlass10250x01);
            }
            if(
g_iBitInvisibleHat && IsSetBit(g_iBitInvisibleHatiPlayer))
            {
                
ClearBit(g_iBitInvisibleHatiPlayer);
                if(
task_exists(iPlayer+TASK_INVISIBLE_HAT)) remove_task(iPlayer+TASK_INVISIBLE_HAT);
            }
            if(
g_iBitClothingType && IsSetBit(g_iBitClothingTypeiPlayer)) jbe_default_player_model(iPlayer);
            if(
g_iBitFastRun && IsSetBit(g_iBitFastRuniPlayer))
            {
                
ClearBit(g_iBitFastRuniPlayer);
                
ExecuteHamB(Ham_Player_ResetMaxSpeediPlayer);
            }
            if(
g_iBitRandomGlow && IsSetBit(g_iBitRandomGlowiPlayer)) ClearBit(g_iBitRandomGlowiPlayer);
            if(
IsSetBit(g_iBitUserHookiPlayer) && task_exists(iPlayer+TASK_HOOK_THINK))
            {
                
remove_task(iPlayer+TASK_HOOK_THINK);
                
emit_sound(iPlayerCHAN_STATIC"jb_engine/hook.wav"VOL_NORMATTN_NORMSND_STOPPITCH_NORM);
            }
        }
        if(
g_bSoccerStatusjbe_soccer_disable_all();
        if(
g_bBoxingStatusjbe_boxing_disable_all();
    }
    for(new 
iPlayer 1iPlayer <= g_iMaxPlayersiPlayer++) jbe_hide_user_costumes(iPlayer);
    
jbe_open_doors();

__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !

Last edited by Old.School; 03-16-2017 at 11:36.
Old.School is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-16-2016 , 15:20   Re: [HELP] JBE EDIT add restrict to the used days mods
Reply With Quote #2

post the voteday menu...

so we might help you..

the Show_DayModeMenu function..

Last edited by Natsheh; 07-16-2016 at 15:20.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 07-16-2016 , 17:52   Re: [HELP] JBE EDIT add restrict to the used days mods
Reply With Quote #3

PHP Code:
Show_DayModeMenu(idiPos)
{
    if(
iPos 0) return (idg_iMenuPosition[id] = 0);
    
jbe_informer_offset_up(id);
    new 
iStart iPos PLAYERS_PER_PAGE;
    if(
iStart g_iDayModeListSizeiStart g_iDayModeListSize;
    
iStart iStart - (iStart 8);
    
g_iMenuPosition[id] = iStart PLAYERS_PER_PAGE;
    new 
iEnd iStart PLAYERS_PER_PAGE;
    if(
iEnd g_iDayModeListSizeiEnd g_iDayModeListSize;
    new 
szMenu[512], iLeniPagesNum = (g_iDayModeListSize PLAYERS_PER_PAGE + ((g_iDayModeListSize PLAYERS_PER_PAGE) ? 0));
    
iLen formatex(szMenucharsmax(szMenu), "\y%L \w[%d|%d]^n\d%L^n"id"JBE_MENU_VOTE_DAY_MODE_TITLE"iPos 1iPagesNumid"JBE_MENU_VOTE_DAY_MODE_TIME_END"g_iDayModeVoteTime);
    new 
aDataDayMode[DATA_DAY_MODE], iKeys = (1<<9), b;
    for(new 
iStartiEnda++)
    {
        
ArrayGetArray(g_aDataDayModeaaDataDayMode);
        if(
aDataDayMode[MODE_BLOCKED]) iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen"\y[%d] \d%L \r[%L]^n", ++bidaDataDayMode[LANG_MODE], id"JBE_MENU_VOTE_DAY_MODE_BLOCKED"aDataDayMode[MODE_BLOCKED]);
        else
        {
            if(
IsSetBit(g_iBitUserDayModeVotedid)) iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen"\y[%d] \d%L \r[%d]^n", ++bidaDataDayMode[LANG_MODE], aDataDayMode[VOTES_NUM]);
            else
            {
                
iKeys |= (1<<b);
                
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen"\y[%d] \w%L \r[%d]^n", ++bidaDataDayMode[LANG_MODE], aDataDayMode[VOTES_NUM]);
            }
        }
    }
    for(new 
bPLAYERS_PER_PAGEi++) iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen"^n");
    if(
iEnd g_iDayModeListSize)
    {
        
iKeys |= (1<<8);
        
formatex(szMenu[iLen], charsmax(szMenu) - iLen"^n\y9. \w%L^n\y0. \w%L"id"JBE_MENU_NEXT"idiPos "JBE_MENU_BACK" "JBE_MENU_EXIT");
    }
    else 
formatex(szMenu[iLen], charsmax(szMenu) - iLen"^n^n\y0. \w%L"idiPos "JBE_MENU_BACK" "JBE_MENU_EXIT");
    return 
show_menu(idiKeysszMenu2"");
}

public 
Handle_DayModeMenu(idiKey)
{
    switch(
iKey)
    {
        case 
8: return (id, ++g_iMenuPosition[id]);
        case 
9: return (id, --g_iMenuPosition[id]);
        default:
        {
            new 
aDataDayMode[DATA_DAY_MODE], iDayMode g_iMenuPosition[id] * PLAYERS_PER_PAGE iKey;
            
ArrayGetArray(g_aDataDayModeiDayModeaDataDayMode);
            
aDataDayMode[VOTES_NUM]++;
            
ArraySetArray(g_aDataDayModeiDayModeaDataDayMode);
            
SetBit(g_iBitUserDayModeVotedid);
        }
    }
    return (
idg_iMenuPosition[id]);

__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 08-06-2016 , 13:14   Re: [HELP] JBE EDIT add restrict to the used days mods
Reply With Quote #4

bump
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 08-06-2016 , 13:30   Re: [HELP] JBE EDIT add restrict to the used days mods
Reply With Quote #5

Quote:
Originally Posted by Old.School View Post
i need to add restriction to the used day mods for 3 votes .so the the players will can't vote for the restricted days mode. and thnx
Does not make sense restrict it for 3 votes, so cannot vote to restricted days mode. Can you explain this better?
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 08-06-2016 at 13:37. Reason: update
addons_zz is offline
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 08-07-2016 , 06:34   Re: [HELP] JBE EDIT add restrict to the used days mods
Reply With Quote #6

what i need is Days restriction (voting only) to prevent several days being played a lot.
so the players will can't vote for the same day mod only after 3 days mode
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 08-07-2016 , 08:36   Re: [HELP] JBE EDIT add restrict to the used days mods
Reply With Quote #7

Quote:
Originally Posted by Old.School View Post
what i need is Days restriction (voting only) to prevent several days being played a lot.
so the players will can't vote for the same day mod only after 3 days mode
So, I will tell you what do you need to do. I will not give you the full code, you do not give me full plugin and also we are on Scripting Help section, not Suggestions/Requests.
  1. Each time the vote start, you check the file or nvault on disk for the days modes it has written on it.
  2. If some day is found on that file or nvault, you do not allow it on the voting menu.
  3. Each time the vote is done and one day is successfully voted, you save it to a file on disk or nvault.
  4. Just only write the last 3 days to the file or nvault, so when it is loaded you got all you need.
  5. Also, when loading this file or nvault, only load 3 days, and again you got all you need.
  6. This way you can easily keep consistency within your files or nvault.
I this the same thing as the "ban recent maps feature" from a map chooser. Here you can see the
loader/writer functions used for files:
https://github.com/addonszz/Galileo/blob/d3881d8518097f2a1e1117b8e156777e29cf6f79/scripting/galileo.sma#L1738-L1849
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 08-07-2016 at 08:44. Reason: update
addons_zz is offline
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 09-24-2016 , 00:13   Re: [HELP] JBE EDIT add restrict to the used days mods
Reply With Quote #8

i didn't have time to do it so bump
and this is full code and thnx advance
Attached Files
File Type: sma Get Plugin or Get Source (jbe_core.sma - 734 views - 285.6 KB)
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 12-11-2016 , 00:16   Re: [HELP] JBE EDIT add restrict to the used days mods
Reply With Quote #9

bump! i still interested after all this time
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School 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 09:17.


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