[AMXX] Mega Gungame b1.1
#1
Estrella 
[AMXX] MEGA GUNGAME B1.0



Buenas tardes, día o noche, en este caso vengo a aportar algo que llevo haciendo
de hace un tiempo para acá lo cual es un gungame.

¿Que contiene este?

  • TOP 5 - (Jugadores que más han ganado gungame)
  • ESTADÍSTICAS DE JUGADOR
  • 21 NIVELES
  • VOTEMAP
  • TOP 3 - (HUD)
  • 5 MODOS  - (Sin equipos/Rapido/Lento/35 hp/Only HeadShot) Recomendaciones para el modo sin equipos, instalar algún random spawn
  • SHOP  - (Items extras)


Comandos:
  • TOP 5 - /top
  • ESTADÍSTICAS - /ggstats
  • NIVELES - /levels
  • SHOP - pulsar la letra n


¿Que requiere?
Imagenes

Fotos by: Rusky <3
[Imagen: Screenshot-1.png]
[Imagen: Screenshot-2.png]
[Imagen: de-dust20009.png]
[Imagen: de-dust20010.png]
[Imagen: de-dust20011.png]
[Imagen: de-dust20005.png]
[Imagen: de-dust20004.png]
[Imagen: de-dust20006.png]
[Imagen: de-dust20007.png]
Código PHP:
/* 
 Changelog:
 AMXX - Mega Gungame b1.0:
 * 1-. Version de lanzamiento.

 Requiere: 
 * 1-. AMXMOD 1.8.3 >
 * 2-. adv_vault (Guardado)
 * 3-. RegameDLL
*/

#define TASK_ID(%1,%2) (%1 - %2)

/*----------- [ M O T D ] ----------- */

#define TEAM_BLUE_IMG "http://img.fenixzone.net/i/YU3nq2v.jpeg"
#define TEAM_RED_IMG "http://img.fenixzone.net/i/lfAyT3u.jpeg"
#define BLUE_COLOR "#11D9E1"
#define RED_COLOR "#E11111"

/*----------- [ M A P S - V O T E ] ----------- */

#define MAX_MAPS 100
#define MAX_MAPS_VOTE 5
#define MAX_PLAYERS_TOP_MOTD 5
#define MAX_PLAYERS_TOP_HUD 3
#define TIME_VOTEMAP 15
#define TIME_SVC_INTERMISSION 10.0

/*----------- [ P U B L I C I D A D ] ----------- */

#define TIME_PUBLICITY 150 

/*----------- [ G R A N A D E - E F E C C T ] ----------- */

#define GRANADE_MONEY 3000

/*----------- [ F A K E - T R A J E ] ----------- */
#define TRAJE_FAKE_MONEY 6000

/*----------- [ L I F E - E F F E C T ] ----------- */
#define EFFECT_LIFE_MONEY 7000
#define EFFECT_LIFE_HP 150

/*----------- [ R E G E N E R A T E ] ----------- */
#define EFFECT_REGENERATE_MONEY 5500
#define EFFECT_REGENERATE_MAX_HP 150 
#define EFFECT_REGENERATE_SEG 1
#define EFFECT_REGENERATE_TIME 40

/*----------- [ S P E E D - E F F E C T ] ----------- */
#define EFFECT_SPEED_TIME 20
#define EFFECT_SPEED_MONEY 10000
#define EFFECT_SPEED_VELOCITY 3.0

/*----------- [ I N C L U D E S ] ----------- */
#include <amxmodx>
#include <amxmisc>
#include <adv_vault>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <csx>

/*----------- [ E N U M E R A D O R E S ] ----------- */
enum _:DATA_TYPE_SAVE {
 
SD_PLAYER_SAVEDATA,
 
SD_PLAYER_LOADDATA,
 
SD_INIT
}

enum _:DATA_TYPE_STATEGG {
 
PLAYER_STATE_WIN,
 
PLAYER_STATE_LOSE
}

enum _:DATA_TYPE_KILLS {
 
TYPE_DEATH,
 
TYPE_FRAG,
 
TYPE_KNIFE,
 
TYPE_HEADSHOT
}

enum _:DATA_KILLS_POINT {
 
PLAYER_KILL,
 
PLAYER_HEADSHOT,
 
PLAYER_KNIFE,
 
PLAYER_AUTOKILL
}

enum _:DATA_MONEY_POINT {
 
MONEY_KILL 500,
 
MONEY_HEADSHOT 700,
 
MONEY_KNIFE 600
}

enum _:DATA_STATE {
 
MG_STATE_OFFLINE,
 
MG_STATE_CALENTVOTE,
 
MG_STATE_ONLINE,
 
MG_STATE_VOTEMAP,
 
MG_STATE_BESTPLAYER
}

enum _:DATA_TASKS ( += 115 ) {
 
TASK_HUD,
 
TASK_LEVEL,
 
TASK_CALENTVOTE,
 
TASK_BESTPLAYER,
 
TASK_VOTEMAP,
 
TASK_ENDVOTEMAP,
 
TASK_CHANGEMAP,
 
TASK_INIGUNGAME,
 
TASK_ENDVOTEGUNGAME,
 
TASK_PLAYER_PRE_EQUIP,
 
TASK_PLAYER_VOTEGUNGAME,
 
TASK_PLAYER_HE,
 
TASK_PLAYER_EQUIP,
 
TASK_PLAYER_RESPAWN,
 
TASK_PLAYER_SPEED,
 
TASK_PLAYER_REGENERATE
}

enum _:DATA_PCVARS {
 
MG_MIN_PLAYERS,
 
MG_SUPER_RACHA_KILLS,
 
MG_TIME_HE,
 
MG_CALENT_TIME
}

enum _:DATA_LEVELS
{
 
WPN_NAME[33],
 
CSW_WEAPON,
 
WPN_REALNAME[30],
 
POINTS
};

/*----------- [ A R R A Y S ] ----------- */
new g_szLevels[][DATA_LEVELS] =
{
 
// wpn_name CSW_WEAPON wpn_realname    puntos
 
{"weapon_glock18"CSW_GLOCK18"Glock18"},
 {
"weapon_usp"CSW_USP"Usp"},
 {
"weapon_deagle"CSW_DEAGLE"Deagle"},
 {
"weapon_fiveseven",CSW_FIVESEVEN"Fiveseven"},
 {
"weapon_m3"CSW_M3"M3"10 },
 {
"weapon_xm1014"CSW_XM1014"XM1014"14 },
 {
"weapon_mp5navy"CSW_MP5NAVY"MP5Navy"18 },
 {
"weapon_p90"CSW_P90"P90"22 },
 {
"weapon_mac10"CSW_MAC10"MAC10"26 },
 {
"weapon_ump45"CSW_UMP45"UMP45"30 },
 {
"weapon_famas"CSW_FAMAS"Famas"34 },
 {
"weapon_galil"CSW_GALIL"Galil"38 },
 {
"weapon_sg552"CSW_SG552"SG552"42 },
 {
"weapon_ak47"CSW_AK47"Ak47"45 },
 {
"weapon_m4a1"CSW_M4A1"M4A1"50 },
 {
"weapon_aug"CSW_AUG"Aug"55 },
 {
"weapon_scout"CSW_SCOUT"Scout"58 },
 {
"weapon_awp"CSW_AWP"Awp"60 },
 {
"weapon_g3sg1"CSW_G3SG1"G3SG1"67 },
 {
"weapon_m249"CSW_M249"M249"70 },
 {
"weapon_hegrenade",CSW_HEGRENADE"Granada"72 },
 {
"weapon_knife"CSW_KNIFE"Cuchillo"74 }
};

new 
g_iModes[][] = {
 
// kill  Headshot Knife  Autokill
 
111, -},  //Sin equipos 
 
222, -},  //Modo rapido 
 
111, -}, //Modo Lento
 
111, -}, //Modo 35 HP 
 
222, -}  //Modo Only Headshot 
};
 
/*----------- [ V A R I A B L E S ] ----------- */
new g_MaxPlayers;
new 
g_StateGungame;
new 
g_MsgScoreInfo;
new 
g_MsgStatusIcon;
new 
g_MsgHideWeapon;
new 
g_MsgScreenFade;

new 
g_iCountPublicity;
new 
g_iCountVoteMap;
new 
g_iCountCalent;
new 
g_PlayerSuperKnife;
new 
g_PlayerBestMap;
new 
g_VaultSaveData;
new 
g_VaultSort;
new 
g_ModeGungame;
new 
g_bVoteOn false;

new 
g_iPlayerPoint[MAX_PLAYERS+1];
new 
g_iPlayerLevel[MAX_PLAYERS+1];
new 
g_iPlayerKills[MAX_PLAYERS+1];
new 
g_iPlayerCount[MAX_PLAYERS+1];
new 
g_sPlayerFrags[MAX_PLAYERS+1][DATA_TYPE_KILLS];
new 
g_oPlayerFrags[MAX_PLAYERS+1][DATA_TYPE_KILLS];
new 
g_sPlayerGungameState[MAX_PLAYERS+1][DATA_TYPE_STATEGG];
new 
g_iPlayerHeCount[MAX_PLAYERS+1];
new 
g_iPlayerRegenerate[MAX_PLAYERS+1];
new 
g_iPlayerVoteMap[MAX_PLAYERS+1];
new 
g_iPlayerVoteGungame[MAX_PLAYERS+1];

new 
bool:g_bPlayerSpeed[MAX_PLAYERS+1];
new 
bool:g_bPlayerFake[MAX_PLAYERS+1];

new 
g_pCvars[DATA_PCVARS];
new 
g_lMaps[MAX_MAPS][32];
new 
g_sFrags[DATA_TYPE_KILLS];
new 
g_sGungameState[DATA_TYPE_STATEGG];
new 
g_Sync[7];
new 
g_lMapsVote[MAX_MAPS_VOTE][32];
new 
g_PlayerIcon[32][192];

new 
gsTag[] = "^4[AMXX]^1";
new 
snd_lvlup[] =  "mega-gungame/level_up.wav";
new 
snd_alert[] = "garg/gar_alert2.wav";
new 
db_savedata[] = "AMXX-MEGAGUNGAME";

/*----------- [ P L U G I N - I N I T ] ----------- */
public plugin_init() {
 
register_plugin("AMXX - Mega Gungame""b1.0""Alejandro-.");

 
register_event("CurWeapon""CurWeapon""ab");
 
register_event("ResetHUD""onResetHUD""b");

 
register_forward(FM_SetModel"FwRemoveModel");

 
RegisterHam(Ham_Spawn"player""PlayerSpawn"true);
 
RegisterHam(Ham_TraceAttack"player""Forward_PlayerAttack");

 
register_clcmd("drop""BlockCommand");
 
register_clcmd("nightvision""ShowMenuExtraItems");
 
register_clcmd("say /levels""CmdLevelsMenu");
 
register_clcmd("say /ggstats""CmdPlayerStats");
 
register_clcmd("say /top""CmdTopPlayers");

 
g_pCvars[MG_MIN_PLAYERS] = register_cvar("mg_min_players""1"); // Minimo de jugadores para iniciar el Mega-Gungame!
 
g_pCvars[MG_SUPER_RACHA_KILLS] = register_cvar("mg_super_racha_kill""10");  // kills para super racha!
 
g_pCvars[MG_TIME_HE] = register_cvar("mg_time_he""5"); // Segundos en entregar la he!
 
g_pCvars[MG_CALENT_TIME] = register_cvar("mg_time_calent""30"); // Tiempo de calentamiento

 
g_MsgHideWeapon get_user_msgid("HideWeapon");
 
g_MsgScoreInfo get_user_msgid("ScoreInfo");
 
g_MsgStatusIcon get_user_msgid("StatusIcon");
 
g_MsgScreenFade get_user_msgid("ScreenFade");

 
register_message(g_MsgHideWeapon"msgHideWeapon");
 
register_message(g_MsgScoreInfo"PfnScoreInfo");
 
register_message(g_MsgStatusIcon"PfnStatusIcon");

 
register_menu("PublicityMenu"1023"HandPublicityMenu");

 
g_MaxPlayers get_maxplayers();
 
g_StateGungame MG_STATE_OFFLINE;

 for (new 
0<sizeof g_Synci++)
 
g_Sync[i] = CreateHudSyncObj();

 
set_task(1.0"ShowHudGungame"TASK_HUD__"b");
 
adv_vault(0SD_INIT);
 
LoadMaps();
}

public 
Forward_PlayerAttack(indexattackerFloat:dmgFloat:dir[3], trdmgbit) {
 if (
index != attacker && get_tr2(trTR_iHitgroup) != HIT_HEAD && g_StateGungame == MG_STATE_ONLINE && g_ModeGungame == 4) {
 if (
<= attacker <= g_MaxPlayers) {
 if (
get_user_weapon(attacker) == CSW_KNIFE || get_user_weapon(attacker) == CSW_HEGRENADE){
 return 
HAM_IGNORED;
 }
 return 
HAM_SUPERCEDE;
 }
 }
 return 
HAM_IGNORED;
}

public 
CmdPlayerStats(index) {
 static 
menu;
 
menu menu_create(fmt("\wAMXX - \yEstadisticas: \r%n"index), "HandNiveles");
 
menu_additem(menufmt("\d-\w Frags: \y %d (HS: %d)"g_sPlayerFrags[index][TYPE_FRAG], g_sPlayerFrags[index][TYPE_HEADSHOT]));
 
menu_additem(menufmt("\d-\w Frags con cuchillo:\y %d"g_sPlayerFrags[index][TYPE_KNIFE]));
 
menu_additem(menufmt("\d-\w Muertes:\y %d"g_sPlayerFrags[index][TYPE_DEATH]));
 
menu_additem(menufmt("\d-\w Gungame ganados:\y %d"g_sPlayerGungameState[index][PLAYER_STATE_WIN]));
 
menu_additem(menufmt("\d-\w Gungame perdidos:\y %d"g_sPlayerGungameState[index][PLAYER_STATE_LOSE]));
 
menu_setprop(menuMPROP_NUMBER_COLOR"\r");
 
menu_setprop(menuMPROP_NEXTNAME"Siguiente");
 
menu_setprop(menuMPROP_BACKNAME"Anterior");
 
menu_setprop(menuMPROP_EXITNAME"Cerrar");
 
menu_display(indexmenu);
}

public 
CmdLevelsMenu(index) {
 static 
menu;
 
menu menu_create(fmt("\wAMXX - \yNiveles: \r%d"charsmax(g_szLevels)), "HandNiveles");

 for(new 
0<sizeof g_szLevelsi++) {
 
menu_additem(menufmt("(\y%d\w:\y %s\w) \d- \w(PTS:\r %d\w)"ig_szLevels[i][WPN_REALNAME], g_szLevels[i][POINTS]));
 }
 
menu_setprop(menuMPROP_NUMBER_COLOR"\r");
 
menu_setprop(menuMPROP_NEXTNAME"Siguiente");
 
menu_setprop(menuMPROP_BACKNAME"Anterior");
 
menu_setprop(menuMPROP_EXITNAME"Cerrar");
 
menu_display(indexmenu);
}

public 
HandNiveles(indexmenuitem) {
 if (
item == MENU_EXIT) {
 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;
 }

 
client_print_color(indexprint_team_default"%s Nivel: (^3%d^1:^3%s^1) - (PTS:^4 %d^1)"gsTagitemg_szLevels[item][WPN_REALNAME], g_szLevels[item][POINTS])
 
CmdLevelsMenu(index);
 return 
PLUGIN_HANDLED;
}
public 
ShowMenuExtraItems(index) {

 if (!
is_user_alive(index) || g_StateGungame != MG_STATE_ONLINE)
 return 
PLUGIN_HANDLED;

 static 
menu;
 
menu menu_create("\wAMXX - \yExtra items: \r5""HandExtraItems");

 if (
cs_get_user_money(index) >= GRANADE_MONEY && g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] != CSW_HEGRENADE)
 
menu_additem(menufmt("- \wGranada \rHE\w                    -    \y($%d)"GRANADE_MONEY ));
 else 
 
menu_additem(menufmt("\d- Granada HE                    -    \r($%d)"GRANADE_MONEY ));

 if (
cs_get_user_money(index) >= EFFECT_SPEED_MONEY)
 
menu_additem(menufmt("- \wSpeed \r(%i Segundos)\w      -    \y($%i)"EFFECT_SPEED_TIMEEFFECT_SPEED_MONEY));
 else 
 
menu_additem(menufmt("\d- Speed (%i Segundos)      -    \r($%i)"EFFECT_SPEED_TIMEEFFECT_SPEED_MONEY));

 if (
cs_get_user_money(index) >= EFFECT_REGENERATE_MONEY)
 
menu_additem(menufmt("- \wRegeneracion de HP        -    \y($%i)"EFFECT_REGENERATE_MONEY));
 else 
 
menu_additem(menufmt("\d- Regeneracion de HP        -    \r($%i)"EFFECT_REGENERATE_MONEY));

 if (
cs_get_user_money(index) >= TRAJE_FAKE_MONEY)
 
menu_additem(menufmt("- \wTraje Falso                      -    \y($%i)"TRAJE_FAKE_MONEY));
 else 
 
menu_additem(menufmt("\d- Traje Falso                      -    \r($%i)"TRAJE_FAKE_MONEY));

 if (
cs_get_user_money(index) >= EFFECT_LIFE_MONEY)
 
menu_additem(menufmt("- \wObtener \r(+%i)\w de vida    -    \y($%i)"EFFECT_LIFE_HPEFFECT_LIFE_MONEY));
 else 
 
menu_additem(menufmt("\d- Obtener (+%i) de vida  -    \r($%i)"EFFECT_LIFE_HPEFFECT_LIFE_MONEY));

 
menu_setprop(menuMPROP_NUMBER_COLOR"\r");
 
menu_setprop(menuMPROP_NEXTNAME"Siguiente");
 
menu_setprop(menuMPROP_BACKNAME"Anterior");
 
menu_setprop(menuMPROP_EXITNAME"Cerrar");
 
menu_display(indexmenu);
 return 
PLUGIN_HANDLED;
}

public 
HandExtraItems(indexmenuitem) {
 if (
item == MENU_EXIT || !is_user_alive(index)) {
 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;
 }

 switch(
item) {
 case 
0: {
 if(
g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] == CSW_HEGRENADE) {
 
client_print_color(indexprint_team_default"%s No puedes comprar granada en el nivel ^4HE"gsTag);
 return 
PLUGIN_HANDLED
 }
 if (
cs_get_user_money(index) < GRANADE_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagGRANADE_MONEY cs_get_user_money(index));
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - GRANADE_MONEY);

 
give_item(index"weapon_hegrenade");
 
client_print_color(indexprint_team_default"%s Compraste: ^4Granada HE"gsTag); 
 }
 }
 case 
1: {
 if (
cs_get_user_money(index) < EFFECT_SPEED_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagEFFECT_SPEED_MONEY cs_get_user_money(index));
 }
 else if (
g_bPlayerSpeed[index]) {
 
client_print_color(indexprint_team_default"%s Ya tienes en uso el: ^4Speed"gsTag); 
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - EFFECT_SPEED_MONEY);
 
set_user_maxspeed(indexget_user_maxspeed(index) * EFFECT_SPEED_VELOCITY);
 
g_bPlayerSpeed[index] = true;
 
set_task(float(EFFECT_SPEED_TIME), "EndEffectSpeed"index TASK_PLAYER_SPEED);
 
client_print_color(indexprint_team_default"%s Compraste: ^4%d Seg De Speed"gsTagEFFECT_SPEED_TIME); 
 }
 }
 case 
2: {
 if (
cs_get_user_money(index) < EFFECT_REGENERATE_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagEFFECT_REGENERATE_MONEY cs_get_user_money(index));
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - EFFECT_REGENERATE_MONEY);
 
set_task(0.5"RegenerateHP"index TASK_PLAYER_REGENERATE__"a"EFFECT_REGENERATE_TIME);
 
client_print_color(indexprint_team_default"%s Compraste: ^4Regeneracion De HP"gsTag); 
 }
 }
 case 
3: {
 if (
cs_get_user_money(index) < TRAJE_FAKE_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagTRAJE_FAKE_MONEY cs_get_user_money(index));
 }
 else if (
g_bPlayerFake[index]) {
 
client_print_color(indexprint_team_default"%s Ya tienes en uso el: ^4Traje falso"gsTag); 
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - TRAJE_FAKE_MONEY);
 
g_bPlayerFake[index] = true;
 
SetPlayerFake(index);
 
client_print_color(indexprint_team_default"%s Compraste: ^4Traje falso"gsTag); 
 }
 }
 case 
4: {
 if (
cs_get_user_money(index) < EFFECT_LIFE_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagEFFECT_LIFE_MONEY cs_get_user_money(index));
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - EFFECT_LIFE_MONEY);
 
set_user_health(indexget_user_health(index) + EFFECT_LIFE_HP);
 
client_print_color(indexprint_team_default"%s Compraste: ^4(+%i)^1 de ^3HP"gsTagEFFECT_LIFE_HP); 
 }
 }
 }

 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;
}

public 
RegenerateHP(index) {
 
index TASK_ID(indexTASK_PLAYER_REGENERATE);

 if (
get_user_health(index) < EFFECT_REGENERATE_MAX_HP) {
 
set_user_health(indexget_user_health(index) + EFFECT_REGENERATE_SEG);
 }
}

