|
Junior Member
|

10-07-2010
, 08:08
Fix jailbreak vote days
|
#1
|
Hi guys ,
can any one fix that code
i need it 
example :
i vote number 1
final vote random 
i need someone to fix it
and
I want to show the vote for T, they can`t vote
look at the most vote
And the most votes will be chosen
And I want to name appears player
what choose
"" vote CT only ""
PHP Code:
#include < amxmodx > #include < amxmisc > #include < cstrike > #include < fun > #include < hamsandwich> #include < colorchat > #include < core >
new const AUTHOR []= "Unknown"; new const PLUGIN []= "Jailbreak Days Menu"; new const VERSION[]= "7up soda";
new const ClanTag[] = "CG";
new gmsg_SetFOV;
new g_maxplayers
new bool:can_have_gun[33];
new cvar_atsiranda, cvar_pranyksta;
//dienos new g_iVotes[ 9 ];
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); g_maxplayers = get_maxplayers() RegisterHam(Ham_Touch, "armoury_entity", "FwdHamPlayerPickup"); RegisterHam(Ham_Touch, "weaponbox", "FwdHamPlayerPickup"); RegisterHam(Ham_Spawn, "player", "Event_Playerspawn", 1); register_event("HLTV", "newROUND", "a", "1=0", "2=0") cvar_atsiranda = register_cvar("days_votestart", "5.0") cvar_pranyksta = register_cvar("days_voteend", "10.0") } public newROUND(){ set_task(get_pcvar_float(cvar_atsiranda), "days_menu") }
public Event_Playerspawn(id) { can_have_gun[id] = true }
public FwdHamPlayerPickup(iEntity, id) { if(!can_have_gun[id]) return HAM_SUPERCEDE; return HAM_IGNORED; }
public days_menu() { new days_menu = menu_create("\yDays Menu", "day_handler"); menu_additem(days_menu, "\rFreeday!", "1", 0); menu_additem(days_menu, "\rZombie Day", "2", 0); menu_additem(days_menu, "\rLava Day", "3", 0); menu_additem(days_menu, "\rShark Day", "4", 0); menu_additem(days_menu, "\rCage Day", "5", 0); menu_additem(days_menu, "\rDrug Freeday", "6", 0); menu_additem(days_menu, "\rNight Crawler Day", "7", 0); menu_additem(days_menu, "\rSpartan Day", "8", 0); menu_setprop(days_menu, MPROP_EXIT, MEXIT_ALL); new players[32], pnum, tempid; get_players(players,pnum,"ae","CT")
for( new i; i<pnum; i++ ) { tempid = players[i];
menu_display(tempid, days_menu, 0); set_task(get_pcvar_float(cvar_pranyksta),"tikrintiBALSUS") } return PLUGIN_HANDLED }
public freeDAY() { ColorChat(0, RED, "^x04[%s]^x01 Today is freeday!", ClanTag); set_hudmessage(0, 0, 255, 0.01, 0.90, 0, 6.0, 12.0); show_hudmessage(0, "Day: Freeday!"); for(new i=1; i<=g_maxplayers; i++) { if(!is_user_alive(i)) continue; if(cs_get_user_team( i ) == CS_TEAM_T) { set_user_rendering(i, kRenderFxGlowShell, 250, 0, 0, kRenderTransColor, 16); } } }
public zombieDAY() { ColorChat(0, RED, "^x04[%s]^x01 Today is zombie day!", ClanTag); set_hudmessage(0, 0, 255, 0.01, 0.90, 0, 6.0, 12.0); show_hudmessage(0, "Day: Zombie!"); for(new i=1; i<=g_maxplayers; i++) { if(!is_user_alive(i)) continue; if( cs_get_user_team( i ) == CS_TEAM_T) { strip_user_weapons(i); give_item(i, "weapon_knife"); set_user_health(i, 2000); can_have_gun[i] = false } } }
public lavaDAY() { ColorChat(0, RED, "^x04[%s]^x01 Today is lava day!", ClanTag); set_hudmessage(0, 0, 255, 0.01, 0.90, 0, 6.0, 12.0); show_hudmessage(0, "Day: Lava!"); for(new i=1; i<=g_maxplayers; i++) { if(!is_user_alive(i)) continue; if( cs_get_user_team( i ) == CS_TEAM_T) { ColorChat(i, RED, "^x04[%s]^x01 Hurry and get on a spray!", ClanTag); } } }
public sharkDAY() { ColorChat(0, RED, "^x04[%s]^x01 Today is shark day!", ClanTag); set_hudmessage(0, 0, 255, 0.01, 0.90, 0, 6.0, 12.0); show_hudmessage(0, "Day: Shark!"); static CsTeams:team for(new i=1; i<=g_maxplayers; i++) { if(!is_user_alive(i)) continue; team = cs_get_user_team( i ) if( team == CS_TEAM_CT) { strip_user_weapons(i); give_item(i, "weapon_knife"); set_user_noclip(i, true); new Players[32] new playerCount, i, player get_players(Players, playerCount, "a") for (i=0; i<playerCount; i++) player = Players[i] can_have_gun[player] = false; } else if( team == CS_TEAM_T) { strip_user_weapons(i); give_item(i, "weapon_knife"); give_item(i, "weapon_deagle"); give_item(i, "weapon_m4a1"); } } }
public cageDAY() { ColorChat(0, RED, "^x04[%s]^x01 Today is cage day!", ClanTag); set_hudmessage(0, 0, 255, 0.01, 0.90, 0, 6.0, 12.0); show_hudmessage(0, "Day: Cage!"); for(new i=1; i<=g_maxplayers; i++) { if(!is_user_alive(i)) continue; if( cs_get_user_team( i ) == CS_TEAM_T) { ColorChat(i, GREEN, "[%s] GET YOUR ASSES IN THE CAGE!", ClanTag); } } }
public drugDAY() { ColorChat(0, RED, "^x04[%s]^x01 Today is drug freeday!", ClanTag); set_hudmessage(0, 0, 255, 0.01, 0.90, 0, 6.0, 12.0); show_hudmessage(0, "Day: Drug Freeday!"); for(new i=1; i<=g_maxplayers; i++) { if(!is_user_alive(i)) continue; gmsg_SetFOV = get_user_msgid("SetFOV"); message_begin( MSG_ONE, gmsg_SetFOV, {0, 0, 0},i); write_byte( 180 ); message_end( ); } } public crawlerDAY() { ColorChat(0, RED, "^x04[%s]^x01 Today is night crawler day!", ClanTag); set_hudmessage(0, 0, 255, 0.01, 0.90, 0, 6.0, 12.0); show_hudmessage(0, "Day: Night Crawler!"); static CsTeams:team for(new i=1; i<=g_maxplayers; i++) { if(!is_user_alive(i)) continue; team = cs_get_user_team( i ) if( team == CS_TEAM_CT) { strip_user_weapons(i); give_item(i, "weapon_knife"); can_have_gun[i] = false; set_user_rendering(i, kRenderFxGlowShell, 0, 0, 0, kRenderTransColor, 0); } else if( team == CS_TEAM_T) { strip_user_weapons(i) give_item(i, "weapon_knife"); give_item(i, "weapon_deagle"); give_item(i, "weapon_m4a1"); give_item(i, "weapon_hegrenade"); } } }
public spartanDAY() { ColorChat(0, RED, "^x04[%s]^x01 Today is spartan day!", ClanTag); set_hudmessage(0, 0, 255, 0.01, 0.90, 0, 6.0, 12.0); show_hudmessage(0, "Day: Spartan!"); for(new i=1; i<=g_maxplayers; i++) { if(!is_user_alive(i)) continue; if( cs_get_user_team( i ) == CS_TEAM_T) { strip_user_weapons(i); give_item(i, "weapon_knife"); give_item(i, "weapon_deagle"); give_item(i, "weapon_shield"); can_have_gun[i] = false; } } }
public day_handler(id, days_menu, item) { if( item == MENU_EXIT ) { menu_destroy(days_menu); return PLUGIN_HANDLED; } new data[7], iName[64]; new access, callback; menu_item_getinfo(days_menu, item, access, data, 7, iName, 63, callback); new key = str_to_num(data); switch(key) { case 1: { g_iVotes[1]++; } case 2: { g_iVotes[2]++; } case 3: { g_iVotes[3]++; } case 4: { g_iVotes[4]++; } case 5: { g_iVotes[5]++; } case 6: { g_iVotes[6]++; } case 7: { g_iVotes[7]++; } case 8: { g_iVotes[8]++; } } return PLUGIN_HANDLED; }
public tikrintiBALSUS(){ new iVoteData[ sizeof( g_iVotes ) ][ 2 ]; for( new i = 0; i < sizeof( iVoteData ); i++ ) { iVoteData[ i ][ 0 ] = i; iVoteData[ i ][ 1 ] = g_iVotes[ i ]; } SortCustom2D( iVoteData, 9,"SortVotes" ); new iBestIndex = iVoteData[ 0 ][ 0 ]; new iBestVotes = g_iVotes[ iBestIndex ]; new iSimilar = 1; for( new i = 1; i < sizeof( iVoteData ); i++ ) { if( iBestVotes != iVoteData[ i ][ 1 ] ) { break; } iSimilar++; } if( iSimilar > 1 ) { iBestIndex = iVoteData[ random( iSimilar ) ][ 0 ]; iBestVotes = g_iVotes[ iBestIndex ]; if(iBestIndex == 1) { freeDAY() }else if(iBestIndex == 2) { zombieDAY() }else if(iBestIndex == 3) { lavaDAY() }else if(iBestIndex == 4) { sharkDAY() }else if(iBestIndex == 5) { cageDAY() }else if(iBestIndex == 6) { drugDAY() }else if(iBestIndex == 7) { crawlerDAY() }else if(iBestIndex == 8) { spartanDAY() } }else{ if(g_iVotes[1] > g_iVotes[2] && g_iVotes[1] > g_iVotes[3] && g_iVotes[1] > g_iVotes[4] && g_iVotes[1] > g_iVotes[5] && g_iVotes[1] > g_iVotes[6] && g_iVotes[1] > g_iVotes[7] && g_iVotes[1] > g_iVotes[8]) { freeDAY() }else if(g_iVotes[2] > g_iVotes[1] && g_iVotes[2] > g_iVotes[3] && g_iVotes[2] > g_iVotes[4] && g_iVotes[2] > g_iVotes[5] && g_iVotes[2] > g_iVotes[6] && g_iVotes[2] > g_iVotes[7] && g_iVotes[2] > g_iVotes[8]) { zombieDAY() }else if(g_iVotes[3] > g_iVotes[1] && g_iVotes[3] > g_iVotes[2] && g_iVotes[3] > g_iVotes[4] && g_iVotes[3] > g_iVotes[5] && g_iVotes[3] > g_iVotes[6] && g_iVotes[3] > g_iVotes[7] && g_iVotes[3] > g_iVotes[8]) { lavaDAY() }else if(g_iVotes[4] > g_iVotes[1] && g_iVotes[4] > g_iVotes[3] && g_iVotes[4] > g_iVotes[2] && g_iVotes[4] > g_iVotes[5] && g_iVotes[4] > g_iVotes[6] && g_iVotes[4] > g_iVotes[7] && g_iVotes[4] > g_iVotes[8]) { sharkDAY() }else if(g_iVotes[5] > g_iVotes[1] && g_iVotes[5] > g_iVotes[3] && g_iVotes[5] > g_iVotes[4] && g_iVotes[5] > g_iVotes[2] && g_iVotes[5] > g_iVotes[6] && g_iVotes[5] > g_iVotes[7] && g_iVotes[5] > g_iVotes[8]) { cageDAY() }else if(g_iVotes[6] > g_iVotes[1] && g_iVotes[6] > g_iVotes[3] && g_iVotes[6] > g_iVotes[4] && g_iVotes[6] > g_iVotes[5] && g_iVotes[6] > g_iVotes[2] && g_iVotes[6] > g_iVotes[7] && g_iVotes[6] > g_iVotes[8]) { drugDAY() }else if(g_iVotes[7] > g_iVotes[1] && g_iVotes[7] > g_iVotes[2] && g_iVotes[7] > g_iVotes[4] && g_iVotes[7] > g_iVotes[5] && g_iVotes[7] > g_iVotes[6] && g_iVotes[7] > g_iVotes[2] && g_iVotes[7] > g_iVotes[8]) { crawlerDAY() }else if(g_iVotes[8] > g_iVotes[1] && g_iVotes[8] > g_iVotes[3] && g_iVotes[8] > g_iVotes[2] && g_iVotes[8] > g_iVotes[5] && g_iVotes[8] > g_iVotes[6] && g_iVotes[8] > g_iVotes[7] && g_iVotes[8] > g_iVotes[4]) { spartanDAY() } } for( new i = 1; i < sizeof(g_iVotes); i++ ){ g_iVotes[i] = 0; } iSimilar = 0; iBestIndex = 0; iBestVotes = 0; }
public SortVotes( iData1[ ], iData2[ ], iArray[ ], iData[ ], iDataSize ) { return ( iData1[ 1 ] < iData2[ 1 ] ) ? -1 : 1; }
|
|