Mensajes: 205
Temas: 52
Registro en: Aug 2016
Reputación:
0
03/06/2019, 04:09 PM
(Última modificación: 04/06/2019, 03:54 PM por |-|Tuli|-|. Edited 1 time in total.)
hola, tengo un problema con este menu y no encuentro la falla
idea del menu: la idea es que cambie de nombre al estar activado y al estar desacitivado
osea si es de noche que diga para que sea de dia
y si es de dia que diga para q sea de noche
Cita:PROBLEMA: al copilar me dice
Warning: Function "Handle_Escondida" should return a value on line 61
codigo:
Código PHP: new dia = false public Evento_Escondida(id) { new texto[50] new menu = menu_create("\r[ \yEvento Escondidas \r]", "Handle_Escondida") if(!dia) { formatex(texto, charsmax(texto), "Hacer de: \dNOCHE") } else if(dia) { formatex(texto, charsmax(texto), "Hacer de: \yDIA") } menu_additem(menu, texto, "0") menu_additem(menu, "Dar Arma", "1", 0) menu_setprop(menu, MPROP_EXITNAME,"Atras") menu_display(id, menu, 0) } public Handle_Escondida(id, menu, item){ if (item == MENU_EXIT){ menu_staff2(id) menu_destroy(menu) } switch(item){ case 0: { if(!dia) { set_lights("a") set_cvar_num("mp_flashlight", 1) Evento_Escondida(id) dia = true } if(dia) { set_lights("#OFF") set_cvar_num("mp_flashlight", 0) Evento_Escondida(id) dia = false } return PLUGIN_HANDLED } case 1: client_print(id, print_chat, "asd") } } // aca me dice que es el error return PLUGIN_HANDLED }
Mensajes: 1,040
Temas: 89
Registro en: Jun 2015
Reputación:
21
Código PHP: new dia = false public Evento_Escondida(id) { new texto[50] new menu = menu_create("\r[ \yEvento Escondidas \r]", "Handle_Escondida") formatex(texto, charsmax(texto), "Hacer de: %s", dia == true ? "\yDIA":"\dNOCHE") menu_additem(menu, texto, "0") menu_additem(menu, "Dar Arma", "1", 0) menu_setprop(menu, MPROP_EXITNAME,"Atras") menu_display(id, menu, 0) } public Handle_Escondida(id, menu, item) { if (item == MENU_EXIT){ menu_staff2(id) menu_destroy(menu) } switch(item) { case 0: { if(!dia) { set_lights("a") set_cvar_num("mp_flashlight", 1) Evento_Escondida(id) dia = true } if(dia) { set_lights("#OFF") set_cvar_num("mp_flashlight", 0) Evento_Escondida(id) dia = false } return PLUGIN_HANDLED } case 1: client_print(id, print_chat, "asd") } return PLUGIN_HANDLED }
Prueba
“Quien te quiere en su vida, volverá a buscarte”
Qué frase más estúpida
Porque quien te quiere en su vida, jamás se iría.
Mensajes: 205
Temas: 52
Registro en: Aug 2016
Reputación:
0
03/06/2019, 04:57 PM
(Última modificación: 03/06/2019, 04:59 PM por |-|Tuli|-|. Edited 1 time in total.)
con el metodo que me pasaste y me tira un warning
se pone en dia y despues queda en dia osea si lo preciono denuevo no vuelve a decir NOCHE
intente hacerlo asi y no me tira mas los warnings pero sigue con el problema de que al precionar denuevo no cambia
asi esta ahora
Código PHP: new dia public Evento_Escondida(id) { new texto[50] new menu = menu_create("\r[ \yEvento Escondidas \r]", "Handle_Escondida") if(!dia) { formatex(texto, charsmax(texto), "Hacer de: \dNOCHE") } else if(dia) { formatex(texto, charsmax(texto), "Hacer de: \yDIA") } menu_additem(menu, texto, "0") menu_additem(menu, "Dar Arma", "1", 0) menu_setprop(menu, MPROP_EXITNAME,"Atras") menu_display(id, menu, 0) } public Handle_Escondida(id, menu, item) { if (item == MENU_EXIT){ menu_staff2(id) menu_destroy(menu) } switch(item) { case 0: { if(!dia) { set_lights("a") set_cvar_num("mp_flashlight", 1) Evento_Escondida(id) dia = true } if(dia) { set_lights("#OFF") set_cvar_num("mp_flashlight", 0) Evento_Escondida(id) dia = false } return PLUGIN_HANDLED } case 1: menu_armas(id) } return PLUGIN_HANDLED }
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
Espero te sirva!
Saludos.
Código PHP: /* Sublime AMXX Editor v3.0.0-beta */
#include < amxmodx > #include < engine >
#pragma semicolon 1
#if AMXX_VERSION_NUM < 183
#define client_disconected client_disconnect #define print_team_default 0 #define MAX_PLAYERS 32 #define MAX_NAME_LENGTH 32
stock client_print_color( iID, iFakeVar, const szInput[ ], any:... ) {
#pragma unused iFakeVar static szMessage[ 191 ], g_iMsgSayText;
if( !g_iMsgSayText ) g_iMsgSayText = get_user_msgid( "SayText" );
vformat( szMessage, 190, szInput, 3 );
message_begin( iID ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, g_iMsgSayText, .player = iID ); write_byte( iID ? iID : 33 ); write_string( szMessage ); message_end( ); } #endif
/* GLOBAL STUFF */ new g_szPluginName[ ] = "Seeker Event Menu"; new g_szPluginVersion[ ] = "1.0b"; new g_szPluginAuthor[ ] = "Chema";
new g_szSayPrefix[ ] = "^3[Kohoutek Gaming]^1"; new g_szConsolePrefix[ ] = "[Kohoutek Gaming]"; new g_szContactUrl[ ] = "www.amxmodx-es.com/Chema";
new const g_szSelectItemSound[ ] = "Ui/buttonclickrelease.wav";
new g_bDay;
public plugin_init( ) {
register_plugin( g_szPluginName, g_szPluginVersion, g_szPluginAuthor ); /* Plugin Cvars */ register_cvar( "sem_author", g_szPluginAuthor, FCVAR_SPONLY );
/* Client-related Stuff */ register_clcmd( "say /event", "ShowSeekerEventMenu" );
g_bDay = false; }
/* Seeker Event Menu */ public ShowSeekerEventMenu( const iID ) {
new iMenu = menu_create( "\ySeeker Event Menu^n^n\yIn this mode you have to hide from the \wCT's", "HandlerSeekerEventMenu" );
menu_additem( iMenu, g_bDay ? "Make \yDAY" : "Make \dNIGHT" ); menu_additem( iMenu, "Give weapons" );
menu_display( iID, iMenu, 0 ); }
public HandlerSeekerEventMenu( const iID, const iMenu, const iItem ) {
if( iItem == MENU_EXIT ) {
menu_destroy( iMenu ); return PLUGIN_HANDLED; }
switch( iItem ) {
case 0: {
g_bDay =! g_bDay; g_bDay ? set_lights( "a" ) : set_lights( "#OFF" ); g_bDay ? set_cvar_num( "mp_flashlight", 1 ) : set_cvar_num( "mp_flashlight", 0 ); } case 1: client_print( iID, print_chat, "%s GIVE WEAPONS!", g_szConsolePrefix ); }
ShowSeekerEventMenu( iID ); client_cmd( iID, "spk ^"%s^"", g_szSelectItemSound );
return PLUGIN_HANDLED; }
Mensajes: 205
Temas: 52
Registro en: Aug 2016
Reputación:
0
03/06/2019, 05:41 PM
(Última modificación: 03/06/2019, 05:41 PM por |-|Tuli|-|. Edited 1 time in total.)
gracias chema me sirvio
logre adaptarlo y
ME QUEDO ASI
Código PHP: public Evento_Escondida(id) { new texto[50] new menu = menu_create("\r[ \yEvento Escondidas \r]", "Handle_Escondida") if(!dia) { formatex(texto, charsmax(texto), "Hacer de: \dNOCHE") } else if(dia) { formatex(texto, charsmax(texto), "Hacer de: \yDIA") } menu_additem(menu, texto, "0") menu_additem(menu, "Dar Arma", "1", 0) menu_setprop(menu, MPROP_EXITNAME,"Atras") menu_display(id, menu, 0) } public Handle_Escondida(id, menu, item) { if (item == MENU_EXIT){ menu_staff2(id) menu_destroy(menu) } switch(item) { case 0: { dia =! dia; //g_bDay ? set_lights( "a" ) : set_lights( "#OFF" ); dia ? set_lights("a") : set_lights("#OFF") dia ? set_cvar_num("mp_flashlight", 1) : set_cvar_num("mp_flashlight", 0) Evento_Escondida(id) } case 1: menu_armas(id) } return PLUGIN_HANDLED }
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
De nada.
Que horrible styling , con lo prolijo que lo había dejado yo
Saludos.
|