public 
EndEffectSpeed(index) {
 
index TASK_ID(indexTASK_PLAYER_SPEED);
 
g_bPlayerSpeed[index] = false;
 
ResetUserMaxSpeed(index);
 
client_print_color(indexprint_team_default"%s Termino tu tiempo de ^4Speed"gsTag); 
}

public 
plugin_precache() {
 if (
snd_lvlup[0])
 
precache_sound(snd_lvlup);
 if (
snd_alert[0])
 
precache_sound(snd_alert);
}
  

public onResetHUD(index) {
 
message_begin(MSG_ONEg_MsgHideWeapon_index);
 
write_byte((1<<4) | (1<<5) | (1<<3));
 
message_end();
}

public 
msgHideWeapon(index) {
 
set_msg_arg_int(1ARG_BYTEget_msg_arg_int(1) | (1<<4));
}

public 
FwRemoveModel(entity, const model[])
{
 static 
szClassname[32];
 
pev(entitypev_classnameszClassnamecharsmax(szClassname));

 if (
equal(szClassname"weaponbox"))
 {
 
set_pev(entitypev_nextthinkget_gametime() + 0.01);
 return 
FMRES_SUPERCEDE;
 }

 return 
FMRES_IGNORED;


public 
PfnStatusIcon(msg_idmsg_destid) {
 static 
szIcon[8];
 
get_msg_arg_string(2szIconcharsmax(szIcon));

 if (
equal(szIcon"buyzone") && get_msg_arg_int(1) && g_StateGungame == MG_STATE_ONLINE) {
 
set_pdata_int(id235get_pdata_int(id235) & ~(1<<0));
 return 
PLUGIN_HANDLED;
 }

 return 
PLUGIN_CONTINUE;


public 
client_death(killervictimwpnindexhitplace) { 

 if(!
IsPlayerValid(killer) || !IsPlayerValid(victim))
 return 
PLUGIN_CONTINUE;

 if (
g_StateGungame != MG_STATE_ONLINE) {
 return 
PLUGIN_CONTINUE;
 }

 if (
killer == victim) {

 if (
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] != CSW_HEGRENADE || 
 
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] == CSW_HEGRENADE && wpnindex == CSW_HEGRENADE)  {
 
SetPlayerPoints(victimGetPlayerPoints(victim) + g_iModes[g_ModeGungame][PLAYER_AUTOKILL]);
 }
 
ResetPlayerKills(victim);
 return 
PLUGIN_CONTINUE;
 }

 
g_sPlayerFrags[killer][TYPE_FRAG]++;
 
g_oPlayerFrags[killer][TYPE_FRAG]++;

 
g_sPlayerFrags[victim][TYPE_DEATH]++;
 
g_oPlayerFrags[victim][TYPE_DEATH]++;
 
client_cmd(killer"spk buttons/bell1.wav");
 
 
g_bPlayerFake[victim] = false;
 
g_bPlayerSpeed[victim] = false;
 
cs_reset_user_model(victim);

 if (
wpnindex == CSW_KNIFE) {

 if(
killer == g_PlayerSuperKnife) { 
 
SetSuperKnifeEffect(killervictim);
 }
 else { 
 
RoboPlayerLevel(killervictim);
 
PlayerKills(killervictim);
 }
 
g_sPlayerFrags[killer][TYPE_KNIFE]++;
 
g_oPlayerFrags[killer][TYPE_KNIFE]++;

 if (
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] != CSW_HEGRENADE || 
 
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] == CSW_HEGRENADE && wpnindex == CSW_HEGRENADE)  {
 
SetPlayerPoints(killerGetPlayerPoints(killer) + g_iModes[g_ModeGungame][PLAYER_KNIFE]);
 }
 
cs_set_user_money(killercs_get_user_money(killer) + MONEY_KNIFE);
 return 
PLUGIN_CONTINUE;
 }

 if (
hitplace == HIT_HEAD) {
 if (
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] != CSW_HEGRENADE || 
 
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] == CSW_HEGRENADE && wpnindex == CSW_HEGRENADE)  {
 
SetPlayerPoints(killerGetPlayerPoints(killer) + g_iModes[g_ModeGungame][PLAYER_HEADSHOT]);
 }
 if(
killer != g_PlayerSuperKnife)
 
PlayerKills(killervictim);

 
g_sPlayerFrags[killer][TYPE_HEADSHOT]++;
 
g_oPlayerFrags[killer][TYPE_HEADSHOT]++;
 
cs_set_user_money(killercs_get_user_money(killer) + MONEY_HEADSHOT);
 return 
PLUGIN_CONTINUE;
 }
 if (
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] != CSW_HEGRENADE || 
 
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] == CSW_HEGRENADE && wpnindex == CSW_HEGRENADE)  {
 
SetPlayerPoints(killerGetPlayerPoints(killer) + g_iModes[g_ModeGungame][PLAYER_KILL]);
 }
 if(
killer != g_PlayerSuperKnife)
 
PlayerKills(killervictim);

 
cs_set_user_money(killercs_get_user_money(killer) + MONEY_KILL);
 return 
PLUGIN_CONTINUE;
}

public 
BlockCommand(index)
{
 if (
g_StateGungame == MG_STATE_ONLINE)
 return 
PLUGIN_HANDLED;
 return 
PLUGIN_CONTINUE;
}

public 
PlayerSpawn(index) {
 
 if (!
is_user_connected(index))
 return 
HAM_IGNORED;

 if (
g_StateGungame == MG_STATE_ONLINE) { 
 if (!
task_exists(index TASK_PLAYER_EQUIP)) {
 
ShowMenuPublicity(index);
 
set_task(0.1"SetPlayerEquip"index TASK_PLAYER_EQUIP__"b");
 }
 }
 
set_task(0.1"SetPlayerPreEquip"index TASK_PLAYER_PRE_EQUIP);
 return 
HAM_IGNORED;
}

public 
SetPlayerPreEquip(index) {
 
index TASK_ID(indexTASK_PLAYER_PRE_EQUIP);
 switch (
g_StateGungame) { 
 case 
MG_STATE_CALENTVOTE: {
 
strip_user_weapons(index);
 
give_item(index"weapon_knife");
 
give_item(index"weapon_m4a1");
 
give_item(index"weapon_deagle");
 
give_item(index"weapon_hegrenade");
 
cs_set_user_bpammo(indexCSW_M4A1200);
 
cs_set_user_bpammo(indexCSW_DEAGLE200);
 }
 case 
MG_STATE_ONLINE: {
 
strip_user_weapons(index);
 
 if (
g_ModeGungame == 3) {
 
SetFadeRed(index); 
 
set_user_health(index35);
 
client_cmd(index"spk player/headshot1.wav");
 }
 else 
 
cs_set_user_armor(index200CS_ARMOR_VESTHELM);
 }
 case 
MG_STATE_VOTEMAPMG_STATE_BESTPLAYER: {
 
strip_user_weapons(index);
 }
 }
}
public 
ShowMenuPublicity(index) {
 static 
sztext512 ], iLenkeys;
 
iLen 0;

 
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wAMXX \d| \yMEGA GUNGAME \rv1.0b^n^n");

 
keys = (1<<9);
 
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wNIVELES: \r%d \d(CMD: \r/levels\d)^n"charsmax(g_szLevels));
 switch(
g_ModeGungame) {
 case 
0iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wMODO: \ySIN EQUIPOS^n"charsmax(g_szLevels));
 case 
1iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wMODO: \yRAPIDO^n"charsmax(g_szLevels));
 case 
2iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wMODO: \yLENTO^n"charsmax(g_szLevels));
 case 
3iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wMODO: \y35 HP^n"charsmax(g_szLevels));
 case 
4iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wMODO: \yONLY HEADSHOT^n"charsmax(g_szLevels));
 }
 
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wVOTEMAP: \yACTIVO^n");
 
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wESTADISTICAS: \yACTIVO \d(CMD: \r/ggstats\d)^n");
 
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wTOP 5: \yACTIVO \d(CMD: \r/top\d)^n");
 
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wMOTD BEST PLAYER: \yACTIVO^n");
 
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wSUPER KNIFE: \yACTIVO \d(%d KILLS Y TE LA ACTIVAS)^n"get_pcvar_num(g_pCvars[MG_SUPER_RACHA_KILLS]));
 
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wSHOP: \yPULSAR \rN\d (DEBES ESTAR VIVO)^n^n");
 
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \yNOTA:\w SE EL PRIMERO EN LLEGAR AL NIVEL MAXIMO^n^n");
 
iLen += format(sztext[iLen], sizeof sztext iLen"\r0. \wCerrar");
 
show_menuindexkeyssztext, -1"PublicityMenu" );
}

public 
HandPublicityMenu(indexkey) {
 return 
PLUGIN_HANDLED;
}

public 
SetPlayerEquip(index) {
 
index TASK_ID(indexTASK_PLAYER_EQUIP);

 if (
g_StateGungame != MG_STATE_ONLINE) {
 if (
task_exists(index+TASK_PLAYER_EQUIP))
 
remove_task(index+TASK_PLAYER_EQUIP)
 return;
 }
 if (!
is_user_alive(index)) {
 return;
 }

 switch (
g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON])
 {
 case 
CSW_KNIFE: {
 if (
get_user_weapon(index) != CSW_KNIFE && get_user_weapon(index) != CSW_HEGRENADE) {
 
strip_user_weapons(index);
 
give_item(index"weapon_knife");
 
engclient_cmd(index"weapon_knife");
 }
 }
 case 
CSW_HEGRENADE: { 
 if (
get_user_weapon(index) != CSW_HEGRENADE) {
 if ((
get_user_weapon(index) != CSW_KNIFE && get_user_weapon(index) != CSW_GLOCK18)) {

 
strip_user_weapons(index);
 
give_item(index"weapon_knife");
 
give_item(index"weapon_glock18");
 
give_item(index"weapon_hegrenade");

 if(!
task_exists(index TASK_PLAYER_HE))
 
set_task(1.0"SetPlayerHe"index TASK_PLAYER_HE__"b");
 }
 }
 }
 default: {
 new 
weapons pev(indexpev_weapons);
 if (
get_user_weapon(index) != g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON]) {
 if ((
get_user_weapon(index) != CSW_KNIFE && get_user_weapon(index) != CSW_HEGRENADE) && get_user_weapon(index) != g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] ||
 (
get_user_weapon(index) == CSW_KNIFE && get_user_weapon(index) == CSW_HEGRENADE) && !(weapons&1<<g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON])) {

 
strip_user_weapons(index);
 
give_item(index"weapon_knife");
 
give_item(indexg_szLevels[g_iPlayerLevel[index]][WPN_NAME]);

 if(
g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] == CSW_AWP) {
 
cs_set_weapon_ammo(g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON], 1);
 }

 
cs_set_user_bpammo(indexg_szLevels[g_iPlayerLevel[index]][CSW_WEAPON], 200);
 
engclient_cmd(indexg_szLevels[g_iPlayerLevel[index]][WPN_NAME]); 
 }
 }
 }
 }
}

public 
SetPlayerHe(index) {
 
index TASK_ID(indexTASK_PLAYER_HE);
 if (
g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] != CSW_HEGRENADE) {
 if (
task_exists(index TASK_PLAYER_HE))
 
remove_task(index TASK_PLAYER_HE)
 return;
 }

 new 
weapons pev(indexpev_weapons);
 if(!(
weapons&1<<CSW_HEGRENADE)) {
 if (
g_iPlayerHeCount[index]) {
 
client_print(indexprint_center"Obtendras una: Granada en %d seg"g_iPlayerHeCount[index]); 
 
g_iPlayerHeCount[index]--;
 }
 else {
 
give_item(index"weapon_hegrenade");
 
client_print(indexprint_center"Obtienes una: Granada");
 }
 } 
 else {
 
g_iPlayerHeCount[index] = get_pcvar_num(g_pCvars[MG_TIME_HE]);
 }
}

public 
PfnScoreInfo(msid) {
 static 
_score_player_id;
 
_score_player_id get_msg_arg_int(1);

 if (
g_StateGungame == MG_STATE_ONLINE) {
 
set_msg_arg_int(2ARG_SHORTGetPlayerPoints(_score_player_id));
 }
}

public 
ShowHudGungame() {

 new 
bool:hud true;
 new 
szBuffer[600];
 static 
iLen;

 
iLen 0;

 switch (
g_StateGungame) {
 case 
MG_STATE_CALENTVOTE: {
 
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"Calentamiento: 00:%02i segundos..."g_iCountCalent); 
 }
 case 
MG_STATE_BESTPLAYER: {
 if (
is_user_connected(g_PlayerBestMap))
 
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"\
 <-----------[GANADOR]-------->^n\
 Jugador: %n^n\
 gg ganados: %i^n\
 Frags: %i (HS: %i)^n\
 Frags Knife: %i^n\
 Muertes: %i^n\
 <-----------[GANADOR]-------->"
g_PlayerBestMapg_sPlayerGungameState[g_PlayerBestMap][PLAYER_STATE_WIN], g_oPlayerFrags[g_PlayerBestMap][TYPE_FRAG], g_oPlayerFrags[g_PlayerBestMap][TYPE_HEADSHOT], g_oPlayerFrags[g_PlayerBestMap][TYPE_KNIFE], g_oPlayerFrags[g_PlayerBestMap][TYPE_DEATH]); 
 else 
 
hud false
 }
 case 
MG_STATE_OFFLINE: {
 
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"Esperando %d/%d jugadores"GetPlayersNum(), get_pcvar_num(g_pCvars[MG_MIN_PLAYERS]));

 if (
GetPlayersNum() >= get_pcvar_num(g_pCvars[MG_MIN_PLAYERS])) {
 
StartCalent();
 }
 }
 case 
MG_STATE_ONLINE: {
 
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"\
 MEGA-GUNGAME | PLAYERS TOP^n\
 ------------------------------------------------------^n\
 - Jugador              - (PTS) (L/LM) (EQUIP) (100%%%%)^n"
);
 
 new 
PlayersTop[MAX_PLAYERS_TOP_HUD];

 
set_hudmessage(2552552550.020.24016.01.3);
 
GetPlayersTop(PlayersTop);
 new 
iCount 0;

 for(new 
top 0top <sizeof PlayersToptop++)
 {
 if (
is_user_connected(PlayersTop[top])) {

 new 
name[12];
 
get_user_name(PlayersTop[top], namecharsmax(name));
 new 
iPorcentaje;
 
iPorcentaje = ((g_iPlayerPoint[PlayersTop[top]] * 100) / g_szLevels[sizeof g_szLevels 1][POINTS]);
 new 
iEspacios 12 strlen(name) + 4;
 
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"%i. %s"top 1name);      
 
for (new 0<=iEspaciosi++) {
 
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen" ");      
 
}
 
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"- (%d) (%d/%d) (%s) (%i%%%%)%s^n"GetPlayerPoints(PlayersTop[top]), g_iPlayerLevel[PlayersTop[top]], sizeof g_szLevels 1g_szLevels[g_iPlayerLevel[PlayersTop[top]]][WPN_REALNAME], iPorcentajetop == " (LIDERANDO)" "");
 
iCount++;
 }
 }

 if (!
iCount) {
 
hud false;
 }

 
g_iCountPublicity--;

 if (!
g_iCountPublicity) {
 new 
iBestPlayer[MAX_PLAYERS_TOP_HUD]; 
 
GetPlayersTop(iBestPlayer);

 if (
GetPlayerPoints(iBestPlayer[0])) { 
 
client_print_color(0print_team_default"%s El jugador: ^4%n^1. Esta liderando con (^4%d^3 PTS^1) y nivel ^3%d ^4(%s)"gsTagiBestPlayer[0], GetPlayerPoints(iBestPlayer[0]), g_iPlayerLevel[iBestPlayer[0]], g_szLevels[g_iPlayerLevel[iBestPlayer[0]]][WPN_REALNAME]);
 }

 
g_iCountPublicity TIME_PUBLICITY;
 }

 for (new 
Players 1Players <= g_MaxPlayersPlayers++) {
 if (
IsPlayerValid(Players)) {
 
UpdateIcon(Players);
 }
 }
 }
 case 
MG_STATE_VOTEMAP: {
 if (
g_iCountVoteMap) {
 
g_iCountVoteMap--;

 
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"\
 MEGA-GUNGAME | VOTE MAP                (%d)^n\
 ------------------------------------------------------^n\
 - Mapa                        - (VOTOS) (100%%%%)^n"
g_iCountVoteMap);

 new 
iCount 0;
 new 
MapsVotes[MAX_MAPS_VOTE];
 new 
iPorcentaje;

 for(new 
vMaps 0vMaps <MAX_MAPS_VOTEvMaps++)
 {
 if (
g_lMapsVote[vMaps][0]) {

 for (new 
Players 1Players <=g_MaxPlayersPlayers++)
 {
 if(
IsPlayerValid(Players)){
 if( 
g_iPlayerVoteMap[Players] == vMaps )
 
MapsVotes[vMaps] += 1;
 }
 }
 
iPorcentaje = ((MapsVotes[vMaps] * 100) / GetPlayersNum());
 new 
iEspacios 19 strlen(g_lMapsVote[vMaps]) + 4;
 
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"%i. %s"vMaps 1g_lMapsVote[vMaps]);      
 
for (new 0<=iEspaciosi++) {
 
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen" ");      
 
}
 
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"- (%d) (%i%%%%)^n"MapsVotes[vMaps], iPorcentaje);
 
iCount++;
 }
 }

 if (!
iCount) {
 
hud false;
 }
 }
 }
 }

 if (
hud) {
 
set_hudmessage(02550g_StateGungame == MG_STATE_CALENTVOTE || g_StateGungame == MG_STATE_OFFLINE ? -1.0 0.02g_StateGungame == MG_STATE_CALENTVOTE || g_StateGungame == MG_STATE_OFFLINE 0.9 0.17016.01.3);
 
ShowSyncHudMsg(0g_Sync[0], szBuffer);
 }
}

public 
plugin_end() {
 if (
task_exists(TASK_HUD))
 
remove_task(TASK_HUD);
}

public 
client_putinserver(index) {
 
g_iPlayerPoint[index] = EOS;
 
g_iPlayerLevel[index] = EOS;
 
g_iPlayerKills[index] = EOS;
 
g_iPlayerCount[index] = EOS;
 
g_iPlayerRegenerate[index] = EOS;
 
g_iPlayerHeCount[index] = EOS;
 
g_bPlayerFake[index] = false;
 
g_bPlayerSpeed[index] = false;
 
g_iPlayerVoteMap[index] = -1;
 
g_iPlayerVoteGungame[index] = -1;

 for (new 
0<sizeof(g_sPlayerFrags[]); i++)
 
g_sPlayerFrags[index][i] = EOS;

 for (new 
0<sizeof(g_sPlayerGungameState[]); i++)
 
g_sPlayerGungameState[index][i] = EOS;

 switch (
g_StateGungame) {
 case 
MG_STATE_OFFLINE: {
 if (
GetPlayersNum() >= get_pcvar_num(g_pCvars[MG_MIN_PLAYERS])) {
 
StartCalent();
 }
 }
 case 
MG_STATE_ONLINE: {
 new 
PlayerBest[MAX_PLAYERS_TOP_HUD];
 
GetPlayersTop(PlayerBest);
 if (
g_iPlayerLevel[PlayerBest[0]] > 8) {
 
g_iPlayerLevel[index] = (g_iPlayerLevel[PlayerBest[0]] - 8);
 
g_iPlayerPoint[index] = (g_szLevels[(g_iPlayerLevel[PlayerBest[0]] - 8) - 1][POINTS]);
 }
 }
 }

 
adv_vault(indexSD_PLAYER_LOADDATA);
}

