Mensajes: 2,454
Temas: 14
Registro en: Oct 2013
Reputación:
51
06/04/2017, 01:37 AM
(Última modificación: 06/04/2017, 01:37 AM por Manu.)
Puede que por error haya subido otra versión pero lo dudo mucho, acabo de probar y puedo registrarme, identificarme y auto-loguearme correctamente. Voy a corroborar que puede estar causando el problema.
No hago trabajos privados. Si necesitás ayuda, abrí un nuevo tema.
¿Buscás un ejemplo o algún modo de juego? Podés echarle un vistazo a mis aportes.
Mensajes: 2,074
Temas: 110
Registro en: Apr 2014
Que buen aporte, en Drunk Games me encanta jugarlo
Mensajes: 2,454
Temas: 14
Registro en: Oct 2013
Reputación:
51
06/04/2017, 05:18 PM
(Última modificación: 06/04/2017, 05:22 PM por Manu.)
Verifiquen que no sacaron ni modificaron nada del código que no pertenezca a la sección modificable, porque es muy raro que el baúl tire errores como esos... es como si g_iVault no hubiera sido asignada lo cual es imposible con el código tal cual está.
Deben usar la última versión de Orpheu junto con el Round Terminator y sus signatures actualizadas, AMX Mod X 1.8.3 y Adv_Vault en su última versión. Verifiquen que el baúl se crea correctamente dentro de amxmodx/data/carpeta_del_adv_vault y cuéntenme los resultados .
PD: Comparé el código que tengo con el del zip con DiffNow y no hay diferencia alguna, si bien lo probé muy poco lo poco que lo probé funcionó perfectamente (con 4 personas reales).
No hago trabajos privados. Si necesitás ayuda, abrí un nuevo tema.
¿Buscás un ejemplo o algún modo de juego? Podés echarle un vistazo a mis aportes.
Mensajes: 130
Temas: 39
Registro en: Oct 2016
Reputación:
0
Cuando lo adaptas a AMX Mod X 1.8.2 ?
Mensajes: 3,238
Temas: 47
Registro en: Feb 2015
Reputación:
34
(26/06/2017, 07:18 AM)destroy3r escribió: Cuando lo adaptas a AMX Mod X 1.8.2 ?
Tanto te cuesta instalar el amx 1.8.3?
Mensajes: 7,178
Temas: 93
Registro en: Aug 2014
Reputación:
63
28/06/2017, 10:25 PM
(Última modificación: 29/06/2017, 12:38 AM por Hinami.)
alguien que me pase el orpheu me da errores con eso xd
eviten responder mierda v:
me da error con la signature endround algo así
me descargue varios y termine usando el roundcontrol!
gracias si alguien leyo esto
Mensajes: 166
Temas: 33
Registro en: Apr 2014
Reputación:
0
alguien tiene las signatures?
solo falta eso
(13/08/2018, 07:59 PM)KrR10VnZl escribió: Usted tiene un retraso de otro mundo, pon de tu parte coño, como es posible que preguntes cual código? muchacho mongólico si dice código, él se refiere al SMA del CTF, dios mio y si no te gusta que te digan que tienes un retraso magistral, astral del otro mundo pon de tú parte y no hagas preguntas tontas.
Mensajes: 2,454
Temas: 14
Registro en: Oct 2013
Reputación:
51
(26/11/2017, 06:55 AM)Yoshi Saw escribió: alguien tiene las signatures?
solo falta eso
Cuando formatié no guardé nada de las signatures y ese estilo de cosas así que no las tengo, pero podés hacer lo que hizo NkkI y reemplazar el Round Terminator por las natives del Round Control. O mejor aún, en caso de tener ReAPI, utilizar lo que te provee ReAPI para controlar la ronda (creo que tiene algo).
Caso aparte: hace poco a un amigo le surgieron unos pequeños bugs durante el testing prolongado que los arreglé pero no los anoté, por lo que esta versión tiene dichos pequeños bugs. Si alguien los encuentra me los hace saber y actualizo. Saludos.
No hago trabajos privados. Si necesitás ayuda, abrí un nuevo tema.
¿Buscás un ejemplo o algún modo de juego? Podés echarle un vistazo a mis aportes.
Mensajes: 2,454
Temas: 14
Registro en: Oct 2013
Reputación:
51
22/01/2018, 02:27 PM
(Última modificación: 22/01/2018, 02:29 PM por Manu.)
Les dejo otra versión libre de errores (o eso creo) pero que utiliza ReAPI. No tiene estadísticas ni nada, es solo el core. Necesita nada más que los módulos base y el ReAPI.
PD: Lo separé de un HG privado que funciona a la perfección, a pedido de un usuario que reportó problemas con el otro publicado. Abrir preferentemente con Sublime Text, así se ve correctamente identado.
Código PHP: #include <amxmodx> #include <fakemeta> #include <engine> #include <hamsandwich> #include <cstrike> #include <fun> #include <reapi> #include <xs>
/* ================================================================================= * [ Global stuff ] * ================================================================================= */
#define PLAYER_ARRAY 33
#define IsPlayer(%0) ( 1 <= %0 <= 32 )
#define GetPlayerBit(%0,%1) ( IsPlayer(%1) && ( %0 & ( 1 << ( %1 & 31 ) ) ) ) #define SetPlayerBit(%0,%1) ( IsPlayer(%1) && ( %0 |= ( 1 << ( %1 & 31 ) ) ) ) #define ClearPlayerBit(%0,%1) ( IsPlayer(%1) && ( %0 &= ~( 1 << ( %1 & 31 ) ) ) )
#define ClientPlaySound(%0,%1) client_cmd( %0, "spk %s", %1 )
const m_iRadiosLeft = 192; const m_iVGUI = 510;
const MAIN_MENU_KEYS = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3; const CONFIG_MENU_KEYS = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6; const TEAM_MENU_KEYS = MENU_KEY_1|MENU_KEY_2|MENU_KEY_5|MENU_KEY_6;
const TASK_RESTART = 100; const TASK_IMMUNITY = 200; const TASK_DUELIMMUNITY = 300; const TASK_JOINTEAM = 400;
const Float:JOINTEAM_DELAY = 1.0;
enum _:Game_Status { Game_Waiting, Game_Started }
enum _:Round_Type { Round_None, Round_Countdown, Round_Immunity, Round_Normal, Round_Versus }
enum _:Teams { Team_Unassigned, Team_Terrorist, Team_Antiterrorist, Team_Spectator }
enum _:Weapon_Data { Weapon_Name[ 16 ], Weapon_Item[ 32 ], Weapon_Index, Weapon_Min, Weapon_Max }
new const g_eWeapons[ ][ Weapon_Data ] = { { "Glock-18", "weapon_glock18", CSW_GLOCK18, 8, 15 }, { "USP", "weapon_usp", CSW_USP, 4, 9 }, { "P228", "weapon_p228", CSW_P228, 3, 11 }, { "Deagle", "weapon_deagle", CSW_DEAGLE, 2, 6 }, { "FiveSeven", "weapon_fiveseven", CSW_FIVESEVEN, 6, 18 }, { "Dual Elites", "weapon_elite", CSW_ELITE, 12, 27 }, { "TMP", "weapon_tmp", CSW_TMP, 6, 24 }, { "MAC-10", "weapon_mac10", CSW_MAC10, 11, 29 }, { "MP5-Navy", "weapon_mp5navy", CSW_MP5NAVY, 10, 22 }, { "Ump-45", "weapon_ump45", CSW_UMP45, 14, 25 }, { "P90", "weapon_p90", CSW_P90, 12, 38 }, { "M3", "weapon_m3", CSW_M3, 3, 7 }, { "XM-1014", "weapon_xm1014", CSW_XM1014, 1, 7 }, { "Famas", "weapon_famas", CSW_FAMAS, 6, 21 }, { "Galil", "weapon_galil", CSW_GALIL, 12, 32 }, { "Scout", "weapon_scout", CSW_SCOUT, 1, 5 }, { "Awp", "weapon_awp", CSW_AWP, 1, 2 }, { "AK-47", "weapon_ak47", CSW_AK47, 4, 14 }, { "M4A1", "weapon_m4a1", CSW_M4A1, 4, 14 }, { "SG550", "weapon_sg550", CSW_SG550, 6, 17 }, { "AUG", "weapon_aug", CSW_AUG, 7, 15 } };
new const g_szBoxBrokenSound[ ] = "hungergames/picked.wav"; new const g_szBoxModel[ ] = "models/hungergames/Supply.mdl";
new const g_szBoxClassname[ ] = "HGBox"; new const g_szGameThinkClassname[ ] = "GameThink";
new const g_szCache_InfoTarget[ ] = "info_target"; new const g_szCache_WeaponKnife[ ] = "weapon_knife"; new const g_szCache_DoorClass[ ] = "hg_puerta"; new const g_szCache_VipStart[ ] = "info_vip_start";
new const g_szPrefix[ ] = "HG";
new g_iConnected; new g_iAlive; new g_iCountdown; new g_iGame; new g_iBoxGibs; new g_iPlayerWeaponStrip; new g_bNoDamage; new g_iHideWeapon; new g_iCrosshair; new g_iScoreInfo; new g_iGameThink; new g_iFirstRound; new g_iFrozen; new g_iTributes; new g_iShowMenu; new g_iVGUIMenu; new g_iBoxes; new g_iVisibleBoxes; new g_iRoundStatus;
new bool:g_bLoaded;
new g_szSaveFile[ 64 ]; new g_iPlayerScore[ 33 ]; new Float:g_flDuelPosition[ 4 ][ 3 ];
/* ================================================================================= * [ Plugin events ] * ================================================================================= */
public plugin_precache( ) { precache_sound( g_szBoxBrokenSound ); precache_model( g_szBoxModel ); g_iPlayerWeaponStrip = create_entity( "player_weaponstrip" ); g_iBoxGibs = precache_model( "models/woodgibs.mdl" ); }
public plugin_init( ) { register_plugin( "Hunger Games", "1.0", "Manu" );
RegisterHam( Ham_Spawn, "player", "OnPlayerSpawn_Post", true, true ); RegisterHam( Ham_TakeDamage, "player", "OnPlayerTakeDamage_Pre", false, true ); RegisterHam( Ham_CS_Player_ResetMaxSpeed, "player", "OnPlayerResetMaxSpeed_Pre", false, true ); register_forward( FM_ClientKill, "OnClientKill_Pre", false );
register_touch( g_szBoxClassname, "player", "OnBoxTouch" ); register_think( g_szGameThinkClassname, "OnGameThink" );
register_event( "DeathMsg", "Event_DeathMsg", "a" ); register_event( "ResetHUD", "Event_ResetHUD", "be" ); register_logevent( "Event_RoundStart", 2, "1=Round_Start" ); register_logevent( "Event_RoundEnd", 2, "1=Round_End" ); register_message( ( g_iShowMenu = get_user_msgid( "ShowMenu" ) ), "Message_ShowMenu" ); register_message( ( g_iVGUIMenu = get_user_msgid( "VGUIMenu" ) ), "Message_VGUIMenu" );
register_menucmd( register_menuid( "Main Menu", false ), MAIN_MENU_KEYS, "MainMenuHandler" ); register_menucmd( register_menuid( "Config Menu", false ), CONFIG_MENU_KEYS, "ConfigMenuHandler" ); register_menucmd( register_menuid( "Team_Select", true ), TEAM_MENU_KEYS, "TeamSelectMenuHandler" );
register_clcmd( "jointeam", "ClientCommand_TeamChoosing" ); register_clcmd( "chooseteam", "ClientCommand_TeamChoosing" ); register_clcmd( "hg_fly", "ClientCommand_Fly" ); g_bNoDamage = true; g_iRoundStatus = Round_None; g_iGameThink = create_entity( g_szCache_InfoTarget ); g_iHideWeapon = get_user_msgid( "HideWeapon" ); g_iCrosshair = get_user_msgid( "Crosshair" ); g_iScoreInfo = get_user_msgid( "ScoreInfo" ); set_msg_block( get_user_msgid( "Radar" ), BLOCK_SET ); entity_set_string( g_iGameThink, EV_SZ_classname, g_szGameThinkClassname ); set_cvar_num( "mp_autoteambalance", 0 ); set_cvar_num( "mp_limitteams", 0 ); set_cvar_num( "mp_friendlyfire", 1 ); set_cvar_num( "mp_tkpunish", 0 ); set_cvar_num( "mp_autokick", 0 ); set_cvar_num( "mp_freezetime", 0 ); set_cvar_num( "mp_freeforall", 1 ); set_cvar_num( "mp_round_infinite", 1 ); set_cvar_num( "mp_max_teamkills", 0 ); set_cvar_float( "mp_buytime", 0.0 ); LoadConfigs( ); LoadDuelPoints( ); if( !is_regamedll( ) ) { pause( "Recurso faltante: ReGameDLL." ); } }
/* ================================================================================= * [ Tasks, Events & Messages ] * ================================================================================= */
public Event_RoundStart( ) { if( ( g_iFirstRound == 2 ) && !task_exists( TASK_RESTART ) ) { set_task( 10.0, "Task_RestartGame" ); client_print_color( 0, print_team_default, "^4[%s]^1 Bienvenidos al modo^4 Hunger Games v1.0 Beta^1!", g_szPrefix ); client_print_color( 0, print_team_default, "^4[%s]^1 El juego comenzara en^3 diez segundos^1. Preparense!", g_szPrefix ); } else if( g_iGame == Game_Started ) { g_iFirstRound = 0; g_bNoDamage = true; g_iRoundStatus = Round_Countdown; g_iCountdown = 10; DrawBoxes( ); UpdateScoreBoard( ); entity_set_float( g_iGameThink, EV_FL_nextthink, get_gametime( ) ); } }
public Event_ResetHUD( iId ) { message_begin( MSG_ONE_UNRELIABLE, g_iHideWeapon, _, iId ); write_byte( ( 1<<4 | 1<<5 ) ); message_end( ); message_begin( MSG_ONE_UNRELIABLE, g_iCrosshair, _, iId ); write_byte( 0 ); message_end( ); }
public Event_RoundEnd( ) { remove_task( TASK_DUELIMMUNITY ); g_bNoDamage = true; g_iRoundStatus = Round_None; entity_set_float( g_iGameThink, EV_FL_nextthink, 0.0 ); }
public Event_DeathMsg( ) { static iKiller; iKiller = read_data( 1 ); static iVictim; iVictim = read_data( 2 ); ClearPlayerBit( g_iAlive, iVictim ); if( g_iGame != Game_Started ) { return PLUGIN_CONTINUE; } if( iKiller != iVictim && GetPlayerBit( g_iConnected, iKiller ) ) { g_iPlayerScore[ iKiller ]++;
UpdateScore( iKiller ); } CheckRoundStatus( ); return PLUGIN_CONTINUE; }
public Message_VGUIMenu( iMessage, iDest, iId ) { if( !GetPlayerBit( g_iConnected, iId ) ) { return PLUGIN_CONTINUE; } if( get_msg_arg_int( 1 ) == 2 ) { return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; }
public Message_ShowMenu( iMessage, iDest, iId ) { if( !GetPlayerBit( g_iConnected, iId ) ) { return PLUGIN_CONTINUE; } static const FIRST_JOIN_MSG[ ] = "#Team_Select"; static const FIRST_JOIN_MSG_SPEC[ ] = "#Team_Select_Spect"; static const INGAME_JOIN_MSG[ ] = "#IG_Team_Select"; static const INGAME_JOIN_MSG_SPEC[ ] = "#IG_Team_Select_Spect"; static szMenuCode[ 64 ]; get_msg_arg_string( 4, szMenuCode, sizeof( szMenuCode ) - 1 ); if( equal( szMenuCode, FIRST_JOIN_MSG ) || equal( szMenuCode, FIRST_JOIN_MSG_SPEC ) || equal( szMenuCode, INGAME_JOIN_MSG ) || equal( szMenuCode, INGAME_JOIN_MSG_SPEC ) ) { return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; }
public Task_DuelImmunity( ) { for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iAlive, iPlayer ) ) { UnfreezePlayer( iPlayer ); } } }
public Task_RestartGame( ) { g_iFirstRound = 1; server_cmd( "sv_restartround 1" ); server_exec( ); client_print_color( 0, print_team_default, "^4[%s]^1 Reiniciando ronda...", g_szPrefix ); }
public Task_ForceJoinTeam( iTask ) { new iId = iTask - TASK_JOINTEAM; if( !GetPlayerBit( g_iConnected, iId ) ) { return; } if( !is_user_bot( iId ) ) { new iRestore = get_pdata_int( iId, m_iVGUI ); if( iRestore & ( 1<<0 ) ) { set_pdata_int( iId, m_iVGUI, iRestore & ~( 1<<0 ) ); } set_msg_block( g_iShowMenu, BLOCK_SET ); set_msg_block( g_iVGUIMenu, BLOCK_SET ); engclient_cmd( iId, "jointeam", "2" ); engclient_cmd( iId, "joinclass", "5" ); set_msg_block( g_iShowMenu, BLOCK_NOT ); set_msg_block( g_iVGUIMenu, BLOCK_NOT ); if( iRestore & ( 1<<0 ) ) { set_pdata_int( iId, m_iVGUI, iRestore ); } menu_cancel( iId ); } CheckGameStatus( ); }
/* ================================================================================= * [ CBasePlayer Forwards ] * ================================================================================= */
public OnPlayerSpawn_Post( iId ) { if( !is_user_alive( iId ) ) { return HAM_IGNORED; } SetPlayerBit( g_iAlive, iId ); RemovePlayerWeapons( iId ); cs_set_user_armor( iId, 0, CS_ARMOR_NONE ); give_item( iId, g_szCache_WeaponKnife ); set_pdata_int( iId, m_iRadiosLeft, 0 );
if( g_iRoundStatus == Round_Countdown ) { FreezePlayer( iId ); }
return HAM_IGNORED; }
public OnPlayerTakeDamage_Pre( iVictim, iInflictor, iAttacker, Float:flDamage, iDamageBits ) { if( g_bNoDamage ) { return HAM_SUPERCEDE; } return HAM_IGNORED; }
public OnPlayerResetMaxSpeed_Pre( iId ) { if( GetPlayerBit( g_iFrozen, iId ) ) { return HAM_SUPERCEDE; } return HAM_IGNORED; }
/* ================================================================================= * [ General Forwards ] * ================================================================================= */
public OnBoxTouch( iBox, iId ) { if( !GetPlayerBit( g_iAlive, iId ) || ( g_iGame != Game_Started ) || ( entity_get_int( iBox, EV_INT_solid ) == SOLID_NOT ) ) { return PLUGIN_CONTINUE; } static iOrigin[ 3 ]; static Float:flOrigin[ 3 ]; entity_get_vector( iBox, EV_VEC_origin, flOrigin ); FVecIVec( flOrigin, iOrigin ); message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); write_byte( TE_BREAKMODEL ); write_coord( iOrigin[ 0 ] ); write_coord( iOrigin[ 1 ] ); write_coord( iOrigin[ 2 ] ); write_coord( 16 ); write_coord( 16 ); write_coord( 16 ); write_coord( 25 ); write_coord( 25 ); write_coord( 25 ); write_byte( 10 ); write_short( g_iBoxGibs ); write_byte( 10 ); write_byte( 25 ); write_byte( 0x08 ); message_end( ); emit_sound( iBox, CHAN_AUTO, g_szBoxBrokenSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); entity_set_int( iBox, EV_INT_solid, SOLID_NOT ); entity_set_int( iBox, EV_INT_effects, entity_get_int( iBox, EV_INT_effects ) | EF_NODRAW ); g_iVisibleBoxes -= 1; GiveRandomItem( iId ); return PLUGIN_CONTINUE; }
public OnGameThink( iEnt ) { new iAlive; for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iAlive, iPlayer ) ) { iAlive++; } } set_dhudmessage( 255, 140, 0, -1.0, 0.1, 0, 1.0, 1.0 ); switch( g_iRoundStatus ) { case Round_Countdown: { g_iCountdown--; show_dhudmessage( 0, "Juegos del hambre^nLa ronda comenzara en %d", g_iCountdown ); if( g_iCountdown <= 0 ) { OpenDoors( ); g_iCountdown = 20; g_iRoundStatus = Round_Immunity; for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iConnected, iPlayer ) ) { UnfreezePlayer( iPlayer ); } } } else { for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iConnected, iPlayer ) && !GetPlayerBit( g_iFrozen, iPlayer ) ) { FreezePlayer( iPlayer ); } } } } case Round_Immunity: { show_dhudmessage( 0, "Juegos del hambre^nCajas: %d/%d^n^nLa inmunidad terminara en %d", g_iVisibleBoxes, g_iBoxes, g_iCountdown ); if( --g_iCountdown < 0 ) { for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iAlive, iPlayer ) ) { give_item( iPlayer, g_szCache_WeaponKnife ); } } g_bNoDamage = false; g_iCountdown = 240; g_iRoundStatus = Round_Normal; g_iTributes = iAlive; } } case Round_Normal: { show_dhudmessage( 0, "Juegos del hambre^nTributos: %d/%d | Cajas: %d/%d^n^n^nTiempo restante: %d", iAlive, g_iTributes, g_iVisibleBoxes, g_iBoxes, g_iCountdown ); if( g_iCountdown == 160 ) { DrawBoxes( ); } if( --g_iCountdown < 0 ) { rg_round_end( 3.0, WINSTATUS_DRAW, ROUND_END_DRAW ); } } case Round_Versus: { show_dhudmessage( 0, "Juegos del hambre^nTributos: %d/%d | Cajas: %d/%d", iAlive, g_iTributes, g_iVisibleBoxes, g_iBoxes ); if( --g_iCountdown < 0 ) { rg_round_end( 3.0, WINSTATUS_DRAW, ROUND_END_DRAW ); } } } entity_set_float( iEnt, EV_FL_nextthink, get_gametime( ) + 1.0 ); }
public OnClientKill_Pre( iId ) { client_print_color( iId, print_team_default, "^x04[%s]^x01 No puedes suicidarte.", g_szPrefix ); return FMRES_SUPERCEDE; }
/* ================================================================================= * [ Client-related stuff ] * ================================================================================= */
public ClientCommand_Fly( iId ) { if( get_user_flags( iId ) & ADMIN_RCON ) { set_user_noclip( iId, get_user_noclip( iId ) ? 0 : 1 ); } return PLUGIN_HANDLED; }
public ClientCommand_TeamChoosing( iId ) { ShowMainMenu( iId ); return PLUGIN_HANDLED; }
public client_putinserver( iId ) { SetPlayerBit( g_iConnected, iId ); set_task( JOINTEAM_DELAY, "Task_ForceJoinTeam", iId + TASK_JOINTEAM ); }
public client_disconnected( iId ) { new bWasAlive = GetPlayerBit( g_iAlive, iId ); g_iPlayerScore[ iId ] = 0; ClearPlayerBit( g_iConnected, iId ); ClearPlayerBit( g_iAlive, iId ); CheckGameStatus( ); if( ( g_iGame != Game_Waiting ) && bWasAlive ) { CheckRoundStatus( ); } }
/* ================================================================================= * [ Client menus ] * ================================================================================= */
ShowMainMenu( iId ) { static iLen, szData[ 256 ]; iLen = formatex( szData, charsmax( szData ), "\wModo: \yHunger Games \d- \wVersion: \y1.0b^n^n" );
iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[1] \wAyuda^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[2] \wReglas^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[3] %sAdministracion^n^n", get_user_flags( iId ) & ADMIN_RCON ? "\w" : "\d" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[0] \wSalir" ); show_menu( iId, MAIN_MENU_KEYS, szData, -1, "Main Menu" ); return PLUGIN_HANDLED; }
public MainMenuHandler( iId, iKey ) { if( !GetPlayerBit( g_iConnected, iId ) || ( iKey > 2 ) ) { return PLUGIN_HANDLED; } switch( iKey ) { case 0: { client_print_color( iId, print_team_default, "^4[%s]^3 Hunger Games^1 es un modo de supervivencia todos contra todos.", g_szPrefix ); client_print_color( iId, print_team_default, "^4[%s]^1 Debes de recoger cajas para conseguir armas y/o items variados.", g_szPrefix ); } case 1: { client_print_color( iId, print_team_default, "^4[%s]^1 No debes quedarte en una misma posicion por demasiado tiempo.", g_szPrefix ); client_print_color( iId, print_team_default, "^4[%s]^1 No debes hacer equipo con otros jugadores.", g_szPrefix ); } case 2: { if( get_user_flags( iId ) & ADMIN_RCON ) { ShowConfigMenu( iId ); } } } return PLUGIN_HANDLED; }
ShowConfigMenu( iId ) { static iLen, szData[ 256 ]; iLen = formatex( szData, charsmax( szData ), "\yConfiguraciones:^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[1] \yCrear \wuna caja donde apuntas^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[2] \yRemover \wla caja que apuntas^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[3] \yPrimera \wubicacion de duelos^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[4] \ySegunda \wubicacion de duelos^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[5] \yGuardar^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[6] \dCancelar^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[!] \wCajas creadas: \r%d", g_iBoxes ); show_menu( iId, CONFIG_MENU_KEYS, szData, -1, "Config Menu" ); return PLUGIN_HANDLED; }
public ConfigMenuHandler( iId, iKey ) { if( !GetPlayerBit( g_iConnected, iId ) || iKey > 4 ) { return PLUGIN_HANDLED; } static iBox, iBody, szClassname[ 16 ], Float:flOrigin[ 3 ]; switch( iKey ) { case 0: { GetBoxLocation( iId, flOrigin ); CreateBox( flOrigin ); client_print_color( iId, print_team_default, "^x04[%s]^x01 Se creo una caja donde apuntabas.", g_szPrefix ); } case 1: { get_user_aiming( iId, iBox, iBody ); if( is_valid_ent( iBox ) ) { entity_get_string( iBox, EV_SZ_classname, szClassname, charsmax( szClassname ) ); if( equal( szClassname, g_szBoxClassname ) ) { g_iBoxes--; remove_entity( iBox ); client_print_color( iId, print_team_default, "^x04[%s]^x01 La caja se ha removido correctamente.", g_szPrefix ); } } else { client_print_color( iId, print_team_default, "^x04[%s]^x01 No estabas apuntando a una entidad valida.", g_szPrefix ); } } case 2: { entity_get_vector( iId, EV_VEC_origin, g_flDuelPosition[ 0 ] ); client_print_color( iId, print_team_default, "^x04[%s]^x01 Nueva ubicacion establecida. Recuerde guardar los cambios.", g_szPrefix ); } case 3: { entity_get_vector( iId, EV_VEC_origin, g_flDuelPosition[ 1 ] ); client_print_color( iId, print_team_default, "^x04[%s]^x01 Nueva ubicacion establecida. Recuerde guardar los cambios.", g_szPrefix ); } case 4: { SaveConfigs( ); client_print_color( iId, print_team_default, "^x04[%s]^x01 Configuraciones guardadas correctamente.", g_szPrefix ); } } ShowConfigMenu( iId ); return PLUGIN_HANDLED; }
public TeamSelectMenuHandler( iId, iKeys ) { ShowMainMenu( iId ); return PLUGIN_HANDLED; }
/* ================================================================================= * [ Private functions ] * ================================================================================= */
LoadConfigs( ) { new iLines, iFile, Float:flOrigin[ 3 ], szOrigin[ 3 ][ 8 ], szMap[ 32 ], szData[ 128 ]; get_localinfo( "amxx_configsdir", szData, charsmax( szData ) ); get_mapname( szMap, charsmax( szMap ) ); if( !( szMap[ 0 ] == 'h' && szMap[ 1 ] == 'g' && szMap[ 2 ] == '_' ) ) { set_fail_state( "Mapa no compatible. Requisito: hg_" ); } formatex( g_szSaveFile, charsmax( g_szSaveFile ), "%s/hungergames", szData ); if( !dir_exists( g_szSaveFile ) ) { mkdir( g_szSaveFile ); return; } formatex( g_szSaveFile, charsmax( g_szSaveFile ), "%s/hungergames/%s.ini", szData, szMap ); if( file_exists( g_szSaveFile ) ) { iFile = fopen( g_szSaveFile, "rt" ); g_bLoaded = true; while( !feof( iFile ) ) { fgets( iFile, szData, charsmax( szData ) ); trim( szData ); if( parse( szData, szOrigin[ 0 ], charsmax( szOrigin[ ] ), szOrigin[ 1 ], charsmax( szOrigin[ ] ), szOrigin[ 2 ], charsmax( szOrigin[ ] ) ) != 3 ) { continue; } if( iLines < 2 ) { g_flDuelPosition[ iLines ][ 0 ] = str_to_float( szOrigin[ 0 ] ); g_flDuelPosition[ iLines ][ 1 ] = str_to_float( szOrigin[ 1 ] ); g_flDuelPosition[ iLines ][ 2 ] = str_to_float( szOrigin[ 2 ] ); } else { flOrigin[ 0 ] = str_to_float( szOrigin[ 0 ] ); flOrigin[ 1 ] = str_to_float( szOrigin[ 1 ] ); flOrigin[ 2 ] = str_to_float( szOrigin[ 2 ] ); CreateBox( flOrigin ); } iLines++; } fclose( iFile ); } }
LoadDuelPoints( ) { new iEnt, iCount; while( ( iEnt = find_ent_by_class( iEnt, g_szCache_VipStart ) ) > 0 ) { entity_get_vector( iEnt, EV_VEC_origin, g_flDuelPosition[ iCount++ ] ); } }
SaveConfigs( ) { new iEnt, iFile, Float:flOrigin[ 3 ]; if( file_exists( g_szSaveFile ) ) { delete_file( g_szSaveFile ); } iFile = fopen( g_szSaveFile, "wt" ); fprintf( iFile, "%0.3f %0.3f %0.3f^n", g_flDuelPosition[ 0 ][ 0 ], g_flDuelPosition[ 0 ][ 1 ], g_flDuelPosition[ 0 ][ 2 ] ); fprintf( iFile, "%0.3f %0.3f %0.3f^n", g_flDuelPosition[ 1 ][ 0 ], g_flDuelPosition[ 1 ][ 1 ], g_flDuelPosition[ 1 ][ 2 ] ); while( ( iEnt = find_ent_by_class( iEnt, g_szBoxClassname ) ) != 0 ) { entity_get_vector( iEnt, EV_VEC_origin, flOrigin ); fprintf( iFile, "%0.3f %0.3f %0.3f^n", flOrigin[ 0 ], flOrigin[ 1 ], flOrigin[ 2 ] ); } fclose( iFile ); }
CreateBox( Float:flOrigin[ 3 ] ) { static iEnt; iEnt = create_entity( g_szCache_InfoTarget ); entity_set_string( iEnt, EV_SZ_classname, g_szBoxClassname ); entity_set_model( iEnt, g_szBoxModel ); entity_set_size( iEnt, Float:{ -8.0, -8.0, 0.0 }, Float:{ 8.0, 8.0, 8.0 } ); entity_set_origin( iEnt, flOrigin ); entity_set_int( iEnt, EV_INT_solid, SOLID_BBOX ); entity_set_int( iEnt, EV_INT_movetype, MOVETYPE_TOSS ); drop_to_floor( iEnt ); g_iBoxes++; }
DrawBoxes( ) { new iEnt; while( ( iEnt = find_ent_by_class( iEnt, g_szBoxClassname ) ) != 0 ) { entity_set_int( iEnt, EV_INT_solid, SOLID_BBOX ); entity_set_int( iEnt, EV_INT_effects, entity_get_int( iEnt, EV_INT_effects ) & ~EF_NODRAW ); } g_iVisibleBoxes = g_iBoxes; }
GetBoxLocation( const iId, Float:flOrigin[ 3 ] ) { static Float:flAngles[ 3 ], Float:flViewOfs[ 3 ], Float:flEnd[ 3 ]; entity_get_vector( iId, EV_VEC_origin, flOrigin ); entity_get_vector( iId, EV_VEC_view_ofs, flViewOfs ); entity_get_vector( iId, EV_VEC_v_angle, flAngles ); xs_vec_add( flOrigin, flViewOfs, flOrigin ); angle_vector( flAngles, ANGLEVECTOR_FORWARD, flAngles ); xs_vec_mul_scalar( flAngles, 2048.0, flAngles ); xs_vec_add( flOrigin, flAngles, flEnd ); trace_line( iId, flOrigin, flEnd, flOrigin ); flOrigin[ 2 ] += 64.0; }
RemovePlayerWeapons( iId ) { dllfunc( DLLFunc_Use, g_iPlayerWeaponStrip, iId ); }
OpenDoors( ) { new iEnt; while( ( iEnt = find_ent_by_tname( iEnt, g_szCache_DoorClass ) ) != 0 ) { force_use( iEnt, iEnt ); } }
UpdateScore( iId ) { entity_set_float( iId, EV_FL_frags, float( g_iPlayerScore[ iId ] ) );
message_begin( MSG_BROADCAST, g_iScoreInfo ); write_byte( iId ); write_short( g_iPlayerScore[ iId ] ); write_short( get_user_deaths( iId ) ); write_short( 0 ); write_short( get_user_team( iId ) ); message_end( ); }
UpdateScoreBoard( ) { message_begin( MSG_BROADCAST, g_iScoreInfo ); write_byte( 33 ); write_short( 0 ); write_short( 0 ); write_short( 0 ); write_short( 0 ); message_end( ); }
GiveRandomItem( const iId ) { static iRandom, iBullets; iRandom = random( 5 ); if( iRandom > 0 ) { iRandom = random( sizeof( g_eWeapons ) ); iBullets = random_num( g_eWeapons[ iRandom ][ Weapon_Min ], g_eWeapons[ iRandom ][ Weapon_Max ] ); if( !user_has_weapon( iId, g_eWeapons[ iRandom ][ Weapon_Index ] ) ) { cs_set_weapon_ammo( give_item( iId, g_eWeapons[ iRandom ][ Weapon_Item ] ), iBullets ); client_print_color( iId, print_team_grey, "^4[%s]^1 Hallaste ^4%s^1 con ^4%d^1 balas.", g_szPrefix, g_eWeapons[ iRandom ][ Weapon_Name ], iBullets); } else { cs_set_user_bpammo( iId, g_eWeapons[ iRandom ][ Weapon_Index ], cs_get_user_bpammo( iId, g_eWeapons[ iRandom ][ Weapon_Index ] ) + iBullets ); client_print_color( iId, print_team_grey, "^4[%s]^1 Hallaste^4 %d balas^1 para tu^4 %s^1.", g_szPrefix, iBullets, g_eWeapons[ iRandom ][ Weapon_Name ] ); } } else { if( random( 2 ) > 0 ) { if( user_has_weapon( iId, CSW_HEGRENADE ) ) { cs_set_user_bpammo( iId, CSW_HEGRENADE, cs_get_user_bpammo( iId, CSW_HEGRENADE ) + 1 ); client_print_color( iId, print_team_grey, "^4[%s]^1 Hallaste otra^4 granada explosiva^1.", g_szPrefix ); } else { give_item( iId, "weapon_hegrenade" ); client_print_color( iId, print_team_grey, "^4[%s]^1 Hallaste una^4 granada explosiva^1.", g_szPrefix ); } } else { new iAmount = random_num( 10, 100 ), CsArmorType:iType; cs_set_user_armor( iId, cs_get_user_armor( iId, iType ) + iAmount, CS_ARMOR_VESTHELM ); client_print_color( iId, print_team_default, "^4[%s]^1 Hallaste ^4%d^1 puntos de ^4chaleco^1", g_szPrefix, iAmount); } } }
CheckGameStatus( ) { new iCount; for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iConnected, iPlayer ) ) { iCount++; } } if( iCount >= 3 ) { if( g_iGame != Game_Started ) { g_iGame = Game_Started; g_iFirstRound = 2; server_cmd( "sv_restartround 1" ); server_exec( ); client_print_color( 0, print_team_default, "^x04[%s]^x01 Se consiguieron jugadores suficientes. Preparense!", g_szPrefix ); } } else if( g_iGame != Game_Waiting ) { g_iGame = Game_Waiting; g_bNoDamage = true; rg_round_end( 3.0, WINSTATUS_DRAW, ROUND_END_DRAW ); client_print_color( 0, print_team_default, "^x04[%s]^x01 No hay jugadores suficientes para el modo.", g_szPrefix ); } }
CheckRoundStatus( ) { new iPlayers[ 32 ], iNum; for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iAlive, iPlayer ) ) { iPlayers[ iNum++ ] = iPlayer; } } if( iNum < 3 ) { if( iNum > 1 ) { FreezePlayer( iPlayers[ 0 ] ); FreezePlayer( iPlayers[ 1 ] ); entity_set_float( iPlayers[ 0 ], EV_FL_health, 300.0 ); entity_set_float( iPlayers[ 1 ], EV_FL_health, 300.0 ); RemovePlayerWeapons( iPlayers[ 0 ] ); RemovePlayerWeapons( iPlayers[ 1 ] ); give_item( iPlayers[ 0 ], g_szCache_WeaponKnife ); give_item( iPlayers[ 1 ], g_szCache_WeaponKnife ); if( g_bLoaded ) { entity_set_origin( iPlayers[ 0 ], g_flDuelPosition[ 0 ] ); entity_set_origin( iPlayers[ 1 ], g_flDuelPosition[ 1 ] ); } set_task( 3.0, "Task_DuelImmunity", TASK_DUELIMMUNITY ); g_iCountdown = 60; g_iRoundStatus = Round_Versus; } else { rg_round_end( 10.0, WINSTATUS_DRAW, ROUND_END_DRAW ); } } }
FreezePlayer( const iId ) { entity_set_float( iId, EV_FL_maxspeed, 1.0 ); entity_set_vector( iId, EV_VEC_velocity, Float:{ 0.0, 0.0, 0.0 } ); SetPlayerBit( g_iFrozen, iId ); }
UnfreezePlayer( const iId ) { ClearPlayerBit( g_iFrozen, iId ); ExecuteHamB( Ham_CS_Player_ResetMaxSpeed, iId ); }
No hago trabajos privados. Si necesitás ayuda, abrí un nuevo tema.
¿Buscás un ejemplo o algún modo de juego? Podés echarle un vistazo a mis aportes.
Mensajes: 255
Temas: 7
Registro en: Sep 2017
Reputación:
3
Que bugs corregiste?.
Y que tiene/falta que no tenia el anterior?
Plata o Plomo Usted decide
- Pablo Emilio Escobar Gaviria -
Mensajes: 2,454
Temas: 14
Registro en: Oct 2013
Reputación:
51
22/01/2018, 04:05 PM
(Última modificación: 22/01/2018, 04:17 PM por Manu.)
(22/01/2018, 03:19 PM)Juansi Loow escribió: Que bugs corregiste?.
Y que tiene/falta que no tenia el anterior?
Los bugs no los sé, tiene un par corregidos pero no los anoté. No tiene las estadísticas (top, rank, level, cuentas). Las estadísticas y ese tipo de cosas las tengo pero son privadas.
No hago trabajos privados. Si necesitás ayuda, abrí un nuevo tema.
¿Buscás un ejemplo o algún modo de juego? Podés echarle un vistazo a mis aportes.
Mensajes: 7,178
Temas: 93
Registro en: Aug 2014
Reputación:
63
(22/01/2018, 03:19 PM)Juansi Loow escribió: Que bugs corregiste?.
Y que tiene/falta que no tenia el anterior?
Que más le vas a pedir.
Mensajes: 4,247
Temas: 94
Registro en: Mar 2014
Reputación:
58
Gracias treki :o
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
PLUGINSMAPAS
Menú LANG
[SF] Sistema de Frags
Say System (Admin Prefix)
Mensajes: 127
Temas: 36
Registro en: Apr 2014
Reputación:
1
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
(23/01/2018, 03:21 PM)MR10 escribió: Un crack treki ♡
Teamooo
Igual no es para HL marcos JAJAJA
Bien ahí Manu!
Mensajes: 127
Temas: 36
Registro en: Apr 2014
Reputación:
1
(23/01/2018, 04:33 PM)Chema escribió: (23/01/2018, 03:21 PM)MR10 escribió: Un crack treki ♡
Teamooo
Igual no es para HL marcos JAJAJA
Bien ahí Manu!
Pfff si supieras jajaja, despues te mando una movie
Mensajes: 34
Temas: 6
Registro en: Jan 2018
Reputación:
0
Necesito un module que es <safemenu> alguien me lo puede pasar?
Mensajes: 5
Temas: 1
Registro en: Apr 2017
Reputación:
0
buenas...
disculpen mi ignorancia, necesito ayuda.
me sale que este trozo de codigo tira error
for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ )
gracias :33
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
(28/02/2018, 09:19 PM)TuTioMax escribió: buenas...
disculpen mi ignorancia, necesito ayuda.
me sale que este trozo de codigo tira error
for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ )
gracias :33
Ya te dije en el tema que creaste.
AmxModX 1.8.3
Mensajes: 2,454
Temas: 14
Registro en: Oct 2013
Reputación:
51
(28/02/2018, 09:19 PM)TuTioMax escribió: buenas...
disculpen mi ignorancia, necesito ayuda.
me sale que este trozo de codigo tira error
for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ )
gracias :33
Cita:Requisitos:
- AMX Mod X 1.8.3.
No hago trabajos privados. Si necesitás ayuda, abrí un nuevo tema.
¿Buscás un ejemplo o algún modo de juego? Podés echarle un vistazo a mis aportes.
Mensajes: 2
Temas: 1
Registro en: Jan 2018
Reputación:
0
ola tengo un problema. El plugin round terminator me manda error en el servidor que ya ni corre. lo desabilito y empieza bien pero no tengo el mod activado
Mensajes: 166
Temas: 33
Registro en: Apr 2014
Reputación:
0
29/03/2018, 06:50 AM
(Última modificación: 29/03/2018, 06:51 AM por Yoshi Saw.)
Mira Forge, este es el de Treki que si funciona perfectamente sólo falta que tu añadas lo demás
(22/01/2018, 02:27 PM)Treki escribió: Les dejo otra versión libre de errores (o eso creo) pero que utiliza ReAPI. No tiene estadísticas ni nada, es solo el core. Necesita nada más que los módulos base y el ReAPI.
PD: Lo separé de un HG privado que funciona a la perfección, a pedido de un usuario que reportó problemas con el otro publicado. Abrir preferentemente con Sublime Text, así se ve correctamente identado.
Código PHP: #include <amxmodx> #include <fakemeta> #include <engine> #include <hamsandwich> #include <cstrike> #include <fun> #include <reapi> #include <xs>
/* ================================================================================= * [ Global stuff ] * ================================================================================= */
#define PLAYER_ARRAY 33
#define IsPlayer(%0) ( 1 <= %0 <= 32 )
#define GetPlayerBit(%0,%1) ( IsPlayer(%1) && ( %0 & ( 1 << ( %1 & 31 ) ) ) ) #define SetPlayerBit(%0,%1) ( IsPlayer(%1) && ( %0 |= ( 1 << ( %1 & 31 ) ) ) ) #define ClearPlayerBit(%0,%1) ( IsPlayer(%1) && ( %0 &= ~( 1 << ( %1 & 31 ) ) ) )
#define ClientPlaySound(%0,%1) client_cmd( %0, "spk %s", %1 )
const m_iRadiosLeft = 192; const m_iVGUI = 510;
const MAIN_MENU_KEYS = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3; const CONFIG_MENU_KEYS = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6; const TEAM_MENU_KEYS = MENU_KEY_1|MENU_KEY_2|MENU_KEY_5|MENU_KEY_6;
const TASK_RESTART = 100; const TASK_IMMUNITY = 200; const TASK_DUELIMMUNITY = 300; const TASK_JOINTEAM = 400;
const Float:JOINTEAM_DELAY = 1.0;
enum _:Game_Status { Game_Waiting, Game_Started }
enum _:Round_Type { Round_None, Round_Countdown, Round_Immunity, Round_Normal, Round_Versus }
enum _:Teams { Team_Unassigned, Team_Terrorist, Team_Antiterrorist, Team_Spectator }
enum _:Weapon_Data { Weapon_Name[ 16 ], Weapon_Item[ 32 ], Weapon_Index, Weapon_Min, Weapon_Max }
new const g_eWeapons[ ][ Weapon_Data ] = { { "Glock-18", "weapon_glock18", CSW_GLOCK18, 8, 15 }, { "USP", "weapon_usp", CSW_USP, 4, 9 }, { "P228", "weapon_p228", CSW_P228, 3, 11 }, { "Deagle", "weapon_deagle", CSW_DEAGLE, 2, 6 }, { "FiveSeven", "weapon_fiveseven", CSW_FIVESEVEN, 6, 18 }, { "Dual Elites", "weapon_elite", CSW_ELITE, 12, 27 }, { "TMP", "weapon_tmp", CSW_TMP, 6, 24 }, { "MAC-10", "weapon_mac10", CSW_MAC10, 11, 29 }, { "MP5-Navy", "weapon_mp5navy", CSW_MP5NAVY, 10, 22 }, { "Ump-45", "weapon_ump45", CSW_UMP45, 14, 25 }, { "P90", "weapon_p90", CSW_P90, 12, 38 }, { "M3", "weapon_m3", CSW_M3, 3, 7 }, { "XM-1014", "weapon_xm1014", CSW_XM1014, 1, 7 }, { "Famas", "weapon_famas", CSW_FAMAS, 6, 21 }, { "Galil", "weapon_galil", CSW_GALIL, 12, 32 }, { "Scout", "weapon_scout", CSW_SCOUT, 1, 5 }, { "Awp", "weapon_awp", CSW_AWP, 1, 2 }, { "AK-47", "weapon_ak47", CSW_AK47, 4, 14 }, { "M4A1", "weapon_m4a1", CSW_M4A1, 4, 14 }, { "SG550", "weapon_sg550", CSW_SG550, 6, 17 }, { "AUG", "weapon_aug", CSW_AUG, 7, 15 } };
new const g_szBoxBrokenSound[ ] = "hungergames/picked.wav"; new const g_szBoxModel[ ] = "models/hungergames/Supply.mdl";
new const g_szBoxClassname[ ] = "HGBox"; new const g_szGameThinkClassname[ ] = "GameThink";
new const g_szCache_InfoTarget[ ] = "info_target"; new const g_szCache_WeaponKnife[ ] = "weapon_knife"; new const g_szCache_DoorClass[ ] = "hg_puerta"; new const g_szCache_VipStart[ ] = "info_vip_start";
new const g_szPrefix[ ] = "HG";
new g_iConnected; new g_iAlive; new g_iCountdown; new g_iGame; new g_iBoxGibs; new g_iPlayerWeaponStrip; new g_bNoDamage; new g_iHideWeapon; new g_iCrosshair; new g_iScoreInfo; new g_iGameThink; new g_iFirstRound; new g_iFrozen; new g_iTributes; new g_iShowMenu; new g_iVGUIMenu; new g_iBoxes; new g_iVisibleBoxes; new g_iRoundStatus;
new bool:g_bLoaded;
new g_szSaveFile[ 64 ]; new g_iPlayerScore[ 33 ]; new Float:g_flDuelPosition[ 4 ][ 3 ];
/* ================================================================================= * [ Plugin events ] * ================================================================================= */
public plugin_precache( ) { precache_sound( g_szBoxBrokenSound ); precache_model( g_szBoxModel ); g_iPlayerWeaponStrip = create_entity( "player_weaponstrip" ); g_iBoxGibs = precache_model( "models/woodgibs.mdl" ); }
public plugin_init( ) { register_plugin( "Hunger Games", "1.0", "Manu" );
RegisterHam( Ham_Spawn, "player", "OnPlayerSpawn_Post", true, true ); RegisterHam( Ham_TakeDamage, "player", "OnPlayerTakeDamage_Pre", false, true ); RegisterHam( Ham_CS_Player_ResetMaxSpeed, "player", "OnPlayerResetMaxSpeed_Pre", false, true ); register_forward( FM_ClientKill, "OnClientKill_Pre", false );
register_touch( g_szBoxClassname, "player", "OnBoxTouch" ); register_think( g_szGameThinkClassname, "OnGameThink" );
register_event( "DeathMsg", "Event_DeathMsg", "a" ); register_event( "ResetHUD", "Event_ResetHUD", "be" ); register_logevent( "Event_RoundStart", 2, "1=Round_Start" ); register_logevent( "Event_RoundEnd", 2, "1=Round_End" ); register_message( ( g_iShowMenu = get_user_msgid( "ShowMenu" ) ), "Message_ShowMenu" ); register_message( ( g_iVGUIMenu = get_user_msgid( "VGUIMenu" ) ), "Message_VGUIMenu" );
register_menucmd( register_menuid( "Main Menu", false ), MAIN_MENU_KEYS, "MainMenuHandler" ); register_menucmd( register_menuid( "Config Menu", false ), CONFIG_MENU_KEYS, "ConfigMenuHandler" ); register_menucmd( register_menuid( "Team_Select", true ), TEAM_MENU_KEYS, "TeamSelectMenuHandler" );
register_clcmd( "jointeam", "ClientCommand_TeamChoosing" ); register_clcmd( "chooseteam", "ClientCommand_TeamChoosing" ); register_clcmd( "hg_fly", "ClientCommand_Fly" ); g_bNoDamage = true; g_iRoundStatus = Round_None; g_iGameThink = create_entity( g_szCache_InfoTarget ); g_iHideWeapon = get_user_msgid( "HideWeapon" ); g_iCrosshair = get_user_msgid( "Crosshair" ); g_iScoreInfo = get_user_msgid( "ScoreInfo" ); set_msg_block( get_user_msgid( "Radar" ), BLOCK_SET ); entity_set_string( g_iGameThink, EV_SZ_classname, g_szGameThinkClassname ); set_cvar_num( "mp_autoteambalance", 0 ); set_cvar_num( "mp_limitteams", 0 ); set_cvar_num( "mp_friendlyfire", 1 ); set_cvar_num( "mp_tkpunish", 0 ); set_cvar_num( "mp_autokick", 0 ); set_cvar_num( "mp_freezetime", 0 ); set_cvar_num( "mp_freeforall", 1 ); set_cvar_num( "mp_round_infinite", 1 ); set_cvar_num( "mp_max_teamkills", 0 ); set_cvar_float( "mp_buytime", 0.0 ); LoadConfigs( ); LoadDuelPoints( ); if( !is_regamedll( ) ) { pause( "Recurso faltante: ReGameDLL." ); } }
/* ================================================================================= * [ Tasks, Events & Messages ] * ================================================================================= */
public Event_RoundStart( ) { if( ( g_iFirstRound == 2 ) && !task_exists( TASK_RESTART ) ) { set_task( 10.0, "Task_RestartGame" ); client_print_color( 0, print_team_default, "^4[%s]^1 Bienvenidos al modo^4 Hunger Games v1.0 Beta^1!", g_szPrefix ); client_print_color( 0, print_team_default, "^4[%s]^1 El juego comenzara en^3 diez segundos^1. Preparense!", g_szPrefix ); } else if( g_iGame == Game_Started ) { g_iFirstRound = 0; g_bNoDamage = true; g_iRoundStatus = Round_Countdown; g_iCountdown = 10; DrawBoxes( ); UpdateScoreBoard( ); entity_set_float( g_iGameThink, EV_FL_nextthink, get_gametime( ) ); } }
public Event_ResetHUD( iId ) { message_begin( MSG_ONE_UNRELIABLE, g_iHideWeapon, _, iId ); write_byte( ( 1<<4 | 1<<5 ) ); message_end( ); message_begin( MSG_ONE_UNRELIABLE, g_iCrosshair, _, iId ); write_byte( 0 ); message_end( ); }
public Event_RoundEnd( ) { remove_task( TASK_DUELIMMUNITY ); g_bNoDamage = true; g_iRoundStatus = Round_None; entity_set_float( g_iGameThink, EV_FL_nextthink, 0.0 ); }
public Event_DeathMsg( ) { static iKiller; iKiller = read_data( 1 ); static iVictim; iVictim = read_data( 2 ); ClearPlayerBit( g_iAlive, iVictim ); if( g_iGame != Game_Started ) { return PLUGIN_CONTINUE; } if( iKiller != iVictim && GetPlayerBit( g_iConnected, iKiller ) ) { g_iPlayerScore[ iKiller ]++;
UpdateScore( iKiller ); } CheckRoundStatus( ); return PLUGIN_CONTINUE; }
public Message_VGUIMenu( iMessage, iDest, iId ) { if( !GetPlayerBit( g_iConnected, iId ) ) { return PLUGIN_CONTINUE; } if( get_msg_arg_int( 1 ) == 2 ) { return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; }
public Message_ShowMenu( iMessage, iDest, iId ) { if( !GetPlayerBit( g_iConnected, iId ) ) { return PLUGIN_CONTINUE; } static const FIRST_JOIN_MSG[ ] = "#Team_Select"; static const FIRST_JOIN_MSG_SPEC[ ] = "#Team_Select_Spect"; static const INGAME_JOIN_MSG[ ] = "#IG_Team_Select"; static const INGAME_JOIN_MSG_SPEC[ ] = "#IG_Team_Select_Spect"; static szMenuCode[ 64 ]; get_msg_arg_string( 4, szMenuCode, sizeof( szMenuCode ) - 1 ); if( equal( szMenuCode, FIRST_JOIN_MSG ) || equal( szMenuCode, FIRST_JOIN_MSG_SPEC ) || equal( szMenuCode, INGAME_JOIN_MSG ) || equal( szMenuCode, INGAME_JOIN_MSG_SPEC ) ) { return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; }
public Task_DuelImmunity( ) { for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iAlive, iPlayer ) ) { UnfreezePlayer( iPlayer ); } } }
public Task_RestartGame( ) { g_iFirstRound = 1; server_cmd( "sv_restartround 1" ); server_exec( ); client_print_color( 0, print_team_default, "^4[%s]^1 Reiniciando ronda...", g_szPrefix ); }
public Task_ForceJoinTeam( iTask ) { new iId = iTask - TASK_JOINTEAM; if( !GetPlayerBit( g_iConnected, iId ) ) { return; } if( !is_user_bot( iId ) ) { new iRestore = get_pdata_int( iId, m_iVGUI ); if( iRestore & ( 1<<0 ) ) { set_pdata_int( iId, m_iVGUI, iRestore & ~( 1<<0 ) ); } set_msg_block( g_iShowMenu, BLOCK_SET ); set_msg_block( g_iVGUIMenu, BLOCK_SET ); engclient_cmd( iId, "jointeam", "2" ); engclient_cmd( iId, "joinclass", "5" ); set_msg_block( g_iShowMenu, BLOCK_NOT ); set_msg_block( g_iVGUIMenu, BLOCK_NOT ); if( iRestore & ( 1<<0 ) ) { set_pdata_int( iId, m_iVGUI, iRestore ); } menu_cancel( iId ); } CheckGameStatus( ); }
/* ================================================================================= * [ CBasePlayer Forwards ] * ================================================================================= */
public OnPlayerSpawn_Post( iId ) { if( !is_user_alive( iId ) ) { return HAM_IGNORED; } SetPlayerBit( g_iAlive, iId ); RemovePlayerWeapons( iId ); cs_set_user_armor( iId, 0, CS_ARMOR_NONE ); give_item( iId, g_szCache_WeaponKnife ); set_pdata_int( iId, m_iRadiosLeft, 0 );
if( g_iRoundStatus == Round_Countdown ) { FreezePlayer( iId ); }
return HAM_IGNORED; }
public OnPlayerTakeDamage_Pre( iVictim, iInflictor, iAttacker, Float:flDamage, iDamageBits ) { if( g_bNoDamage ) { return HAM_SUPERCEDE; } return HAM_IGNORED; }
public OnPlayerResetMaxSpeed_Pre( iId ) { if( GetPlayerBit( g_iFrozen, iId ) ) { return HAM_SUPERCEDE; } return HAM_IGNORED; }
/* ================================================================================= * [ General Forwards ] * ================================================================================= */
public OnBoxTouch( iBox, iId ) { if( !GetPlayerBit( g_iAlive, iId ) || ( g_iGame != Game_Started ) || ( entity_get_int( iBox, EV_INT_solid ) == SOLID_NOT ) ) { return PLUGIN_CONTINUE; } static iOrigin[ 3 ]; static Float:flOrigin[ 3 ]; entity_get_vector( iBox, EV_VEC_origin, flOrigin ); FVecIVec( flOrigin, iOrigin ); message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); write_byte( TE_BREAKMODEL ); write_coord( iOrigin[ 0 ] ); write_coord( iOrigin[ 1 ] ); write_coord( iOrigin[ 2 ] ); write_coord( 16 ); write_coord( 16 ); write_coord( 16 ); write_coord( 25 ); write_coord( 25 ); write_coord( 25 ); write_byte( 10 ); write_short( g_iBoxGibs ); write_byte( 10 ); write_byte( 25 ); write_byte( 0x08 ); message_end( ); emit_sound( iBox, CHAN_AUTO, g_szBoxBrokenSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); entity_set_int( iBox, EV_INT_solid, SOLID_NOT ); entity_set_int( iBox, EV_INT_effects, entity_get_int( iBox, EV_INT_effects ) | EF_NODRAW ); g_iVisibleBoxes -= 1; GiveRandomItem( iId ); return PLUGIN_CONTINUE; }
public OnGameThink( iEnt ) { new iAlive; for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iAlive, iPlayer ) ) { iAlive++; } } set_dhudmessage( 255, 140, 0, -1.0, 0.1, 0, 1.0, 1.0 ); switch( g_iRoundStatus ) { case Round_Countdown: { g_iCountdown--; show_dhudmessage( 0, "Juegos del hambre^nLa ronda comenzara en %d", g_iCountdown ); if( g_iCountdown <= 0 ) { OpenDoors( ); g_iCountdown = 20; g_iRoundStatus = Round_Immunity; for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iConnected, iPlayer ) ) { UnfreezePlayer( iPlayer ); } } } else { for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iConnected, iPlayer ) && !GetPlayerBit( g_iFrozen, iPlayer ) ) { FreezePlayer( iPlayer ); } } } } case Round_Immunity: { show_dhudmessage( 0, "Juegos del hambre^nCajas: %d/%d^n^nLa inmunidad terminara en %d", g_iVisibleBoxes, g_iBoxes, g_iCountdown ); if( --g_iCountdown < 0 ) { for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iAlive, iPlayer ) ) { give_item( iPlayer, g_szCache_WeaponKnife ); } } g_bNoDamage = false; g_iCountdown = 240; g_iRoundStatus = Round_Normal; g_iTributes = iAlive; } } case Round_Normal: { show_dhudmessage( 0, "Juegos del hambre^nTributos: %d/%d | Cajas: %d/%d^n^n^nTiempo restante: %d", iAlive, g_iTributes, g_iVisibleBoxes, g_iBoxes, g_iCountdown ); if( g_iCountdown == 160 ) { DrawBoxes( ); } if( --g_iCountdown < 0 ) { rg_round_end( 3.0, WINSTATUS_DRAW, ROUND_END_DRAW ); } } case Round_Versus: { show_dhudmessage( 0, "Juegos del hambre^nTributos: %d/%d | Cajas: %d/%d", iAlive, g_iTributes, g_iVisibleBoxes, g_iBoxes ); if( --g_iCountdown < 0 ) { rg_round_end( 3.0, WINSTATUS_DRAW, ROUND_END_DRAW ); } } } entity_set_float( iEnt, EV_FL_nextthink, get_gametime( ) + 1.0 ); }
public OnClientKill_Pre( iId ) { client_print_color( iId, print_team_default, "^x04[%s]^x01 No puedes suicidarte.", g_szPrefix ); return FMRES_SUPERCEDE; }
/* ================================================================================= * [ Client-related stuff ] * ================================================================================= */
public ClientCommand_Fly( iId ) { if( get_user_flags( iId ) & ADMIN_RCON ) { set_user_noclip( iId, get_user_noclip( iId ) ? 0 : 1 ); } return PLUGIN_HANDLED; }
public ClientCommand_TeamChoosing( iId ) { ShowMainMenu( iId ); return PLUGIN_HANDLED; }
public client_putinserver( iId ) { SetPlayerBit( g_iConnected, iId ); set_task( JOINTEAM_DELAY, "Task_ForceJoinTeam", iId + TASK_JOINTEAM ); }
public client_disconnected( iId ) { new bWasAlive = GetPlayerBit( g_iAlive, iId ); g_iPlayerScore[ iId ] = 0; ClearPlayerBit( g_iConnected, iId ); ClearPlayerBit( g_iAlive, iId ); CheckGameStatus( ); if( ( g_iGame != Game_Waiting ) && bWasAlive ) { CheckRoundStatus( ); } }
/* ================================================================================= * [ Client menus ] * ================================================================================= */
ShowMainMenu( iId ) { static iLen, szData[ 256 ]; iLen = formatex( szData, charsmax( szData ), "\wModo: \yHunger Games \d- \wVersion: \y1.0b^n^n" );
iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[1] \wAyuda^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[2] \wReglas^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[3] %sAdministracion^n^n", get_user_flags( iId ) & ADMIN_RCON ? "\w" : "\d" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[0] \wSalir" ); show_menu( iId, MAIN_MENU_KEYS, szData, -1, "Main Menu" ); return PLUGIN_HANDLED; }
public MainMenuHandler( iId, iKey ) { if( !GetPlayerBit( g_iConnected, iId ) || ( iKey > 2 ) ) { return PLUGIN_HANDLED; } switch( iKey ) { case 0: { client_print_color( iId, print_team_default, "^4[%s]^3 Hunger Games^1 es un modo de supervivencia todos contra todos.", g_szPrefix ); client_print_color( iId, print_team_default, "^4[%s]^1 Debes de recoger cajas para conseguir armas y/o items variados.", g_szPrefix ); } case 1: { client_print_color( iId, print_team_default, "^4[%s]^1 No debes quedarte en una misma posicion por demasiado tiempo.", g_szPrefix ); client_print_color( iId, print_team_default, "^4[%s]^1 No debes hacer equipo con otros jugadores.", g_szPrefix ); } case 2: { if( get_user_flags( iId ) & ADMIN_RCON ) { ShowConfigMenu( iId ); } } } return PLUGIN_HANDLED; }
ShowConfigMenu( iId ) { static iLen, szData[ 256 ]; iLen = formatex( szData, charsmax( szData ), "\yConfiguraciones:^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[1] \yCrear \wuna caja donde apuntas^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[2] \yRemover \wla caja que apuntas^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[3] \yPrimera \wubicacion de duelos^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[4] \ySegunda \wubicacion de duelos^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[5] \yGuardar^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[6] \dCancelar^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[!] \wCajas creadas: \r%d", g_iBoxes ); show_menu( iId, CONFIG_MENU_KEYS, szData, -1, "Config Menu" ); return PLUGIN_HANDLED; }
public ConfigMenuHandler( iId, iKey ) { if( !GetPlayerBit( g_iConnected, iId ) || iKey > 4 ) { return PLUGIN_HANDLED; } static iBox, iBody, szClassname[ 16 ], Float:flOrigin[ 3 ]; switch( iKey ) { case 0: { GetBoxLocation( iId, flOrigin ); CreateBox( flOrigin ); client_print_color( iId, print_team_default, "^x04[%s]^x01 Se creo una caja donde apuntabas.", g_szPrefix ); } case 1: { get_user_aiming( iId, iBox, iBody ); if( is_valid_ent( iBox ) ) { entity_get_string( iBox, EV_SZ_classname, szClassname, charsmax( szClassname ) ); if( equal( szClassname, g_szBoxClassname ) ) { g_iBoxes--; remove_entity( iBox ); client_print_color( iId, print_team_default, "^x04[%s]^x01 La caja se ha removido correctamente.", g_szPrefix ); } } else { client_print_color( iId, print_team_default, "^x04[%s]^x01 No estabas apuntando a una entidad valida.", g_szPrefix ); } } case 2: { entity_get_vector( iId, EV_VEC_origin, g_flDuelPosition[ 0 ] ); client_print_color( iId, print_team_default, "^x04[%s]^x01 Nueva ubicacion establecida. Recuerde guardar los cambios.", g_szPrefix ); } case 3: { entity_get_vector( iId, EV_VEC_origin, g_flDuelPosition[ 1 ] ); client_print_color( iId, print_team_default, "^x04[%s]^x01 Nueva ubicacion establecida. Recuerde guardar los cambios.", g_szPrefix ); } case 4: { SaveConfigs( ); client_print_color( iId, print_team_default, "^x04[%s]^x01 Configuraciones guardadas correctamente.", g_szPrefix ); } } ShowConfigMenu( iId ); return PLUGIN_HANDLED; }
public TeamSelectMenuHandler( iId, iKeys ) { ShowMainMenu( iId ); return PLUGIN_HANDLED; }
/* ================================================================================= * [ Private functions ] * ================================================================================= */
LoadConfigs( ) { new iLines, iFile, Float:flOrigin[ 3 ], szOrigin[ 3 ][ 8 ], szMap[ 32 ], szData[ 128 ]; get_localinfo( "amxx_configsdir", szData, charsmax( szData ) ); get_mapname( szMap, charsmax( szMap ) ); if( !( szMap[ 0 ] == 'h' && szMap[ 1 ] == 'g' && szMap[ 2 ] == '_' ) ) { set_fail_state( "Mapa no compatible. Requisito: hg_" ); } formatex( g_szSaveFile, charsmax( g_szSaveFile ), "%s/hungergames", szData ); if( !dir_exists( g_szSaveFile ) ) { mkdir( g_szSaveFile ); return; } formatex( g_szSaveFile, charsmax( g_szSaveFile ), "%s/hungergames/%s.ini", szData, szMap ); if( file_exists( g_szSaveFile ) ) { iFile = fopen( g_szSaveFile, "rt" ); g_bLoaded = true; while( !feof( iFile ) ) { fgets( iFile, szData, charsmax( szData ) ); trim( szData ); if( parse( szData, szOrigin[ 0 ], charsmax( szOrigin[ ] ), szOrigin[ 1 ], charsmax( szOrigin[ ] ), szOrigin[ 2 ], charsmax( szOrigin[ ] ) ) != 3 ) { continue; } if( iLines < 2 ) { g_flDuelPosition[ iLines ][ 0 ] = str_to_float( szOrigin[ 0 ] ); g_flDuelPosition[ iLines ][ 1 ] = str_to_float( szOrigin[ 1 ] ); g_flDuelPosition[ iLines ][ 2 ] = str_to_float( szOrigin[ 2 ] ); } else { flOrigin[ 0 ] = str_to_float( szOrigin[ 0 ] ); flOrigin[ 1 ] = str_to_float( szOrigin[ 1 ] ); flOrigin[ 2 ] = str_to_float( szOrigin[ 2 ] ); CreateBox( flOrigin ); } iLines++; } fclose( iFile ); } }
LoadDuelPoints( ) { new iEnt, iCount; while( ( iEnt = find_ent_by_class( iEnt, g_szCache_VipStart ) ) > 0 ) { entity_get_vector( iEnt, EV_VEC_origin, g_flDuelPosition[ iCount++ ] ); } }
SaveConfigs( ) { new iEnt, iFile, Float:flOrigin[ 3 ]; if( file_exists( g_szSaveFile ) ) { delete_file( g_szSaveFile ); } iFile = fopen( g_szSaveFile, "wt" ); fprintf( iFile, "%0.3f %0.3f %0.3f^n", g_flDuelPosition[ 0 ][ 0 ], g_flDuelPosition[ 0 ][ 1 ], g_flDuelPosition[ 0 ][ 2 ] ); fprintf( iFile, "%0.3f %0.3f %0.3f^n", g_flDuelPosition[ 1 ][ 0 ], g_flDuelPosition[ 1 ][ 1 ], g_flDuelPosition[ 1 ][ 2 ] ); while( ( iEnt = find_ent_by_class( iEnt, g_szBoxClassname ) ) != 0 ) { entity_get_vector( iEnt, EV_VEC_origin, flOrigin ); fprintf( iFile, "%0.3f %0.3f %0.3f^n", flOrigin[ 0 ], flOrigin[ 1 ], flOrigin[ 2 ] ); } fclose( iFile ); }
CreateBox( Float:flOrigin[ 3 ] ) { static iEnt; iEnt = create_entity( g_szCache_InfoTarget ); entity_set_string( iEnt, EV_SZ_classname, g_szBoxClassname ); entity_set_model( iEnt, g_szBoxModel ); entity_set_size( iEnt, Float:{ -8.0, -8.0, 0.0 }, Float:{ 8.0, 8.0, 8.0 } ); entity_set_origin( iEnt, flOrigin ); entity_set_int( iEnt, EV_INT_solid, SOLID_BBOX ); entity_set_int( iEnt, EV_INT_movetype, MOVETYPE_TOSS ); drop_to_floor( iEnt ); g_iBoxes++; }
DrawBoxes( ) { new iEnt; while( ( iEnt = find_ent_by_class( iEnt, g_szBoxClassname ) ) != 0 ) { entity_set_int( iEnt, EV_INT_solid, SOLID_BBOX ); entity_set_int( iEnt, EV_INT_effects, entity_get_int( iEnt, EV_INT_effects ) & ~EF_NODRAW ); } g_iVisibleBoxes = g_iBoxes; }
GetBoxLocation( const iId, Float:flOrigin[ 3 ] ) { static Float:flAngles[ 3 ], Float:flViewOfs[ 3 ], Float:flEnd[ 3 ]; entity_get_vector( iId, EV_VEC_origin, flOrigin ); entity_get_vector( iId, EV_VEC_view_ofs, flViewOfs ); entity_get_vector( iId, EV_VEC_v_angle, flAngles ); xs_vec_add( flOrigin, flViewOfs, flOrigin ); angle_vector( flAngles, ANGLEVECTOR_FORWARD, flAngles ); xs_vec_mul_scalar( flAngles, 2048.0, flAngles ); xs_vec_add( flOrigin, flAngles, flEnd ); trace_line( iId, flOrigin, flEnd, flOrigin ); flOrigin[ 2 ] += 64.0; }
RemovePlayerWeapons( iId ) { dllfunc( DLLFunc_Use, g_iPlayerWeaponStrip, iId ); }
OpenDoors( ) { new iEnt; while( ( iEnt = find_ent_by_tname( iEnt, g_szCache_DoorClass ) ) != 0 ) { force_use( iEnt, iEnt ); } }
UpdateScore( iId ) { entity_set_float( iId, EV_FL_frags, float( g_iPlayerScore[ iId ] ) );
message_begin( MSG_BROADCAST, g_iScoreInfo ); write_byte( iId ); write_short( g_iPlayerScore[ iId ] ); write_short( get_user_deaths( iId ) ); write_short( 0 ); write_short( get_user_team( iId ) ); message_end( ); }
UpdateScoreBoard( ) { message_begin( MSG_BROADCAST, g_iScoreInfo ); write_byte( 33 ); write_short( 0 ); write_short( 0 ); write_short( 0 ); write_short( 0 ); message_end( ); }
GiveRandomItem( const iId ) { static iRandom, iBullets; iRandom = random( 5 ); if( iRandom > 0 ) { iRandom = random( sizeof( g_eWeapons ) ); iBullets = random_num( g_eWeapons[ iRandom ][ Weapon_Min ], g_eWeapons[ iRandom ][ Weapon_Max ] ); if( !user_has_weapon( iId, g_eWeapons[ iRandom ][ Weapon_Index ] ) ) { cs_set_weapon_ammo( give_item( iId, g_eWeapons[ iRandom ][ Weapon_Item ] ), iBullets ); client_print_color( iId, print_team_grey, "^4[%s]^1 Hallaste ^4%s^1 con ^4%d^1 balas.", g_szPrefix, g_eWeapons[ iRandom ][ Weapon_Name ], iBullets); } else { cs_set_user_bpammo( iId, g_eWeapons[ iRandom ][ Weapon_Index ], cs_get_user_bpammo( iId, g_eWeapons[ iRandom ][ Weapon_Index ] ) + iBullets ); client_print_color( iId, print_team_grey, "^4[%s]^1 Hallaste^4 %d balas^1 para tu^4 %s^1.", g_szPrefix, iBullets, g_eWeapons[ iRandom ][ Weapon_Name ] ); } } else { if( random( 2 ) > 0 ) { if( user_has_weapon( iId, CSW_HEGRENADE ) ) { cs_set_user_bpammo( iId, CSW_HEGRENADE, cs_get_user_bpammo( iId, CSW_HEGRENADE ) + 1 ); client_print_color( iId, print_team_grey, "^4[%s]^1 Hallaste otra^4 granada explosiva^1.", g_szPrefix ); } else { give_item( iId, "weapon_hegrenade" ); client_print_color( iId, print_team_grey, "^4[%s]^1 Hallaste una^4 granada explosiva^1.", g_szPrefix ); } } else { new iAmount = random_num( 10, 100 ), CsArmorType:iType; cs_set_user_armor( iId, cs_get_user_armor( iId, iType ) + iAmount, CS_ARMOR_VESTHELM ); client_print_color( iId, print_team_default, "^4[%s]^1 Hallaste ^4%d^1 puntos de ^4chaleco^1", g_szPrefix, iAmount); } } }
CheckGameStatus( ) { new iCount; for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iConnected, iPlayer ) ) { iCount++; } } if( iCount >= 3 ) { if( g_iGame != Game_Started ) { g_iGame = Game_Started; g_iFirstRound = 2; server_cmd( "sv_restartround 1" ); server_exec( ); client_print_color( 0, print_team_default, "^x04[%s]^x01 Se consiguieron jugadores suficientes. Preparense!", g_szPrefix ); } } else if( g_iGame != Game_Waiting ) { g_iGame = Game_Waiting; g_bNoDamage = true; rg_round_end( 3.0, WINSTATUS_DRAW, ROUND_END_DRAW ); client_print_color( 0, print_team_default, "^x04[%s]^x01 No hay jugadores suficientes para el modo.", g_szPrefix ); } }
CheckRoundStatus( ) { new iPlayers[ 32 ], iNum; for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iAlive, iPlayer ) ) { iPlayers[ iNum++ ] = iPlayer; } } if( iNum < 3 ) { if( iNum > 1 ) { FreezePlayer( iPlayers[ 0 ] ); FreezePlayer( iPlayers[ 1 ] ); entity_set_float( iPlayers[ 0 ], EV_FL_health, 300.0 ); entity_set_float( iPlayers[ 1 ], EV_FL_health, 300.0 ); RemovePlayerWeapons( iPlayers[ 0 ] ); RemovePlayerWeapons( iPlayers[ 1 ] ); give_item( iPlayers[ 0 ], g_szCache_WeaponKnife ); give_item( iPlayers[ 1 ], g_szCache_WeaponKnife ); if( g_bLoaded ) { entity_set_origin( iPlayers[ 0 ], g_flDuelPosition[ 0 ] ); entity_set_origin( iPlayers[ 1 ], g_flDuelPosition[ 1 ] ); } set_task( 3.0, "Task_DuelImmunity", TASK_DUELIMMUNITY ); g_iCountdown = 60; g_iRoundStatus = Round_Versus; } else { rg_round_end( 10.0, WINSTATUS_DRAW, ROUND_END_DRAW ); } } }
FreezePlayer( const iId ) { entity_set_float( iId, EV_FL_maxspeed, 1.0 ); entity_set_vector( iId, EV_VEC_velocity, Float:{ 0.0, 0.0, 0.0 } ); SetPlayerBit( g_iFrozen, iId ); }
UnfreezePlayer( const iId ) { ClearPlayerBit( g_iFrozen, iId ); ExecuteHamB( Ham_CS_Player_ResetMaxSpeed, iId ); }
(13/08/2018, 07:59 PM)KrR10VnZl escribió: Usted tiene un retraso de otro mundo, pon de tu parte coño, como es posible que preguntes cual código? muchacho mongólico si dice código, él se refiere al SMA del CTF, dios mio y si no te gusta que te digan que tienes un retraso magistral, astral del otro mundo pon de tú parte y no hagas preguntas tontas.
Mensajes: 1
Temas: 0
Registro en: Mar 2018
Reputación:
0
04/04/2018, 04:38 PM
¿Alguien tiene el plugins copilado o bien echo?, por que para pasarlo a amxx me da error.https://amxmodx-es.com/images/icons/sad.gif
Mensajes: 4,247
Temas: 94
Registro en: Mar 2014
Reputación:
58
(04/04/2018, 04:38 PM)berkely3099v2 escribió: ¿Alguien tiene el plugins copilado o bien echo?, por que para pasarlo a amxx me da error.https://amxmodx-es.com/images/icons/sad.gif
Que error te da?
Que version de amx usas?
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
PLUGINSMAPAS
Menú LANG
[SF] Sistema de Frags
Say System (Admin Prefix)
Mensajes: 4
Temas: 0
Registro en: Apr 2018
Reputación:
0
(22/01/2018, 02:27 PM)Treki escribió: Les dejo otra versión libre de errores (o eso creo) pero que utiliza ReAPI. No tiene estadísticas ni nada, es solo el core. Necesita nada más que los módulos base y el ReAPI.
PD: Lo separé de un HG privado que funciona a la perfección, a pedido de un usuario que reportó problemas con el otro publicado. Abrir preferentemente con Sublime Text, así se ve correctamente identado.
Código PHP: #include <amxmodx> #include <fakemeta> #include <engine> #include <hamsandwich> #include <cstrike> #include <fun> #include <reapi> #include <xs>
/* ================================================================================= * [ Global stuff ] * ================================================================================= */
#define PLAYER_ARRAY 33
#define IsPlayer(%0) ( 1 <= %0 <= 32 )
#define GetPlayerBit(%0,%1) ( IsPlayer(%1) && ( %0 & ( 1 << ( %1 & 31 ) ) ) ) #define SetPlayerBit(%0,%1) ( IsPlayer(%1) && ( %0 |= ( 1 << ( %1 & 31 ) ) ) ) #define ClearPlayerBit(%0,%1) ( IsPlayer(%1) && ( %0 &= ~( 1 << ( %1 & 31 ) ) ) )
#define ClientPlaySound(%0,%1) client_cmd( %0, "spk %s", %1 )
const m_iRadiosLeft = 192; const m_iVGUI = 510;
const MAIN_MENU_KEYS = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3; const CONFIG_MENU_KEYS = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6; const TEAM_MENU_KEYS = MENU_KEY_1|MENU_KEY_2|MENU_KEY_5|MENU_KEY_6;
const TASK_RESTART = 100; const TASK_IMMUNITY = 200; const TASK_DUELIMMUNITY = 300; const TASK_JOINTEAM = 400;
const Float:JOINTEAM_DELAY = 1.0;
enum _:Game_Status { Game_Waiting, Game_Started }
enum _:Round_Type { Round_None, Round_Countdown, Round_Immunity, Round_Normal, Round_Versus }
enum _:Teams { Team_Unassigned, Team_Terrorist, Team_Antiterrorist, Team_Spectator }
enum _:Weapon_Data { Weapon_Name[ 16 ], Weapon_Item[ 32 ], Weapon_Index, Weapon_Min, Weapon_Max }
new const g_eWeapons[ ][ Weapon_Data ] = { { "Glock-18", "weapon_glock18", CSW_GLOCK18, 8, 15 }, { "USP", "weapon_usp", CSW_USP, 4, 9 }, { "P228", "weapon_p228", CSW_P228, 3, 11 }, { "Deagle", "weapon_deagle", CSW_DEAGLE, 2, 6 }, { "FiveSeven", "weapon_fiveseven", CSW_FIVESEVEN, 6, 18 }, { "Dual Elites", "weapon_elite", CSW_ELITE, 12, 27 }, { "TMP", "weapon_tmp", CSW_TMP, 6, 24 }, { "MAC-10", "weapon_mac10", CSW_MAC10, 11, 29 }, { "MP5-Navy", "weapon_mp5navy", CSW_MP5NAVY, 10, 22 }, { "Ump-45", "weapon_ump45", CSW_UMP45, 14, 25 }, { "P90", "weapon_p90", CSW_P90, 12, 38 }, { "M3", "weapon_m3", CSW_M3, 3, 7 }, { "XM-1014", "weapon_xm1014", CSW_XM1014, 1, 7 }, { "Famas", "weapon_famas", CSW_FAMAS, 6, 21 }, { "Galil", "weapon_galil", CSW_GALIL, 12, 32 }, { "Scout", "weapon_scout", CSW_SCOUT, 1, 5 }, { "Awp", "weapon_awp", CSW_AWP, 1, 2 }, { "AK-47", "weapon_ak47", CSW_AK47, 4, 14 }, { "M4A1", "weapon_m4a1", CSW_M4A1, 4, 14 }, { "SG550", "weapon_sg550", CSW_SG550, 6, 17 }, { "AUG", "weapon_aug", CSW_AUG, 7, 15 } };
new const g_szBoxBrokenSound[ ] = "hungergames/picked.wav"; new const g_szBoxModel[ ] = "models/hungergames/Supply.mdl";
new const g_szBoxClassname[ ] = "HGBox"; new const g_szGameThinkClassname[ ] = "GameThink";
new const g_szCache_InfoTarget[ ] = "info_target"; new const g_szCache_WeaponKnife[ ] = "weapon_knife"; new const g_szCache_DoorClass[ ] = "hg_puerta"; new const g_szCache_VipStart[ ] = "info_vip_start";
new const g_szPrefix[ ] = "HG";
new g_iConnected; new g_iAlive; new g_iCountdown; new g_iGame; new g_iBoxGibs; new g_iPlayerWeaponStrip; new g_bNoDamage; new g_iHideWeapon; new g_iCrosshair; new g_iScoreInfo; new g_iGameThink; new g_iFirstRound; new g_iFrozen; new g_iTributes; new g_iShowMenu; new g_iVGUIMenu; new g_iBoxes; new g_iVisibleBoxes; new g_iRoundStatus;
new bool:g_bLoaded;
new g_szSaveFile[ 64 ]; new g_iPlayerScore[ 33 ]; new Float:g_flDuelPosition[ 4 ][ 3 ];
/* ================================================================================= * [ Plugin events ] * ================================================================================= */
public plugin_precache( ) { precache_sound( g_szBoxBrokenSound ); precache_model( g_szBoxModel ); g_iPlayerWeaponStrip = create_entity( "player_weaponstrip" ); g_iBoxGibs = precache_model( "models/woodgibs.mdl" ); }
public plugin_init( ) { register_plugin( "Hunger Games", "1.0", "Manu" );
RegisterHam( Ham_Spawn, "player", "OnPlayerSpawn_Post", true, true ); RegisterHam( Ham_TakeDamage, "player", "OnPlayerTakeDamage_Pre", false, true ); RegisterHam( Ham_CS_Player_ResetMaxSpeed, "player", "OnPlayerResetMaxSpeed_Pre", false, true ); register_forward( FM_ClientKill, "OnClientKill_Pre", false );
register_touch( g_szBoxClassname, "player", "OnBoxTouch" ); register_think( g_szGameThinkClassname, "OnGameThink" );
register_event( "DeathMsg", "Event_DeathMsg", "a" ); register_event( "ResetHUD", "Event_ResetHUD", "be" ); register_logevent( "Event_RoundStart", 2, "1=Round_Start" ); register_logevent( "Event_RoundEnd", 2, "1=Round_End" ); register_message( ( g_iShowMenu = get_user_msgid( "ShowMenu" ) ), "Message_ShowMenu" ); register_message( ( g_iVGUIMenu = get_user_msgid( "VGUIMenu" ) ), "Message_VGUIMenu" );
register_menucmd( register_menuid( "Main Menu", false ), MAIN_MENU_KEYS, "MainMenuHandler" ); register_menucmd( register_menuid( "Config Menu", false ), CONFIG_MENU_KEYS, "ConfigMenuHandler" ); register_menucmd( register_menuid( "Team_Select", true ), TEAM_MENU_KEYS, "TeamSelectMenuHandler" );
register_clcmd( "jointeam", "ClientCommand_TeamChoosing" ); register_clcmd( "chooseteam", "ClientCommand_TeamChoosing" ); register_clcmd( "hg_fly", "ClientCommand_Fly" ); g_bNoDamage = true; g_iRoundStatus = Round_None; g_iGameThink = create_entity( g_szCache_InfoTarget ); g_iHideWeapon = get_user_msgid( "HideWeapon" ); g_iCrosshair = get_user_msgid( "Crosshair" ); g_iScoreInfo = get_user_msgid( "ScoreInfo" ); set_msg_block( get_user_msgid( "Radar" ), BLOCK_SET ); entity_set_string( g_iGameThink, EV_SZ_classname, g_szGameThinkClassname ); set_cvar_num( "mp_autoteambalance", 0 ); set_cvar_num( "mp_limitteams", 0 ); set_cvar_num( "mp_friendlyfire", 1 ); set_cvar_num( "mp_tkpunish", 0 ); set_cvar_num( "mp_autokick", 0 ); set_cvar_num( "mp_freezetime", 0 ); set_cvar_num( "mp_freeforall", 1 ); set_cvar_num( "mp_round_infinite", 1 ); set_cvar_num( "mp_max_teamkills", 0 ); set_cvar_float( "mp_buytime", 0.0 ); LoadConfigs( ); LoadDuelPoints( ); if( !is_regamedll( ) ) { pause( "Recurso faltante: ReGameDLL." ); } }
/* ================================================================================= * [ Tasks, Events & Messages ] * ================================================================================= */
public Event_RoundStart( ) { if( ( g_iFirstRound == 2 ) && !task_exists( TASK_RESTART ) ) { set_task( 10.0, "Task_RestartGame" ); client_print_color( 0, print_team_default, "^4[%s]^1 Bienvenidos al modo^4 Hunger Games v1.0 Beta^1!", g_szPrefix ); client_print_color( 0, print_team_default, "^4[%s]^1 El juego comenzara en^3 diez segundos^1. Preparense!", g_szPrefix ); } else if( g_iGame == Game_Started ) { g_iFirstRound = 0; g_bNoDamage = true; g_iRoundStatus = Round_Countdown; g_iCountdown = 10; DrawBoxes( ); UpdateScoreBoard( ); entity_set_float( g_iGameThink, EV_FL_nextthink, get_gametime( ) ); } }
public Event_ResetHUD( iId ) { message_begin( MSG_ONE_UNRELIABLE, g_iHideWeapon, _, iId ); write_byte( ( 1<<4 | 1<<5 ) ); message_end( ); message_begin( MSG_ONE_UNRELIABLE, g_iCrosshair, _, iId ); write_byte( 0 ); message_end( ); }
public Event_RoundEnd( ) { remove_task( TASK_DUELIMMUNITY ); g_bNoDamage = true; g_iRoundStatus = Round_None; entity_set_float( g_iGameThink, EV_FL_nextthink, 0.0 ); }
public Event_DeathMsg( ) { static iKiller; iKiller = read_data( 1 ); static iVictim; iVictim = read_data( 2 ); ClearPlayerBit( g_iAlive, iVictim ); if( g_iGame != Game_Started ) { return PLUGIN_CONTINUE; } if( iKiller != iVictim && GetPlayerBit( g_iConnected, iKiller ) ) { g_iPlayerScore[ iKiller ]++;
UpdateScore( iKiller ); } CheckRoundStatus( ); return PLUGIN_CONTINUE; }
public Message_VGUIMenu( iMessage, iDest, iId ) { if( !GetPlayerBit( g_iConnected, iId ) ) { return PLUGIN_CONTINUE; } if( get_msg_arg_int( 1 ) == 2 ) { return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; }
public Message_ShowMenu( iMessage, iDest, iId ) { if( !GetPlayerBit( g_iConnected, iId ) ) { return PLUGIN_CONTINUE; } static const FIRST_JOIN_MSG[ ] = "#Team_Select"; static const FIRST_JOIN_MSG_SPEC[ ] = "#Team_Select_Spect"; static const INGAME_JOIN_MSG[ ] = "#IG_Team_Select"; static const INGAME_JOIN_MSG_SPEC[ ] = "#IG_Team_Select_Spect"; static szMenuCode[ 64 ]; get_msg_arg_string( 4, szMenuCode, sizeof( szMenuCode ) - 1 ); if( equal( szMenuCode, FIRST_JOIN_MSG ) || equal( szMenuCode, FIRST_JOIN_MSG_SPEC ) || equal( szMenuCode, INGAME_JOIN_MSG ) || equal( szMenuCode, INGAME_JOIN_MSG_SPEC ) ) { return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; }
public Task_DuelImmunity( ) { for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iAlive, iPlayer ) ) { UnfreezePlayer( iPlayer ); } } }
public Task_RestartGame( ) { g_iFirstRound = 1; server_cmd( "sv_restartround 1" ); server_exec( ); client_print_color( 0, print_team_default, "^4[%s]^1 Reiniciando ronda...", g_szPrefix ); }
public Task_ForceJoinTeam( iTask ) { new iId = iTask - TASK_JOINTEAM; if( !GetPlayerBit( g_iConnected, iId ) ) { return; } if( !is_user_bot( iId ) ) { new iRestore = get_pdata_int( iId, m_iVGUI ); if( iRestore & ( 1<<0 ) ) { set_pdata_int( iId, m_iVGUI, iRestore & ~( 1<<0 ) ); } set_msg_block( g_iShowMenu, BLOCK_SET ); set_msg_block( g_iVGUIMenu, BLOCK_SET ); engclient_cmd( iId, "jointeam", "2" ); engclient_cmd( iId, "joinclass", "5" ); set_msg_block( g_iShowMenu, BLOCK_NOT ); set_msg_block( g_iVGUIMenu, BLOCK_NOT ); if( iRestore & ( 1<<0 ) ) { set_pdata_int( iId, m_iVGUI, iRestore ); } menu_cancel( iId ); } CheckGameStatus( ); }
/* ================================================================================= * [ CBasePlayer Forwards ] * ================================================================================= */
public OnPlayerSpawn_Post( iId ) { if( !is_user_alive( iId ) ) { return HAM_IGNORED; } SetPlayerBit( g_iAlive, iId ); RemovePlayerWeapons( iId ); cs_set_user_armor( iId, 0, CS_ARMOR_NONE ); give_item( iId, g_szCache_WeaponKnife ); set_pdata_int( iId, m_iRadiosLeft, 0 );
if( g_iRoundStatus == Round_Countdown ) { FreezePlayer( iId ); }
return HAM_IGNORED; }
public OnPlayerTakeDamage_Pre( iVictim, iInflictor, iAttacker, Float:flDamage, iDamageBits ) { if( g_bNoDamage ) { return HAM_SUPERCEDE; } return HAM_IGNORED; }
public OnPlayerResetMaxSpeed_Pre( iId ) { if( GetPlayerBit( g_iFrozen, iId ) ) { return HAM_SUPERCEDE; } return HAM_IGNORED; }
/* ================================================================================= * [ General Forwards ] * ================================================================================= */
public OnBoxTouch( iBox, iId ) { if( !GetPlayerBit( g_iAlive, iId ) || ( g_iGame != Game_Started ) || ( entity_get_int( iBox, EV_INT_solid ) == SOLID_NOT ) ) { return PLUGIN_CONTINUE; } static iOrigin[ 3 ]; static Float:flOrigin[ 3 ]; entity_get_vector( iBox, EV_VEC_origin, flOrigin ); FVecIVec( flOrigin, iOrigin ); message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); write_byte( TE_BREAKMODEL ); write_coord( iOrigin[ 0 ] ); write_coord( iOrigin[ 1 ] ); write_coord( iOrigin[ 2 ] ); write_coord( 16 ); write_coord( 16 ); write_coord( 16 ); write_coord( 25 ); write_coord( 25 ); write_coord( 25 ); write_byte( 10 ); write_short( g_iBoxGibs ); write_byte( 10 ); write_byte( 25 ); write_byte( 0x08 ); message_end( ); emit_sound( iBox, CHAN_AUTO, g_szBoxBrokenSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); entity_set_int( iBox, EV_INT_solid, SOLID_NOT ); entity_set_int( iBox, EV_INT_effects, entity_get_int( iBox, EV_INT_effects ) | EF_NODRAW ); g_iVisibleBoxes -= 1; GiveRandomItem( iId ); return PLUGIN_CONTINUE; }
public OnGameThink( iEnt ) { new iAlive; for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iAlive, iPlayer ) ) { iAlive++; } } set_dhudmessage( 255, 140, 0, -1.0, 0.1, 0, 1.0, 1.0 ); switch( g_iRoundStatus ) { case Round_Countdown: { g_iCountdown--; show_dhudmessage( 0, "Juegos del hambre^nLa ronda comenzara en %d", g_iCountdown ); if( g_iCountdown <= 0 ) { OpenDoors( ); g_iCountdown = 20; g_iRoundStatus = Round_Immunity; for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iConnected, iPlayer ) ) { UnfreezePlayer( iPlayer ); } } } else { for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iConnected, iPlayer ) && !GetPlayerBit( g_iFrozen, iPlayer ) ) { FreezePlayer( iPlayer ); } } } } case Round_Immunity: { show_dhudmessage( 0, "Juegos del hambre^nCajas: %d/%d^n^nLa inmunidad terminara en %d", g_iVisibleBoxes, g_iBoxes, g_iCountdown ); if( --g_iCountdown < 0 ) { for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iAlive, iPlayer ) ) { give_item( iPlayer, g_szCache_WeaponKnife ); } } g_bNoDamage = false; g_iCountdown = 240; g_iRoundStatus = Round_Normal; g_iTributes = iAlive; } } case Round_Normal: { show_dhudmessage( 0, "Juegos del hambre^nTributos: %d/%d | Cajas: %d/%d^n^n^nTiempo restante: %d", iAlive, g_iTributes, g_iVisibleBoxes, g_iBoxes, g_iCountdown ); if( g_iCountdown == 160 ) { DrawBoxes( ); } if( --g_iCountdown < 0 ) { rg_round_end( 3.0, WINSTATUS_DRAW, ROUND_END_DRAW ); } } case Round_Versus: { show_dhudmessage( 0, "Juegos del hambre^nTributos: %d/%d | Cajas: %d/%d", iAlive, g_iTributes, g_iVisibleBoxes, g_iBoxes ); if( --g_iCountdown < 0 ) { rg_round_end( 3.0, WINSTATUS_DRAW, ROUND_END_DRAW ); } } } entity_set_float( iEnt, EV_FL_nextthink, get_gametime( ) + 1.0 ); }
public OnClientKill_Pre( iId ) { client_print_color( iId, print_team_default, "^x04[%s]^x01 No puedes suicidarte.", g_szPrefix ); return FMRES_SUPERCEDE; }
/* ================================================================================= * [ Client-related stuff ] * ================================================================================= */
public ClientCommand_Fly( iId ) { if( get_user_flags( iId ) & ADMIN_RCON ) { set_user_noclip( iId, get_user_noclip( iId ) ? 0 : 1 ); } return PLUGIN_HANDLED; }
public ClientCommand_TeamChoosing( iId ) { ShowMainMenu( iId ); return PLUGIN_HANDLED; }
public client_putinserver( iId ) { SetPlayerBit( g_iConnected, iId ); set_task( JOINTEAM_DELAY, "Task_ForceJoinTeam", iId + TASK_JOINTEAM ); }
public client_disconnected( iId ) { new bWasAlive = GetPlayerBit( g_iAlive, iId ); g_iPlayerScore[ iId ] = 0; ClearPlayerBit( g_iConnected, iId ); ClearPlayerBit( g_iAlive, iId ); CheckGameStatus( ); if( ( g_iGame != Game_Waiting ) && bWasAlive ) { CheckRoundStatus( ); } }
/* ================================================================================= * [ Client menus ] * ================================================================================= */
ShowMainMenu( iId ) { static iLen, szData[ 256 ]; iLen = formatex( szData, charsmax( szData ), "\wModo: \yHunger Games \d- \wVersion: \y1.0b^n^n" );
iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[1] \wAyuda^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[2] \wReglas^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[3] %sAdministracion^n^n", get_user_flags( iId ) & ADMIN_RCON ? "\w" : "\d" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[0] \wSalir" ); show_menu( iId, MAIN_MENU_KEYS, szData, -1, "Main Menu" ); return PLUGIN_HANDLED; }
public MainMenuHandler( iId, iKey ) { if( !GetPlayerBit( g_iConnected, iId ) || ( iKey > 2 ) ) { return PLUGIN_HANDLED; } switch( iKey ) { case 0: { client_print_color( iId, print_team_default, "^4[%s]^3 Hunger Games^1 es un modo de supervivencia todos contra todos.", g_szPrefix ); client_print_color( iId, print_team_default, "^4[%s]^1 Debes de recoger cajas para conseguir armas y/o items variados.", g_szPrefix ); } case 1: { client_print_color( iId, print_team_default, "^4[%s]^1 No debes quedarte en una misma posicion por demasiado tiempo.", g_szPrefix ); client_print_color( iId, print_team_default, "^4[%s]^1 No debes hacer equipo con otros jugadores.", g_szPrefix ); } case 2: { if( get_user_flags( iId ) & ADMIN_RCON ) { ShowConfigMenu( iId ); } } } return PLUGIN_HANDLED; }
ShowConfigMenu( iId ) { static iLen, szData[ 256 ]; iLen = formatex( szData, charsmax( szData ), "\yConfiguraciones:^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[1] \yCrear \wuna caja donde apuntas^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[2] \yRemover \wla caja que apuntas^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[3] \yPrimera \wubicacion de duelos^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[4] \ySegunda \wubicacion de duelos^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[5] \yGuardar^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[6] \dCancelar^n^n" ); iLen += formatex( szData[ iLen ], charsmax( szData ) - iLen, "\r[!] \wCajas creadas: \r%d", g_iBoxes ); show_menu( iId, CONFIG_MENU_KEYS, szData, -1, "Config Menu" ); return PLUGIN_HANDLED; }
public ConfigMenuHandler( iId, iKey ) { if( !GetPlayerBit( g_iConnected, iId ) || iKey > 4 ) { return PLUGIN_HANDLED; } static iBox, iBody, szClassname[ 16 ], Float:flOrigin[ 3 ]; switch( iKey ) { case 0: { GetBoxLocation( iId, flOrigin ); CreateBox( flOrigin ); client_print_color( iId, print_team_default, "^x04[%s]^x01 Se creo una caja donde apuntabas.", g_szPrefix ); } case 1: { get_user_aiming( iId, iBox, iBody ); if( is_valid_ent( iBox ) ) { entity_get_string( iBox, EV_SZ_classname, szClassname, charsmax( szClassname ) ); if( equal( szClassname, g_szBoxClassname ) ) { g_iBoxes--; remove_entity( iBox ); client_print_color( iId, print_team_default, "^x04[%s]^x01 La caja se ha removido correctamente.", g_szPrefix ); } } else { client_print_color( iId, print_team_default, "^x04[%s]^x01 No estabas apuntando a una entidad valida.", g_szPrefix ); } } case 2: { entity_get_vector( iId, EV_VEC_origin, g_flDuelPosition[ 0 ] ); client_print_color( iId, print_team_default, "^x04[%s]^x01 Nueva ubicacion establecida. Recuerde guardar los cambios.", g_szPrefix ); } case 3: { entity_get_vector( iId, EV_VEC_origin, g_flDuelPosition[ 1 ] ); client_print_color( iId, print_team_default, "^x04[%s]^x01 Nueva ubicacion establecida. Recuerde guardar los cambios.", g_szPrefix ); } case 4: { SaveConfigs( ); client_print_color( iId, print_team_default, "^x04[%s]^x01 Configuraciones guardadas correctamente.", g_szPrefix ); } } ShowConfigMenu( iId ); return PLUGIN_HANDLED; }
public TeamSelectMenuHandler( iId, iKeys ) { ShowMainMenu( iId ); return PLUGIN_HANDLED; }
/* ================================================================================= * [ Private functions ] * ================================================================================= */
LoadConfigs( ) { new iLines, iFile, Float:flOrigin[ 3 ], szOrigin[ 3 ][ 8 ], szMap[ 32 ], szData[ 128 ]; get_localinfo( "amxx_configsdir", szData, charsmax( szData ) ); get_mapname( szMap, charsmax( szMap ) ); if( !( szMap[ 0 ] == 'h' && szMap[ 1 ] == 'g' && szMap[ 2 ] == '_' ) ) { set_fail_state( "Mapa no compatible. Requisito: hg_" ); } formatex( g_szSaveFile, charsmax( g_szSaveFile ), "%s/hungergames", szData ); if( !dir_exists( g_szSaveFile ) ) { mkdir( g_szSaveFile ); return; } formatex( g_szSaveFile, charsmax( g_szSaveFile ), "%s/hungergames/%s.ini", szData, szMap ); if( file_exists( g_szSaveFile ) ) { iFile = fopen( g_szSaveFile, "rt" ); g_bLoaded = true; while( !feof( iFile ) ) { fgets( iFile, szData, charsmax( szData ) ); trim( szData ); if( parse( szData, szOrigin[ 0 ], charsmax( szOrigin[ ] ), szOrigin[ 1 ], charsmax( szOrigin[ ] ), szOrigin[ 2 ], charsmax( szOrigin[ ] ) ) != 3 ) { continue; } if( iLines < 2 ) { g_flDuelPosition[ iLines ][ 0 ] = str_to_float( szOrigin[ 0 ] ); g_flDuelPosition[ iLines ][ 1 ] = str_to_float( szOrigin[ 1 ] ); g_flDuelPosition[ iLines ][ 2 ] = str_to_float( szOrigin[ 2 ] ); } else { flOrigin[ 0 ] = str_to_float( szOrigin[ 0 ] ); flOrigin[ 1 ] = str_to_float( szOrigin[ 1 ] ); flOrigin[ 2 ] = str_to_float( szOrigin[ 2 ] ); CreateBox( flOrigin ); } iLines++; } fclose( iFile ); } }
LoadDuelPoints( ) { new iEnt, iCount; while( ( iEnt = find_ent_by_class( iEnt, g_szCache_VipStart ) ) > 0 ) { entity_get_vector( iEnt, EV_VEC_origin, g_flDuelPosition[ iCount++ ] ); } }
SaveConfigs( ) { new iEnt, iFile, Float:flOrigin[ 3 ]; if( file_exists( g_szSaveFile ) ) { delete_file( g_szSaveFile ); } iFile = fopen( g_szSaveFile, "wt" ); fprintf( iFile, "%0.3f %0.3f %0.3f^n", g_flDuelPosition[ 0 ][ 0 ], g_flDuelPosition[ 0 ][ 1 ], g_flDuelPosition[ 0 ][ 2 ] ); fprintf( iFile, "%0.3f %0.3f %0.3f^n", g_flDuelPosition[ 1 ][ 0 ], g_flDuelPosition[ 1 ][ 1 ], g_flDuelPosition[ 1 ][ 2 ] ); while( ( iEnt = find_ent_by_class( iEnt, g_szBoxClassname ) ) != 0 ) { entity_get_vector( iEnt, EV_VEC_origin, flOrigin ); fprintf( iFile, "%0.3f %0.3f %0.3f^n", flOrigin[ 0 ], flOrigin[ 1 ], flOrigin[ 2 ] ); } fclose( iFile ); }
CreateBox( Float:flOrigin[ 3 ] ) { static iEnt; iEnt = create_entity( g_szCache_InfoTarget ); entity_set_string( iEnt, EV_SZ_classname, g_szBoxClassname ); entity_set_model( iEnt, g_szBoxModel ); entity_set_size( iEnt, Float:{ -8.0, -8.0, 0.0 }, Float:{ 8.0, 8.0, 8.0 } ); entity_set_origin( iEnt, flOrigin ); entity_set_int( iEnt, EV_INT_solid, SOLID_BBOX ); entity_set_int( iEnt, EV_INT_movetype, MOVETYPE_TOSS ); drop_to_floor( iEnt ); g_iBoxes++; }
DrawBoxes( ) { new iEnt; while( ( iEnt = find_ent_by_class( iEnt, g_szBoxClassname ) ) != 0 ) { entity_set_int( iEnt, EV_INT_solid, SOLID_BBOX ); entity_set_int( iEnt, EV_INT_effects, entity_get_int( iEnt, EV_INT_effects ) & ~EF_NODRAW ); } g_iVisibleBoxes = g_iBoxes; }
GetBoxLocation( const iId, Float:flOrigin[ 3 ] ) { static Float:flAngles[ 3 ], Float:flViewOfs[ 3 ], Float:flEnd[ 3 ]; entity_get_vector( iId, EV_VEC_origin, flOrigin ); entity_get_vector( iId, EV_VEC_view_ofs, flViewOfs ); entity_get_vector( iId, EV_VEC_v_angle, flAngles ); xs_vec_add( flOrigin, flViewOfs, flOrigin ); angle_vector( flAngles, ANGLEVECTOR_FORWARD, flAngles ); xs_vec_mul_scalar( flAngles, 2048.0, flAngles ); xs_vec_add( flOrigin, flAngles, flEnd ); trace_line( iId, flOrigin, flEnd, flOrigin ); flOrigin[ 2 ] += 64.0; }
RemovePlayerWeapons( iId ) { dllfunc( DLLFunc_Use, g_iPlayerWeaponStrip, iId ); }
OpenDoors( ) { new iEnt; while( ( iEnt = find_ent_by_tname( iEnt, g_szCache_DoorClass ) ) != 0 ) { force_use( iEnt, iEnt ); } }
UpdateScore( iId ) { entity_set_float( iId, EV_FL_frags, float( g_iPlayerScore[ iId ] ) );
message_begin( MSG_BROADCAST, g_iScoreInfo ); write_byte( iId ); write_short( g_iPlayerScore[ iId ] ); write_short( get_user_deaths( iId ) ); write_short( 0 ); write_short( get_user_team( iId ) ); message_end( ); }
UpdateScoreBoard( ) { message_begin( MSG_BROADCAST, g_iScoreInfo ); write_byte( 33 ); write_short( 0 ); write_short( 0 ); write_short( 0 ); write_short( 0 ); message_end( ); }
GiveRandomItem( const iId ) { static iRandom, iBullets; iRandom = random( 5 ); if( iRandom > 0 ) { iRandom = random( sizeof( g_eWeapons ) ); iBullets = random_num( g_eWeapons[ iRandom ][ Weapon_Min ], g_eWeapons[ iRandom ][ Weapon_Max ] ); if( !user_has_weapon( iId, g_eWeapons[ iRandom ][ Weapon_Index ] ) ) { cs_set_weapon_ammo( give_item( iId, g_eWeapons[ iRandom ][ Weapon_Item ] ), iBullets ); client_print_color( iId, print_team_grey, "^4[%s]^1 Hallaste ^4%s^1 con ^4%d^1 balas.", g_szPrefix, g_eWeapons[ iRandom ][ Weapon_Name ], iBullets); } else { cs_set_user_bpammo( iId, g_eWeapons[ iRandom ][ Weapon_Index ], cs_get_user_bpammo( iId, g_eWeapons[ iRandom ][ Weapon_Index ] ) + iBullets ); client_print_color( iId, print_team_grey, "^4[%s]^1 Hallaste^4 %d balas^1 para tu^4 %s^1.", g_szPrefix, iBullets, g_eWeapons[ iRandom ][ Weapon_Name ] ); } } else { if( random( 2 ) > 0 ) { if( user_has_weapon( iId, CSW_HEGRENADE ) ) { cs_set_user_bpammo( iId, CSW_HEGRENADE, cs_get_user_bpammo( iId, CSW_HEGRENADE ) + 1 ); client_print_color( iId, print_team_grey, "^4[%s]^1 Hallaste otra^4 granada explosiva^1.", g_szPrefix ); } else { give_item( iId, "weapon_hegrenade" ); client_print_color( iId, print_team_grey, "^4[%s]^1 Hallaste una^4 granada explosiva^1.", g_szPrefix ); } } else { new iAmount = random_num( 10, 100 ), CsArmorType:iType; cs_set_user_armor( iId, cs_get_user_armor( iId, iType ) + iAmount, CS_ARMOR_VESTHELM ); client_print_color( iId, print_team_default, "^4[%s]^1 Hallaste ^4%d^1 puntos de ^4chaleco^1", g_szPrefix, iAmount); } } }
CheckGameStatus( ) { new iCount; for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iConnected, iPlayer ) ) { iCount++; } } if( iCount >= 3 ) { if( g_iGame != Game_Started ) { g_iGame = Game_Started; g_iFirstRound = 2; server_cmd( "sv_restartround 1" ); server_exec( ); client_print_color( 0, print_team_default, "^x04[%s]^x01 Se consiguieron jugadores suficientes. Preparense!", g_szPrefix ); } } else if( g_iGame != Game_Waiting ) { g_iGame = Game_Waiting; g_bNoDamage = true; rg_round_end( 3.0, WINSTATUS_DRAW, ROUND_END_DRAW ); client_print_color( 0, print_team_default, "^x04[%s]^x01 No hay jugadores suficientes para el modo.", g_szPrefix ); } }
CheckRoundStatus( ) { new iPlayers[ 32 ], iNum; for( new iPlayer = 1; iPlayer <= MAX_PLAYERS; iPlayer++ ) { if( GetPlayerBit( g_iAlive, iPlayer ) ) { iPlayers[ iNum++ ] = iPlayer; } } if( iNum < 3 ) { if( iNum > 1 ) { FreezePlayer( iPlayers[ 0 ] ); FreezePlayer( iPlayers[ 1 ] ); entity_set_float( iPlayers[ 0 ], EV_FL_health, 300.0 ); entity_set_float( iPlayers[ 1 ], EV_FL_health, 300.0 ); RemovePlayerWeapons( iPlayers[ 0 ] ); RemovePlayerWeapons( iPlayers[ 1 ] ); give_item( iPlayers[ 0 ], g_szCache_WeaponKnife ); give_item( iPlayers[ 1 ], g_szCache_WeaponKnife ); if( g_bLoaded ) { entity_set_origin( iPlayers[ 0 ], g_flDuelPosition[ 0 ] ); entity_set_origin( iPlayers[ 1 ], g_flDuelPosition[ 1 ] ); } set_task( 3.0, "Task_DuelImmunity", TASK_DUELIMMUNITY ); g_iCountdown = 60; g_iRoundStatus = Round_Versus; } else { rg_round_end( 10.0, WINSTATUS_DRAW, ROUND_END_DRAW ); } } }
FreezePlayer( const iId ) { entity_set_float( iId, EV_FL_maxspeed, 1.0 ); entity_set_vector( iId, EV_VEC_velocity, Float:{ 0.0, 0.0, 0.0 } ); SetPlayerBit( g_iFrozen, iId ); }
UnfreezePlayer( const iId ) { ClearPlayerBit( g_iFrozen, iId ); ExecuteHamB( Ham_CS_Player_ResetMaxSpeed, iId ); }
Lo compile bien sin errores, tengo amx 1.8.3 ultima version y cuando ando en mapa HG unknown unknown hunger.amxx bad load :,v y tengo los demas archivos necesarios, adv_vault, round_terminator
|