AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Jailbreak Days Voter (https://forums.alliedmods.net/showthread.php?t=128274)

uNy 05-30-2010 14:33

Jailbreak Days Voter
 
This plugin was made by Wrecked. Take NO credits to myself .. Heres the problem. Anything you vote.. is gonna be zombie day .. also, if there are 2 ppl and i vote sparta and the other free, its automatically zombie .. why? Also, if the vote fails, i want some other vote between restricted and unrest freeday ! pleasaaseasease help !


PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>

new const PLUGIN[] = "Days Votemenu"
new const VERSION[] = "1.0"
new const AUTHOR[] = "Wrecked"

new const prefix[] = "!g[Jailbreak]!y"

#define DAYS        7
#define VOTE_TIME    6.0
#define TASKID        1996
#define START_TASKID    1998

new iVotes[DAYS]

new const 
DAYSNAMES[DAYS][] =
{
    
"Zombie Day",
    
"Cage Day",
    
"Free Day",
    
"Spartan Day",
    
"War Day",
    
"Knife Day",
    
"Other Day"
}

new 
iVoteAmount

new bool:b_DayChosen

new bool:b_NoWep

new menu

public plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR // :avast:
    
    
register_event"HLTV""EVENT_NewRound""a""1=0""2=0" // new round, no freezetime
    
    
RegisterHamHam_Spawn"player""HAM_Spawn_Post")
    
RegisterHamHam_PlayerAddItem"player""HAM_Add_Item_Pre")
    
    
set_task7.0"EVENT_NewRound"START_TASKID // since HLTV isn't called on mapstart
}

public 
HAM_Add_Item_PreidiEnt )
{
    if( 
cs_get_user_teamid ) == CS_TEAM_T && b_NoWep && b_DayChosen )
    {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}

public 
HAM_Spawn_Postid )
{
    if( !
is_user_aliveid ) || !b_DayChosen )
        return 
HAM_IGNORED;
        
    new 
bigger 0
    
    
for( new 1DAYSi++ ) // thanks seta
    
{
        if( 
iVotes[i] > iVotes[bigger] )
        {
            
bigger i
        
}
    }
    
    
EXEC_DayActionidbigger )
    
    return 
HAM_IGNORED;
}

public 
EVENT_NewRound()
{
    
b_DayChosen false
    b_NoWep 
false
    remove_task
TASKID )
    
remove_taskSTART_TASKID )
    
    for( new 
0sizeofiVotes ); i++ )
    {
        
iVotes[i] = 0
    
}
    
    
menu menu_create"What day will today be?""MENU_Handler" )
    
    for( new 
0DAYSz++ )
    {
        new 
menuitem[64]
        new 
number[10]
        
formatexmenuitem63"%s"DAYSNAMES[z] )
        
formatexnumber9"%d")
        
        
menu_additemmenumenuitemnumber)
    }
    
    
menu_setpropmenuMPROP_EXITMEXIT_ALL )
    
    new 
iPlayers[32]
    new 
iNum
    
    get_players
iPlayersiNum )
    
    new 
id
    
    
for( new 0iNumi++ )
    {
        
id iPlayers[i]
        
        if( 
cs_get_user_teamid ) == CS_TEAM_CT )
        {
            
menu_displayidmenu)
            
            
iVoteAmount++
        }
    }
    
    
UPDATE_Hud()
    
    
set_taskVOTE_TIME"TASK_GetDay"TASKID )
}

public 
MENU_Handleridmenuitem )
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroymenu )
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
name[64]
    new 
data[6]
    new 
access
    
new callback
    
    menu_item_getinfo
menuitemaccessdata5name63callback )
    
    new 
choice str_to_numdata )
    
    
iVotes[choice-1]++
    
iVoteAmount--
    
    
menu_destroymenu )
    
    
UPDATE_Hud()
    
    return 
PLUGIN_HANDLED;
}

public 
TASK_GetDay()
{
    new 
bigger 0;
    
    for( new 
1DAYSi++ ) // thanks Seta
    
{
        if( 
iVotes[i] > iVotes[bigger] )
        {
            
bigger i
        
}
    }
    
    
EXEC_DayAction0bigger )
}

EXEC_DayActionplriValue )
{
    
b_DayChosen true
    
    
new iPlayers[32]
    
    new 
iNum 1
    
    
if( plr )
    {
        
iPlayers[0] = plr
    
}
    else
    {
        
get_playersiPlayersiNum )
    }
    
    new 
id
    
    
switch( iValue )
    {
        case 
1// zombie
        
{
            for( new 
0iNumi++ )
            {
                
id iPlayers[i]
                
                if( 
cs_get_user_teamid ) == CS_TEAM_T && is_user_aliveid ) )
                {
                    
set_user_healthid2000 )
                }
            }
            
        
b_NoWep true
            ChatColor