public 
StartCalent() {
 if(
g_StateGungame != MG_STATE_OFFLINE
 return;

 
g_StateGungame  MG_STATE_CALENTVOTE;
 
g_iCountPublicity TIME_PUBLICITY;
 
g_PlayerSuperKnife EOS;
 
g_PlayerBestMap = -1;
 
g_iCountVoteMap TIME_VOTEMAP;
 
g_iCountCalent get_pcvar_num(g_pCvars[MG_CALENT_TIME]);
 
g_bVoteOn true;
 
set_cvar_num("sv_restart"1);
 for(new 
0<=g_MaxPlayersi++) {
 if (
IsPlayerValid(i)) {
 
set_task(1.0"ShowVoteGungame"TASK_PLAYER_VOTEGUNGAME__"b");
 }
 }
 
set_task(15.0"EndVoteGungame"TASK_ENDVOTEGUNGAME);
 
set_task(1.0"StartCalentCount"TASK_CALENTVOTE__"b");
}

public 
ShowVoteGungame(index) {
 
index TASK_ID(indexTASK_PLAYER_VOTEGUNGAME);

 static 
menu
 
menu menu_create("\wAMXX \d- \yVote Gungame""HandVoteGungame");

 new 
iVotes[5];
 new 
iPorcentaje[5];

 for (new 
0<=g_MaxPlayersi++) {
 if (
IsPlayerValid(i)) {
 if(
g_iPlayerVoteGungame[i] != -1) {
 
iVotes[g_iPlayerVoteGungame[i]]++;
 
iPorcentaje[g_iPlayerVoteGungame[i]] = ((iVotes[g_iPlayerVoteGungame[i]] * 100) / GetPlayersNum());
 }
 
 }
 }

 
menu_additem(menufmt("\d- \wModo:\y Sin equipos  \d- [%i] (%i%%)"iVotes[0], iPorcentaje[0]));
 
menu_additem(menufmt("\d- \wModo:\y rapido        \d- [%i] (%i%%)"iVotes[1], iPorcentaje[1]));
 
menu_additem(menufmt("\d- \wModo:\y lento        \d- [%i] (%i%%)"iVotes[2], iPorcentaje[2]));
 
menu_additem(menufmt("\d- \wModo:\y 35 hp        \d- [%i] (%i%%)"iVotes[3], iPorcentaje[3]));
 
menu_additem(menufmt("\d- \wModo:\y Only Headshot \d- [%i] (%i%%)"iVotes[4], iPorcentaje[4]));
//mp_freeforall
 
menu_setprop(menuMPROP_NUMBER_COLOR"\r");
 
menu_setprop(menuMPROP_NEXTNAME"Siguiente");
 
menu_setprop(menuMPROP_BACKNAME"Anterior");
 
menu_setprop(menuMPROP_EXITNAME"Cerrar");
 
menu_display(indexmenu);
 if (!
g_bVoteOn)
 if (
task_exists(index TASK_PLAYER_VOTEGUNGAME)) remove_task(index TASK_PLAYER_VOTEGUNGAME);
}

public 
HandVoteGungame(indexmenuitem) {
 if (
item == MENU_EXIT) {
 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;
 }

 if (
g_iPlayerVoteGungame[index] == -&& g_StateGungame == MG_STATE_CALENTVOTE && g_bVoteOn) {
 
g_iPlayerVoteGungame[index] = item;
 switch(
item) {
 case 
0client_print_color(0print_team_default"%s ^3%n^1 Voto por:^4 Modo:^3 Sin equipos"gsTagindex); 
 case 
1client_print_color(0print_team_default"%s ^3%n^1 Voto por:^4 Modo:^3 rapido"gsTagindex);
 case 
2client_print_color(0print_team_default"%s ^3%n^1 Voto por:^4 Modo:^3 lento"gsTagindex);
 case 
3client_print_color(0print_team_default"%s ^3%n^1 Voto por:^4 Modo:^3 35 hp"gsTagindex);
 case 
4client_print_color(0print_team_default"%s ^3%n^1 Voto por:^4 Modo:^3 only headshot"gsTagindex);
 }
 
client_cmdindex"speak buttons/button9" );
 }
 return 
PLUGIN_HANDLED;
}

public 
EndVoteGungame() {
 new 
iVotes[5];

 for (new 
0<=g_MaxPlayersi++) {
 if (
IsPlayerValid(i)) {
 if(
g_iPlayerVoteGungame[i] != -1)
 
iVotes[g_iPlayerVoteGungame[i]]++;
 }
 }

 new 
iBestVotebool:bTypeEvent false;

 for (new 
0<sizeof iVotesi++) {
 for (new 
i2 0i2 <sizeof iVotesi2++) {
 if (
iVotes[i] > iVotes[i2]) {
 
iBestVote i;
 
bTypeEvent true;
 }
 }
 } 

 if (!
bTypeEvent) {
 
iBestVote random_num(03);
 } 

 switch(
iBestVote) {
 case 
0client_print_color(0print_team_default"%s Modo de juego ganador:^3 Sin equipos"gsTag);
 case 
1client_print_color(0print_team_default"%s Modo de juego ganador:^3 Rapido"gsTag);
 case 
2client_print_color(0print_team_default"%s Modo de juego ganador:^3 Lento"gsTag);
 case 
3client_print_color(0print_team_default"%s Modo de juego ganador:^3 35 hp"gsTag);
 case 
4client_print_color(0print_team_default"%s Modo de juego ganador:^3 Only Headshot"gsTag);
 }

 
g_ModeGungame iBestVote;
 
g_bVoteOn   false;
}

public 
StartCalentCount() {
 if (
g_StateGungame != MG_STATE_CALENTVOTE
 return;

 if (
g_iCountCalent) {
 
g_iCountCalent--;
 }
 else {
 if(
task_exists(TASK_CALENTVOTE))
 
remove_task(TASK_CALENTVOTE);

 
client_print_color(0print_team_default"%s INICIANDO ^3GUNGAME^4!"gsTag);
 
set_task(1.5"StartMegaGungame"TASK_INIGUNGAME);
 }
}

public 
client_disconnected(index) {
 if (
task_exists(index TASK_PLAYER_EQUIP))
 
remove_task(index TASK_PLAYER_EQUIP);
 
adv_vault(indexSD_PLAYER_SAVEDATA);
}

public 
StartMegaGungame() {
 if(
g_StateGungame != MG_STATE_CALENTVOTE)
 return;

 
g_StateGungame MG_STATE_ONLINE
 
ServerGungame();
}

public 
EndMegaGungame(const BestPlayer) {
 if(
g_StateGungame != MG_STATE_ONLINE)
 return;

 
g_PlayerBestMap BestPlayer;

 for (new 
1<=g_MaxPlayersi++) {
 if(
== BestPlayer)
 continue;

 if(
IsPlayerValid(i)) {
 
g_sPlayerGungameState[i][PLAYER_STATE_LOSE]++;
 
adv_vault(iSD_PLAYER_SAVEDATA);
 }
 }
 
g_sPlayerGungameState[BestPlayer][PLAYER_STATE_WIN]++;
 
adv_vault(BestPlayerSD_PLAYER_SAVEDATA);
 
g_StateGungame MG_STATE_BESTPLAYER;
 
set_task(1.0"EffectEndGungame"TASK_BESTPLAYER);
 
client_print_color(0print_team_default"%s El Ganador del ^3MEGA-GUNGAME!^1 es: ^4%n"gsTagg_PlayerBestMap);
}

public 
EffectEndGungame() {
 
 
set_lights("a");
 
set_cvar_num"sv_maxspeed");

 for (new 
players 1players <= g_MaxPlayersplayers++) {
 if (!
IsPlayerValid(players))
 continue;
 if (!(
<= get_user_team(players) <= 2))
 continue; 

 
strip_user_weapons(players);
 }

 
LoadMapsVote();
 
VoteMapGungame();
 
set_task(15.0"EndVoteMap"TASK_ENDVOTEMAP);
}


public 
DisPlayMotd(const BestPlayer) {
 new 
motd[1536];
 static 
len;
 
len 0;
 new 
iTeam get_user_team(BestPlayer);

 switch(
iTeam) {
 case 
1: {
 
len += formatex(motd[len], sizeof motd-len,
 
"<body>\
 <style>\
 @import url('https://fonts.googleapis.com/css?family=Mukta');\
 body{color:white;background:#282725;font-family:'Mukta',sans-serif}\
 img{border-radius:100;width:50%%;}\
 h1{font-size:15px;background:%s;}\
 .left{width:40%%;color:white;text-align:center;background:rgba(0,0,0,0.5);padding:3%%;float:left;margin-left:3%%;}\
 .left a{color:%s;font-size:15px;text-decoration:none}\
 .right{width:40%%;color:white;text-align:center;background:rgba(0,0,0,0.5);padding:3%%;float:right;margin-right:3%%}\
 .right a{color:%s;font-size:15px;text-decoration:none}\
 table{border:1px solid %s;font-size:10px}\
 th{background:%s;}\
 td{border:1px solid %s}</style>"
RED_COLORRED_COLORRED_COLORRED_COLORRED_COLORRED_COLOR);
 
len += formatex(motd[len], sizeof motd-len"<div class=left><h1>Mejor jugador</h1></br><img src=%s></br><h4>%n</h4>"TEAM_RED_IMGBestPlayer);
 }
 case 
2:{
 
len += formatex(motd[len], sizeof motd-len,
 
"<body>\
 <style>\
 @import url('https://fonts.googleapis.com/css?family=Mukta');\
 body{color:white;background:#282725;font-family:'Mukta',sans-serif}\
 img{border-radius:100;width:50%%;}\
 h1{font-size:15px;background:%s;}\
 .left{width:40%%;color:white;text-align:center;background:rgba(0,0,0,0.5);padding:3%%;float:left;margin-left:3%%;}\
 .left a{color:%s;font-size:15px;text-decoration:none}\
 .right{width:40%%;color:white;text-align:center;background:rgba(0,0,0,0.5);padding:3%%;float:right;margin-right:3%%}\
 .right a{color:%s;font-size:15px;text-decoration:none}\
 table{border:1px solid %s;font-size:10px}\
 th{background:%s;}\
 td{border:1px solid %s}</style>"
BLUE_COLORBLUE_COLORBLUE_COLORBLUE_COLORBLUE_COLORBLUE_COLOR);
 
len += formatex(motd[len], sizeof motd-len"<div class=left><h1>Mejor jugador</h1></br><img src=%s></br><h4>%n</h4>"TEAM_BLUE_IMGBestPlayer);
 }
 }
 
len += formatex(motd[len], sizeof motd-len"</div><div class=right>\
 <h1>ESTADISTICAS</h1>\
 </br>\
 <table width=100%%>\
 <tr align=center>\
 <th width=50%%>Gungame Ganados\
 <th width=50%%>Gungame Perdidos"
);
 
len += formatex(motd[len], sizeof motd-len"\
 <tr align=center>\
 <td>%i\
 <td>%i"
g_sPlayerGungameState[BestPlayer][PLAYER_STATE_WIN], g_sPlayerGungameState[BestPlayer][PLAYER_STATE_LOSE]);
 
len += formatex(motd[len], sizeof motd-len"</table><table width=100%%>\
 <tr align=center>\
 <th width=35%%>Frags\
 <th width=35%%>Frags Knife\
 <th width=35%%>Muertes"
);
 
len += formatex(motd[len], sizeof motd-len"\
 <tr align=center>\
 <td>%i\
 <td>%i\
 <td>%i"
g_oPlayerFrags[BestPlayer][TYPE_FRAG], g_oPlayerFrags[BestPlayer][TYPE_KNIFE], g_oPlayerFrags[BestPlayer][TYPE_DEATH]);

 
len += formatex(motd[len], sizeof motd-len"</table></div>");
 
len += formatex(motd[len], sizeof motd-len"</body>");

 for(new 
Players 1Players <= g_MaxPlayersPlayers++)
 {
 if(!
IsPlayerValid(Players))
 continue;

 
show_motd(Playersmotd"[AMXX] Mega-GunGame v1.0b");
 }
}

public 
CmdTopPlayers(index) {
 new 
motd[2200];
 static 
len;
 
len 0;

 
adv_vault_sort_update(g_VaultSaveDatag_VaultSort);
 new 
toploop min(adv_vault_sort_numresult(g_VaultSaveDatag_VaultSort), MAX_PLAYERS_TOP_MOTD);

 
len += formatex(motd[len], sizeof motd-len,
 
"<body>\
 <style>\
 @import url('https://fonts.googleapis.com/css?family=Mukta');\
 *{font-size:11px}\
 body{color:white;background:url(^"
http://img.fenixzone.net/i/I2067Wl.jpeg^");\
 
font-family:'Mukta',sans-serif;background-position:center center;background-attachment:fixed}\
 
table{border:10px;width:100%%}\
 .
t{background:rgba(0,0,0,0.6); width:80%%;margin-left:auto;margin-right:auto;border-radius:50px 50px 0 0}\
 
h1{text-align:center;font-size:20px;}\
 .
c1{background:rgba(15,15,15,0.8)}\
 .
c2{background:rgba(30,30,30,0.8)}\
 
th{color:black;background:rgba(34,177,201,0.8)}\
 </
style></br></br></br><div class=t><table>\
 <
h1>TOP 5 <span style=color:#99FF00;>|</span> MEGA-GUNGAME v1.0b</h1>\
 
<tr align=center>\
 <
th width=5%%>#\
 
<th width=50%%>Nombre\
 <
th width=15%%>gg win\
 <
th width=15%%>Frags\
 <
th width=15%%>muertes");

 new gg_win, frags, death, headshot, pj[32], keyindex;

 for(new position = 1; position <= toploop; position++)
 {
 keyindex = adv_vault_sort_position(g_VaultSaveData, g_VaultSort, position);

 if(!adv_vault_get_prepare(g_VaultSaveData, keyindex)) 
 continue;

 frags = adv_vault_get_field(g_VaultSaveData, g_sFrags[TYPE_FRAG]);
 death = adv_vault_get_field(g_VaultSaveData, g_sFrags[TYPE_DEATH]);
 headshot = adv_vault_get_field(g_VaultSaveData, g_sFrags[TYPE_HEADSHOT]);
 gg_win = adv_vault_get_field(g_VaultSaveData, g_sGungameState[PLAYER_STATE_WIN]);

 adv_vault_get_keyname(g_VaultSaveData, keyindex, pj, 31);

 len += formatex(motd[len], sizeof motd-len, "
<tr align=center>");
 len += formatex(motd[len], sizeof motd-len, "
<td class=%s>%d", ((position%2) == 0) ? "c1" : "c2", position);
 len += formatex(motd[len], sizeof motd-len, "
<td class=%s>%s", ((position%2) == 0) ? "c1" : "c2", pj);
 len += formatex(motd[len], sizeof motd-len, "
<td class=%s>%d", ((position%2) == 0) ? "c1" : "c2", gg_win);
 len += formatex(motd[len], sizeof motd-len, "
<td class=%s>%(HS: %d)", ((position%2) == 0) ? "c1" : "c2", frags, headshot);
 len += formatex(motd[len], sizeof motd-len, "
<td class=%s>%d", ((position%2) == 0) ? "c1" : "c2", death);
 }

 len += formatex(motd[len], sizeof motd-len, "
</div></body>");
 show_motd(index, motd, "
TOP 10 MEGA-GUNGAME");
}

public VoteMapGungame() {
 g_StateGungame = MG_STATE_VOTEMAP;

 new szTitle[150];
 formatex(szTitle, charsmax(szTitle), "
\y[AMXX] \wVotacion de mapa");
 new menu = menu_create(szTitle, "
HandlerVoteMap");

 if (g_iCountVoteMap) {
 
 for (new vMaps = 0; vMaps <MAX_MAPS_VOTE; vMaps++) {
 if (g_lMapsVote[vMaps][0]) {
 menu_additem(menu, g_lMapsVote[vMaps]);
 }
 }
 menu_setprop(menu, MPROP_NUMBER_COLOR, "
\r");
 menu_setprop(menu, MPROP_NEXTNAME, "
Siguiente");
 menu_setprop(menu, MPROP_BACKNAME, "
Anterior");
 menu_setprop(menu, MPROP_EXITNAME, "
Cerrar");
 for (new players = 1; players <= g_MaxPlayers; players++) {
 if (!IsPlayerValid(players))
 continue;

 menu_display(players, menu);
 } 
 }
 else {
 for (new players = 1; players <= g_MaxPlayers; players++) {
 if (!IsPlayerValid(players))
 continue;

 show_menu(players, 0, "
^n");
 } 

 if (task_exists(TASK_VOTEMAP))
 remove_task(TASK_VOTEMAP);
 }
 set_task(1.0, "
VoteMapGungame", TASK_VOTEMAP);
}

public HandlerVoteMap(index, menu, item) {
 if (item == MENU_EXIT) {
 menu_destroy(menu);
 return PLUGIN_HANDLED;
 }

 if (g_iPlayerVoteMap[index] == -1 && g_StateGungame == MG_STATE_VOTEMAP && g_iCountVoteMap) {
 g_iPlayerVoteMap[index] = item;
 client_print_color( 0, print_team_default, "
%^3%n^1 Voto por:^%s", gsTag, index, g_lMapsVote[g_iPlayerVoteMap[index]]);
 client_cmd( index, "
speak buttons/button9" );
 }

 menu_destroy(menu);
 return PLUGIN_HANDLED;
}

public EndVoteMap() {

 new MapsVotes[MAX_MAPS_VOTE];
 new BestMap = 0;

 for (new vMaps = 0; vMaps <MAX_MAPS_VOTE; vMaps++)
 {
 for (new Players = 1; Players <=g_MaxPlayers; Players++) {
 if(IsPlayerValid(Players)){
 if( g_iPlayerVoteMap[Players] == vMaps )
 MapsVotes[vMaps] += 1;
 }
 }

 if (MapsVotes[vMaps] >= MapsVotes[BestMap]) {
 BestMap = vMaps;
 }
 }

 client_print_color(0, print_team_default, "
%s Siguiente mapa:^%s", gsTag, g_lMapsVote[BestMap]);
 DisPlayMotd(g_PlayerBestMap);
 set_task(TIME_SVC_INTERMISSION, "
ChangeMap", BestMap + TASK_CHANGEMAP);
}

public ChangeMap(BestMap) {
 BestMap = TASK_ID(BestMap, TASK_CHANGEMAP);
 server_cmd("
changelevel ^"%s^"", g_lMapsVote[BestMap]);
}

public CurWeapon(index) {
 if (IsPlayerValid(index) && g_bPlayerSpeed[index]) {
 set_user_maxspeed(index, get_user_maxspeed(index) * EFFECT_SPEED_VELOCITY);
 }
}

public UpdateIcon(index) {
 if(is_user_alive(index) && g_StateGungame == MG_STATE_ONLINE)
 {
 new iwpn, sprite[192];
 remove_weapon_icon(index);

 iwpn = g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON];

 switch(iwpn) {
 case CSW_P228: sprite = "
d_p228";
 case CSW_SCOUT: sprite = "
d_scout";
 case CSW_HEGRENADE: sprite = "
d_grenade";
 case CSW_XM1014: sprite = "
d_xm1014";
 case CSW_C4: sprite = "
d_c4";
 case CSW_MAC10: sprite = "
d_mac10";
 case CSW_AUG: sprite = "
d_aug";
 case CSW_SMOKEGRENADE: sprite = "
d_grenade";
 case CSW_ELITE: sprite = "
d_elite";
 case CSW_FIVESEVEN: sprite = "
d_fiveseven";
 case CSW_UMP45: sprite = "
d_ump45";
 case CSW_SG550: sprite = "
d_sg550";
 case CSW_GALIL: sprite = "
d_galil";
 case CSW_FAMAS: sprite = "
d_famas";
 case CSW_USP: sprite = "
d_usp";
 case CSW_MP5NAVY: sprite = "
d_mp5navy";
 case CSW_M249: sprite = "
d_m249";
 case CSW_M3: sprite = "
d_m3";
 case CSW_M4A1: sprite = "
d_m4a1";
 case CSW_TMP: sprite = "
d_tmp";
 case CSW_G3SG1: sprite = "
d_g3sg1";
 case CSW_FLASHBANG: sprite = "
d_flashbang";
 case CSW_DEAGLE: sprite = "
d_deagle";
 case CSW_SG552: sprite = "
d_sg552";
 case CSW_AK47: sprite = "
d_ak47";
 case CSW_KNIFE: sprite = "
d_knife";
 case CSW_P90: sprite = "
d_p90";
 case CSW_VEST: sprite = "
suit_full";
 case CSW_VESTHELM: sprite = "
suithelmet_full";
 case CSW_GLOCK18: sprite = "
d_glock18";
 case CSW_AWP: sprite = "
d_awp";
 case 0: sprite = "";
 default: sprite = "";
 }

 if (is_user_connected(index) && !is_user_bot(index) && is_user_alive(index)) {
 if (equali(sprite, "")) {
 remove_weapon_icon(index);
 } 
 else {
 new IconOrigin[3] = {0, 0, 0};
 message_begin(MSG_ONE, g_MsgStatusIcon, IconOrigin, index);
 write_byte(1);
 write_string(sprite);
 write_byte(30); // red
 write_byte(255); // green
 write_byte(30); // blue
 message_end();
 }
 g_PlayerIcon[index] = sprite;
 }
 }
 return PLUGIN_CONTINUE;



stock ResetUserMaxSpeed( iPlayerID ) {
    // credits to connor?
    new Float:fMaxSpeed;
    
    switch( get_user_weapon( iPlayerID ) )
    {
    case CSW_SG550, CSW_AWP, CSW_G3SG1 :                fMaxSpeed = 210.0;
    case CSW_M249 :                                    fMaxSpeed = 220.0;
    case CSW_AK47 :                                    fMaxSpeed = 221.0;
    case CSW_M3, CSW_M4A1 :                            fMaxSpeed = 230.0;
    case CSW_SG552 :                                    fMaxSpeed = 235.0;
    case CSW_XM1014, CSW_AUG, CSW_GALIL, CSW_FAMAS :    fMaxSpeed = 240.0;
    case CSW_P90 :                                      fMaxSpeed = 245.0;
    case CSW_SCOUT :                                    fMaxSpeed = 260.0;
    default :                                            fMaxSpeed = 250.0;
    }
    
    set_user_maxspeed( iPlayerID, fMaxSpeed );
}

stock IsPlayerValid(index) {
 if (!is_user_connected(index))
 return false;
 if (is_user_hltv(index))
 return false;
 if (is_user_bot(index))
 return false;
 
 return true;
}
stock PlayerKills(killer, victim) {
 SetPlayerKills(killer);
 ResetPlayerKills(victim); 
}

stock SetPlayerKills(attack) {

 g_iPlayerKills[attack]++;

 if (g_iPlayerKills[attack] >= 3) {
 set_hudmessage(random_num(50, 255), random_num(50, 255), random_num(50, 255), 0.1, 0.70, 0, 6.0, 3.5);
 ShowSyncHudMsg(0, g_Sync[2], "
[AMXX] %n Hizo racha de %d kills", attack, g_iPlayerKills[attack]);
 }

 if (g_iPlayerKills[attack] >= get_pcvar_num(g_pCvars[MG_SUPER_RACHA_KILLS])) {

 if(attack == g_PlayerSuperKnife)
 return;

 set_task(1.0, "
SetPlayerEfect", attack, _, _, "a", .repeat = 3);
 SetSuperKnife(attack);
 }
}

stock ResetPlayerKills(victim) {
 g_iPlayerKills[victim] = 0;

 if (g_PlayerSuperKnife == victim) {
 g_PlayerSuperKnife = EOS;
 }
}

stock SetSuperKnifeEffect(attack, victim) {
 SetFadeRed(attack);
 set_hudmessage(255, 0, 0, -1.0, 0.30, 0, 1.0, 3.5);
 ShowSyncHudMsg(0, g_Sync[3], "
\
 <------------------[
PELIGRO]------------------>^n\
 %
n FUE VICTIMA DE %n^n\
 
CON EL SUPER CUCHILLO^n\
 <------------------[
PELIGRO]------------------>", victim, attack);

 g_iPlayerLevel[victim] = 0;
 g_iPlayerPoint[victim] = 0;
 g_PlayerSuperKnife = 0;
 client_print_color(victim, print_team_default, "
%s Fuiste victima de^%n^1 con ^3Super Knife^1 tu nivel fue reseteado", gsTag, attack);


public SetPlayerEfect(attack) {

 if(g_StateGungame != MG_STATE_ONLINE)
 return;

 for (new players = 0; players <= g_MaxPlayers; players++) {
 if (!IsPlayerValid(players))
 continue;
 if (!(1 <= get_user_team(players) <= 2))
 continue;
 SetFadeRed(players);
 }

 client_cmd(0, "
spk %s", snd_alert);
 set_hudmessage(255, 0, 0, -1.0, 0.30, 0, 1.0, 3.5);
 ShowSyncHudMsg(0, g_Sync[4], "
\
 <------------------[
PELIGRO]------------------>^n\
 %
n^n TIENE EL SUPER CUCHILLO^n\
 <------------------[
PELIGRO]------------------>", attack);
}

stock SetSuperKnife(attack) {
 g_PlayerSuperKnife = attack;
}

stock SetFadeRed(index) {
 message_begin(MSG_ONE, g_MsgScreenFade, {0,0,0}, index);
 write_short(1<<10);
 write_short(1<<10);
 write_short(0x0000);
 write_byte(255);
 write_byte(0);
 write_byte(0);
 write_byte(80);
 message_end();
}

stock RoboPlayerLevel(Ladron, victim) {
 if (g_iPlayerLevel[Ladron] < sizeof g_szLevels - 2 && g_iPlayerLevel[victim] > 0) {
 g_iPlayerLevel[Ladron]++;
 g_iPlayerLevel[victim]--;
 g_iPlayerPoint[Ladron] = g_szLevels[g_iPlayerLevel[Ladron] - 1][POINTS];
 g_iPlayerPoint[victim] = g_szLevels[g_iPlayerLevel[victim] - 1][POINTS];

 client_print_color(0, print_team_default, "
%s El jugador: ^4%n^1. Le robo^3 1^1 nivel a:^%n^1 por acuchillarlo", gsTag, Ladron, victim);
 }
}

stock GetPlayersTop(PlayersTop[MAX_PLAYERS_TOP_HUD]) {
 new bool:Client_Invalid = false;

 for (new t = 0; t <sizeof(PlayersTop); t++) {
 for (new Player = 1; Player <= g_MaxPlayers; Player++)
 {
 if (!IsPlayerValid(Player))
 continue;
 if (!(1 <= get_user_team(Player) <= 2))
 continue;

 for (new iTop = 0; iTop <sizeof(PlayersTop); iTop++) {
 if(Player == PlayersTop[iTop]) {
 Client_Invalid = true;
 break;
 }
 else {
 Client_Invalid = false;
 }
 }

 if (Client_Invalid)
 continue;

 if (GetPlayerPoints(Player) >= GetPlayerPoints(PlayersTop[t])) {
 PlayersTop[t] = Player;
 }
 }
 }
}

stock SetPlayerPoints(Player, Points) {
 g_iPlayerPoint[Player] = Points;

 if (g_iPlayerPoint[Player] < 0) {
 g_iPlayerPoint[Player] = 0;
 }

 new bool:bAument = false;

 if (Points) {
 while (g_iPlayerPoint[Player] >= g_szLevels[g_iPlayerLevel[Player]][POINTS]) {

 if (g_iPlayerLevel[Player] >= sizeof g_szLevels - 1) {
 EndMegaGungame(Player);
 return;
 }

 g_iPlayerLevel[Player]++;
 bAument = true; 
 } 

 SetHudPoints(Player);
 }
 else {
 if (g_iPlayerLevel[Player] > 1) {

 g_iPlayerLevel[Player]--;
 g_iPlayerPoint[Player] = g_szLevels[g_iPlayerLevel[Player] - 1][POINTS]
 client_print_color(Player, print_team_default, "
%s Desendiste al nivel ^4(%d/%d)^1Equipamiento:^%s", gsTag, g_iPlayerLevel[Player], sizeof g_szLevels - 1, g_szLevels[g_iPlayerLevel[Player]][WPN_REALNAME]);
 } 
 }
 if(bAument) {
 client_print_color(Player, print_team_default, "
%s Aumentaste de nivel ^4(%d/%d)^1Equipamiento:^%s", gsTag, g_iPlayerLevel[Player], sizeof g_szLevels - 1, g_szLevels[g_iPlayerLevel[Player]][WPN_REALNAME]);
 client_cmd(Player, "
spk %s", snd_lvlup);
 }
}

stock SetHudPoints(player) {
 if(!(g_szLevels[g_iPlayerLevel[player]][POINTS] - g_iPlayerPoint[player]))
 return;

 set_hudmessage(255, 255, 255, -1.0, 0.60, 1, 1.0, 6.0);
 ShowSyncHudMsg(player, g_Sync[5], "
Puntos: %d/%]^nTe faltan %i para subir de nivel", 
 g_iPlayerPoint[player], g_szLevels[g_iPlayerLevel[player]][POINTS], g_szLevels[g_iPlayerLevel[player]][POINTS] - g_iPlayerPoint[player]);
}

stock GetPlayerPoints(Player) {
 return g_iPlayerPoint[Player];
}

stock GetPlayersNum() {
 new iCount = 0;

 for (new Players = 1; Players <= g_MaxPlayers; Players++)
 {
 if (!IsPlayerValid(Players))
 continue;
 if (!(1 <= get_user_team(Players) <= 2))
 continue;
 iCount++;
 }
 return iCount; 
}

stock SetPlayerFake(index) {
 if (get_user_team(index) == 1)
 cs_set_user_model(index, "
gign");
 else if (get_user_team(index) == 2)
 cs_set_user_model(index, "
leet");
}

ServerGungame() {
 set_cvar_string("
mp_freezetime", "0");
 set_cvar_string("
mp_autoteambalance", "0");
 set_cvar_string("
mp_auto_join_team", "1");
 set_cvar_string("
mp_refill_bpammo_weapons", "3");
 set_cvar_string("
mp_forcerespawn", "3");
 set_cvar_string("
mp_roundrespawn_time", "3");
 set_cvar_string("
mp_round_infinite", "1");
 set_cvar_string("
mp_respawn_immunitytime", "5");
 set_cvar_string("
mp_infinite_ammo", "2");
 set_cvar_string("
mp_roundtime", "80");

 if( g_ModeGungame == 0)
 set_cvar_string("
mp_freeforall", "1");

 set_cvar_string("
sv_restart", "1");
}

stock remove_weapon_icon(index) {
 if (is_user_connected(index) && !is_user_bot(index) && is_user_alive(index)) {
 new IconOrigin[3] = {0, 0, 0};
 message_begin(MSG_ONE, g_MsgStatusIcon, IconOrigin, index);
 write_byte(0);
 write_string(g_PlayerIcon[index]);
 message_end();
 }
}

stock LoadMaps() {
 new mapname[32];
 get_mapname(mapname, 31);

 new configsdir[128];
 get_localinfo("
amxx_configsdir", configsdir, charsmax(configsdir));
 add(configsdir, charsmax(configsdir), "
/maps.ini");
 
 new fh;
 fh = fopen(configsdir, "
r");

 if (!fh)
 {
 server_print("
[AMXX-Mega Gungame 1.0bNo se pudo abrir el archivo de mapasLeyendo el directorio de mapas");
 LoadMaps();
 return;
 }

 new Line[32];
 static Count = 0;

 while (!feof(fh))
 {
 fgets(fh, Line, charsmax(Line));
 replace(Line, charsmax(Line), "
.bsp", "");
 trim(Line);

 if (!Line[0] || Line[0] == ';' || (Line[0] == '/' && Line[1] == '/') || Line[0] == '#' || !is_map_valid(Line) || equal(mapname, Line)) {
 continue;
 }

 format(g_lMaps[Count], charsmax(g_lMaps[]), Line);
 Count++;
 }

 fclose(fh); 
}

stock LoadMapsVote() {
 for (new Maps = 0; Maps <MAX_MAPS_VOTE; Maps++) {
 if (!g_lMapsVote[Maps][0]) {
 formatex(g_lMapsVote[Maps], charsmax(g_lMapsVote[]), g_lMaps[GetRandomMap()]);
 }
 }
}

stock GetRandomMap()
{
 new iMapas[MAX_MAPS];
 new count = 0;

 for(new maps = 0; maps <MAX_MAPS; maps++)
 {
 if (!g_lMaps[maps][0]) 
 continue;

 
 iMapas[count] = maps;
 count++;
 }

 new number_random = random_num(0, count);

 new bMapExist = false;
 for (new vMaps = 0; vMaps <MAX_MAPS_VOTE; vMaps++)
 { 
 if (!g_lMapsVote[vMaps][0])
 continue;
 
 if (equal(g_lMaps[iMapas[number_random]], g_lMapsVote[vMaps])) {
 bMapExist = true;
 break;
 }
 } 

 if(bMapExist) { 
 return GetRandomMap();
 }

 return iMapas[number_random];
}

stock adv_vault(const index, const TYPE_SAVE) {

 new name[32];
 get_user_name(index, name, charsmax(name));

 switch(TYPE_SAVE) {
 case SD_PLAYER_SAVEDATA: {
 if (is_user_connected(index)) {
 adv_vault_set_start(g_VaultSaveData);

 for (new i = 0; i <sizeof g_sFrags; i++) 
 adv_vault_set_field(g_VaultSaveData, g_sFrags[i], g_sPlayerFrags[index][i]); 

 for (new i = 0; i <sizeof g_sGungameState; i++) 
 adv_vault_set_field(g_VaultSaveData, g_sGungameState[i], g_sPlayerGungameState[index][i]);         
 adv_vault_set_end(g_VaultSaveData, 0, name);
 }
 }
 case SD_PLAYER_LOADDATA: {
 if (is_user_connected(index) && (adv_vault_get_prepare(g_VaultSaveData, _, name))) {
 for (new i = 0; i <sizeof g_sFrags; i++) 
 g_sPlayerFrags[index][i] = adv_vault_get_field(g_VaultSaveData, g_sFrags[i]);    
 for (new i = 0; i <sizeof g_sGungameState; i++) 
 g_sPlayerGungameState[index][i] = adv_vault_get_field(g_VaultSaveData, g_sGungameState[i]);    
 }
 }
 case SD_INIT: {
 g_VaultSaveData = adv_vault_open(db_savedata, false);
 for (new i = 0; i <sizeof g_sFrags; i++) {
 g_sFrags[i] = adv_vault_register_field(g_VaultSaveData, fmt("
TYPE-FRAG-%d", i + 1));
 }
 for (new i = 0; i <sizeof g_sGungameState; i++) {
 g_sGungameState[i] = adv_vault_register_field(g_VaultSaveData, fmt("
TYPE-GGSTATE-%d", i + 1));
 }
 adv_vault_init(g_VaultSaveData);
 g_VaultSort = adv_vault_sort_create(g_VaultSaveData, ORDER_DESC, 0, 2000, g_sGungameState[PLAYER_STATE_WIN]);

 }
 }



Archivos adjuntos
.sma   Descargar AMXX / AMXX-MegaGungame1-1.sma (Tamaño: 56.5 KB / Descargas: 226)
Responder
#2
Que buen aporte. Excelente como siempre Mario
"Cada golpe es una lección, y cada lección te hace mejor."

[Imagen: b_350_20_000000_8a7300_ffffff_eeff00.png]
[Imagen: 76561198371193937.png]
Responder
#3
Buen aporte! Mario
Corazón I dream of someday being able to have your near. Corazón
[Imagen: 76561199006140497.png]
Responder
#4
(29/06/2020, 09:03 PM)rojedafeik escribió: Que buen aporte. Excelente como siempre  Mario

(29/06/2020, 10:03 PM)andres_1041 escribió: Buen aporte! Mario

Graciass! Corazón
Responder
#5
epico
Responder
#6
Buen aporte. Alguna mejora que te dejo para que hagas:

Todo esto se puede optimizar y simplificar con un simple for. Buscate en el foro algunas tiendas por puntos o tiendas por dinero o algun metodo, para que te guies por ahí.
Código PHP:
public ShowMenuExtraItems(index) {

 if (!
is_user_alive(index) || g_StateGungame != MG_STATE_ONLINE)
 return 
PLUGIN_HANDLED;

 static 
menu;
 
menu menu_create("\wAMXX - \yExtra items: \r5""HandExtraItems");

 if (
cs_get_user_money(index) >= GRANADE_MONEY && g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] != CSW_HEGRENADE)
 
menu_additem(menufmt("- \wGranada \rHE\w                    -    \y($%d)"GRANADE_MONEY ));
 else 
 
menu_additem(menufmt("\d- Granada HE                    -    \r($%d)"GRANADE_MONEY ));

 if (
cs_get_user_money(index) >= EFFECT_SPEED_MONEY)
 
menu_additem(menufmt("- \wSpeed \r(%i Segundos)\w      -    \y($%i)"EFFECT_SPEED_TIMEEFFECT_SPEED_MONEY));
 else 
 
menu_additem(menufmt("\d- Speed (%i Segundos)      -    \r($%i)"EFFECT_SPEED_TIMEEFFECT_SPEED_MONEY));

 if (
cs_get_user_money(index) >= EFFECT_REGENERATE_MONEY)
 
menu_additem(menufmt("- \wRegeneracion de HP        -    \y($%i)"EFFECT_REGENERATE_MONEY));
 else 
 
menu_additem(menufmt("\d- Regeneracion de HP        -    \r($%i)"EFFECT_REGENERATE_MONEY));

 if (
cs_get_user_money(index) >= TRAJE_FAKE_MONEY)
 
menu_additem(menufmt("- \wTraje Falso                      -    \y($%i)"TRAJE_FAKE_MONEY));
 else 
 
menu_additem(menufmt("\d- Traje Falso                      -    \r($%i)"TRAJE_FAKE_MONEY));

 if (
cs_get_user_money(index) >= EFFECT_LIFE_MONEY)
 
menu_additem(menufmt("- \wObtener \r(+%i)\w de vida    -    \y($%i)"EFFECT_LIFE_HPEFFECT_LIFE_MONEY));
 else 
 
menu_additem(menufmt("\d- Obtener (+%i) de vida  -    \r($%i)"EFFECT_LIFE_HPEFFECT_LIFE_MONEY));

 
menu_setprop(menuMPROP_NUMBER_COLOR"\r");
 
menu_setprop(menuMPROP_NEXTNAME"Siguiente");
 
menu_setprop(menuMPROP_BACKNAME"Anterior");
 
menu_setprop(menuMPROP_EXITNAME"Cerrar");
 
menu_display(indexmenu);
 return 
PLUGIN_HANDLED;
}
public 
HandExtraItems(indexmenuitem) {
 if (
item == MENU_EXIT || !is_user_alive(index)) {
 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;
 }

 switch(
item) {
 case 
0: {
 if(
g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] == CSW_HEGRENADE) {
 
client_print_color(indexprint_team_default"%s No puedes comprar granada en el nivel ^4HE"gsTag);
 return 
PLUGIN_HANDLED
 }
 if (
cs_get_user_money(index) < GRANADE_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagGRANADE_MONEY cs_get_user_money(index));
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - GRANADE_MONEY);

 
give_item(index"weapon_hegrenade");
 
client_print_color(indexprint_team_default"%s Compraste: ^4Granada HE"gsTag); 
 }
 }
 case 
1: {
 if (
cs_get_user_money(index) < EFFECT_SPEED_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagEFFECT_SPEED_MONEY cs_get_user_money(index));
 }
 else if (
g_bPlayerSpeed[index]) {
 
client_print_color(indexprint_team_default"%s Ya tienes en uso el: ^4Speed"gsTag); 
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - EFFECT_SPEED_MONEY);
 
set_user_maxspeed(indexget_user_maxspeed(index) * EFFECT_SPEED_VELOCITY);
 
g_bPlayerSpeed[index] = true;
 
set_task(float(EFFECT_SPEED_TIME), "EndEffectSpeed"index TASK_PLAYER_SPEED);
 
client_print_color(indexprint_team_default"%s Compraste: ^4%d Seg De Speed"gsTagEFFECT_SPEED_TIME); 
 }
 }
 case 
2: {
 if (
cs_get_user_money(index) < EFFECT_REGENERATE_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagEFFECT_REGENERATE_MONEY cs_get_user_money(index));
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - EFFECT_REGENERATE_MONEY);
 
set_task(0.5"RegenerateHP"index TASK_PLAYER_REGENERATE__"a"EFFECT_REGENERATE_TIME);
 
client_print_color(indexprint_team_default"%s Compraste: ^4Regeneracion De HP"gsTag); 
 }
 }
 case 
3: {
 if (
cs_get_user_money(index) < TRAJE_FAKE_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagTRAJE_FAKE_MONEY cs_get_user_money(index));
 }
 else if (
g_bPlayerFake[index]) {
 
client_print_color(indexprint_team_default"%s Ya tienes en uso el: ^4Traje falso"gsTag); 
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - TRAJE_FAKE_MONEY);
 
g_bPlayerFake[index] = true;
 
SetPlayerFake(index);
 
client_print_color(indexprint_team_default"%s Compraste: ^4Traje falso"gsTag); 
 }
 }
 case 
4: {
 if (
cs_get_user_money(index) < EFFECT_LIFE_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagEFFECT_LIFE_MONEY cs_get_user_money(index));
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - EFFECT_LIFE_MONEY);
 
set_user_health(indexget_user_health(index) + EFFECT_LIFE_HP);
 
client_print_color(indexprint_team_default"%s Compraste: ^4(+%i)^1 de ^3HP"gsTagEFFECT_LIFE_HP); 
 }
 }
 }

 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;

Responder
#7
(30/06/2020, 07:56 PM)Niper.-. escribió: Buen aporte. Alguna mejora que te dejo para que hagas:

Todo esto se puede optimizar y simplificar con un simple for.  Buscate en el foro algunas tiendas por puntos o tiendas por dinero o algun metodo, para que te guies por ahí.
Código PHP:
public ShowMenuExtraItems(index) {

 if (!
is_user_alive(index) || g_StateGungame != MG_STATE_ONLINE)
 return 
PLUGIN_HANDLED;

 static 
menu;
 
menu menu_create("\wAMXX - \yExtra items: \r5""HandExtraItems");

 if (
cs_get_user_money(index) >= GRANADE_MONEY && g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] != CSW_HEGRENADE)
 
menu_additem(menufmt("- \wGranada \rHE\w                    -    \y($%d)"GRANADE_MONEY ));
 else 
 
menu_additem(menufmt("\d- Granada HE                    -    \r($%d)"GRANADE_MONEY ));

 if (
cs_get_user_money(index) >= EFFECT_SPEED_MONEY)
 
menu_additem(menufmt("- \wSpeed \r(%i Segundos)\w      -    \y($%i)"EFFECT_SPEED_TIMEEFFECT_SPEED_MONEY));
 else 
 
menu_additem(menufmt("\d- Speed (%i Segundos)      -    \r($%i)"EFFECT_SPEED_TIMEEFFECT_SPEED_MONEY));

 if (
cs_get_user_money(index) >= EFFECT_REGENERATE_MONEY)
 
menu_additem(menufmt("- \wRegeneracion de HP        -    \y($%i)"EFFECT_REGENERATE_MONEY));
 else 
 
menu_additem(menufmt("\d- Regeneracion de HP        -    \r($%i)"EFFECT_REGENERATE_MONEY));

 if (
cs_get_user_money(index) >= TRAJE_FAKE_MONEY)
 
menu_additem(menufmt("- \wTraje Falso                      -    \y($%i)"TRAJE_FAKE_MONEY));
 else 
 
menu_additem(menufmt("\d- Traje Falso                      -    \r($%i)"TRAJE_FAKE_MONEY));

 if (
cs_get_user_money(index) >= EFFECT_LIFE_MONEY)
 
menu_additem(menufmt("- \wObtener \r(+%i)\w de vida    -    \y($%i)"EFFECT_LIFE_HPEFFECT_LIFE_MONEY));
 else 
 
menu_additem(menufmt("\d- Obtener (+%i) de vida  -    \r($%i)"EFFECT_LIFE_HPEFFECT_LIFE_MONEY));

 
menu_setprop(menuMPROP_NUMBER_COLOR"\r");
 
menu_setprop(menuMPROP_NEXTNAME"Siguiente");
 
menu_setprop(menuMPROP_BACKNAME"Anterior");
 
menu_setprop(menuMPROP_EXITNAME"Cerrar");
 
menu_display(indexmenu);
 return 
PLUGIN_HANDLED;
}
public 
HandExtraItems(indexmenuitem) {
 if (
item == MENU_EXIT || !is_user_alive(index)) {
 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;
 }

 switch(
item) {
 case 
0: {
 if(
g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] == CSW_HEGRENADE) {
 
client_print_color(indexprint_team_default"%s No puedes comprar granada en el nivel ^4HE"gsTag);
 return 
PLUGIN_HANDLED
 }
 if (
cs_get_user_money(index) < GRANADE_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagGRANADE_MONEY cs_get_user_money(index));
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - GRANADE_MONEY);

 
give_item(index"weapon_hegrenade");
 
client_print_color(indexprint_team_default"%s Compraste: ^4Granada HE"gsTag); 
 }
 }
 case 
1: {
 if (
cs_get_user_money(index) < EFFECT_SPEED_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagEFFECT_SPEED_MONEY cs_get_user_money(index));
 }
 else if (
g_bPlayerSpeed[index]) {
 
client_print_color(indexprint_team_default"%s Ya tienes en uso el: ^4Speed"gsTag); 
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - EFFECT_SPEED_MONEY);
 
set_user_maxspeed(indexget_user_maxspeed(index) * EFFECT_SPEED_VELOCITY);
 
g_bPlayerSpeed[index] = true;
 
set_task(float(EFFECT_SPEED_TIME), "EndEffectSpeed"index TASK_PLAYER_SPEED);
 
client_print_color(indexprint_team_default"%s Compraste: ^4%d Seg De Speed"gsTagEFFECT_SPEED_TIME); 
 }
 }
 case 
2: {
 if (
cs_get_user_money(index) < EFFECT_REGENERATE_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagEFFECT_REGENERATE_MONEY cs_get_user_money(index));
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - EFFECT_REGENERATE_MONEY);
 
set_task(0.5"RegenerateHP"index TASK_PLAYER_REGENERATE__"a"EFFECT_REGENERATE_TIME);
 
client_print_color(indexprint_team_default"%s Compraste: ^4Regeneracion De HP"gsTag); 
 }
 }
 case 
3: {
 if (
cs_get_user_money(index) < TRAJE_FAKE_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagTRAJE_FAKE_MONEY cs_get_user_money(index));
 }
 else if (
g_bPlayerFake[index]) {
 
client_print_color(indexprint_team_default"%s Ya tienes en uso el: ^4Traje falso"gsTag); 
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - TRAJE_FAKE_MONEY);
 
g_bPlayerFake[index] = true;
 
SetPlayerFake(index);
 
client_print_color(indexprint_team_default"%s Compraste: ^4Traje falso"gsTag); 
 }
 }
 case 
4: {
 if (
cs_get_user_money(index) < EFFECT_LIFE_MONEY) { 
 
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagEFFECT_LIFE_MONEY cs_get_user_money(index));
 }
 else {
 
cs_set_user_money(indexcs_get_user_money(index) - EFFECT_LIFE_MONEY);
 
set_user_health(indexget_user_health(index) + EFFECT_LIFE_HP);
 
client_print_color(indexprint_team_default"%s Compraste: ^4(+%i)^1 de ^3HP"gsTagEFFECT_LIFE_HP); 
 }
 }
 }

 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;


Gracias, Se de que hablas, no use for por que uso varias formas de uso en la tienda algunas por tiempo y distintos valores que no creo que con un for hubiese quedado, pero si puedo optimizarlo lo haré en la siguiente version!
Responder
#8
Bastante bueno, podrías subir devuelta el código tabulado ya que me da una pereza descargar el adjunto o tabularlo xd.

pd: te robare el diseño del top xdd.
Responder
#9
(30/06/2020, 09:58 PM)Kross escribió: Bastante bueno, podrías subir devuelta el código tabulado ya que me da una pereza descargar el adjunto o tabularlo xd.

pd: te robare el diseño del top xdd.

El adjunto está bien tabulado... descargalo y dejate de embromar.

Buen aporte ale. Mario

pd: después veo el código y por ahí te comento algo e.e
Responder
#10
(30/06/2020, 10:05 PM)Chema escribió: El adjunto está bien tabulado... descargalo y dejate de embromar.

Lo que pasa que ando en celular y me gustaría ojearlo desde el móvil.
Responder
#11
(30/06/2020, 10:10 PM)Kross escribió: Lo que pasa que ando en celular y me gustaría ojearlo desde el móvil.

Whatdone

Código PHP:
/* 
    Changelog:
        AMXX - Mega Gungame b1.0:
        * 1-. Version de lanzamiento.

        Requiere: 
        * 1-. AMXMOD 1.8.3 >
        * 2-. adv_vault (Guardado)
        * 3-. RegameDLL
*/

#define TASK_ID(%1,%2) (%1 - %2)

/*----------- [ M O T D ] ----------- */

#define TEAM_BLUE_IMG                 "http://img.fenixzone.net/i/YU3nq2v.jpeg"
#define TEAM_RED_IMG                 "http://img.fenixzone.net/i/lfAyT3u.jpeg"
#define BLUE_COLOR                     "#11D9E1"
#define RED_COLOR                     "#E11111"

/*----------- [ M A P S - V O T E ] ----------- */

#define MAX_MAPS                     100
#define MAX_MAPS_VOTE                 5
#define MAX_PLAYERS_TOP_MOTD         5
#define MAX_PLAYERS_TOP_HUD         3
#define TIME_VOTEMAP                 15
#define TIME_SVC_INTERMISSION         10.0

/*----------- [ P U B L I C I D A D ] ----------- */

#define TIME_PUBLICITY                 150    

/*----------- [ G R A N A D E - E F E C C T ] ----------- */

#define GRANADE_MONEY                 3000

/*----------- [ F A K E - T R A J E ] ----------- */
#define TRAJE_FAKE_MONEY             6000

/*----------- [ L I F E - E F F E C T ] ----------- */
#define EFFECT_LIFE_MONEY             7000
#define EFFECT_LIFE_HP                 150

/*----------- [ R E G E N E R A T E ] ----------- */
#define EFFECT_REGENERATE_MONEY     5500
#define EFFECT_REGENERATE_MAX_HP     150 
#define EFFECT_REGENERATE_SEG         1
#define EFFECT_REGENERATE_TIME         40

/*----------- [ S P E E D - E F F E C T ] ----------- */
#define EFFECT_SPEED_TIME             20
#define EFFECT_SPEED_MONEY             10000
#define EFFECT_SPEED_VELOCITY         3.0

/*----------- [ I N C L U D E S ] ----------- */
#include <amxmodx>
#include <amxmisc>
#include <adv_vault>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <csx>

/*----------- [ E N U M E R A D O R E S ] ----------- */
enum _:DATA_TYPE_SAVE {
    
SD_PLAYER_SAVEDATA,
    
SD_PLAYER_LOADDATA,
    
SD_INIT
}

enum _:DATA_TYPE_STATEGG {
    
PLAYER_STATE_WIN,
    
PLAYER_STATE_LOSE
}

enum _:DATA_TYPE_KILLS {
    
TYPE_DEATH,
    
TYPE_FRAG,
    
TYPE_KNIFE,
    
TYPE_HEADSHOT
}

enum _:DATA_KILLS_POINT {
    
PLAYER_KILL,
    
PLAYER_HEADSHOT,
    
PLAYER_KNIFE,
    
PLAYER_AUTOKILL
}

enum _:DATA_MONEY_POINT {
    
MONEY_KILL 500,
    
MONEY_HEADSHOT 700,
    
MONEY_KNIFE 600
}

enum _:DATA_STATE {
    
MG_STATE_OFFLINE,
    
MG_STATE_CALENTVOTE,
    
MG_STATE_ONLINE,
    
MG_STATE_VOTEMAP,
    
MG_STATE_BESTPLAYER
}

enum _:DATA_TASKS ( += 115 ) {
    
TASK_HUD,
    
TASK_LEVEL,
    
TASK_CALENTVOTE,
    
TASK_BESTPLAYER,
    
TASK_VOTEMAP,
    
TASK_ENDVOTEMAP,
    
TASK_CHANGEMAP,
    
TASK_INIGUNGAME,
    
TASK_ENDVOTEGUNGAME,
    
TASK_PLAYER_PRE_EQUIP,
    
TASK_PLAYER_VOTEGUNGAME,
    
TASK_PLAYER_HE,
    
TASK_PLAYER_EQUIP,
    
TASK_PLAYER_RESPAWN,
    
TASK_PLAYER_SPEED,
    
TASK_PLAYER_REGENERATE
}

enum _:DATA_PCVARS {
    
MG_MIN_PLAYERS,
    
MG_SUPER_RACHA_KILLS,
    
MG_TIME_HE,
    
MG_CALENT_TIME
}

enum _:DATA_LEVELS
{
    
WPN_NAME[33],
    
CSW_WEAPON,
    
WPN_REALNAME[30],
    
POINTS
};

/*----------- [ A R R A Y S ] ----------- */
new g_szLevels[][DATA_LEVELS] =
{
    
// wpn_name         CSW_WEAPON         wpn_realname    puntos
    
{"weapon_glock18",     CSW_GLOCK18,    "Glock18",        2        },
    {
"weapon_usp",         CSW_USP,        "Usp",            4        },
    {
"weapon_deagle",     CSW_DEAGLE,        "Deagle",        6        },
    {
"weapon_fiveseven",CSW_FIVESEVEN,     "Fiveseven",    8        },
    {
"weapon_m3",         CSW_M3,            "M3",            10        },
    {
"weapon_xm1014",     CSW_XM1014,        "XM1014",        14         },
    {
"weapon_mp5navy",     CSW_MP5NAVY,    "MP5Navy",        18        },
    {
"weapon_p90",         CSW_P90,        "P90",            22        },
    {
"weapon_mac10",     CSW_MAC10,        "MAC10",        26        },
    {
"weapon_ump45",     CSW_UMP45,        "UMP45",        30        },
    {
"weapon_famas",     CSW_FAMAS,        "Famas",        34        },
    {
"weapon_galil",     CSW_GALIL,        "Galil",        38        },
    {
"weapon_sg552",     CSW_SG552,        "SG552",         42         },
    {
"weapon_ak47",     CSW_AK47,        "Ak47",            45        },
    {
"weapon_m4a1",     CSW_M4A1,        "M4A1",            50        },
    {
"weapon_aug",         CSW_AUG,        "Aug",            55        },
    {
"weapon_scout",     CSW_SCOUT,        "Scout",        58         },
    {
"weapon_awp",         CSW_AWP,        "Awp",            60        },
    {
"weapon_g3sg1",     CSW_G3SG1,        "G3SG1",        67        },
    {
"weapon_m249",     CSW_M249,        "M249",            70        },
    {
"weapon_hegrenade",CSW_HEGRENADE,    "Granada",        72        },
    {
"weapon_knife",    CSW_KNIFE,        "Cuchillo",     74        }
};

new 
g_iModes[][] = {
    
//     kill          Headshot     Knife          Autokill
    
{    1,            1,            1,            -1        },  //Sin equipos 
    
{    2,             2,             2,             -2        },  //Modo rapido 
    
{    1,            1,            1,            -1        },    //Modo Lento
    
{    1,            1,            1,            -1        },    //Modo 35 HP 
    
{    2,             2,             2,             -2        }      //Modo Only Headshot 
};
    
/*----------- [ V A R I A B L E S ] ----------- */
new g_MaxPlayers;
new 
g_StateGungame;
new 
g_MsgScoreInfo;
new 
g_MsgStatusIcon;
new 
g_MsgHideWeapon;
new 
g_MsgScreenFade;

new 
g_iCountPublicity;
new 
g_iCountVoteMap;
new 
g_iCountCalent;
new 
g_PlayerSuperKnife;
new 
g_PlayerBestMap;
new 
g_VaultSaveData;
new 
g_VaultSort;
new 
g_ModeGungame;
new 
g_bVoteOn false;

new 
g_iPlayerPoint[MAX_PLAYERS+1];
new 
g_iPlayerLevel[MAX_PLAYERS+1];
new 
g_iPlayerKills[MAX_PLAYERS+1];
new 
g_iPlayerCount[MAX_PLAYERS+1];
new 
g_sPlayerFrags[MAX_PLAYERS+1][DATA_TYPE_KILLS];
new 
g_oPlayerFrags[MAX_PLAYERS+1][DATA_TYPE_KILLS];
new 
g_sPlayerGungameState[MAX_PLAYERS+1][DATA_TYPE_STATEGG];
new 
g_iPlayerHeCount[MAX_PLAYERS+1];
new 
g_iPlayerRegenerate[MAX_PLAYERS+1];
new 
g_iPlayerVoteMap[MAX_PLAYERS+1];
new 
g_iPlayerVoteGungame[MAX_PLAYERS+1];

new 
bool:g_bPlayerSpeed[MAX_PLAYERS+1];
new 
bool:g_bPlayerFake[MAX_PLAYERS+1];

new 
g_pCvars[DATA_PCVARS];
new 
g_lMaps[MAX_MAPS][32];
new 
g_sFrags[DATA_TYPE_KILLS];
new 
g_sGungameState[DATA_TYPE_STATEGG];
new 
g_Sync[7];
new 
g_lMapsVote[MAX_MAPS_VOTE][32];
new 
g_PlayerIcon[32][192];

new 
gsTag[]            =    "^4[AMXX]^1";
new 
snd_lvlup[]        =   "mega-gungame/level_up.wav";
new 
snd_alert[]        =     "garg/gar_alert2.wav";
new 
db_savedata[]    =    "AMXX-MEGAGUNGAME";

/*----------- [ P L U G I N - I N I T ] ----------- */
public plugin_init() {
    
register_plugin("AMXX - Mega Gungame""b1.0""Alejandro-.");

    
register_event("CurWeapon""CurWeapon""ab");
    
register_event("ResetHUD""onResetHUD""b");

    
register_forward(FM_SetModel"FwRemoveModel");

    
RegisterHam(Ham_Spawn"player""PlayerSpawn"true);
    
RegisterHam(Ham_TraceAttack"player""Forward_PlayerAttack");

    
register_clcmd("drop""BlockCommand");
    
register_clcmd("nightvision""ShowMenuExtraItems");
    
register_clcmd("say /levels""CmdLevelsMenu");
    
register_clcmd("say /ggstats""CmdPlayerStats");
    
register_clcmd("say /top""CmdTopPlayers");

    
g_pCvars[MG_MIN_PLAYERS]         = register_cvar("mg_min_players""1");                // Minimo de jugadores para iniciar el Mega-Gungame!
    
g_pCvars[MG_SUPER_RACHA_KILLS]     = register_cvar("mg_super_racha_kill""10");          // kills para super racha!
    
g_pCvars[MG_TIME_HE]             = register_cvar("mg_time_he""5");                  // Segundos en entregar la he!
    
g_pCvars[MG_CALENT_TIME]         = register_cvar("mg_time_calent""30");              // Tiempo de calentamiento

    
g_MsgHideWeapon get_user_msgid("HideWeapon");
    
g_MsgScoreInfo     get_user_msgid("ScoreInfo");
    
g_MsgStatusIcon get_user_msgid("StatusIcon");
    
g_MsgScreenFade get_user_msgid("ScreenFade");

    
register_message(g_MsgHideWeapon"msgHideWeapon");
    
register_message(g_MsgScoreInfo"PfnScoreInfo");
    
register_message(g_MsgStatusIcon"PfnStatusIcon");

    
register_menu("PublicityMenu"1023"HandPublicityMenu");

    
g_MaxPlayers         get_maxplayers();
    
g_StateGungame         MG_STATE_OFFLINE;

    for (new 
0<sizeof g_Synci++)
        
g_Sync[i] = CreateHudSyncObj();

    
set_task(1.0"ShowHudGungame"TASK_HUD__"b");
    
adv_vault(0SD_INIT);
    
LoadMaps();
}

public 
Forward_PlayerAttack(indexattackerFloat:dmgFloat:dir[3], trdmgbit) {
    if (
index != attacker && get_tr2(trTR_iHitgroup) != HIT_HEAD && g_StateGungame == MG_STATE_ONLINE && g_ModeGungame == 4) {
        if (
<= attacker <= g_MaxPlayers) {
            if (
get_user_weapon(attacker) == CSW_KNIFE || get_user_weapon(attacker) == CSW_HEGRENADE){
                    return 
HAM_IGNORED;
            }
            return 
HAM_SUPERCEDE;
        }
    }
    return 
HAM_IGNORED;
}

public 
CmdPlayerStats(index) {
    static 
menu;
    
menu menu_create(fmt("\wAMXX - \yEstadisticas: \r%n"index), "HandNiveles");
    
menu_additem(menufmt("\d-\w Frags: \y %d (HS: %d)"g_sPlayerFrags[index][TYPE_FRAG], g_sPlayerFrags[index][TYPE_HEADSHOT]));
    
menu_additem(menufmt("\d-\w Frags con cuchillo:\y %d"g_sPlayerFrags[index][TYPE_KNIFE]));
    
menu_additem(menufmt("\d-\w Muertes:\y %d"g_sPlayerFrags[index][TYPE_DEATH]));
    
menu_additem(menufmt("\d-\w Gungame ganados:\y %d"g_sPlayerGungameState[index][PLAYER_STATE_WIN]));
    
menu_additem(menufmt("\d-\w Gungame perdidos:\y %d"g_sPlayerGungameState[index][PLAYER_STATE_LOSE]));
    
menu_setprop(menuMPROP_NUMBER_COLOR"\r");
    
menu_setprop(menuMPROP_NEXTNAME"Siguiente");
    
menu_setprop(menuMPROP_BACKNAME"Anterior");
    
menu_setprop(menuMPROP_EXITNAME"Cerrar");
    
menu_display(indexmenu);
}

public 
CmdLevelsMenu(index) {
    static 
menu;
    
menu menu_create(fmt("\wAMXX - \yNiveles: \r%d"charsmax(g_szLevels)), "HandNiveles");

    for(new 
0<sizeof g_szLevelsi++) {
        
menu_additem(menufmt("(\y%d\w:\y %s\w)             \d- \w(PTS:\r %d\w)"ig_szLevels[i][WPN_REALNAME], g_szLevels[i][POINTS]));
    }
    
menu_setprop(menuMPROP_NUMBER_COLOR"\r");
    
menu_setprop(menuMPROP_NEXTNAME"Siguiente");
    
menu_setprop(menuMPROP_BACKNAME"Anterior");
    
menu_setprop(menuMPROP_EXITNAME"Cerrar");
    
menu_display(indexmenu);
}

public 
HandNiveles(indexmenuitem) {
    if (
item == MENU_EXIT) {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    
client_print_color(indexprint_team_default"%s Nivel: (^3%d^1:^3%s^1) - (PTS:^4 %d^1)"gsTagitemg_szLevels[item][WPN_REALNAME], g_szLevels[item][POINTS])
    
CmdLevelsMenu(index);
    return 
PLUGIN_HANDLED;
}
public 
ShowMenuExtraItems(index) {

    if (!
is_user_alive(index) || g_StateGungame != MG_STATE_ONLINE)
    return 
PLUGIN_HANDLED;

    static 
menu;
    
menu menu_create("\wAMXX - \yExtra items: \r5""HandExtraItems");

    if (
cs_get_user_money(index) >= GRANADE_MONEY && g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] != CSW_HEGRENADE)
    
menu_additem(menufmt("- \wGranada \rHE\w                     -    \y($%d)"GRANADE_MONEY ));
    else 
    
menu_additem(menufmt("\d- Granada HE                     -    \r($%d)"GRANADE_MONEY ));

    if (
cs_get_user_money(index) >= EFFECT_SPEED_MONEY)
    
menu_additem(menufmt("- \wSpeed \r(%i Segundos)\w       -    \y($%i)"EFFECT_SPEED_TIMEEFFECT_SPEED_MONEY));
    else 
    
menu_additem(menufmt("\d- Speed (%i Segundos)       -    \r($%i)"EFFECT_SPEED_TIMEEFFECT_SPEED_MONEY));

    if (
cs_get_user_money(index) >= EFFECT_REGENERATE_MONEY)
    
menu_additem(menufmt("- \wRegeneracion de HP         -    \y($%i)"EFFECT_REGENERATE_MONEY));
    else 
    
menu_additem(menufmt("\d- Regeneracion de HP         -    \r($%i)"EFFECT_REGENERATE_MONEY));

    if (
cs_get_user_money(index) >= TRAJE_FAKE_MONEY)
    
menu_additem(menufmt("- \wTraje Falso                      -    \y($%i)"TRAJE_FAKE_MONEY));
    else 
    
menu_additem(menufmt("\d- Traje Falso                      -    \r($%i)"TRAJE_FAKE_MONEY));

    if (
cs_get_user_money(index) >= EFFECT_LIFE_MONEY)
    
menu_additem(menufmt("- \wObtener \r(+%i)\w de vida    -    \y($%i)"EFFECT_LIFE_HPEFFECT_LIFE_MONEY));
    else 
    
menu_additem(menufmt("\d- Obtener (+%i) de vida   -    \r($%i)"EFFECT_LIFE_HPEFFECT_LIFE_MONEY));

    
menu_setprop(menuMPROP_NUMBER_COLOR"\r");
    
menu_setprop(menuMPROP_NEXTNAME"Siguiente");
    
menu_setprop(menuMPROP_BACKNAME"Anterior");
    
menu_setprop(menuMPROP_EXITNAME"Cerrar");
    
menu_display(indexmenu);
    return 
PLUGIN_HANDLED;
}

public 
HandExtraItems(indexmenuitem) {
    if (
item == MENU_EXIT || !is_user_alive(index)) {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    switch(
item) {
        case 
0: {
            if(
g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] == CSW_HEGRENADE) {
                
client_print_color(indexprint_team_default"%s No puedes comprar granada en el nivel ^4HE"gsTag);
                return 
PLUGIN_HANDLED;                
            }
            if (
cs_get_user_money(index) < GRANADE_MONEY) { 
                
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagGRANADE_MONEY cs_get_user_money(index));
            }
            else {
                
cs_set_user_money(indexcs_get_user_money(index) - GRANADE_MONEY);

                
give_item(index"weapon_hegrenade");
                
client_print_color(indexprint_team_default"%s Compraste: ^4Granada HE"gsTag);                
            }
        }
        case 
1: {
            if (
cs_get_user_money(index) < EFFECT_SPEED_MONEY) { 
                
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagEFFECT_SPEED_MONEY cs_get_user_money(index));
            }
            else if (
g_bPlayerSpeed[index]) {
                
client_print_color(indexprint_team_default"%s Ya tienes en uso el: ^4Speed"gsTag);                
            }
            else {
                
cs_set_user_money(indexcs_get_user_money(index) - EFFECT_SPEED_MONEY);
                
set_user_maxspeed(indexget_user_maxspeed(index) * EFFECT_SPEED_VELOCITY);
                
g_bPlayerSpeed[index] = true;
                
set_task(float(EFFECT_SPEED_TIME), "EndEffectSpeed"index TASK_PLAYER_SPEED);
                
client_print_color(indexprint_team_default"%s Compraste: ^4%d Seg De Speed"gsTagEFFECT_SPEED_TIME);                
            }
        }
        case 
2: {
            if (
cs_get_user_money(index) < EFFECT_REGENERATE_MONEY) { 
                
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagEFFECT_REGENERATE_MONEY cs_get_user_money(index));
            }
            else {
                
cs_set_user_money(indexcs_get_user_money(index) - EFFECT_REGENERATE_MONEY);
                
set_task(0.5"RegenerateHP"index TASK_PLAYER_REGENERATE__"a"EFFECT_REGENERATE_TIME);
                
client_print_color(indexprint_team_default"%s Compraste: ^4Regeneracion De HP"gsTag);                
            }
        }
        case 
3: {
            if (
cs_get_user_money(index) < TRAJE_FAKE_MONEY) { 
                
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagTRAJE_FAKE_MONEY cs_get_user_money(index));
            }
            else if (
g_bPlayerFake[index]) {
                
client_print_color(indexprint_team_default"%s Ya tienes en uso el: ^4Traje falso"gsTag);                
            }
            else {
                
cs_set_user_money(indexcs_get_user_money(index) - TRAJE_FAKE_MONEY);
                
g_bPlayerFake[index] = true;
                
SetPlayerFake(index);
                
client_print_color(indexprint_team_default"%s Compraste: ^4Traje falso"gsTag);                
            }
        }
        case 
4: {
            if (
cs_get_user_money(index) < EFFECT_LIFE_MONEY) { 
                
client_print_color(indexprint_team_default"%s Te faltan: ^4$%d"gsTagEFFECT_LIFE_MONEY cs_get_user_money(index));
            }
            else {
                
cs_set_user_money(indexcs_get_user_money(index) - EFFECT_LIFE_MONEY);
                
set_user_health(indexget_user_health(index) + EFFECT_LIFE_HP);
                
client_print_color(indexprint_team_default"%s Compraste: ^4(+%i)^1 de ^3HP"gsTagEFFECT_LIFE_HP);                
            }
        }
    }

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
RegenerateHP(index) {
    
index TASK_ID(indexTASK_PLAYER_REGENERATE);

    if (
get_user_health(index) < EFFECT_REGENERATE_MAX_HP) {
        
set_user_health(indexget_user_health(index) + EFFECT_REGENERATE_SEG);
    }
}

public 
EndEffectSpeed(index) {
    
index TASK_ID(indexTASK_PLAYER_SPEED);
    
g_bPlayerSpeed[index] = false;
    
ResetUserMaxSpeed(index);
    
client_print_color(indexprint_team_default"%s Termino tu tiempo de ^4Speed"gsTag);                
}

public 
plugin_precache() {
    if (
snd_lvlup[0])
    
precache_sound(snd_lvlup);
    if (
snd_alert[0])
    
precache_sound(snd_alert);
}   

public 
onResetHUD(index) {
    
message_begin(MSG_ONEg_MsgHideWeapon_index);
    
write_byte((1<<4) | (1<<5) | (1<<3));
    
message_end();
}

public 
msgHideWeapon(index) {
    
set_msg_arg_int(1ARG_BYTEget_msg_arg_int(1) | (1<<4));
}

public 
FwRemoveModel(entity, const model[])
{
    static 
szClassname[32];
    
pev(entitypev_classnameszClassnamecharsmax(szClassname));

    if (
equal(szClassname"weaponbox"))
    {
        
set_pev(entitypev_nextthinkget_gametime() + 0.01);
        return 
FMRES_SUPERCEDE;
    }

    return 
FMRES_IGNORED;


public 
PfnStatusIcon(msg_idmsg_destid) {
    static 
szIcon[8];
    
get_msg_arg_string(2szIconcharsmax(szIcon));

    if (
equal(szIcon"buyzone") && get_msg_arg_int(1) && g_StateGungame == MG_STATE_ONLINE) {
        
set_pdata_int(id235get_pdata_int(id235) & ~(1<<0));
        return 
PLUGIN_HANDLED;
    }

    return 
PLUGIN_CONTINUE;


public 
client_death(killervictimwpnindexhitplace) {    

    if(!
IsPlayerValid(killer) || !IsPlayerValid(victim))
    return 
PLUGIN_CONTINUE;

    if (
g_StateGungame != MG_STATE_ONLINE) {
        return 
PLUGIN_CONTINUE;
    }

    if (
killer == victim) {

        if (
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] != CSW_HEGRENADE || 
            
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] == CSW_HEGRENADE && wpnindex == CSW_HEGRENADE)  {
            
SetPlayerPoints(victimGetPlayerPoints(victim) + g_iModes[g_ModeGungame][PLAYER_AUTOKILL]);
        }
        
ResetPlayerKills(victim);
        return 
PLUGIN_CONTINUE;
    }

    
g_sPlayerFrags[killer][TYPE_FRAG]++;
    
g_oPlayerFrags[killer][TYPE_FRAG]++;

    
g_sPlayerFrags[victim][TYPE_DEATH]++;
    
g_oPlayerFrags[victim][TYPE_DEATH]++;
    
client_cmd(killer"spk buttons/bell1.wav");
    
    
g_bPlayerFake[victim]        = false;
    
g_bPlayerSpeed[victim]         = false;
    
cs_reset_user_model(victim);

    if (
wpnindex == CSW_KNIFE) {

        if(
killer == g_PlayerSuperKnife) {    
            
SetSuperKnifeEffect(killervictim);
        }
        else {    
            
RoboPlayerLevel(killervictim);
            
PlayerKills(killervictim);
        }
        
g_sPlayerFrags[killer][TYPE_KNIFE]++;
        
g_oPlayerFrags[killer][TYPE_KNIFE]++;

        if (
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] != CSW_HEGRENADE || 
            
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] == CSW_HEGRENADE && wpnindex == CSW_HEGRENADE)  {
            
SetPlayerPoints(killerGetPlayerPoints(killer) + g_iModes[g_ModeGungame][PLAYER_KNIFE]);
        }
        
cs_set_user_money(killercs_get_user_money(killer) + MONEY_KNIFE);
        return 
PLUGIN_CONTINUE;
    }

    if (
hitplace == HIT_HEAD) {
        if (
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] != CSW_HEGRENADE || 
            
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] == CSW_HEGRENADE && wpnindex == CSW_HEGRENADE)  {
            
SetPlayerPoints(killerGetPlayerPoints(killer) + g_iModes[g_ModeGungame][PLAYER_HEADSHOT]);
        }
        if(
killer != g_PlayerSuperKnife)
        
PlayerKills(killervictim);

        
g_sPlayerFrags[killer][TYPE_HEADSHOT]++;
        
g_oPlayerFrags[killer][TYPE_HEADSHOT]++;
        
cs_set_user_money(killercs_get_user_money(killer) + MONEY_HEADSHOT);
        return 
PLUGIN_CONTINUE;
    }
    if (
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] != CSW_HEGRENADE || 
        
g_szLevels[g_iPlayerLevel[killer]][CSW_WEAPON] == CSW_HEGRENADE && wpnindex == CSW_HEGRENADE)  {
        
SetPlayerPoints(killerGetPlayerPoints(killer) + g_iModes[g_ModeGungame][PLAYER_KILL]);
    }
    if(
killer != g_PlayerSuperKnife)
    
PlayerKills(killervictim);

    
cs_set_user_money(killercs_get_user_money(killer) + MONEY_KILL);
    return 
PLUGIN_CONTINUE;
}

public 
BlockCommand(index)
{
    if (
g_StateGungame == MG_STATE_ONLINE)
    return 
PLUGIN_HANDLED;
    return 
PLUGIN_CONTINUE;
}

public 
PlayerSpawn(index) {
    
    if (!
is_user_connected(index))
    return 
HAM_IGNORED;

    if (
g_StateGungame == MG_STATE_ONLINE) { 
        if (!
task_exists(index TASK_PLAYER_EQUIP)) {
            
ShowMenuPublicity(index);
            
set_task(0.1"SetPlayerEquip"index TASK_PLAYER_EQUIP__"b");
        }
    }
    
set_task(0.1"SetPlayerPreEquip"index TASK_PLAYER_PRE_EQUIP);
    return 
HAM_IGNORED;
}

public 
SetPlayerPreEquip(index) {
    
index TASK_ID(indexTASK_PLAYER_PRE_EQUIP);
    switch (
g_StateGungame) { 
        case 
MG_STATE_CALENTVOTE: {
            
strip_user_weapons(index);
            
give_item(index"weapon_knife");
            
give_item(index"weapon_m4a1");
            
give_item(index"weapon_deagle");
            
give_item(index"weapon_hegrenade");
            
cs_set_user_bpammo(indexCSW_M4A1200);
            
cs_set_user_bpammo(indexCSW_DEAGLE200);
        }
        case 
MG_STATE_ONLINE: {
            
strip_user_weapons(index);
            
            if (
g_ModeGungame == 3) {
                
SetFadeRed(index);    
                
set_user_health(index35);
                
client_cmd(index"spk player/headshot1.wav");
            }
            else 
                
cs_set_user_armor(index200CS_ARMOR_VESTHELM);
        }
        case 
MG_STATE_VOTEMAPMG_STATE_BESTPLAYER: {
            
strip_user_weapons(index);
        }
    }
}
public 
ShowMenuPublicity(index) {
    static 
sztext512 ], iLenkeys;
    
iLen 0;

    
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wAMXX \d| \yMEGA GUNGAME \rv1.0b^n^n");

    
keys = (1<<9);
    
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wNIVELES: \r%d \d(CMD: \r/levels\d)^n"charsmax(g_szLevels));
    switch(
g_ModeGungame) {
        case 
0iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wMODO: \ySIN EQUIPOS^n"charsmax(g_szLevels));
        case 
1iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wMODO: \yRAPIDO^n"charsmax(g_szLevels));
        case 
2iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wMODO: \yLENTO^n"charsmax(g_szLevels));
        case 
3iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wMODO: \y35 HP^n"charsmax(g_szLevels));
        case 
4iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wMODO: \yONLY HEADSHOT^n"charsmax(g_szLevels));
    }
    
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wVOTEMAP: \yACTIVO^n");
    
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wESTADISTICAS: \yACTIVO \d(CMD: \r/ggstats\d)^n");
    
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wTOP 5: \yACTIVO \d(CMD: \r/top\d)^n");
    
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wMOTD BEST PLAYER: \yACTIVO^n");
    
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wSUPER KNIFE: \yACTIVO \d(%d KILLS Y TE LA ACTIVAS)^n"get_pcvar_num(g_pCvars[MG_SUPER_RACHA_KILLS]));
    
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \wSHOP: \yPULSAR \rN\d (DEBES ESTAR VIVO)^n^n");
    
iLen += format(sztext[iLen], sizeof sztext iLen"\d- \yNOTA:\w SE EL PRIMERO EN LLEGAR AL NIVEL MAXIMO^n^n");
    
iLen += format(sztext[iLen], sizeof sztext iLen"\r0. \wCerrar");
    
show_menuindexkeyssztext, -1"PublicityMenu" );
}

public 
HandPublicityMenu(indexkey) {
    return 
PLUGIN_HANDLED;
}

public 
SetPlayerEquip(index) {
    
index TASK_ID(indexTASK_PLAYER_EQUIP);

    if (
g_StateGungame != MG_STATE_ONLINE) {
        if (
task_exists(index+TASK_PLAYER_EQUIP))
        
remove_task(index+TASK_PLAYER_EQUIP)
        return;
    }
    if (!
is_user_alive(index)) {
        return;
    }

    switch (
g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON])
    {
        case 
CSW_KNIFE: {
            if (
get_user_weapon(index) != CSW_KNIFE && get_user_weapon(index) != CSW_HEGRENADE) {
                
strip_user_weapons(index);
                
give_item(index"weapon_knife");
                
engclient_cmd(index"weapon_knife");
            }
        }
        case 
CSW_HEGRENADE: {    
            if (
get_user_weapon(index) != CSW_HEGRENADE) {
                if ((
get_user_weapon(index) != CSW_KNIFE && get_user_weapon(index) != CSW_GLOCK18)) {

                    
strip_user_weapons(index);
                    
give_item(index"weapon_knife");
                    
give_item(index"weapon_glock18");
                    
give_item(index"weapon_hegrenade");

                    if(!
task_exists(index TASK_PLAYER_HE))
                    
set_task(1.0"SetPlayerHe"index TASK_PLAYER_HE__"b");
                }
            }
        }
        default: {
            new 
weapons pev(indexpev_weapons);
            if (
get_user_weapon(index) != g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON]) {
                if ((
get_user_weapon(index) != CSW_KNIFE && get_user_weapon(index) != CSW_HEGRENADE) && get_user_weapon(index) != g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] ||
                    (
get_user_weapon(index) == CSW_KNIFE && get_user_weapon(index) == CSW_HEGRENADE) && !(weapons&1<<g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON])) {

                    
strip_user_weapons(index);
                    
give_item(index"weapon_knife");
                    
give_item(indexg_szLevels[g_iPlayerLevel[index]][WPN_NAME]);

                    if(
g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] == CSW_AWP) {
                        
cs_set_weapon_ammo(g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON], 1);
                    }

                    
cs_set_user_bpammo(indexg_szLevels[g_iPlayerLevel[index]][CSW_WEAPON], 200);
                    
engclient_cmd(indexg_szLevels[g_iPlayerLevel[index]][WPN_NAME]);                    
                }
            }
        }
    }
}

public 
SetPlayerHe(index) {
    
index TASK_ID(indexTASK_PLAYER_HE);
    if (
g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON] != CSW_HEGRENADE) {
        if (
task_exists(index TASK_PLAYER_HE))
        
remove_task(index TASK_PLAYER_HE)
        return;
    }

    new 
weapons pev(indexpev_weapons);
    if(!(
weapons&1<<CSW_HEGRENADE)) {
        if (
g_iPlayerHeCount[index]) {
            
client_print(indexprint_center"Obtendras una: Granada en %d seg"g_iPlayerHeCount[index]);            
            
g_iPlayerHeCount[index]--;
        }
        else {
            
give_item(index"weapon_hegrenade");
            
client_print(indexprint_center"Obtienes una: Granada");
        }
    }    
    else {
        
g_iPlayerHeCount[index] = get_pcvar_num(g_pCvars[MG_TIME_HE]);
    }
}

public 
PfnScoreInfo(msid) {
    static 
_score_player_id;
    
_score_player_id get_msg_arg_int(1);

    if (
g_StateGungame == MG_STATE_ONLINE) {
        
set_msg_arg_int(2ARG_SHORTGetPlayerPoints(_score_player_id));
    }
}

public 
ShowHudGungame() {

    new 
bool:hud true;
    new 
szBuffer[600];
    static 
iLen;

    
iLen 0;

    switch (
g_StateGungame) {
        case 
MG_STATE_CALENTVOTE: {
            
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"Calentamiento: 00:%02i segundos..."g_iCountCalent);            
        }
        case 
MG_STATE_BESTPLAYER: {
            if (
is_user_connected(g_PlayerBestMap))
            
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"\
                <-----------[GANADOR]-------->^n\
                Jugador: %n^n\
                gg ganados: %i^n\
                Frags: %i (HS: %i)^n\
                Frags Knife: %i^n\
                Muertes: %i^n\
                <-----------[GANADOR]-------->"
g_PlayerBestMapg_sPlayerGungameState[g_PlayerBestMap][PLAYER_STATE_WIN], g_oPlayerFrags[g_PlayerBestMap][TYPE_FRAG], g_oPlayerFrags[g_PlayerBestMap][TYPE_HEADSHOT], g_oPlayerFrags[g_PlayerBestMap][TYPE_KNIFE], g_oPlayerFrags[g_PlayerBestMap][TYPE_DEATH]);        
            else 
            
hud false;    
        }
        case 
MG_STATE_OFFLINE: {
            
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"Esperando %d/%d jugadores"GetPlayersNum(), get_pcvar_num(g_pCvars[MG_MIN_PLAYERS]));

            if (
GetPlayersNum() >= get_pcvar_num(g_pCvars[MG_MIN_PLAYERS])) {
                
StartCalent();
            }
        }
        case 
MG_STATE_ONLINE: {
            
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"\
                MEGA-GUNGAME | PLAYERS TOP^n\
                ------------------------------------------------------^n\
                - Jugador               - (PTS) (L/LM) (EQUIP) (100%%%%)^n"
);
            
            new 
PlayersTop[MAX_PLAYERS_TOP_HUD];

            
set_hudmessage(2552552550.020.24016.01.3);
            
GetPlayersTop(PlayersTop);
            new 
iCount 0;

            for(new 
top 0top <sizeof PlayersToptop++)
            {
                if (
is_user_connected(PlayersTop[top])) {

                    new 
name[12];
                    
get_user_name(PlayersTop[top], namecharsmax(name));
                    new 
iPorcentaje;
                    
iPorcentaje = ((g_iPlayerPoint[PlayersTop[top]] * 100) / g_szLevels[sizeof g_szLevels 1][POINTS]);
                    new 
iEspacios 12 strlen(name) + 4;
                    
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"%i. %s"top 1name);       
                    for (new 
0<=iEspaciosi++) {
                        
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen" ");       
                    }
                    
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"- (%d) (%d/%d) (%s) (%i%%%%)%s^n"GetPlayerPoints(PlayersTop[top]), g_iPlayerLevel[PlayersTop[top]], sizeof g_szLevels 1g_szLevels[g_iPlayerLevel[PlayersTop[top]]][WPN_REALNAME], iPorcentajetop == " (LIDERANDO)" "");
                    
iCount++;
                }
            }

            if (!
iCount) {
                
hud false;
            }

            
g_iCountPublicity--;

            if (!
g_iCountPublicity) {
                new 
iBestPlayer[MAX_PLAYERS_TOP_HUD]; 
                
GetPlayersTop(iBestPlayer);

                if (
GetPlayerPoints(iBestPlayer[0])) {    
                    
client_print_color(0print_team_default"%s El jugador: ^4%n^1. Esta liderando con (^4%d^3 PTS^1) y nivel ^3%d ^4(%s)"gsTagiBestPlayer[0], GetPlayerPoints(iBestPlayer[0]), g_iPlayerLevel[iBestPlayer[0]], g_szLevels[g_iPlayerLevel[iBestPlayer[0]]][WPN_REALNAME]);
                }

                
g_iCountPublicity TIME_PUBLICITY;
            }

            for (new 
Players 1Players <= g_MaxPlayersPlayers++) {
                if (
IsPlayerValid(Players)) {
                    
UpdateIcon(Players);
                }
            }
        }
        case 
MG_STATE_VOTEMAP: {
            if (
g_iCountVoteMap) {
                
g_iCountVoteMap--;

                
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"\
                    MEGA-GUNGAME | VOTE MAP                (%d)^n\
                    ------------------------------------------------------^n\
                    - Mapa                             - (VOTOS) (100%%%%)^n"
g_iCountVoteMap);

                new 
iCount 0;
                new 
MapsVotes[MAX_MAPS_VOTE];
                new 
iPorcentaje;

                for(new 
vMaps 0vMaps <MAX_MAPS_VOTEvMaps++)
                {
                    if (
g_lMapsVote[vMaps][0]) {

                        for (new 
Players 1Players <=g_MaxPlayersPlayers++)
                        {
                            if(
IsPlayerValid(Players)){
                                if( 
g_iPlayerVoteMap[Players] == vMaps )
                                
MapsVotes[vMaps] += 1;
                            }
                        }
                        
iPorcentaje = ((MapsVotes[vMaps] * 100) / GetPlayersNum());
                        new 
iEspacios 19 strlen(g_lMapsVote[vMaps]) + 4;
                        
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"%i. %s"vMaps 1g_lMapsVote[vMaps]);       
                        for (new 
0<=iEspaciosi++) {
                            
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen" ");       
                        }
                        
iLen += formatex(szBuffer[iLen], sizeof szBuffer iLen"- (%d) (%i%%%%)^n"MapsVotes[vMaps], iPorcentaje);
                        
iCount++;
                    }
                }

                if (!
iCount) {
                    
hud false;
                }
            }
        }
    }

    if (
hud) {
        
set_hudmessage(02550g_StateGungame == MG_STATE_CALENTVOTE || g_StateGungame == MG_STATE_OFFLINE ? -1.0 0.02g_StateGungame == MG_STATE_CALENTVOTE || g_StateGungame == MG_STATE_OFFLINE 0.9 0.17016.01.3);
        
ShowSyncHudMsg(0g_Sync[0], szBuffer);
    }
}

public 
plugin_end() {
    if (
task_exists(TASK_HUD))
    
remove_task(TASK_HUD);
}

public 
client_putinserver(index) {
    
g_iPlayerPoint[index]         = EOS;
    
g_iPlayerLevel[index]         = EOS;
    
g_iPlayerKills[index]         = EOS;
    
g_iPlayerCount[index]         = EOS;
    
g_iPlayerRegenerate[index]     = EOS;
    
g_iPlayerHeCount[index]     = EOS;
    
g_bPlayerFake[index]         = false;
    
g_bPlayerSpeed[index]         = false;
    
g_iPlayerVoteMap[index]     = -1;
    
g_iPlayerVoteGungame[index]    = -1;

    for (new 
0<sizeof(g_sPlayerFrags[]); i++)
    
g_sPlayerFrags[index][i]    = EOS;

    for (new 
0<sizeof(g_sPlayerGungameState[]); i++)
    
g_sPlayerGungameState[index][i]    = EOS;

    switch (
g_StateGungame) {
        case 
MG_STATE_OFFLINE: {
            if (
GetPlayersNum() >= get_pcvar_num(g_pCvars[MG_MIN_PLAYERS])) {
                
StartCalent();
            }
        }
        case 
MG_STATE_ONLINE: {
            new 
PlayerBest[MAX_PLAYERS_TOP_HUD];
            
GetPlayersTop(PlayerBest);
            if (
g_iPlayerLevel[PlayerBest[0]] > 8) {
                
g_iPlayerLevel[index] = (g_iPlayerLevel[PlayerBest[0]] - 8);
                
g_iPlayerPoint[index] = (g_szLevels[(g_iPlayerLevel[PlayerBest[0]] - 8) - 1][POINTS]);
            }
        }
    }

    
adv_vault(indexSD_PLAYER_LOADDATA);
}

public 
StartCalent() {
    if(
g_StateGungame != MG_STATE_OFFLINE
    return;

    
g_StateGungame      MG_STATE_CALENTVOTE;
    
g_iCountPublicity     TIME_PUBLICITY;
    
g_PlayerSuperKnife     EOS;
    
g_PlayerBestMap     = -1;
    
g_iCountVoteMap     TIME_VOTEMAP;
    
g_iCountCalent         get_pcvar_num(g_pCvars[MG_CALENT_TIME]);
    
g_bVoteOn            true;
    
set_cvar_num("sv_restart"1);
    for(new 
0<=g_MaxPlayersi++) {
        if (
IsPlayerValid(i)) {
            
set_task(1.0"ShowVoteGungame"TASK_PLAYER_VOTEGUNGAME__"b");
        }
    }
    
set_task(15.0"EndVoteGungame"TASK_ENDVOTEGUNGAME);
    
set_task(1.0"StartCalentCount"TASK_CALENTVOTE__"b");
}

public 
ShowVoteGungame(index) {
    
index TASK_ID(indexTASK_PLAYER_VOTEGUNGAME);

    static 
menu
    
menu menu_create("\wAMXX \d- \yVote Gungame""HandVoteGungame");

    new 
iVotes[5];
    new 
iPorcentaje[5];

    for (new 
0<=g_MaxPlayersi++) {
        if (
IsPlayerValid(i)) {
            if(
g_iPlayerVoteGungame[i] != -1) {
                
iVotes[g_iPlayerVoteGungame[i]]++;
                
iPorcentaje[g_iPlayerVoteGungame[i]] = ((iVotes[g_iPlayerVoteGungame[i]] * 100) / GetPlayersNum());
            }
    
        }
    }

    
menu_additem(menufmt("\d- \wModo:\y Sin equipos   \d- [%i] (%i%%)"iVotes[0], iPorcentaje[0]));
    
menu_additem(menufmt("\d- \wModo:\y rapido        \d- [%i] (%i%%)"iVotes[1], iPorcentaje[1]));
    
menu_additem(menufmt("\d- \wModo:\y lento         \d- [%i] (%i%%)"iVotes[2], iPorcentaje[2]));
    
menu_additem(menufmt("\d- \wModo:\y 35 hp         \d- [%i] (%i%%)"iVotes[3], iPorcentaje[3]));
    
menu_additem(menufmt("\d- \wModo:\y Only Headshot \d- [%i] (%i%%)"iVotes[4], iPorcentaje[4]));
//mp_freeforall
    
menu_setprop(menuMPROP_NUMBER_COLOR"\r");
    
menu_setprop(menuMPROP_NEXTNAME"Siguiente");
    
menu_setprop(menuMPROP_BACKNAME"Anterior");
    
menu_setprop(menuMPROP_EXITNAME"Cerrar");
    
menu_display(indexmenu);
    if (!
g_bVoteOn)
        if (
task_exists(index TASK_PLAYER_VOTEGUNGAME)) remove_task(index TASK_PLAYER_VOTEGUNGAME);
}

public 
HandVoteGungame(indexmenuitem) {
    if (
item == MENU_EXIT) {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    if (
g_iPlayerVoteGungame[index] == -&& g_StateGungame == MG_STATE_CALENTVOTE && g_bVoteOn) {
        
g_iPlayerVoteGungame[index] = item;
        switch(
item) {
            case 
0client_print_color(0print_team_default"%s ^3%n^1 Voto por:^4 Modo:^3 Sin equipos"gsTagindex); 
            case 
1client_print_color(0print_team_default"%s ^3%n^1 Voto por:^4 Modo:^3 rapido"gsTagindex);
            case 
2client_print_color(0print_team_default"%s ^3%n^1 Voto por:^4 Modo:^3 lento"gsTagindex);
            case 
3client_print_color(0print_team_default"%s ^3%n^1 Voto por:^4 Modo:^3 35 hp"gsTagindex);
            case 
4client_print_color(0print_team_default"%s ^3%n^1 Voto por:^4 Modo:^3 only headshot"gsTagindex);
        }
        
client_cmdindex"speak buttons/button9" );
    }
    return 
PLUGIN_HANDLED;
}

public 
EndVoteGungame() {
    new 
iVotes[5];

    for (new 
0<=g_MaxPlayersi++) {
        if (
IsPlayerValid(i)) {
            if(
g_iPlayerVoteGungame[i] != -1)
                
iVotes[g_iPlayerVoteGungame[i]]++;
        }
    }

    new 
iBestVotebool:bTypeEvent false;

    for (new 
0<sizeof iVotesi++) {
        for (new 
i2 0i2 <sizeof iVotesi2++) {
            if (
iVotes[i] > iVotes[i2]) {
                
iBestVote i;
                
bTypeEvent true;
            }
        }
    }    

    if (!
bTypeEvent) {
        
iBestVote random_num(03);
    }    

    switch(
iBestVote) {
        case 
0client_print_color(0print_team_default"%s Modo de juego ganador:^3 Sin equipos"gsTag);
        case 
1client_print_color(0print_team_default"%s Modo de juego ganador:^3 Rapido"gsTag);
        case 
2client_print_color(0print_team_default"%s Modo de juego ganador:^3 Lento"gsTag);
        case 
3client_print_color(0print_team_default"%s Modo de juego ganador:^3 35 hp"gsTag);
        case 
4client_print_color(0print_team_default"%s Modo de juego ganador:^3 Only Headshot"gsTag);
    }

    
g_ModeGungame iBestVote;
    
g_bVoteOn       false;
}

public 
StartCalentCount() {
    if (
g_StateGungame != MG_STATE_CALENTVOTE
    return;

    if (
g_iCountCalent) {
        
g_iCountCalent--;
    }
    else {
        if(
task_exists(TASK_CALENTVOTE))
        
remove_task(TASK_CALENTVOTE);

        
client_print_color(0print_team_default"%s INICIANDO ^3GUNGAME^4!"gsTag);
        
set_task(1.5"StartMegaGungame"TASK_INIGUNGAME);
    }
}

public 
client_disconnected(index) {
    if (
task_exists(index TASK_PLAYER_EQUIP))
    
remove_task(index TASK_PLAYER_EQUIP);
    
adv_vault(indexSD_PLAYER_SAVEDATA);
}

public 
StartMegaGungame() {
    if(
g_StateGungame != MG_STATE_CALENTVOTE)
        return;

    
g_StateGungame MG_STATE_ONLINE;    
    
ServerGungame();
}

public 
EndMegaGungame(const BestPlayer) {
    if(
g_StateGungame != MG_STATE_ONLINE)
    return;

    
g_PlayerBestMap BestPlayer;

    for (new 
1<=g_MaxPlayersi++) {
        if(
== BestPlayer)
        continue;

        if(
IsPlayerValid(i)) {
            
g_sPlayerGungameState[i][PLAYER_STATE_LOSE]++;
            
adv_vault(iSD_PLAYER_SAVEDATA);
        }
    }
    
g_sPlayerGungameState[BestPlayer][PLAYER_STATE_WIN]++;
    
adv_vault(BestPlayerSD_PLAYER_SAVEDATA);
    
g_StateGungame MG_STATE_BESTPLAYER;
    
set_task(1.0"EffectEndGungame"TASK_BESTPLAYER);
    
client_print_color(0print_team_default"%s El Ganador del ^3MEGA-GUNGAME!^1 es: ^4%n"gsTagg_PlayerBestMap);
}

public 
EffectEndGungame() {
    
    
set_lights("a");
    
set_cvar_num"sv_maxspeed");

    for (new 
players 1players <= g_MaxPlayersplayers++) {
        if (!
IsPlayerValid(players))
        continue;
        if (!(
<= get_user_team(players) <= 2))
        continue;    

        
strip_user_weapons(players);
    }

    
LoadMapsVote();
    
VoteMapGungame();
    
set_task(15.0"EndVoteMap"TASK_ENDVOTEMAP);
}


public 
DisPlayMotd(const BestPlayer) {
    new 
motd[1536];
    static 
len;
    
len 0;
    new 
iTeam get_user_team(BestPlayer);

    switch(
iTeam) {
        case 
1: {
            
len += formatex(motd[len], sizeof motd-len,
                
"<body>\
                <style>\
                @import url('https://fonts.googleapis.com/css?family=Mukta');\
                body{color:white;background:#282725;font-family:'Mukta',sans-serif}\
                img{border-radius:100;width:50%%;}\
                h1{font-size:15px;background:%s;}\
                .left{width:40%%;color:white;text-align:center;background:rgba(0,0,0,0.5);padding:3%%;float:left;margin-left:3%%;}\
                .left a{color:%s;font-size:15px;text-decoration:none}\
                .right{width:40%%;color:white;text-align:center;background:rgba(0,0,0,0.5);padding:3%%;float:right;margin-right:3%%}\
                .right a{color:%s;font-size:15px;text-decoration:none}\
                table{border:1px solid %s;font-size:10px}\
                th{background:%s;}\
                td{border:1px solid %s}</style>"
RED_COLORRED_COLORRED_COLORRED_COLORRED_COLORRED_COLOR);
            
len += formatex(motd[len], sizeof motd-len"<div class=left><h1>Mejor jugador</h1></br><img src=%s></br><h4>%n</h4>"TEAM_RED_IMGBestPlayer);
        }
        case 
2:{
            
len += formatex(motd[len], sizeof motd-len,
                
"<body>\
                <style>\
                @import url('https://fonts.googleapis.com/css?family=Mukta');\
                body{color:white;background:#282725;font-family:'Mukta',sans-serif}\
                img{border-radius:100;width:50%%;}\
                h1{font-size:15px;background:%s;}\
                .left{width:40%%;color:white;text-align:center;background:rgba(0,0,0,0.5);padding:3%%;float:left;margin-left:3%%;}\
                .left a{color:%s;font-size:15px;text-decoration:none}\
                .right{width:40%%;color:white;text-align:center;background:rgba(0,0,0,0.5);padding:3%%;float:right;margin-right:3%%}\
                .right a{color:%s;font-size:15px;text-decoration:none}\
                table{border:1px solid %s;font-size:10px}\
                th{background:%s;}\
                td{border:1px solid %s}</style>"
BLUE_COLORBLUE_COLORBLUE_COLORBLUE_COLORBLUE_COLORBLUE_COLOR);
            
len += formatex(motd[len], sizeof motd-len"<div class=left><h1>Mejor jugador</h1></br><img src=%s></br><h4>%n</h4>"TEAM_BLUE_IMGBestPlayer);
        }
    }
    
len += formatex(motd[len], sizeof motd-len"</div><div class=right>\
        <h1>ESTADISTICAS</h1>\
        </br>\
        <table width=100%%>\
        <tr align=center>\
        <th width=50%%>Gungame Ganados\
        <th width=50%%>Gungame Perdidos"
);
    
len += formatex(motd[len], sizeof motd-len"\
        <tr align=center>\
        <td>%i\
        <td>%i"
g_sPlayerGungameState[BestPlayer][PLAYER_STATE_WIN], g_sPlayerGungameState[BestPlayer][PLAYER_STATE_LOSE]);
    
len += formatex(motd[len], sizeof motd-len"</table><table width=100%%>\
        <tr align=center>\
        <th width=35%%>Frags\
        <th width=35%%>Frags Knife\
        <th width=35%%>Muertes"
);
    
len += formatex(motd[len], sizeof motd-len"\
        <tr align=center>\
        <td>%i\
        <td>%i\
        <td>%i"
g_oPlayerFrags[BestPlayer][TYPE_FRAG], g_oPlayerFrags[BestPlayer][TYPE_KNIFE], g_oPlayerFrags[BestPlayer][TYPE_DEATH]);

    
len += formatex(motd[len], sizeof motd-len"</table></div>");
    
len += formatex(motd[len], sizeof motd-len"</body>");

    for(new 
Players 1Players <= g_MaxPlayersPlayers++)
    {
        if(!
IsPlayerValid(Players))
        continue;

        
show_motd(Playersmotd"[AMXX] Mega-GunGame v1.0b");
    }
}

public 
CmdTopPlayers(index) {
    new 
motd[2200];
    static 
len;
    
len 0;

    
adv_vault_sort_update(g_VaultSaveDatag_VaultSort);
    new 
toploop min(adv_vault_sort_numresult(g_VaultSaveDatag_VaultSort), MAX_PLAYERS_TOP_MOTD);

    
len += formatex(motd[len], sizeof motd-len,
        
"<body>\
        <style>\
        @import url('https://fonts.googleapis.com/css?family=Mukta');\
        *{font-size:11px}\
        body{color:white;background:url(^"
http://img.fenixzone.net/i/I2067Wl.jpeg^");\
        
font-family:'Mukta',sans-serif;background-position:center center;background-attachment:fixed}\
        
table{border:10px;width:100%%}\
        .
t{background:rgba(0,0,0,0.6); width:80%%;margin-left:auto;margin-right:auto;border-radius:50px 50px 0 0}\
        
h1{text-align:center;font-size:20px;}\
        .
c1{background:rgba(15,15,15,0.8)}\
        .
c2{background:rgba(30,30,30,0.8)}\
        
th{color:black;background:rgba(34,177,201,0.8)}\
        </
style></br></br></br><div class=t><table>\
        <
h1>TOP 5 <span style=color:#99FF00;>|</span> MEGA-GUNGAME v1.0b</h1>\
        
<tr align=center>\
        <
th width=5%%>#\
        
<th width=50%%>Nombre\
        <
th width=15%%>gg win\
        <
th width=15%%>Frags\
        <
th width=15%%>muertes");

    new gg_win, frags, death, headshot, pj[32], keyindex;

    for(new position = 1; position <= toploop; position++)
    {
        keyindex = adv_vault_sort_position(g_VaultSaveData, g_VaultSort, position);

        if(!adv_vault_get_prepare(g_VaultSaveData, keyindex)) 
        continue;

        frags = adv_vault_get_field(g_VaultSaveData, g_sFrags[TYPE_FRAG]);
        death = adv_vault_get_field(g_VaultSaveData, g_sFrags[TYPE_DEATH]);
        headshot = adv_vault_get_field(g_VaultSaveData, g_sFrags[TYPE_HEADSHOT]);
        gg_win = adv_vault_get_field(g_VaultSaveData, g_sGungameState[PLAYER_STATE_WIN]);

        adv_vault_get_keyname(g_VaultSaveData, keyindex, pj, 31);

        len += formatex(motd[len], sizeof motd-len, "
<tr align=center>");
        len += formatex(motd[len], sizeof motd-len, "
<td class=%s>%d", ((position%2) == 0) ? "c1" : "c2", position);
        len += formatex(motd[len], sizeof motd-len, "
<td class=%s>%s", ((position%2) == 0) ? "c1" : "c2", pj);
        len += formatex(motd[len], sizeof motd-len, "
<td class=%s>%d", ((position%2) == 0) ? "c1" : "c2", gg_win);
        len += formatex(motd[len], sizeof motd-len, "
<td class=%s>%(HS: %d)", ((position%2) == 0) ? "c1" : "c2", frags, headshot);
        len += formatex(motd[len], sizeof motd-len, "
<td class=%s>%d", ((position%2) == 0) ? "c1" : "c2", death);
    }

    len += formatex(motd[len], sizeof motd-len, "
</div></body>");
    show_motd(index, motd, "
TOP 10 MEGA-GUNGAME");
}

public VoteMapGungame() {
    g_StateGungame = MG_STATE_VOTEMAP;

    new szTitle[150];
    formatex(szTitle, charsmax(szTitle), "
\y[AMXX] \wVotacion de mapa");
    new menu = menu_create(szTitle, "
HandlerVoteMap");

    if (g_iCountVoteMap) {
        
        for (new vMaps = 0; vMaps <MAX_MAPS_VOTE; vMaps++) {
            if (g_lMapsVote[vMaps][0]) {
                menu_additem(menu, g_lMapsVote[vMaps]);
            }
        }
        menu_setprop(menu, MPROP_NUMBER_COLOR, "
\r");
        menu_setprop(menu, MPROP_NEXTNAME, "
Siguiente");
        menu_setprop(menu, MPROP_BACKNAME, "
Anterior");
        menu_setprop(menu, MPROP_EXITNAME, "
Cerrar");
        for (new players = 1; players <= g_MaxPlayers; players++) {
            if (!IsPlayerValid(players))
            continue;

            menu_display(players, menu);
        }    
    }
    else {
        for (new players = 1; players <= g_MaxPlayers; players++) {
            if (!IsPlayerValid(players))
            continue;

            show_menu(players, 0, "
^n");
        }    

        if (task_exists(TASK_VOTEMAP))
        remove_task(TASK_VOTEMAP);
    }
    set_task(1.0, "
VoteMapGungame", TASK_VOTEMAP);
}

public HandlerVoteMap(index, menu, item) {
    if (item == MENU_EXIT) {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }

    if (g_iPlayerVoteMap[index] == -1 && g_StateGungame == MG_STATE_VOTEMAP && g_iCountVoteMap) {
        g_iPlayerVoteMap[index] = item;
        client_print_color( 0, print_team_default, "
%^3%n^1 Voto por:^%s", gsTag, index, g_lMapsVote[g_iPlayerVoteMap[index]]);
        client_cmd( index, "
speak buttons/button9" );
    }

    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

public EndVoteMap() {

    new MapsVotes[MAX_MAPS_VOTE];
    new BestMap = 0;

    for (new vMaps = 0; vMaps <MAX_MAPS_VOTE; vMaps++)
    {
        for (new Players = 1; Players <=g_MaxPlayers; Players++) {
            if(IsPlayerValid(Players)){
                if( g_iPlayerVoteMap[Players] == vMaps )
                MapsVotes[vMaps] += 1;
            }
        }

        if (MapsVotes[vMaps] >= MapsVotes[BestMap]) {
            BestMap = vMaps;
        }
    }

    client_print_color(0, print_team_default, "
%s Siguiente mapa:^%s", gsTag, g_lMapsVote[BestMap]);
    DisPlayMotd(g_PlayerBestMap);
    set_task(TIME_SVC_INTERMISSION, "
ChangeMap", BestMap + TASK_CHANGEMAP);
}

public ChangeMap(BestMap) {
    BestMap = TASK_ID(BestMap, TASK_CHANGEMAP);
    server_cmd("
changelevel ^"%s^"", g_lMapsVote[BestMap]);
}

public CurWeapon(index) {
    if (IsPlayerValid(index) && g_bPlayerSpeed[index]) {
        set_user_maxspeed(index, get_user_maxspeed(index) * EFFECT_SPEED_VELOCITY);
    }
}

public UpdateIcon(index) {
    if(is_user_alive(index) && g_StateGungame == MG_STATE_ONLINE)
    {
        new iwpn, sprite[192];
        remove_weapon_icon(index);

        iwpn = g_szLevels[g_iPlayerLevel[index]][CSW_WEAPON];

        switch(iwpn) {
            case CSW_P228: sprite = "
d_p228";
            case CSW_SCOUT: sprite = "
d_scout";
            case CSW_HEGRENADE: sprite = "
d_grenade";
            case CSW_XM1014: sprite = "
d_xm1014";
            case CSW_C4: sprite = "
d_c4";
            case CSW_MAC10: sprite = "
d_mac10";
            case CSW_AUG: sprite = "
d_aug";
            case CSW_SMOKEGRENADE: sprite = "
d_grenade";
            case CSW_ELITE: sprite = "
d_elite";
            case CSW_FIVESEVEN: sprite = "
d_fiveseven";
            case CSW_UMP45: sprite = "
d_ump45";
            case CSW_SG550: sprite = "
d_sg550";
            case CSW_GALIL: sprite = "
d_galil";
            case CSW_FAMAS: sprite = "
d_famas";
            case CSW_USP: sprite = "
d_usp";
            case CSW_MP5NAVY: sprite = "
d_mp5navy";
            case CSW_M249: sprite = "
d_m249";
            case CSW_M3: sprite = "
d_m3";
            case CSW_M4A1: sprite = "
d_m4a1";
            case CSW_TMP: sprite = "
d_tmp";
            case CSW_G3SG1: sprite = "
d_g3sg1";
            case CSW_FLASHBANG: sprite = "
d_flashbang";
            case CSW_DEAGLE: sprite = "
d_deagle";
            case CSW_SG552: sprite = "
d_sg552";
            case CSW_AK47: sprite = "
d_ak47";
            case CSW_KNIFE: sprite = "
d_knife";
            case CSW_P90: sprite = "
d_p90";
            case CSW_VEST: sprite = "
suit_full";
            case CSW_VESTHELM: sprite = "
suithelmet_full";
            case CSW_GLOCK18: sprite = "
d_glock18";
            case CSW_AWP: sprite = "
d_awp";
            case 0: sprite = "";
            default: sprite = "";
        }

        if (is_user_connected(index) && !is_user_bot(index) && is_user_alive(index)) {
            if (equali(sprite, "")) {
                remove_weapon_icon(index);
            } 
            else {
                new IconOrigin[3] = {0, 0, 0};
                message_begin(MSG_ONE, g_MsgStatusIcon, IconOrigin, index);
                write_byte(1);
                write_string(sprite);
                write_byte(30);         // red
                write_byte(255);         // green
                write_byte(30);         // blue
                message_end();
            }
            g_PlayerIcon[index] = sprite;
        }
    }
    return PLUGIN_CONTINUE;



stock ResetUserMaxSpeed( iPlayerID ) {
    // credits to connor?
    new Float:fMaxSpeed;
    
    switch( get_user_weapon( iPlayerID ) )
    {
        case CSW_SG550, CSW_AWP, CSW_G3SG1 :                     fMaxSpeed = 210.0;
        case CSW_M249 :                                         fMaxSpeed = 220.0;
        case CSW_AK47 :                                         fMaxSpeed = 221.0;
        case CSW_M3, CSW_M4A1 :                                 fMaxSpeed = 230.0;
        case CSW_SG552 :                                         fMaxSpeed = 235.0;
        case CSW_XM1014, CSW_AUG, CSW_GALIL, CSW_FAMAS :         fMaxSpeed = 240.0;
        case CSW_P90 :                                           fMaxSpeed = 245.0;
        case CSW_SCOUT :                                         fMaxSpeed = 260.0;
        default :                                                 fMaxSpeed = 250.0;
    }
    
    set_user_maxspeed( iPlayerID, fMaxSpeed );
}

stock IsPlayerValid(index) {
    if (!is_user_connected(index))
    return false;
    if (is_user_hltv(index))
    return false;
    if (is_user_bot(index))
    return false;
    
    return true;
}
stock PlayerKills(killer, victim) {
    SetPlayerKills(killer);
    ResetPlayerKills(victim); 
}

stock SetPlayerKills(attack) {

    g_iPlayerKills[attack]++;

    if (g_iPlayerKills[attack] >= 3) {
        set_hudmessage(random_num(50, 255), random_num(50, 255), random_num(50, 255), 0.1, 0.70, 0, 6.0, 3.5);
        ShowSyncHudMsg(0, g_Sync[2], "
[AMXX] %n Hizo racha de %d kills", attack, g_iPlayerKills[attack]);
    }

    if (g_iPlayerKills[attack] >= get_pcvar_num(g_pCvars[MG_SUPER_RACHA_KILLS])) {

        if(attack == g_PlayerSuperKnife)
        return;

        set_task(1.0, "
SetPlayerEfect", attack, _, _, "a", .repeat = 3);
        SetSuperKnife(attack);
    }
}

stock ResetPlayerKills(victim) {
    g_iPlayerKills[victim] = 0;

    if (g_PlayerSuperKnife == victim) {
        g_PlayerSuperKnife = EOS;
    }
}

stock SetSuperKnifeEffect(attack, victim) {
    SetFadeRed(attack);
    set_hudmessage(255, 0, 0, -1.0, 0.30, 0, 1.0, 3.5);
    ShowSyncHudMsg(0, g_Sync[3], "
\
        <------------------[
PELIGRO]------------------>^n\
        %
n FUE VICTIMA DE %n^n\
        
CON EL SUPER CUCHILLO^n\
        <------------------[
PELIGRO]------------------>", victim, attack);

    g_iPlayerLevel[victim] = 0;
    g_iPlayerPoint[victim] = 0;
    g_PlayerSuperKnife = 0;
    client_print_color(victim, print_team_default, "
%s Fuiste victima de^%n^1 con ^3Super Knife^1 tu nivel fue reseteado", gsTag, attack);


public SetPlayerEfect(attack) {

    if(g_StateGungame != MG_STATE_ONLINE)
    return;

    for (new players = 0; players <= g_MaxPlayers; players++) {
        if (!IsPlayerValid(players))
        continue;
        if (!(1 <= get_user_team(players) <= 2))
        continue;
        SetFadeRed(players);
    }

    client_cmd(0, "
spk %s", snd_alert);
    set_hudmessage(255, 0, 0, -1.0, 0.30, 0, 1.0, 3.5);
    ShowSyncHudMsg(0, g_Sync[4], "
\
        <------------------[
PELIGRO]------------------>^n\
        %
n^n TIENE EL SUPER CUCHILLO^n\
        <------------------[
PELIGRO]------------------>", attack);
}

stock SetSuperKnife(attack) {
    g_PlayerSuperKnife = attack;
}

stock SetFadeRed(index) {
    message_begin(MSG_ONE, g_MsgScreenFade, {0,0,0}, index);
    write_short(1<<10);
    write_short(1<<10);
    write_short(0x0000);
    write_byte(255);
    write_byte(0);
    write_byte(0);
    write_byte(80);
    message_end();
}

stock RoboPlayerLevel(Ladron, victim) {
    if (g_iPlayerLevel[Ladron] < sizeof g_szLevels - 2 && g_iPlayerLevel[victim] > 0) {
        g_iPlayerLevel[Ladron]++;
        g_iPlayerLevel[victim]--;
        g_iPlayerPoint[Ladron] = g_szLevels[g_iPlayerLevel[Ladron] - 1][POINTS];
        g_iPlayerPoint[victim] = g_szLevels[g_iPlayerLevel[victim] - 1][POINTS];

        client_print_color(0, print_team_default, "
%s El jugador: ^4%n^1. Le robo^3 1^1 nivel a:^%n^1 por acuchillarlo", gsTag, Ladron, victim);
    }
}

stock GetPlayersTop(PlayersTop[MAX_PLAYERS_TOP_HUD]) {
    new bool:Client_Invalid = false;

    for (new t = 0; t <sizeof(PlayersTop); t++) {
        for (new Player = 1; Player <= g_MaxPlayers; Player++)
        {
            if (!IsPlayerValid(Player))
            continue;
            if (!(1 <= get_user_team(Player) <= 2))
            continue;

            for (new iTop = 0; iTop <sizeof(PlayersTop); iTop++) {
                if(Player == PlayersTop[iTop]) {
                    Client_Invalid = true;
                    break;
                }
                else {
                    Client_Invalid = false;
                }
            }

            if (Client_Invalid)
            continue;

            if (GetPlayerPoints(Player) >= GetPlayerPoints(PlayersTop[t])) {
                PlayersTop[t] = Player;
            }
        }
    }
}

stock SetPlayerPoints(Player, Points) {
    g_iPlayerPoint[Player] = Points;

    if (g_iPlayerPoint[Player] < 0) {
        g_iPlayerPoint[Player] = 0;
    }

    new bool:bAument = false;

    if (Points) {
        while (g_iPlayerPoint[Player] >= g_szLevels[g_iPlayerLevel[Player]][POINTS]) {

            if (g_iPlayerLevel[Player] >= sizeof g_szLevels - 1) {
                EndMegaGungame(Player);
                return;
            }

            g_iPlayerLevel[Player]++;
            bAument = true;        
        }    

        SetHudPoints(Player);
    }
    else {
        if (g_iPlayerLevel[Player] > 1) {

            g_iPlayerLevel[Player]--;
            g_iPlayerPoint[Player] = g_szLevels[g_iPlayerLevel[Player] - 1][POINTS]
            client_print_color(Player, print_team_default, "
%s Desendiste al nivel ^4(%d/%d)^1Equipamiento:^%s", gsTag, g_iPlayerLevel[Player], sizeof g_szLevels - 1, g_szLevels[g_iPlayerLevel[Player]][WPN_REALNAME]);
        }    
    }
    if(bAument) {
        client_print_color(Player, print_team_default, "
%s Aumentaste de nivel ^4(%d/%d)^1Equipamiento:^%s", gsTag, g_iPlayerLevel[Player], sizeof g_szLevels - 1, g_szLevels[g_iPlayerLevel[Player]][WPN_REALNAME]);
        client_cmd(Player, "
spk %s", snd_lvlup);
    }
}

stock SetHudPoints(player) {
    if(!(g_szLevels[g_iPlayerLevel[player]][POINTS] - g_iPlayerPoint[player]))
    return;

    set_hudmessage(255, 255, 255, -1.0, 0.60, 1, 1.0, 6.0);
    ShowSyncHudMsg(player, g_Sync[5], "
Puntos: %d/%]^nTe faltan %i para subir de nivel", 
        g_iPlayerPoint[player], g_szLevels[g_iPlayerLevel[player]][POINTS], g_szLevels[g_iPlayerLevel[player]][POINTS] - g_iPlayerPoint[player]);
}

stock GetPlayerPoints(Player) {
    return g_iPlayerPoint[Player];
}

stock GetPlayersNum() {
    new iCount = 0;

    for (new Players = 1; Players <= g_MaxPlayers; Players++)
    {
        if (!IsPlayerValid(Players))
        continue;
        if (!(1 <= get_user_team(Players) <= 2))
        continue;
        iCount++;
    }
    return iCount;    
}

stock SetPlayerFake(index) {
    if (get_user_team(index) == 1)
        cs_set_user_model(index, "
gign");
    else if (get_user_team(index) == 2)
        cs_set_user_model(index, "
leet");
}

ServerGungame() {
    set_cvar_string("
mp_freezetime", "0");
    set_cvar_string("
mp_autoteambalance", "0");
    set_cvar_string("
mp_auto_join_team", "1");
    set_cvar_string("
mp_refill_bpammo_weapons", "3");
    set_cvar_string("
mp_forcerespawn", "3");
    set_cvar_string("
mp_roundrespawn_time", "3");
    set_cvar_string("
mp_round_infinite", "1");
    set_cvar_string("
mp_respawn_immunitytime", "5");
    set_cvar_string("
mp_infinite_ammo", "2");
    set_cvar_string("
mp_roundtime", "80");

    if( g_ModeGungame == 0)
        set_cvar_string("
mp_freeforall", "1");

    set_cvar_string("
sv_restart", "1");
}

stock remove_weapon_icon(index) {
    if (is_user_connected(index) && !is_user_bot(index) && is_user_alive(index)) {
        new IconOrigin[3] = {0, 0, 0};
        message_begin(MSG_ONE, g_MsgStatusIcon, IconOrigin, index);
        write_byte(0);
        write_string(g_PlayerIcon[index]);
        message_end();
    }
}

stock LoadMaps() {
    new mapname[32];
    get_mapname(mapname, 31);

    new configsdir[128];
    get_localinfo("
amxx_configsdir", configsdir, charsmax(configsdir));
    add(configsdir, charsmax(configsdir), "
/maps.ini");
    
    new fh;
    fh = fopen(configsdir, "
r");

    if (!fh)
    {
        server_print("
[AMXX-Mega Gungame 1.0bNo se pudo abrir el archivo de mapasLeyendo el directorio de mapas");
        LoadMaps();
        return;
    }

    new Line[32];
    static Count = 0;

    while (!feof(fh))
    {
        fgets(fh, Line, charsmax(Line));
        replace(Line, charsmax(Line), "
.bsp", "");
        trim(Line);

        if (!Line[0] || Line[0] == ';' || (Line[0] == '/' && Line[1] == '/') || Line[0] == '#' || !is_map_valid(Line) || equal(mapname, Line)) {
            continue;
        }

        format(g_lMaps[Count], charsmax(g_lMaps[]), Line);
        Count++;
    }

    fclose(fh);    
}

stock LoadMapsVote() {
    for (new Maps = 0; Maps <MAX_MAPS_VOTE; Maps++) {
        if (!g_lMapsVote[Maps][0]) {
            formatex(g_lMapsVote[Maps], charsmax(g_lMapsVote[]), g_lMaps[GetRandomMap()]);
        }
    }
}

stock GetRandomMap()
{
    new iMapas[MAX_MAPS];
    new count = 0;

    for(new maps = 0; maps <MAX_MAPS; maps++)
    {
        if (!g_lMaps[maps][0]) 
            continue;

    
        iMapas[count] = maps;
        count++;
    }

    new number_random = random_num(0, count);

    new bMapExist = false;
    for (new vMaps = 0; vMaps <MAX_MAPS_VOTE; vMaps++)
    {    
        if (!g_lMapsVote[vMaps][0])
            continue;
            
        if (equal(g_lMaps[iMapas[number_random]], g_lMapsVote[vMaps])) {
            bMapExist = true;
            break;
        }
    }    

    if(bMapExist) { 
        return GetRandomMap();
    }

    return iMapas[number_random];
}

stock adv_vault(const index, const TYPE_SAVE) {

    new name[32];
    get_user_name(index, name, charsmax(name));

    switch(TYPE_SAVE) {
        case SD_PLAYER_SAVEDATA: {
            if (is_user_connected(index)) {
                adv_vault_set_start(g_VaultSaveData);

                for (new i = 0; i <sizeof g_sFrags; i++) 
                adv_vault_set_field(g_VaultSaveData, g_sFrags[i], g_sPlayerFrags[index][i]); 

                for (new i = 0; i <sizeof g_sGungameState; i++) 
                adv_vault_set_field(g_VaultSaveData, g_sGungameState[i], g_sPlayerGungameState[index][i]);                                 
                adv_vault_set_end(g_VaultSaveData, 0, name);
            }
        }
        case SD_PLAYER_LOADDATA: {
            if (is_user_connected(index) && (adv_vault_get_prepare(g_VaultSaveData, _, name))) {
                for (new i = 0; i <sizeof g_sFrags; i++) 
                    g_sPlayerFrags[index][i] = adv_vault_get_field(g_VaultSaveData, g_sFrags[i]);        
                for (new i = 0; i <sizeof g_sGungameState; i++) 
                    g_sPlayerGungameState[index][i] = adv_vault_get_field(g_VaultSaveData, g_sGungameState[i]);        
            }
        }
        case SD_INIT: {
            g_VaultSaveData = adv_vault_open(db_savedata, false);
            for (new i = 0; i <sizeof g_sFrags; i++) {
                g_sFrags[i] = adv_vault_register_field(g_VaultSaveData, fmt("
TYPE-FRAG-%d", i + 1));
            }
            for (new i = 0; i <sizeof g_sGungameState; i++) {
                g_sGungameState[i] = adv_vault_register_field(g_VaultSaveData, fmt("
TYPE-GGSTATE-%d", i + 1));
            }
            adv_vault_init(g_VaultSaveData);
            g_VaultSort = adv_vault_sort_create(g_VaultSaveData, ORDER_DESC, 0, 2000, g_sGungameState[PLAYER_STATE_WIN]);

        }
    }

Responder
#12
(30/06/2020, 10:05 PM)Chema escribió: El adjunto está bien tabulado... descargalo y dejate de embromar.

Buen aporte ale. Mario

pd: después veo el código y por ahí te comento algo e.e

Gracias chemita

(30/06/2020, 09:58 PM)Kross escribió: Bastante bueno, podrías subir devuelta el código tabulado ya que me da una pereza descargar el adjunto o tabularlo xd.

pd: te robare el diseño del top xdd.


xD es un modelo de motd publico, otra cosa debido a la restricción de caracteres de formatex, lo maximo de tops que creo que puedas usar en ese diseño es 5 como lo tengo...
Responder
#13
(30/06/2020, 09:58 PM)Kross escribió: pd: te robare el diseño del top xdd.



[tr]
buen aporte
[Imagen: zcsztw-4.png] [Imagen: 6u5fj2-4.png]
[Imagen: linkedin_thumb_image.png][Imagen: 76561198283253977.png][Imagen: linkedin_thumb_image.png]
Responder
#14
(30/06/2020, 08:08 PM)Alejandro escribió: Gracias, Se de que hablas, no use for por que uso varias formas de uso en la tienda algunas por tiempo y distintos valores que no creo que con un for hubiese quedado, pero si puedo optimizarlo lo haré en la siguiente version!
https://amxmodx-es.com/Thread-TUT-Plugin...subplugins

Respecto al motd podrias subir el css a paginas publicas y luego importarlo con link en la etiqueta head
[Imagen: b_350_20_323957_202743_f19a15_111111.png]

Estudia siempre; el tiempo es oro, lo material se puede recuperar pero el tiempo no se puede recuperar.
(02/10/2016, 05:05 PM)meTaLiCroSS escribió: Siempre me gusta ayudar cuando alguien esta interesado realmente en ver que esta programando.
(08/08/2019, 05:32 PM)meTaLiCroSS escribió: grax x el dato cr4ck


Mis aportes

PLUGINS
MAPAS
Menú LANG [SF] Sistema de Frags
Say System (Admin Prefix)
Responder
#15
(03/07/2020, 08:10 PM)totopizza escribió: https://amxmodx-es.com/Thread-TUT-Plugin...subplugins

Respecto al motd podrias subir el css a paginas publicas y luego importarlo con link en la etiqueta head

Verga, nunca pensé en esa idea, gracias por la idea
Responder
#16
(30/06/2020, 09:58 PM)Kross escribió: pd: te robare el diseño del top xdd.



pd: vuena aportasion
Responder
#17
Hola Buenas, Probé este mod y funciona bien pero hay un problema único es cuando se hace la votación de mapa que sale así
1.- de_dust2
2.- de_nuke
3.- de_train
4.- de_nuke
5.- de_train

Se repite hasta 2 veces un mismo mapa en el menú de votación y en el hud.
Responder
#18
(07/02/2021, 12:16 AM)Manuelito1208 escribió: Hola Buenas, Probé este mod y funciona bien pero hay un problema único es cuando se hace la votación de mapa que sale así
1.- de_dust2
2.- de_nuke
3.- de_train
4.- de_nuke
5.- de_train

Se repite hasta 2 veces un mismo mapa en el menú de votación y en el hud.
Uhmm, con ello quieres decir que si ya jugaste dust2 puedes volver a jugarlo?
Responder
#19
(07/02/2021, 11:02 AM)Alejandro escribió: Uhmm, con ello quieres decir que si ya jugaste dust2 puedes volver a jugarlo?

Si por que sale en la votación y se repite 2 veces de_dust2 en el mismo menú o otro mapa.
Responder
#20
Falta el sonidito <3
Responder
#21
Bueno Aporte <3
[Imagen: b_560_95_1.png]
Responder
#22
how fix this error?

L 12/09/2023 - 18:04:32: -------- Mapchange to gg_33_circa --------
L 12/09/2023 - 18:04:32: [AMXX] Plugin "AMXX-MegaGungame1-1.amxx" failed to load: Plugin uses an unknown function (name "adv_vault_sort_create") - check your modules.ini.
Executing ReGameDLL Configuration File
Responder
#23
(10/12/2023, 12:01 AM)Shadowless escribió: how fix this error?

L 12/09/2023 - 18:04:32: -------- Mapchange to gg_33_circa --------
L 12/09/2023 - 18:04:32: [AMXX] Plugin "AMXX-MegaGungame1-1.amxx" failed to load: Plugin uses an unknown function (name "adv_vault_sort_create") - check your modules.ini.
Executing ReGameDLL Configuration File

(29/06/2020, 04:46 PM)Alejandro escribió: ¿Que requiere?
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)