plr plr 0"%s Today is a!g zombie day!y! All terrorists get!g 2000!y HP!"prefix )
        }
        
        case 
2// cage
        
{
            
ChatColorplr plr 0"%s Everyone get to the!g cage!y and listen to orders! It's a!g cage day!"prefix )
        
b_NoWep false
        
}
        
        case 
3// free
        
{
            
ChatColorplr plr 0"%s Today is a!g free day!"prefix )
        
b_NoWep false
        
}
        
        case 
4// spartan
        
{
            for( new 
0iNumi++ )
            {
                
id iPlayers[i]
                
                if( 
cs_get_user_teamid ) == CS_TEAM_T && is_user_aliveid ) )
                {
                    
strip_user_weaponsid )
                    
                    
give_itemid"weapon_deagle" )
                    
cs_set_user_bpammoidCSW_DEAGLE35 )
                    
                    
give_itemid"weapon_shield" )
                }
            }
            
            
ChatColorplr plr 0"%s Today is a!g spartan day!y!"prefix )
        
b_NoWep true
        
}
        
        case 
5// war
        
{
            for( new 
0iNumi++ )
            {
                
id iPlayers[i]
        
        if( 
is_user_aliveid ) )
        {
            
strip_user_weaponsid )
                
            new 
iWep give_itemid"weapon_m3" )
                
            
cs_set_weapon_ammoiWep32 // 32, right?
        
}
            }
            
            
ChatColorplr plr 0"%s Today is a!g war day!y!"prefix )
        
b_NoWep true
        
}
        
        case 
6// knife
        
{
            for( new 
0iNumi++ )
            {
                
id iPlayers[i]
                
                if( 
is_user_aliveid ) )
        {
            
strip_user_weaponsid )
            
            if( 
cs_get_user_teamid ) == CS_TEAM_CT )
            {
                
give_itemid"weapon_knife" // requested by chris
                
set_user_healthid1000 )
            }
        }
            }
            
            
ChatColorplr plr 0"%s Today is a!g knife day!y!"prefix )
        
b_NoWep true
        
}
        
        case 
7// other
        
{
            
ChatColorplr plr 0"%s Today is an!g other day!y!"prefix )
        
b_NoWep false
        
}
    }
}

stock UPDATE_Hud()
{
    new 
message[256]
    new 
iLen
    
    iLen 
+= formatexmessagecharsmaxmessage ) - iLen"%s v%s by %s^n^n"PLUGINVERSIONAUTHOR )
    for( new 
0DAYSi++ )
    {    
        
iLen += formatexmessage[iLen], charsmaxmessage ) - iLen"%s [%d Vote%s]^n"DAYSNAMES[i], iVotes[i], ( iVotes[i] == ) ? "" "s" )
    }
    
iLen += formatexmessage[iLen], charsmaxmessage ) - iLen"^nRemaining Votes: %d"iVoteAmount )
    
    
set_hudmessage2552552550.560.0206.02.0 )
    
show_hudmessage0"%s"message )
}

stock ChatColorid, const input[], any:... )
{
    new 
count 1;
    new 
players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^4"); // Green Color
    
replace_all(msg190"!y""^1"); // Default Color
    
replace_all(msg190"!team""^3"); // Team Color
    
replace_all(msg190"!team2""^0"); // Team2 Color
    
    
if (id)
    
players[0] = id
    else
    
get_players(playerscount"ch");
    
    for (new 
0counti++)
    {
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }
    }


</span></span>


shuttle_wave 05-30-2010 16:18

Re: Jailbreak Days Voter
 
I have the fixed version of that on my pc at home.

wrecked_ 05-30-2010 21:50

Re: Jailbreak Days Voter
 
Well, for starters, change this line
Code:
RegisterHam( Ham_PlayerAddItem, "player", "HAM_Add_Item_Pre", 0 )
to
Code:
RegisterHam( Ham_AddPlayerItem, "player", "HAM_Add_Item_Pre", 0 )

I might be doing a re-writeup if I get all of my schoolwork done tomorrow, solely because it seems like everyone wants this plugin. That's a temporary fix for why it won't compile, stay tuned.

PWA 08-12-2010 05:57

Re: Jailbreak Days Voter
 
please. rewrite this plugin!..

zirualas 08-12-2010 07:05

Re: Jailbreak Days Voter
 
What's mean spartans day and zombie day?

naven 08-12-2010 07:06

Re: Jailbreak Days Voter
 
Just try it.

chriss 08-26-2010 13:54

Re: Jailbreak Days Voter
 
anybody fix this ?

chriss 08-27-2010 17:09

Re: Jailbreak Days Voter
 
bump

Xalus 08-27-2010 21:04

Re: Jailbreak Days Voter
 
I removed some stuff,
& changed some stuff..

Works fine for me :)

chriss 08-28-2010 09:13

Re: Jailbreak Days Voter
 
can u say what u changed and removed ? :)


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

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