Mensajes: 175
Temas: 57
Registro en: May 2017
Reputación:
0
17/07/2018, 11:27 PM
(Última modificación: 18/07/2018, 05:31 PM por Killers-..)
Hola, bueno les queria pedir si alguien me hace una tienda para solo el equipo CT que tenga esto y que se habra con /shop o /tienda
Tienda de Items:
Glow $1500
130 HP $5000
2 Granadas Smoke y una granada HE $7000
Super velocidad $9500
Doble Salto $16000
Si alguien tan amable que me pueda hacer eso se lo agradeceria mucho garcias
Mensajes: 449
Temas: 32
Registro en: Apr 2017
Reputación:
6
Las quieres por ronda? osea que dure toda la ronda. los items?
Si no te gusta algo, cámbialo. Si no lo puedes cambiar, cambia la forma en que piensas sobre ello <3
Mensajes: 1,148
Temas: 82
Registro en: May 2015
Reputación:
8
Código PHP: // creditos twistedeuphoria multijump
#include amxmodx #include amxmisc #include cstrike #include fun #include hamsandwich #include engine
new has_speed[33] new has_jump[33]
#define PRECIO_ITEM1 1500 #define PRECIO_ITEM2 5000 #define PRECIO_ITEM3 7000 #define PRECIO_ITEM4 9500 #define PRECIO_ITEM5 16000
#define VELOCIDAD 1000.0
new jumpnum[33] = 0 new bool:dojump[33] = false
public plugin_init() { register_clcmd("say /tienda", "tiendita")
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1) register_event("CurWeapon", "curweapon","be","1=1")
register_cvar("amx_maxjumps","1") }
public client_putinserver(id) { jumpnum[id] = 0 dojump[id] = false }
public client_disconnect(id) { jumpnum[id] = 0 dojump[id] = false }
public fw_PlayerSpawn_Post(id) { has_speed[id] = 0 has_jump[id] = 0
if(is_user_alive(id)) set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 25) }
public curweapon(id) { if(is_user_alive(id) && (has_speed[id])) speed(id) }
public tiendita(id) { if(!is_user_admin(id)) { client_print(id, print_chat, "No tienes acceso") return PLUGIN_HANDLED }
if(get_user_team(id) != 2) { client_print(id, print_chat, "Debes ser CT") return PLUGIN_HANDLED }
new menu = menu_create("menu de compra", "menu_menu")
menu_additem(menu, "Random Glow \r$1500", "0", 0) menu_additem(menu, "130 HP \r$5000", "1", 0) menu_additem(menu, "2 Smoke 1 HE \r$7000", "2" , 0) menu_additem(menu, "Super Velocidad \r$9500", "3" , 0) menu_additem(menu, "Doble Salto \r$16000", "4" , 0)
menu_setprop(menu, MPROP_NUMBER_COLOR, "\y"); menu_setprop(menu, MPROP_EXIT, MEXIT_ALL) menu_setprop(menu, MPROP_BACKNAME , "Atras"); menu_setprop(menu, MPROP_NEXTNAME , "Mas"); menu_setprop(menu, MPROP_EXITNAME, "Salir") menu_display(id, menu, 0)
return PLUGIN_HANDLED }
public menu_menu(id, menu, item) { if ( item == MENU_EXIT ) { menu_destroy(menu) return PLUGIN_HANDLED }
if(!is_user_alive(id)) { menu_destroy(menu) return PLUGIN_HANDLED }
switch(item) { case 0: { if(cs_get_user_money(id) >= PRECIO_ITEM1) { cs_set_user_money(id, cs_get_user_money(id) - PRECIO_ITEM1) set_user_rendering(id, kRenderFxGlowShell, random_num(0,255), random_num(0,255), random_num(0,255), kRenderNormal, 25) }
else client_print(id, print_chat, "No tienes dinero") }
case 1: { if(cs_get_user_money(id) >= PRECIO_ITEM2) { cs_set_user_money(id, cs_get_user_money(id) - PRECIO_ITEM2) set_user_health(id, 130) }
else client_print(id, print_chat, "No tienes dinero") }
case 2: { if(cs_get_user_money(id) >= PRECIO_ITEM3) { cs_set_user_money(id, cs_get_user_money(id) - PRECIO_ITEM3) give_item(id, "weapon_smokegrenade") cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 2) give_item(id, "weapon_hegrenade") }
else client_print(id, print_chat, "No tienes dinero") }
case 3: { if(cs_get_user_money(id) >= PRECIO_ITEM4) { cs_set_user_money(id, cs_get_user_money(id) - PRECIO_ITEM4) speed(id) has_speed[id] = 1 }
else client_print(id, print_chat, "No tienes dinero") }
case 4: { if(cs_get_user_money(id) >= PRECIO_ITEM5) { cs_set_user_money(id, cs_get_user_money(id) - PRECIO_ITEM5) has_jump[id] = 1 }
else client_print(id, print_chat, "No tienes dinero") } } return PLUGIN_HANDLED }
public speed(id) set_user_maxspeed(id , Float:VELOCIDAD)
public client_PreThink(id) { if(!is_user_alive(id)) return PLUGIN_CONTINUE
if(!has_jump[id]) return PLUGIN_CONTINUE
new nbut = get_user_button(id) new obut = get_user_oldbutton(id) if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP)) { if(jumpnum[id] < get_cvar_num("amx_maxjumps")) { dojump[id] = true jumpnum[id]++ return PLUGIN_CONTINUE } }
if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND)) { jumpnum[id] = 0 return PLUGIN_CONTINUE } return PLUGIN_CONTINUE }
public client_PostThink(id) { if(!is_user_alive(id)) return PLUGIN_CONTINUE if(!has_jump[id]) return PLUGIN_CONTINUE
if(dojump[id] == true) { new Float:velocity[3] entity_get_vector(id,EV_VEC_velocity,velocity) velocity[2] = random_float(265.0,285.0) entity_set_vector(id,EV_VEC_velocity,velocity) dojump[id] = false return PLUGIN_CONTINUE } return PLUGIN_CONTINUE }
Mensajes: 1,072
Temas: 57
Registro en: Feb 2016
Reputación:
8
18/07/2018, 01:27 AM
(Última modificación: 18/07/2018, 01:33 AM por Niper.-..)
Sorry, no tested.
No vi lo de Nelo.
Código PHP: #include < amxmodx > #include < amxmisc > #include < cstrike > #include < ColorChat > #include < fakemeta_util >
new const PLUGIN [ ] = "[AMXX] Tienda"; new const VERSION [ ] = "1.0"; new const AUTHOR [ ] = "heNK'";
enum _:Tienda{ NOMBRE [ 40 ], PRECIO }
new const szTienda [ ] [ Tienda ] = { { "Glow", 1500 }, //0 { "130HP", 5000 }, //1 { "2 Smoke 1 He", 7000 }, //2 { "Super Velocidad", 9500 }, //3 { "Doble Salto", 16000 } //4 };
new const szPrefix [ ] = "^4[TIENDA]^1";
new g_iTiendaShop [ 33 ] [ 5 ];
new bool:bIsJump [ 33 ] = false; new g_iSaltosMax [ 33 ];
public plugin_init ( ) { register_plugin ( PLUGIN, VERSION, AUTHOR ); register_clcmd ( "say /tienda", "cmdTienda" ); register_clcmd ( "say_team /tienda", "cmdTienda" ); register_forward ( FM_PlayerPreThink, "FW_PlayerPreThink", 0 ); register_forward ( FM_PlayerPreThink, "FW_PlayerPreThink_Post", 1 ); }
public FW_PlayerPreThink ( iIndex ) { if ( !is_user_alive ( iIndex ) || !is_user_admin ( iIndex ) ) return PLUGIN_HANDLED; new iButton = pev ( iIndex, pev_button ); new iOldButton = pev ( iIndex, pev_oldbuttons ); new iFlags = pev ( iIndex, pev_flags ); if ( ( iButton & IN_JUMP ) && !( iFlags & FL_ONGROUND ) && !( iOldButton & IN_JUMP ) ) { if ( g_iSaltosMax [ iIndex ] < 1 ){ bIsJump [ iIndex ] = true; g_iSaltosMax [ iIndex ]++; return PLUGIN_HANDLED; } } if ( ( iButton & IN_JUMP ) && ( iFlags & FL_ONGROUND ) ){ g_iSaltosMax [ iIndex ] = 0; return PLUGIN_CONTINUE; } return PLUGIN_HANDLED; }
public FW_PlayerPreThink_Post ( iIndex ){ if ( !is_user_alive ( iIndex ) || !is_user_admin ( iIndex ) ) return PLUGIN_HANDLED; if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { if ( bIsJump [ iIndex ] == true ) { new Float:flVelocity [ 3 ]; pev ( iIndex, pev_velocity, flVelocity ); flVelocity [ 2 ] += random_float ( 265.0, 285.0 ); set_pev ( iIndex, pev_velocity, flVelocity ); bIsJump [ iIndex ] = false; return PLUGIN_CONTINUE; } } return PLUGIN_CONTINUE; }
public client_putinserver ( iIndex ){ g_iSaltosMax [ iIndex ] = 0; bIsJump [ iIndex ] = false; }
public client_disconnect ( iIndex ){ g_iSaltosMax [ iIndex ] = 0; bIsJump [ iIndex ] = false; }
public cmdTienda ( iIndex ) { if ( !is_user_alive ( iIndex ) || !is_user_admin ( iIndex ) ){ ColorChat ( iIndex, GREEN, "%s No puedes usar la tienda estando muerto o no siendo admin.", szPrefix ); return PLUGIN_HANDLED; } if ( ! ( cs_get_user_team ( iIndex ) == CS_TEAM_CT ) ) { ColorChat ( iIndex, GREEN, "%s Probablemente no eres ^3CT", szPrefix ); return PLUGIN_HANDLED; } new iMenu = menu_create ( "\y[TIENDA SHOP] \wCompras!", "HandlerComprasMenu" ); static iLen [ 256 ]; //256=MAX BUFFER. new iMoney = cs_get_user_money ( iIndex ); for ( new i = 0; i < sizeof ( szTienda ); i++ ){ if ( cs_get_user_money ( iIndex ) < szTienda [ i ] [ PRECIO ] ) formatex ( iLen, sizeof ( iLen ), "%s \y[$%d] \d(TIENES $%d, restante \y%d\d)", szTienda [ i ] [ NOMBRE ], szTienda [ i ] [ PRECIO ], iMoney, szTienda [ i ] [ PRECIO ] - iMoney ); else formatex ( iLen, sizeof ( iLen ), "%s \y[$%d]", szTienda [ i ] [ NOMBRE ], szTienda [ i ] [ PRECIO ] ); menu_additem ( iMenu, iLen ); } menu_setprop ( iMenu, MPROP_EXITNAME, "Salir" ); menu_setprop ( iMenu, MPROP_NEXTNAME, "Siguiente" ); menu_setprop ( iMenu, MPROP_BACKNAME, "Atras" ); menu_setprop ( iMenu, MPROP_NUMBER_COLOR, "\y" ); menu_display ( iIndex, iMenu ); return PLUGIN_HANDLED; }
public HandlerComprasMenu ( iIndex, iMenu, iItem ){ if ( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED; } new iMoney = cs_get_user_money ( iIndex ); if ( iMoney >= szTienda [ iItem ] [ PRECIO ] ){ cs_set_user_money ( iIndex, iMoney - szTienda [ iItem ] [ PRECIO ] ) } else{ ColorChat ( iIndex, GREEN, "%s Te falta ^3($%d) ^1para comprar el item ^4%s", szPrefix, szTienda [ iItem ] [ PRECIO ] - iMoney, szTienda [ iItem ] [ NOMBRE ] ); cmdTienda ( iIndex ); return PLUGIN_HANDLED; } switch ( iItem ) { case 0:{ if ( g_iTiendaShop [ iIndex ] [ 0 ] ) { //item = 0. ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_rendering ( iIndex, kRenderFxGlowShell, 255, 125, 127, kRenderNormal, 35 ); g_iTiendaShop [ iIndex ] [ 0 ] = true; } case 1: { if ( g_iTiendaShop [ iIndex ] [ 1 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_health ( iIndex, 130 ); g_iTiendaShop [ iIndex ] [ 1 ] = true; } case 2: { if ( g_iTiendaShop [ iIndex ] [ 2 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_give_item ( iIndex, "weapon_hegrenade" ); fm_give_item ( iIndex, "weapon_smokegrenade" ); cs_set_user_bpammo ( iIndex, CSW_SMOKEGRENADE, 2 ); g_iTiendaShop [ iIndex ] [ 2 ] = true; } case 3: { if ( g_iTiendaShop [ iIndex ] [ 3 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_maxspeed ( iIndex, 350.0 ); set_task ( 15.0, "RemoverVelocidad", iIndex ); //15 Segundos. g_iTiendaShop [ iIndex ] [ 3 ] = true; } case 4: { if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } g_iTiendaShop [ iIndex ] [ 4 ] = true; } } return PLUGIN_HANDLED; }
public RemoverVelocidad ( iIndex ) { fm_set_user_maxspeed ( iIndex, 250.0 ); ColorChat ( iIndex, GREEN, "%s La velocidad se te termino", szPrefix ); }
Mensajes: 175
Temas: 57
Registro en: May 2017
Reputación:
0
18/07/2018, 02:12 PM
(Última modificación: 18/07/2018, 05:06 PM por Killers-..)
(18/07/2018, 12:03 AM)Saber escribió: Las quieres por ronda? osea que dure toda la ronda. los items?
Sii quiero que los items duren una sola ronda y que la velocidad sea por 20 segundos y el doble salto hasta que se termine la ronda y que la pasar los 20 segundos de la velocidad le diga un mensaje en el chat se te ha acabado la super velocidad y que cada item se pueda comprar una vez por ronda porfavor men me equivoque en el titulo la tienda era para el equipo cT no para los admins sorry
Mensajes: 546
Temas: 83
Registro en: Mar 2018
Reputación:
9
(18/07/2018, 02:12 PM)Killers-. escribió: (18/07/2018, 12:03 AM)Saber escribió: Las quieres por ronda? osea que dure toda la ronda. los items?
Sii quiero que los items duren una sola ronda y que la velocidad sea por 20 segundos y el doble salto hasta que se termine la ronda y que la pasar los 20 segundos de la velocidad le diga un mensaje en el chat se te ha acabado la super velocidad y que cada item se pueda comprar una vez por ronda porfavor men me equivoque en el titulo la tienda era para el equipo cT no para los admins sorry
Cuando haces perder el tiempo a todos...
Lo que tu pides puedes buscarlo en tutoriales, esta bien que la gente te ayude y todo pero tu también deberias decir algo en ves de hacer C&P? pero bueno no puedo culparte todos cometemos errores
Mensajes: 375
Temas: 55
Registro en: Jan 2016
Reputación:
9
(18/07/2018, 08:00 PM)Nazy.- escribió: (18/07/2018, 02:12 PM)Killers-. escribió: (18/07/2018, 12:03 AM)Saber escribió: Las quieres por ronda? osea que dure toda la ronda. los items?
Sii quiero que los items duren una sola ronda y que la velocidad sea por 20 segundos y el doble salto hasta que se termine la ronda y que la pasar los 20 segundos de la velocidad le diga un mensaje en el chat se te ha acabado la super velocidad y que cada item se pueda comprar una vez por ronda porfavor men me equivoque en el titulo la tienda era para el equipo cT no para los admins sorry
Cuando haces perder el tiempo a todos...
Lo que tu pides puedes buscarlo en tutoriales, esta bien que la gente te ayude y todo pero tu también deberias decir algo en ves de hacer C&P? pero bueno no puedo culparte todos cometemos errores
Está en la sección de Pedidos de Plugin, no es necesario responder de esa manera al usuario del Thread.
Mensajes: 1,072
Temas: 57
Registro en: Feb 2016
Reputación:
8
18/07/2018, 09:31 PM
(Última modificación: 18/07/2018, 09:31 PM por Niper.-..)
Toma..
Código PHP: #include < amxmodx > #include < amxmisc > #include < cstrike > #include < ColorChat > #include < fakemeta_util >
new const PLUGIN [ ] = "[AMXX] Tienda"; new const VERSION [ ] = "1.1"; new const AUTHOR [ ] = "heNK'";
enum _:Tienda{ NOMBRE [ 40 ], PRECIO }
new const szTienda [ ] [ Tienda ] = { { "Glow", 1500 }, //0 { "130HP", 5000 }, //1 { "2 Smoke 1 He", 7000 }, //2 { "Super Velocidad", 9500 }, //3 { "Doble Salto", 16000 } //4 };
new const szPrefix [ ] = "^4[TIENDA]^1";
new g_iTiendaShop [ 33 ] [ 5 ];
new bool:bIsJump [ 33 ] = false; new g_iSaltosMax [ 33 ];
public plugin_init ( ) { register_plugin ( PLUGIN, VERSION, AUTHOR ); register_clcmd ( "say /tienda", "cmdTienda" ); register_clcmd ( "say_team /tienda", "cmdTienda" ); register_forward ( FM_PlayerPreThink, "FW_PlayerPreThink", 0 ); register_forward ( FM_PlayerPreThink, "FW_PlayerPreThink_Post", 1 ); register_event ( "HLTV", "eventRoundStart", "a", "1=0", "2=0" ); }
public eventRoundStart ( ){ for ( new i = 1; i <= get_maxplayers ( ); i++ ){ g_iTiendaShop [ i ] [ 0 ] = false; g_iTiendaShop [ i ] [ 1 ] = false; g_iTiendaShop [ i ] [ 2 ] = false; g_iTiendaShop [ i ] [ 3 ] = false; g_iTiendaShop [ i ] [ 4 ] = false; } }
public FW_PlayerPreThink ( iIndex ) { if ( !is_user_alive ( iIndex ) || !is_user_admin ( iIndex ) ) return PLUGIN_HANDLED; new iButton = pev ( iIndex, pev_button ); new iOldButton = pev ( iIndex, pev_oldbuttons ); new iFlags = pev ( iIndex, pev_flags ); if ( ( iButton & IN_JUMP ) && !( iFlags & FL_ONGROUND ) && !( iOldButton & IN_JUMP ) ) { if ( g_iSaltosMax [ iIndex ] < 1 ){ bIsJump [ iIndex ] = true; g_iSaltosMax [ iIndex ]++; return PLUGIN_HANDLED; } } if ( ( iButton & IN_JUMP ) && ( iFlags & FL_ONGROUND ) ){ g_iSaltosMax [ iIndex ] = 0; return PLUGIN_CONTINUE; } return PLUGIN_HANDLED; }
public FW_PlayerPreThink_Post ( iIndex ){ if ( !is_user_alive ( iIndex ) ) return PLUGIN_HANDLED; if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { if ( bIsJump [ iIndex ] == true ) { new Float:flVelocity [ 3 ]; pev ( iIndex, pev_velocity, flVelocity ); flVelocity [ 2 ] += random_float ( 265.0, 285.0 ); set_pev ( iIndex, pev_velocity, flVelocity ); bIsJump [ iIndex ] = false; return PLUGIN_CONTINUE; } } return PLUGIN_CONTINUE; }
public client_putinserver ( iIndex ){ g_iSaltosMax [ iIndex ] = 0; bIsJump [ iIndex ] = false; }
public client_disconnect ( iIndex ){ g_iSaltosMax [ iIndex ] = 0; bIsJump [ iIndex ] = false; }
public cmdTienda ( iIndex ) { if ( !is_user_alive ( iIndex ) ){ ColorChat ( iIndex, GREEN, "%s No puedes usar la tienda estando muerto.", szPrefix ); return PLUGIN_HANDLED; } if ( ! ( cs_get_user_team ( iIndex ) == CS_TEAM_CT ) ) { ColorChat ( iIndex, GREEN, "%s Probablemente no eres ^3CT", szPrefix ); return PLUGIN_HANDLED; } new iMenu = menu_create ( "\y[TIENDA SHOP] \wCompras!", "HandlerComprasMenu" ); static iLen [ 256 ]; //256=MAX BUFFER. new iMoney = cs_get_user_money ( iIndex ); for ( new i = 0; i < sizeof ( szTienda ); i++ ){ if ( cs_get_user_money ( iIndex ) < szTienda [ i ] [ PRECIO ] ) formatex ( iLen, sizeof ( iLen ), "%s \y[$%d] \d(TIENES $%d, restante \y%d\d)", szTienda [ i ] [ NOMBRE ], szTienda [ i ] [ PRECIO ], iMoney, szTienda [ i ] [ PRECIO ] - iMoney ); else formatex ( iLen, sizeof ( iLen ), "%s \y[$%d]", szTienda [ i ] [ NOMBRE ], szTienda [ i ] [ PRECIO ] ); menu_additem ( iMenu, iLen ); } menu_setprop ( iMenu, MPROP_EXITNAME, "Salir" ); menu_setprop ( iMenu, MPROP_NEXTNAME, "Siguiente" ); menu_setprop ( iMenu, MPROP_BACKNAME, "Atras" ); menu_setprop ( iMenu, MPROP_NUMBER_COLOR, "\y" ); menu_display ( iIndex, iMenu ); return PLUGIN_HANDLED; }
public HandlerComprasMenu ( iIndex, iMenu, iItem ){ if ( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED; } new iMoney = cs_get_user_money ( iIndex ); if ( iMoney >= szTienda [ iItem ] [ PRECIO ] ){ cs_set_user_money ( iIndex, iMoney - szTienda [ iItem ] [ PRECIO ] ) } else{ ColorChat ( iIndex, GREEN, "%s Te falta ^3($%d) ^1para comprar el item ^4%s", szPrefix, szTienda [ iItem ] [ PRECIO ] - iMoney, szTienda [ iItem ] [ NOMBRE ] ); cmdTienda ( iIndex ); return PLUGIN_HANDLED; } switch ( iItem ) { case 0:{ if ( g_iTiendaShop [ iIndex ] [ 0 ] ) { //item = 0. ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_rendering ( iIndex, kRenderFxGlowShell, 255, 125, 127, kRenderNormal, 35 ); g_iTiendaShop [ iIndex ] [ 0 ] = true; } case 1: { if ( g_iTiendaShop [ iIndex ] [ 1 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_health ( iIndex, 130 ); g_iTiendaShop [ iIndex ] [ 1 ] = true; } case 2: { if ( g_iTiendaShop [ iIndex ] [ 2 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_give_item ( iIndex, "weapon_hegrenade" ); fm_give_item ( iIndex, "weapon_smokegrenade" ); cs_set_user_bpammo ( iIndex, CSW_SMOKEGRENADE, 2 ); g_iTiendaShop [ iIndex ] [ 2 ] = true; } case 3: { if ( g_iTiendaShop [ iIndex ] [ 3 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_maxspeed ( iIndex, 350.0 ); set_task ( 20.0, "RemoverVelocidad", iIndex ); //15 Segundos. g_iTiendaShop [ iIndex ] [ 3 ] = true; } case 4: { if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } g_iTiendaShop [ iIndex ] [ 4 ] = true; } } return PLUGIN_HANDLED; }
public RemoverVelocidad ( iIndex ) { fm_set_user_maxspeed ( iIndex, 250.0 ); ColorChat ( iIndex, GREEN, "%s La velocidad se te termino", szPrefix ); }
Mensajes: 546
Temas: 83
Registro en: Mar 2018
Reputación:
9
(18/07/2018, 08:50 PM)Cristian escribió: (18/07/2018, 08:00 PM)Nazy.- escribió: (18/07/2018, 02:12 PM)Killers-. escribió: (18/07/2018, 12:03 AM)Saber escribió: Las quieres por ronda? osea que dure toda la ronda. los items?
Sii quiero que los items duren una sola ronda y que la velocidad sea por 20 segundos y el doble salto hasta que se termine la ronda y que la pasar los 20 segundos de la velocidad le diga un mensaje en el chat se te ha acabado la super velocidad y que cada item se pueda comprar una vez por ronda porfavor men me equivoque en el titulo la tienda era para el equipo cT no para los admins sorry
Cuando haces perder el tiempo a todos...
Lo que tu pides puedes buscarlo en tutoriales, esta bien que la gente te ayude y todo pero tu también deberias decir algo en ves de hacer C&P? pero bueno no puedo culparte todos cometemos errores
Está en la sección de Pedidos de Plugin, no es necesario responder de esa manera al usuario del Thread.
Mensajes: 175
Temas: 57
Registro en: May 2017
Reputación:
0
(18/07/2018, 09:31 PM)Niper.-. escribió: Toma..
Código PHP: #include < amxmodx > #include < amxmisc > #include < cstrike > #include < ColorChat > #include < fakemeta_util >
new const PLUGIN [ ] = "[AMXX] Tienda"; new const VERSION [ ] = "1.1"; new const AUTHOR [ ] = "heNK'";
enum _:Tienda{ NOMBRE [ 40 ], PRECIO }
new const szTienda [ ] [ Tienda ] = { { "Glow", 1500 }, //0 { "130HP", 5000 }, //1 { "2 Smoke 1 He", 7000 }, //2 { "Super Velocidad", 9500 }, //3 { "Doble Salto", 16000 } //4 };
new const szPrefix [ ] = "^4[TIENDA]^1";
new g_iTiendaShop [ 33 ] [ 5 ];
new bool:bIsJump [ 33 ] = false; new g_iSaltosMax [ 33 ];
public plugin_init ( ) { register_plugin ( PLUGIN, VERSION, AUTHOR ); register_clcmd ( "say /tienda", "cmdTienda" ); register_clcmd ( "say_team /tienda", "cmdTienda" ); register_forward ( FM_PlayerPreThink, "FW_PlayerPreThink", 0 ); register_forward ( FM_PlayerPreThink, "FW_PlayerPreThink_Post", 1 ); register_event ( "HLTV", "eventRoundStart", "a", "1=0", "2=0" ); }
public eventRoundStart ( ){ for ( new i = 1; i <= get_maxplayers ( ); i++ ){ g_iTiendaShop [ i ] [ 0 ] = false; g_iTiendaShop [ i ] [ 1 ] = false; g_iTiendaShop [ i ] [ 2 ] = false; g_iTiendaShop [ i ] [ 3 ] = false; g_iTiendaShop [ i ] [ 4 ] = false; } }
public FW_PlayerPreThink ( iIndex ) { if ( !is_user_alive ( iIndex ) || !is_user_admin ( iIndex ) ) return PLUGIN_HANDLED; new iButton = pev ( iIndex, pev_button ); new iOldButton = pev ( iIndex, pev_oldbuttons ); new iFlags = pev ( iIndex, pev_flags ); if ( ( iButton & IN_JUMP ) && !( iFlags & FL_ONGROUND ) && !( iOldButton & IN_JUMP ) ) { if ( g_iSaltosMax [ iIndex ] < 1 ){ bIsJump [ iIndex ] = true; g_iSaltosMax [ iIndex ]++; return PLUGIN_HANDLED; } } if ( ( iButton & IN_JUMP ) && ( iFlags & FL_ONGROUND ) ){ g_iSaltosMax [ iIndex ] = 0; return PLUGIN_CONTINUE; } return PLUGIN_HANDLED; }
public FW_PlayerPreThink_Post ( iIndex ){ if ( !is_user_alive ( iIndex ) ) return PLUGIN_HANDLED; if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { if ( bIsJump [ iIndex ] == true ) { new Float:flVelocity [ 3 ]; pev ( iIndex, pev_velocity, flVelocity ); flVelocity [ 2 ] += random_float ( 265.0, 285.0 ); set_pev ( iIndex, pev_velocity, flVelocity ); bIsJump [ iIndex ] = false; return PLUGIN_CONTINUE; } } return PLUGIN_CONTINUE; }
public client_putinserver ( iIndex ){ g_iSaltosMax [ iIndex ] = 0; bIsJump [ iIndex ] = false; }
public client_disconnect ( iIndex ){ g_iSaltosMax [ iIndex ] = 0; bIsJump [ iIndex ] = false; }
public cmdTienda ( iIndex ) { if ( !is_user_alive ( iIndex ) ){ ColorChat ( iIndex, GREEN, "%s No puedes usar la tienda estando muerto.", szPrefix ); return PLUGIN_HANDLED; } if ( ! ( cs_get_user_team ( iIndex ) == CS_TEAM_CT ) ) { ColorChat ( iIndex, GREEN, "%s Probablemente no eres ^3CT", szPrefix ); return PLUGIN_HANDLED; } new iMenu = menu_create ( "\y[TIENDA SHOP] \wCompras!", "HandlerComprasMenu" ); static iLen [ 256 ]; //256=MAX BUFFER. new iMoney = cs_get_user_money ( iIndex ); for ( new i = 0; i < sizeof ( szTienda ); i++ ){ if ( cs_get_user_money ( iIndex ) < szTienda [ i ] [ PRECIO ] ) formatex ( iLen, sizeof ( iLen ), "%s \y[$%d] \d(TIENES $%d, restante \y%d\d)", szTienda [ i ] [ NOMBRE ], szTienda [ i ] [ PRECIO ], iMoney, szTienda [ i ] [ PRECIO ] - iMoney ); else formatex ( iLen, sizeof ( iLen ), "%s \y[$%d]", szTienda [ i ] [ NOMBRE ], szTienda [ i ] [ PRECIO ] ); menu_additem ( iMenu, iLen ); } menu_setprop ( iMenu, MPROP_EXITNAME, "Salir" ); menu_setprop ( iMenu, MPROP_NEXTNAME, "Siguiente" ); menu_setprop ( iMenu, MPROP_BACKNAME, "Atras" ); menu_setprop ( iMenu, MPROP_NUMBER_COLOR, "\y" ); menu_display ( iIndex, iMenu ); return PLUGIN_HANDLED; }
public HandlerComprasMenu ( iIndex, iMenu, iItem ){ if ( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED; } new iMoney = cs_get_user_money ( iIndex ); if ( iMoney >= szTienda [ iItem ] [ PRECIO ] ){ cs_set_user_money ( iIndex, iMoney - szTienda [ iItem ] [ PRECIO ] ) } else{ ColorChat ( iIndex, GREEN, "%s Te falta ^3($%d) ^1para comprar el item ^4%s", szPrefix, szTienda [ iItem ] [ PRECIO ] - iMoney, szTienda [ iItem ] [ NOMBRE ] ); cmdTienda ( iIndex ); return PLUGIN_HANDLED; } switch ( iItem ) { case 0:{ if ( g_iTiendaShop [ iIndex ] [ 0 ] ) { //item = 0. ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_rendering ( iIndex, kRenderFxGlowShell, 255, 125, 127, kRenderNormal, 35 ); g_iTiendaShop [ iIndex ] [ 0 ] = true; } case 1: { if ( g_iTiendaShop [ iIndex ] [ 1 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_health ( iIndex, 130 ); g_iTiendaShop [ iIndex ] [ 1 ] = true; } case 2: { if ( g_iTiendaShop [ iIndex ] [ 2 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_give_item ( iIndex, "weapon_hegrenade" ); fm_give_item ( iIndex, "weapon_smokegrenade" ); cs_set_user_bpammo ( iIndex, CSW_SMOKEGRENADE, 2 ); g_iTiendaShop [ iIndex ] [ 2 ] = true; } case 3: { if ( g_iTiendaShop [ iIndex ] [ 3 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_maxspeed ( iIndex, 350.0 ); set_task ( 20.0, "RemoverVelocidad", iIndex ); //15 Segundos. g_iTiendaShop [ iIndex ] [ 3 ] = true; } case 4: { if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } g_iTiendaShop [ iIndex ] [ 4 ] = true; } } return PLUGIN_HANDLED; }
public RemoverVelocidad ( iIndex ) { fm_set_user_maxspeed ( iIndex, 250.0 ); ColorChat ( iIndex, GREEN, "%s La velocidad se te termino", szPrefix ); }
Gracias men me funciono pero podrias ponerle que al comprar un item diga en el chat por ejemplo esto Has comprado el item y salga el nombre del item que compro, y lo otro igual esque deja comprar un mismo item 2 veces y le quita el dinero podrias poner que solo los items se puedan comprar una vez por ronda porfavor parece que esta pero no funciona porfavor men gracias.
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
(19/07/2018, 01:50 PM)Killers-. escribió: (18/07/2018, 09:31 PM)Niper.-. escribió: Toma..
Código PHP: #include < amxmodx > #include < amxmisc > #include < cstrike > #include < ColorChat > #include < fakemeta_util >
new const PLUGIN [ ] = "[AMXX] Tienda"; new const VERSION [ ] = "1.1"; new const AUTHOR [ ] = "heNK'";
enum _:Tienda{ NOMBRE [ 40 ], PRECIO }
new const szTienda [ ] [ Tienda ] = { { "Glow", 1500 }, //0 { "130HP", 5000 }, //1 { "2 Smoke 1 He", 7000 }, //2 { "Super Velocidad", 9500 }, //3 { "Doble Salto", 16000 } //4 };
new const szPrefix [ ] = "^4[TIENDA]^1";
new g_iTiendaShop [ 33 ] [ 5 ];
new bool:bIsJump [ 33 ] = false; new g_iSaltosMax [ 33 ];
public plugin_init ( ) { register_plugin ( PLUGIN, VERSION, AUTHOR ); register_clcmd ( "say /tienda", "cmdTienda" ); register_clcmd ( "say_team /tienda", "cmdTienda" ); register_forward ( FM_PlayerPreThink, "FW_PlayerPreThink", 0 ); register_forward ( FM_PlayerPreThink, "FW_PlayerPreThink_Post", 1 ); register_event ( "HLTV", "eventRoundStart", "a", "1=0", "2=0" ); }
public eventRoundStart ( ){ for ( new i = 1; i <= get_maxplayers ( ); i++ ){ g_iTiendaShop [ i ] [ 0 ] = false; g_iTiendaShop [ i ] [ 1 ] = false; g_iTiendaShop [ i ] [ 2 ] = false; g_iTiendaShop [ i ] [ 3 ] = false; g_iTiendaShop [ i ] [ 4 ] = false; } }
public FW_PlayerPreThink ( iIndex ) { if ( !is_user_alive ( iIndex ) || !is_user_admin ( iIndex ) ) return PLUGIN_HANDLED; new iButton = pev ( iIndex, pev_button ); new iOldButton = pev ( iIndex, pev_oldbuttons ); new iFlags = pev ( iIndex, pev_flags ); if ( ( iButton & IN_JUMP ) && !( iFlags & FL_ONGROUND ) && !( iOldButton & IN_JUMP ) ) { if ( g_iSaltosMax [ iIndex ] < 1 ){ bIsJump [ iIndex ] = true; g_iSaltosMax [ iIndex ]++; return PLUGIN_HANDLED; } } if ( ( iButton & IN_JUMP ) && ( iFlags & FL_ONGROUND ) ){ g_iSaltosMax [ iIndex ] = 0; return PLUGIN_CONTINUE; } return PLUGIN_HANDLED; }
public FW_PlayerPreThink_Post ( iIndex ){ if ( !is_user_alive ( iIndex ) ) return PLUGIN_HANDLED; if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { if ( bIsJump [ iIndex ] == true ) { new Float:flVelocity [ 3 ]; pev ( iIndex, pev_velocity, flVelocity ); flVelocity [ 2 ] += random_float ( 265.0, 285.0 ); set_pev ( iIndex, pev_velocity, flVelocity ); bIsJump [ iIndex ] = false; return PLUGIN_CONTINUE; } } return PLUGIN_CONTINUE; }
public client_putinserver ( iIndex ){ g_iSaltosMax [ iIndex ] = 0; bIsJump [ iIndex ] = false; }
public client_disconnect ( iIndex ){ g_iSaltosMax [ iIndex ] = 0; bIsJump [ iIndex ] = false; }
public cmdTienda ( iIndex ) { if ( !is_user_alive ( iIndex ) ){ ColorChat ( iIndex, GREEN, "%s No puedes usar la tienda estando muerto.", szPrefix ); return PLUGIN_HANDLED; } if ( ! ( cs_get_user_team ( iIndex ) == CS_TEAM_CT ) ) { ColorChat ( iIndex, GREEN, "%s Probablemente no eres ^3CT", szPrefix ); return PLUGIN_HANDLED; } new iMenu = menu_create ( "\y[TIENDA SHOP] \wCompras!", "HandlerComprasMenu" ); static iLen [ 256 ]; //256=MAX BUFFER. new iMoney = cs_get_user_money ( iIndex ); for ( new i = 0; i < sizeof ( szTienda ); i++ ){ if ( cs_get_user_money ( iIndex ) < szTienda [ i ] [ PRECIO ] ) formatex ( iLen, sizeof ( iLen ), "%s \y[$%d] \d(TIENES $%d, restante \y%d\d)", szTienda [ i ] [ NOMBRE ], szTienda [ i ] [ PRECIO ], iMoney, szTienda [ i ] [ PRECIO ] - iMoney ); else formatex ( iLen, sizeof ( iLen ), "%s \y[$%d]", szTienda [ i ] [ NOMBRE ], szTienda [ i ] [ PRECIO ] ); menu_additem ( iMenu, iLen ); } menu_setprop ( iMenu, MPROP_EXITNAME, "Salir" ); menu_setprop ( iMenu, MPROP_NEXTNAME, "Siguiente" ); menu_setprop ( iMenu, MPROP_BACKNAME, "Atras" ); menu_setprop ( iMenu, MPROP_NUMBER_COLOR, "\y" ); menu_display ( iIndex, iMenu ); return PLUGIN_HANDLED; }
public HandlerComprasMenu ( iIndex, iMenu, iItem ){ if ( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED; } new iMoney = cs_get_user_money ( iIndex ); if ( iMoney >= szTienda [ iItem ] [ PRECIO ] ){ cs_set_user_money ( iIndex, iMoney - szTienda [ iItem ] [ PRECIO ] ) } else{ ColorChat ( iIndex, GREEN, "%s Te falta ^3($%d) ^1para comprar el item ^4%s", szPrefix, szTienda [ iItem ] [ PRECIO ] - iMoney, szTienda [ iItem ] [ NOMBRE ] ); cmdTienda ( iIndex ); return PLUGIN_HANDLED; } switch ( iItem ) { case 0:{ if ( g_iTiendaShop [ iIndex ] [ 0 ] ) { //item = 0. ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_rendering ( iIndex, kRenderFxGlowShell, 255, 125, 127, kRenderNormal, 35 ); g_iTiendaShop [ iIndex ] [ 0 ] = true; } case 1: { if ( g_iTiendaShop [ iIndex ] [ 1 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_health ( iIndex, 130 ); g_iTiendaShop [ iIndex ] [ 1 ] = true; } case 2: { if ( g_iTiendaShop [ iIndex ] [ 2 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_give_item ( iIndex, "weapon_hegrenade" ); fm_give_item ( iIndex, "weapon_smokegrenade" ); cs_set_user_bpammo ( iIndex, CSW_SMOKEGRENADE, 2 ); g_iTiendaShop [ iIndex ] [ 2 ] = true; } case 3: { if ( g_iTiendaShop [ iIndex ] [ 3 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_maxspeed ( iIndex, 350.0 ); set_task ( 20.0, "RemoverVelocidad", iIndex ); //15 Segundos. g_iTiendaShop [ iIndex ] [ 3 ] = true; } case 4: { if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } g_iTiendaShop [ iIndex ] [ 4 ] = true; } } return PLUGIN_HANDLED; }
public RemoverVelocidad ( iIndex ) { fm_set_user_maxspeed ( iIndex, 250.0 ); ColorChat ( iIndex, GREEN, "%s La velocidad se te termino", szPrefix ); }
Gracias men me funciono pero podrias ponerle que al comprar un item diga en el chat por ejemplo esto Has comprado el item y salga el nombre del item que compro, y lo otro igual esque deja comprar un mismo item 2 veces y le quita el dinero podrias poner que solo los items se puedan comprar una vez por ronda porfavor parece que esta pero no funciona porfavor men gracias.
Para el nombre del item.
Código PHP: ColorChat ( iIndex, GREEN, "%s Has comprado el item !g%s!y.", szPrefix, szTienda [ iItem ] [ NOMBRE ] );
Mensajes: 175
Temas: 57
Registro en: May 2017
Reputación:
0
(19/07/2018, 02:15 PM)Chema escribió: (19/07/2018, 01:50 PM)Killers-. escribió: (18/07/2018, 09:31 PM)Niper.-. escribió: Toma..
Código PHP: #include < amxmodx > #include < amxmisc > #include < cstrike > #include < ColorChat > #include < fakemeta_util >
new const PLUGIN [ ] = "[AMXX] Tienda"; new const VERSION [ ] = "1.1"; new const AUTHOR [ ] = "heNK'";
enum _:Tienda{ NOMBRE [ 40 ], PRECIO }
new const szTienda [ ] [ Tienda ] = { { "Glow", 1500 }, //0 { "130HP", 5000 }, //1 { "2 Smoke 1 He", 7000 }, //2 { "Super Velocidad", 9500 }, //3 { "Doble Salto", 16000 } //4 };
new const szPrefix [ ] = "^4[TIENDA]^1";
new g_iTiendaShop [ 33 ] [ 5 ];
new bool:bIsJump [ 33 ] = false; new g_iSaltosMax [ 33 ];
public plugin_init ( ) { register_plugin ( PLUGIN, VERSION, AUTHOR ); register_clcmd ( "say /tienda", "cmdTienda" ); register_clcmd ( "say_team /tienda", "cmdTienda" ); register_forward ( FM_PlayerPreThink, "FW_PlayerPreThink", 0 ); register_forward ( FM_PlayerPreThink, "FW_PlayerPreThink_Post", 1 ); register_event ( "HLTV", "eventRoundStart", "a", "1=0", "2=0" ); }
public eventRoundStart ( ){ for ( new i = 1; i <= get_maxplayers ( ); i++ ){ g_iTiendaShop [ i ] [ 0 ] = false; g_iTiendaShop [ i ] [ 1 ] = false; g_iTiendaShop [ i ] [ 2 ] = false; g_iTiendaShop [ i ] [ 3 ] = false; g_iTiendaShop [ i ] [ 4 ] = false; } }
public FW_PlayerPreThink ( iIndex ) { if ( !is_user_alive ( iIndex ) || !is_user_admin ( iIndex ) ) return PLUGIN_HANDLED; new iButton = pev ( iIndex, pev_button ); new iOldButton = pev ( iIndex, pev_oldbuttons ); new iFlags = pev ( iIndex, pev_flags ); if ( ( iButton & IN_JUMP ) && !( iFlags & FL_ONGROUND ) && !( iOldButton & IN_JUMP ) ) { if ( g_iSaltosMax [ iIndex ] < 1 ){ bIsJump [ iIndex ] = true; g_iSaltosMax [ iIndex ]++; return PLUGIN_HANDLED; } } if ( ( iButton & IN_JUMP ) && ( iFlags & FL_ONGROUND ) ){ g_iSaltosMax [ iIndex ] = 0; return PLUGIN_CONTINUE; } return PLUGIN_HANDLED; }
public FW_PlayerPreThink_Post ( iIndex ){ if ( !is_user_alive ( iIndex ) ) return PLUGIN_HANDLED; if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { if ( bIsJump [ iIndex ] == true ) { new Float:flVelocity [ 3 ]; pev ( iIndex, pev_velocity, flVelocity ); flVelocity [ 2 ] += random_float ( 265.0, 285.0 ); set_pev ( iIndex, pev_velocity, flVelocity ); bIsJump [ iIndex ] = false; return PLUGIN_CONTINUE; } } return PLUGIN_CONTINUE; }
public client_putinserver ( iIndex ){ g_iSaltosMax [ iIndex ] = 0; bIsJump [ iIndex ] = false; }
public client_disconnect ( iIndex ){ g_iSaltosMax [ iIndex ] = 0; bIsJump [ iIndex ] = false; }
public cmdTienda ( iIndex ) { if ( !is_user_alive ( iIndex ) ){ ColorChat ( iIndex, GREEN, "%s No puedes usar la tienda estando muerto.", szPrefix ); return PLUGIN_HANDLED; } if ( ! ( cs_get_user_team ( iIndex ) == CS_TEAM_CT ) ) { ColorChat ( iIndex, GREEN, "%s Probablemente no eres ^3CT", szPrefix ); return PLUGIN_HANDLED; } new iMenu = menu_create ( "\y[TIENDA SHOP] \wCompras!", "HandlerComprasMenu" ); static iLen [ 256 ]; //256=MAX BUFFER. new iMoney = cs_get_user_money ( iIndex ); for ( new i = 0; i < sizeof ( szTienda ); i++ ){ if ( cs_get_user_money ( iIndex ) < szTienda [ i ] [ PRECIO ] ) formatex ( iLen, sizeof ( iLen ), "%s \y[$%d] \d(TIENES $%d, restante \y%d\d)", szTienda [ i ] [ NOMBRE ], szTienda [ i ] [ PRECIO ], iMoney, szTienda [ i ] [ PRECIO ] - iMoney ); else formatex ( iLen, sizeof ( iLen ), "%s \y[$%d]", szTienda [ i ] [ NOMBRE ], szTienda [ i ] [ PRECIO ] ); menu_additem ( iMenu, iLen ); } menu_setprop ( iMenu, MPROP_EXITNAME, "Salir" ); menu_setprop ( iMenu, MPROP_NEXTNAME, "Siguiente" ); menu_setprop ( iMenu, MPROP_BACKNAME, "Atras" ); menu_setprop ( iMenu, MPROP_NUMBER_COLOR, "\y" ); menu_display ( iIndex, iMenu ); return PLUGIN_HANDLED; }
public HandlerComprasMenu ( iIndex, iMenu, iItem ){ if ( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED; } new iMoney = cs_get_user_money ( iIndex ); if ( iMoney >= szTienda [ iItem ] [ PRECIO ] ){ cs_set_user_money ( iIndex, iMoney - szTienda [ iItem ] [ PRECIO ] ) } else{ ColorChat ( iIndex, GREEN, "%s Te falta ^3($%d) ^1para comprar el item ^4%s", szPrefix, szTienda [ iItem ] [ PRECIO ] - iMoney, szTienda [ iItem ] [ NOMBRE ] ); cmdTienda ( iIndex ); return PLUGIN_HANDLED; } switch ( iItem ) { case 0:{ if ( g_iTiendaShop [ iIndex ] [ 0 ] ) { //item = 0. ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_rendering ( iIndex, kRenderFxGlowShell, 255, 125, 127, kRenderNormal, 35 ); g_iTiendaShop [ iIndex ] [ 0 ] = true; } case 1: { if ( g_iTiendaShop [ iIndex ] [ 1 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_health ( iIndex, 130 ); g_iTiendaShop [ iIndex ] [ 1 ] = true; } case 2: { if ( g_iTiendaShop [ iIndex ] [ 2 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_give_item ( iIndex, "weapon_hegrenade" ); fm_give_item ( iIndex, "weapon_smokegrenade" ); cs_set_user_bpammo ( iIndex, CSW_SMOKEGRENADE, 2 ); g_iTiendaShop [ iIndex ] [ 2 ] = true; } case 3: { if ( g_iTiendaShop [ iIndex ] [ 3 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_maxspeed ( iIndex, 350.0 ); set_task ( 20.0, "RemoverVelocidad", iIndex ); //15 Segundos. g_iTiendaShop [ iIndex ] [ 3 ] = true; } case 4: { if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } g_iTiendaShop [ iIndex ] [ 4 ] = true; } } return PLUGIN_HANDLED; }
public RemoverVelocidad ( iIndex ) { fm_set_user_maxspeed ( iIndex, 250.0 ); ColorChat ( iIndex, GREEN, "%s La velocidad se te termino", szPrefix ); }
Gracias men me funciono pero podrias ponerle que al comprar un item diga en el chat por ejemplo esto Has comprado el item y salga el nombre del item que compro, y lo otro igual esque deja comprar un mismo item 2 veces y le quita el dinero podrias poner que solo los items se puedan comprar una vez por ronda porfavor parece que esta pero no funciona porfavor men gracias.
Para el nombre del item.
Código PHP: ColorChat ( iIndex, GREEN, "%s Has comprado el item !g%s!y.", szPrefix, szTienda [ iItem ] [ NOMBRE ] );
Donde va eso men y como hago para que solo se puedan comprar los items una vez por ronda
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
Acá va, ese plugin ya tiene para que solo puedas comprar los items una vez por ronda.
Código PHP: public HandlerComprasMenu ( iIndex, iMenu, iItem ){ if ( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED; } new iMoney = cs_get_user_money ( iIndex ); if ( iMoney >= szTienda [ iItem ] [ PRECIO ] ){ cs_set_user_money ( iIndex, iMoney - szTienda [ iItem ] [ PRECIO ] ) } else{ ColorChat ( iIndex, GREEN, "%s Te falta ^3($%d) ^1para comprar el item ^4%s", szPrefix, szTienda [ iItem ] [ PRECIO ] - iMoney, szTienda [ iItem ] [ NOMBRE ] ); cmdTienda ( iIndex ); return PLUGIN_HANDLED; } switch ( iItem ) { case 0:{ if ( g_iTiendaShop [ iIndex ] [ 0 ] ) { //item = 0. ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_rendering ( iIndex, kRenderFxGlowShell, 255, 125, 127, kRenderNormal, 35 ); g_iTiendaShop [ iIndex ] [ 0 ] = true; } case 1: { if ( g_iTiendaShop [ iIndex ] [ 1 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_health ( iIndex, 130 ); g_iTiendaShop [ iIndex ] [ 1 ] = true; } case 2: { if ( g_iTiendaShop [ iIndex ] [ 2 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_give_item ( iIndex, "weapon_hegrenade" ); fm_give_item ( iIndex, "weapon_smokegrenade" ); cs_set_user_bpammo ( iIndex, CSW_SMOKEGRENADE, 2 ); g_iTiendaShop [ iIndex ] [ 2 ] = true; } case 3: { if ( g_iTiendaShop [ iIndex ] [ 3 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_maxspeed ( iIndex, 350.0 ); set_task ( 20.0, "RemoverVelocidad", iIndex ); //15 Segundos. g_iTiendaShop [ iIndex ] [ 3 ] = true; } case 4: { if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } g_iTiendaShop [ iIndex ] [ 4 ] = true; } } ColorChat ( iIndex, GREEN, "%s Has comprado el item !g%s!y.", szPrefix, szTienda [ iItem ] [ NOMBRE ] ); return PLUGIN_HANDLED; }
Mensajes: 175
Temas: 57
Registro en: May 2017
Reputación:
0
(19/07/2018, 04:49 PM)Chema escribió: Acá va, ese plugin ya tiene para que solo puedas comprar los items una vez por ronda.
Código PHP: public HandlerComprasMenu ( iIndex, iMenu, iItem ){ if ( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED; } new iMoney = cs_get_user_money ( iIndex ); if ( iMoney >= szTienda [ iItem ] [ PRECIO ] ){ cs_set_user_money ( iIndex, iMoney - szTienda [ iItem ] [ PRECIO ] ) } else{ ColorChat ( iIndex, GREEN, "%s Te falta ^3($%d) ^1para comprar el item ^4%s", szPrefix, szTienda [ iItem ] [ PRECIO ] - iMoney, szTienda [ iItem ] [ NOMBRE ] ); cmdTienda ( iIndex ); return PLUGIN_HANDLED; } switch ( iItem ) { case 0:{ if ( g_iTiendaShop [ iIndex ] [ 0 ] ) { //item = 0. ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_rendering ( iIndex, kRenderFxGlowShell, 255, 125, 127, kRenderNormal, 35 ); g_iTiendaShop [ iIndex ] [ 0 ] = true; } case 1: { if ( g_iTiendaShop [ iIndex ] [ 1 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_health ( iIndex, 130 ); g_iTiendaShop [ iIndex ] [ 1 ] = true; } case 2: { if ( g_iTiendaShop [ iIndex ] [ 2 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_give_item ( iIndex, "weapon_hegrenade" ); fm_give_item ( iIndex, "weapon_smokegrenade" ); cs_set_user_bpammo ( iIndex, CSW_SMOKEGRENADE, 2 ); g_iTiendaShop [ iIndex ] [ 2 ] = true; } case 3: { if ( g_iTiendaShop [ iIndex ] [ 3 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_maxspeed ( iIndex, 350.0 ); set_task ( 20.0, "RemoverVelocidad", iIndex ); //15 Segundos. g_iTiendaShop [ iIndex ] [ 3 ] = true; } case 4: { if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } g_iTiendaShop [ iIndex ] [ 4 ] = true; } } ColorChat ( iIndex, GREEN, "%s Has comprado el item !g%s!y.", szPrefix, szTienda [ iItem ] [ NOMBRE ] ); return PLUGIN_HANDLED; }
Amigo dice el mensaje ya has comprado este item y te quita el dinero puedes arreglar eso y puedes poner de que el glow sea de color eleatorio porfavor pls gracias
Mensajes: 1,072
Temas: 57
Registro en: Feb 2016
Reputación:
8
19/07/2018, 08:00 PM
(Última modificación: 19/07/2018, 08:00 PM por Niper.-..)
Edita esta línea.
Código PHP: fm_set_rendering ( iIndex, kRenderFxGlowShell, 255, 125, 127, kRenderNormal, 35 );
por esta:
Código PHP: fm_set_rendering ( iIndex, kRenderFxGlowShell, random_num ( 0, 255 ), random_num ( 0, 255 ), random_num ( 0, 255 ), kRenderNormal, 35 );
Y esta.
Código PHP: ColorChat ( iIndex, GREEN, "%s Has comprado el item !g%s!y.", szPrefix, szTienda [ iItem ] [ NOMBRE ] );
por esta
Código PHP: ColorChat ( iIndex, GREEN, "%s Has comprado el item ^4%s^1.", szPrefix, szTienda [ iItem ] [ NOMBRE ] );
Mensajes: 175
Temas: 57
Registro en: May 2017
Reputación:
0
(19/07/2018, 08:00 PM)Niper.-. escribió: Edita esta línea.
Código PHP: fm_set_rendering ( iIndex, kRenderFxGlowShell, 255, 125, 127, kRenderNormal, 35 );
por esta:
Código PHP: fm_set_rendering ( iIndex, kRenderFxGlowShell, random_num ( 0, 255 ), random_num ( 0, 255 ), random_num ( 0, 255 ), kRenderNormal, 35 );
Y esta.
Código PHP: ColorChat ( iIndex, GREEN, "%s Has comprado el item !g%s!y.", szPrefix, szTienda [ iItem ] [ NOMBRE ] );
por esta
Código PHP: ColorChat ( iIndex, GREEN, "%s Has comprado el item ^4%s^1.", szPrefix, szTienda [ iItem ] [ NOMBRE ] );
Amigo si no fuera mucha molesta me lo podrias pasar el codigo listo y modificado esque no encuentro las lineas y no me compila porfavor
Mensajes: 586
Temas: 15
Registro en: Jul 2017
Reputación:
6
20/07/2018, 08:38 AM
(Última modificación: 20/07/2018, 08:38 AM por Pablo_1998.)
Código PHP: #include <amxmodx> #include <fun> #include <cstrike> #include <hamsandwich> #include <fakemeta> #include <engine>
enum tienda_caracteristicas { NOMBRE[75], ITEM_LIMIT, ITEM_COST, } enum _:ITEMS { GLOW, HP, GRANADAS, SUPERVELOCIDAD, DOBLESALTO }; new const SHOP_ITEMS[][tienda_caracteristicas] = { { "Glow color random", 1, 1500}, { "+130 HP Extra", 1, 5000}, { "2 SmokeGrenade & 1 HeGrenade", 1, 7000}, { "Super Velocidad", 1, 9500}, { "Doble Salto", 1, 16000} }
new Limite[33][ITEMS]; new g_maxplayers
new g_maxJumps = 2
new jumpnum[33] = 0 new bool:dojump[33] = false new g_multijumps[33] = 0 new bool:g_speed[33]
new const szPrefijo[] = "^4[AMXX-ES]^1"
public plugin_init() { register_plugin("Shop Items", "1.0", "Cristian"); register_clcmd("say /tienda", "OpenTienda") register_clcmd("say_team /tienda", "OpenTienda")
register_forward(FM_PlayerPreThink, "FW_PlayerPreThink") register_forward(FM_PlayerPostThink, "FW_PlayerPostThink")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
g_maxplayers = get_maxplayers(); } public event_round_start() { for (new i = 1; i < g_maxplayers; i++) { if(is_user_alive(i)) { for (new ite = 0; ite < ITEMS; ite++) { Limite[i][ite] = 0 dojump[i] = false jumpnum[i] = false g_multijumps[i] = false g_speed[i] = false set_rendering(i) } } } } public OpenTienda(id) { if(!(cs_get_user_team(id) == CS_TEAM_CT)) { ChatColor(id, "%s Tienda disponible solo para el equipo Counter-Terrorista.", szPrefijo) return PLUGIN_HANDLED } if(!is_user_alive(id)) { ChatColor(id, "%s Debes estar vivo para poder utilizar la tienda.", szPrefijo) return PLUGIN_HANDLED } static Menu, sztext[60], i; Menu = menu_create("\r[AMXX-ES] \yMercado de Compras:", "OpenTienda_Handler");
for(i = 0; i < sizeof(SHOP_ITEMS); i++) { if(Limite[id][i] == 1) format(sztext, charsmax(sztext), "\d%s \d[COMPRADO]", SHOP_ITEMS[i][NOMBRE]);
else format(sztext, charsmax(sztext), "\w%s \r[$%d]", SHOP_ITEMS[i][NOMBRE], SHOP_ITEMS[i][ITEM_COST]);
menu_additem(Menu, sztext); } menu_setprop(Menu, MPROP_EXITNAME, "Cerrar"); menu_display(id, Menu); return PLUGIN_HANDLED; } public OpenTienda_Handler(id, Menu, Item) { if(Item == MENU_EXIT || !is_user_alive(id)) { menu_destroy(Menu); return; } static cost; cost = SHOP_ITEMS[Item][ITEM_COST];
if(Limite[id][Item] == SHOP_ITEMS[Item][ITEM_LIMIT]) { ChatColor(id, "%s Solo puedes comprar un item de cada uno por ronda.", szPrefijo) OpenTienda(id) return; } if(cs_get_user_money(id) < cost) { ChatColor(id, "%s No tienes suficiente dinero para comprar este item.", szPrefijo) return; } Comprar_Items(id, Item, cost); menu_destroy(Menu) return; } Comprar_Items(id, Item, cost) { switch(Item) { case GLOW : set_rendering(id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 15) case HP : set_user_health(id, get_user_health(id) + 130) case GRANADAS : { give_item(id, "weapon_smokegrenade"); give_item(id, "weapon_hegrenade"); cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 2) } case SUPERVELOCIDAD : { g_speed[id] = true set_user_maxspeed(id, Float: 500.0) set_task(20.0, "Remover_Velocidad", id) } case DOBLESALTO : DobleSalto(id) } Limite[id][Item]++ cs_set_user_money(id, cs_get_user_money(id) - cost); ChatColor(id, "%s Has comprado el item ^4%s^1.", szPrefijo, SHOP_ITEMS[Item][NOMBRE]) return PLUGIN_HANDLED } public FW_PlayerPreThink(id) { if(!is_user_alive(id) && g_multijumps[id]) return PLUGIN_CONTINUE
new nbut = pev(id,pev_button); new obut = pev(id,pev_oldbuttons);
if((nbut & IN_JUMP) && !(pev(id,pev_flags) & FL_ONGROUND) && !(obut & IN_JUMP)) { if(jumpnum[id] < g_multijumps[id]) { dojump[id] = true; jumpnum[id]++; return PLUGIN_CONTINUE } } if((nbut & IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND)) { jumpnum[id] = 0; return PLUGIN_CONTINUE } return PLUGIN_CONTINUE } public FW_PlayerPostThink(id) { if(!is_user_alive(id) || !g_multijumps[id]) return PLUGIN_CONTINUE
if(dojump[id] == true) { new Float:velocity[3]; pev(id,pev_velocity,velocity); velocity[2] = random_float(265.0,285.0); set_pev(id,pev_velocity,velocity) dojump[id] = false return PLUGIN_CONTINUE } return PLUGIN_CONTINUE } public DobleSalto(id) { if (g_multijumps[id] < g_maxJumps || !g_maxJumps) { g_multijumps[id]++; set_hudmessage(0, 255, 255, -1.0, 0.3, 1, 0.1, 5.0, 0.1) show_hudmessage(id, "El maximo de saltos consecutivos es de 2 Veces") } } public Remover_Velocidad(id) { if(!is_user_connected(id) || !is_user_alive(id)) return; set_user_maxspeed(id, Float: 320.0) ChatColor(id, "%s Se te acabo la ^4Super Velocidad^1.", szPrefijo) g_speed[id] = false } stock ChatColor( id, const input[ ], any:... ) { static szMsg[ 191 ], msgSayText; if( !msgSayText ) msgSayText = get_user_msgid( "SayText" ); vformat( szMsg, 190, input, 3 ); replace_all( szMsg, 190, "!g", "^4" ); replace_all( szMsg, 190, "!y", "^1" ); replace_all( szMsg, 190, "!team", "^3" ); message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgSayText, .player = id ); write_byte( id ? id : 33 ); write_string( szMsg ); message_end( ); }
Mensajes: 175
Temas: 57
Registro en: May 2017
Reputación:
0
(20/07/2018, 08:38 AM)Pablo_1998 escribió: Código PHP: #include <amxmodx> #include <fun> #include <cstrike> #include <hamsandwich> #include <fakemeta> #include <engine>
enum tienda_caracteristicas { NOMBRE[75], ITEM_LIMIT, ITEM_COST, } enum _:ITEMS { GLOW, HP, GRANADAS, SUPERVELOCIDAD, DOBLESALTO }; new const SHOP_ITEMS[][tienda_caracteristicas] = { { "Glow color random", 1, 1500}, { "+130 HP Extra", 1, 5000}, { "2 SmokeGrenade & 1 HeGrenade", 1, 7000}, { "Super Velocidad", 1, 9500}, { "Doble Salto", 1, 16000} }
new Limite[33][ITEMS]; new g_maxplayers
new g_maxJumps = 2
new jumpnum[33] = 0 new bool:dojump[33] = false new g_multijumps[33] = 0 new bool:g_speed[33]
new const szPrefijo[] = "^4[AMXX-ES]^1"
public plugin_init() { register_plugin("Shop Items", "1.0", "Cristian"); register_clcmd("say /tienda", "OpenTienda") register_clcmd("say_team /tienda", "OpenTienda")
register_forward(FM_PlayerPreThink, "FW_PlayerPreThink") register_forward(FM_PlayerPostThink, "FW_PlayerPostThink")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
g_maxplayers = get_maxplayers(); } public event_round_start() { for (new i = 1; i < g_maxplayers; i++) { if(is_user_alive(i)) { for (new ite = 0; ite < ITEMS; ite++) { Limite[i][ite] = 0 dojump[i] = false jumpnum[i] = false g_multijumps[i] = false g_speed[i] = false set_rendering(i) } } } } public OpenTienda(id) { if(!(cs_get_user_team(id) == CS_TEAM_CT)) { ChatColor(id, "%s Tienda disponible solo para el equipo Counter-Terrorista.", szPrefijo) return PLUGIN_HANDLED } if(!is_user_alive(id)) { ChatColor(id, "%s Debes estar vivo para poder utilizar la tienda.", szPrefijo) return PLUGIN_HANDLED } static Menu, sztext[60], i; Menu = menu_create("\r[AMXX-ES] \yMercado de Compras:", "OpenTienda_Handler");
for(i = 0; i < sizeof(SHOP_ITEMS); i++) { if(Limite[id][i] == 1) format(sztext, charsmax(sztext), "\d%s \d[COMPRADO]", SHOP_ITEMS[i][NOMBRE]);
else format(sztext, charsmax(sztext), "\w%s \r[$%d]", SHOP_ITEMS[i][NOMBRE], SHOP_ITEMS[i][ITEM_COST]);
menu_additem(Menu, sztext); } menu_setprop(Menu, MPROP_EXITNAME, "Cerrar"); menu_display(id, Menu); return PLUGIN_HANDLED; } public OpenTienda_Handler(id, Menu, Item) { if(Item == MENU_EXIT || !is_user_alive(id)) { menu_destroy(Menu); return; } static cost; cost = SHOP_ITEMS[Item][ITEM_COST];
if(Limite[id][Item] == SHOP_ITEMS[Item][ITEM_LIMIT]) { ChatColor(id, "%s Solo puedes comprar un item de cada uno por ronda.", szPrefijo) OpenTienda(id) return; } if(cs_get_user_money(id) < cost) { ChatColor(id, "%s No tienes suficiente dinero para comprar este item.", szPrefijo) return; } Comprar_Items(id, Item, cost); menu_destroy(Menu) return; } Comprar_Items(id, Item, cost) { switch(Item) { case GLOW : set_rendering(id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 15) case HP : set_user_health(id, get_user_health(id) + 130) case GRANADAS : { give_item(id, "weapon_smokegrenade"); give_item(id, "weapon_hegrenade"); cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 2) } case SUPERVELOCIDAD : { g_speed[id] = true set_user_maxspeed(id, Float: 500.0) set_task(20.0, "Remover_Velocidad", id) } case DOBLESALTO : DobleSalto(id) } Limite[id][Item]++ cs_set_user_money(id, cs_get_user_money(id) - cost); ChatColor(id, "%s Has comprado el item ^4%s^1.", szPrefijo, SHOP_ITEMS[Item][NOMBRE]) return PLUGIN_HANDLED } public FW_PlayerPreThink(id) { if(!is_user_alive(id) && g_multijumps[id]) return PLUGIN_CONTINUE
new nbut = pev(id,pev_button); new obut = pev(id,pev_oldbuttons);
if((nbut & IN_JUMP) && !(pev(id,pev_flags) & FL_ONGROUND) && !(obut & IN_JUMP)) { if(jumpnum[id] < g_multijumps[id]) { dojump[id] = true; jumpnum[id]++; return PLUGIN_CONTINUE } } if((nbut & IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND)) { jumpnum[id] = 0; return PLUGIN_CONTINUE } return PLUGIN_CONTINUE } public FW_PlayerPostThink(id) { if(!is_user_alive(id) || !g_multijumps[id]) return PLUGIN_CONTINUE
if(dojump[id] == true) { new Float:velocity[3]; pev(id,pev_velocity,velocity); velocity[2] = random_float(265.0,285.0); set_pev(id,pev_velocity,velocity) dojump[id] = false return PLUGIN_CONTINUE } return PLUGIN_CONTINUE } public DobleSalto(id) { if (g_multijumps[id] < g_maxJumps || !g_maxJumps) { g_multijumps[id]++; set_hudmessage(0, 255, 255, -1.0, 0.3, 1, 0.1, 5.0, 0.1) show_hudmessage(id, "El maximo de saltos consecutivos es de 2 Veces") } } public Remover_Velocidad(id) { if(!is_user_connected(id) || !is_user_alive(id)) return; set_user_maxspeed(id, Float: 320.0) ChatColor(id, "%s Se te acabo la ^4Super Velocidad^1.", szPrefijo) g_speed[id] = false } stock ChatColor( id, const input[ ], any:... ) { static szMsg[ 191 ], msgSayText; if( !msgSayText ) msgSayText = get_user_msgid( "SayText" ); vformat( szMsg, 190, input, 3 ); replace_all( szMsg, 190, "!g", "^4" ); replace_all( szMsg, 190, "!y", "^1" ); replace_all( szMsg, 190, "!team", "^3" ); message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgSayText, .player = id ); write_byte( id ? id : 33 ); write_string( szMsg ); message_end( ); }
Gracias amigo funciona pero tiene algunos problemas como por ejemplo que si estas de CT y compras y despues te matas y empieza una nueva ronda de CT y entras a la tienda a comprar salen todos los items comprados y no te dejan comprarlos, tambien el doble salto cuando pasa una ronda sigue y deberia ser por una ronda el doble salto solo por una ronda, y tambien te queria pedir si podias poner que la tienda se abra en cierto tiempo porque es para un base builder y primero empieza el tiempo de construccion y que son dos minutos y 30 seg y me gustaria que al terminar ese tiempo pueda comprar el jugador porque si compra en ese tiempo como que despues viene la fase de probar las bases y se borra todo lo que compro entonces si puedes poner que para comprar en la tienda tenga que esperar primero a que termine la fase de construccion te lo agradeceria mucho gracias.
Mensajes: 1,072
Temas: 57
Registro en: Feb 2016
Reputación:
8
(20/07/2018, 08:38 AM)Pablo_1998 escribió: Código PHP: #include <amxmodx> #include <fun> #include <cstrike> #include <hamsandwich> #include <fakemeta> #include <engine>
enum tienda_caracteristicas { NOMBRE[75], ITEM_LIMIT, ITEM_COST, } enum _:ITEMS { GLOW, HP, GRANADAS, SUPERVELOCIDAD, DOBLESALTO }; new const SHOP_ITEMS[][tienda_caracteristicas] = { { "Glow color random", 1, 1500}, { "+130 HP Extra", 1, 5000}, { "2 SmokeGrenade & 1 HeGrenade", 1, 7000}, { "Super Velocidad", 1, 9500}, { "Doble Salto", 1, 16000} }
new Limite[33][ITEMS]; new g_maxplayers
new g_maxJumps = 2
new jumpnum[33] = 0 new bool:dojump[33] = false new g_multijumps[33] = 0 new bool:g_speed[33]
new const szPrefijo[] = "^4[AMXX-ES]^1"
public plugin_init() { register_plugin("Shop Items", "1.0", "Cristian"); register_clcmd("say /tienda", "OpenTienda") register_clcmd("say_team /tienda", "OpenTienda")
register_forward(FM_PlayerPreThink, "FW_PlayerPreThink") register_forward(FM_PlayerPostThink, "FW_PlayerPostThink")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
g_maxplayers = get_maxplayers(); } public event_round_start() { for (new i = 1; i < g_maxplayers; i++) { if(is_user_alive(i)) { for (new ite = 0; ite < ITEMS; ite++) { Limite[i][ite] = 0 dojump[i] = false jumpnum[i] = false g_multijumps[i] = false g_speed[i] = false set_rendering(i) } } } } public OpenTienda(id) { if(!(cs_get_user_team(id) == CS_TEAM_CT)) { ChatColor(id, "%s Tienda disponible solo para el equipo Counter-Terrorista.", szPrefijo) return PLUGIN_HANDLED } if(!is_user_alive(id)) { ChatColor(id, "%s Debes estar vivo para poder utilizar la tienda.", szPrefijo) return PLUGIN_HANDLED } static Menu, sztext[60], i; Menu = menu_create("\r[AMXX-ES] \yMercado de Compras:", "OpenTienda_Handler");
for(i = 0; i < sizeof(SHOP_ITEMS); i++) { if(Limite[id][i] == 1) format(sztext, charsmax(sztext), "\d%s \d[COMPRADO]", SHOP_ITEMS[i][NOMBRE]);
else format(sztext, charsmax(sztext), "\w%s \r[$%d]", SHOP_ITEMS[i][NOMBRE], SHOP_ITEMS[i][ITEM_COST]);
menu_additem(Menu, sztext); } menu_setprop(Menu, MPROP_EXITNAME, "Cerrar"); menu_display(id, Menu); return PLUGIN_HANDLED; } public OpenTienda_Handler(id, Menu, Item) { if(Item == MENU_EXIT || !is_user_alive(id)) { menu_destroy(Menu); return; } static cost; cost = SHOP_ITEMS[Item][ITEM_COST];
if(Limite[id][Item] == SHOP_ITEMS[Item][ITEM_LIMIT]) { ChatColor(id, "%s Solo puedes comprar un item de cada uno por ronda.", szPrefijo) OpenTienda(id) return; } if(cs_get_user_money(id) < cost) { ChatColor(id, "%s No tienes suficiente dinero para comprar este item.", szPrefijo) return; } Comprar_Items(id, Item, cost); menu_destroy(Menu) return; } Comprar_Items(id, Item, cost) { switch(Item) { case GLOW : set_rendering(id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 15) case HP : set_user_health(id, get_user_health(id) + 130) case GRANADAS : { give_item(id, "weapon_smokegrenade"); give_item(id, "weapon_hegrenade"); cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 2) } case SUPERVELOCIDAD : { g_speed[id] = true set_user_maxspeed(id, Float: 500.0) set_task(20.0, "Remover_Velocidad", id) } case DOBLESALTO : DobleSalto(id) } Limite[id][Item]++ cs_set_user_money(id, cs_get_user_money(id) - cost); ChatColor(id, "%s Has comprado el item ^4%s^1.", szPrefijo, SHOP_ITEMS[Item][NOMBRE]) return PLUGIN_HANDLED } public FW_PlayerPreThink(id) { if(!is_user_alive(id) && g_multijumps[id]) return PLUGIN_CONTINUE
new nbut = pev(id,pev_button); new obut = pev(id,pev_oldbuttons);
if((nbut & IN_JUMP) && !(pev(id,pev_flags) & FL_ONGROUND) && !(obut & IN_JUMP)) { if(jumpnum[id] < g_multijumps[id]) { dojump[id] = true; jumpnum[id]++; return PLUGIN_CONTINUE } } if((nbut & IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND)) { jumpnum[id] = 0; return PLUGIN_CONTINUE } return PLUGIN_CONTINUE } public FW_PlayerPostThink(id) { if(!is_user_alive(id) || !g_multijumps[id]) return PLUGIN_CONTINUE
if(dojump[id] == true) { new Float:velocity[3]; pev(id,pev_velocity,velocity); velocity[2] = random_float(265.0,285.0); set_pev(id,pev_velocity,velocity) dojump[id] = false return PLUGIN_CONTINUE } return PLUGIN_CONTINUE } public DobleSalto(id) { if (g_multijumps[id] < g_maxJumps || !g_maxJumps) { g_multijumps[id]++; set_hudmessage(0, 255, 255, -1.0, 0.3, 1, 0.1, 5.0, 0.1) show_hudmessage(id, "El maximo de saltos consecutivos es de 2 Veces") } } public Remover_Velocidad(id) { if(!is_user_connected(id) || !is_user_alive(id)) return; set_user_maxspeed(id, Float: 320.0) ChatColor(id, "%s Se te acabo la ^4Super Velocidad^1.", szPrefijo) g_speed[id] = false } stock ChatColor( id, const input[ ], any:... ) { static szMsg[ 191 ], msgSayText; if( !msgSayText ) msgSayText = get_user_msgid( "SayText" ); vformat( szMsg, 190, input, 3 ); replace_all( szMsg, 190, "!g", "^4" ); replace_all( szMsg, 190, "!y", "^1" ); replace_all( szMsg, 190, "!team", "^3" ); message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgSayText, .player = id ); write_byte( id ? id : 33 ); write_string( szMsg ); message_end( ); }
Tanto costaba modificar el mío ? :S
Y toma.
Código PHP: public HandlerComprasMenu ( iIndex, iMenu, iItem ){ if ( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED; } new iMoney = cs_get_user_money ( iIndex ); if ( iMoney >= szTienda [ iItem ] [ PRECIO ] ){ cs_set_user_money ( iIndex, iMoney - szTienda [ iItem ] [ PRECIO ] ) ColorChat ( iIndex, GREEN, "%s Has comprado el item ^4%s^1.", szPrefix, szTienda [ iItem ] [ NOMBRE ] ); } else{ ColorChat ( iIndex, GREEN, "%s Te falta ^3($%d) ^1para comprar el item ^4%s", szPrefix, szTienda [ iItem ] [ PRECIO ] - iMoney, szTienda [ iItem ] [ NOMBRE ] ); cmdTienda ( iIndex ); return PLUGIN_HANDLED; } switch ( iItem ) { case 0:{ if ( g_iTiendaShop [ iIndex ] [ 0 ] ) { //item = 0. ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_rendering ( iIndex, kRenderFxGlowShell, random_num ( 0, 255 ), random_num ( 0, 255 ), random_num ( 0, 255 ), kRenderNormal, 35 ); g_iTiendaShop [ iIndex ] [ 0 ] = true; } case 1: { if ( g_iTiendaShop [ iIndex ] [ 1 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_health ( iIndex, 130 ); g_iTiendaShop [ iIndex ] [ 1 ] = true; } case 2: { if ( g_iTiendaShop [ iIndex ] [ 2 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_give_item ( iIndex, "weapon_hegrenade" ); fm_give_item ( iIndex, "weapon_smokegrenade" ); cs_set_user_bpammo ( iIndex, CSW_SMOKEGRENADE, 2 ); g_iTiendaShop [ iIndex ] [ 2 ] = true; } case 3: { if ( g_iTiendaShop [ iIndex ] [ 3 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_maxspeed ( iIndex, 350.0 ); set_task ( 20.0, "RemoverVelocidad", iIndex ); //15 Segundos. g_iTiendaShop [ iIndex ] [ 3 ] = true; } case 4: { if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } g_iTiendaShop [ iIndex ] [ 4 ] = true; } } return PLUGIN_HANDLED; }
Mensajes: 586
Temas: 15
Registro en: Jul 2017
Reputación:
6
21/07/2018, 01:53 PM
(Última modificación: 21/07/2018, 02:46 PM por Pablo_1998.)
(21/07/2018, 01:18 PM)Niper.-. escribió: Tanto costaba modificar el mío ? :S No me iba costar nada, simplemente el plugin ese de cristian lo utilizo para todo capaz a él también le servía.
Mensajes: 1,015
Temas: 42
Registro en: Feb 2016
Reputación:
13
21/07/2018, 02:43 PM
(Última modificación: 21/07/2018, 02:44 PM por Exertency.)
(21/07/2018, 01:18 PM)Niper.-. escribió: Tanto costaba modificar el mío ? :S
Y toma.
Código PHP: public HandlerComprasMenu ( iIndex, iMenu, iItem ){ if ( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED; } new iMoney = cs_get_user_money ( iIndex ); if ( iMoney >= szTienda [ iItem ] [ PRECIO ] ){ cs_set_user_money ( iIndex, iMoney - szTienda [ iItem ] [ PRECIO ] ) ColorChat ( iIndex, GREEN, "%s Has comprado el item ^4%s^1.", szPrefix, szTienda [ iItem ] [ NOMBRE ] ); } else{ ColorChat ( iIndex, GREEN, "%s Te falta ^3($%d) ^1para comprar el item ^4%s", szPrefix, szTienda [ iItem ] [ PRECIO ] - iMoney, szTienda [ iItem ] [ NOMBRE ] ); cmdTienda ( iIndex ); return PLUGIN_HANDLED; } switch ( iItem ) { case 0:{ if ( g_iTiendaShop [ iIndex ] [ 0 ] ) { //item = 0. ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_rendering ( iIndex, kRenderFxGlowShell, random_num ( 0, 255 ), random_num ( 0, 255 ), random_num ( 0, 255 ), kRenderNormal, 35 ); g_iTiendaShop [ iIndex ] [ 0 ] = true; } case 1: { if ( g_iTiendaShop [ iIndex ] [ 1 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_health ( iIndex, 130 ); g_iTiendaShop [ iIndex ] [ 1 ] = true; } case 2: { if ( g_iTiendaShop [ iIndex ] [ 2 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_give_item ( iIndex, "weapon_hegrenade" ); fm_give_item ( iIndex, "weapon_smokegrenade" ); cs_set_user_bpammo ( iIndex, CSW_SMOKEGRENADE, 2 ); g_iTiendaShop [ iIndex ] [ 2 ] = true; } case 3: { if ( g_iTiendaShop [ iIndex ] [ 3 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_maxspeed ( iIndex, 350.0 ); set_task ( 20.0, "RemoverVelocidad", iIndex ); //15 Segundos. g_iTiendaShop [ iIndex ] [ 3 ] = true; } case 4: { if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } g_iTiendaShop [ iIndex ] [ 4 ] = true; } } return PLUGIN_HANDLED; }
Sigue teniendo el mismo problema que comento antes.
Código PHP: public HandlerComprasMenu ( iIndex, iMenu, iItem ){ if ( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED; } new iMoney = cs_get_user_money ( iIndex ); if ( iMoney < szTienda [ iItem ] [ PRECIO ] ){ ColorChat ( iIndex, GREEN, "%s Te falta ^3($%d) ^1para comprar el item ^4%s", szPrefix, szTienda [ iItem ] [ PRECIO ] - iMoney, szTienda [ iItem ] [ NOMBRE ] ); cmdTienda ( iIndex ); return PLUGIN_HANDLED; } else if( g_iTiendaShop[iIndex][iItem] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste el item ^4%s", szPrefix, szTienda[iItem][NOMBRE]); cmdTienda ( iIndex ); return PLUGIN_HANDLED; }
switch ( iItem ) { case 0: fm_set_rendering ( iIndex, kRenderFxGlowShell, random_num ( 0, 255 ), random_num ( 0, 255 ), random_num ( 0, 255 ), kRenderNormal, 35 ); case 1: fm_set_user_health ( iIndex, 130 ); case 2: { fm_give_item ( iIndex, "weapon_hegrenade" ); fm_give_item ( iIndex, "weapon_smokegrenade" ); cs_set_user_bpammo ( iIndex, CSW_SMOKEGRENADE, 2 ); } case 3: { fm_set_user_maxspeed ( iIndex, 350.0 ); set_task ( 20.0, "RemoverVelocidad", iIndex ); // 20 Segundos. } }
g_iTiendaShop [iIndex][iItem] = true; cs_set_user_money ( iIndex, iMoney - szTienda [ iItem ] [ PRECIO ] ) ColorChat ( iIndex, GREEN, "%s Has comprado el item ^4%s^1.", szPrefix, szTienda [ iItem ] [ NOMBRE ] );
return PLUGIN_HANDLED; }
Mensajes: 175
Temas: 57
Registro en: May 2017
Reputación:
0
(21/07/2018, 02:43 PM)Exertency escribió: (21/07/2018, 01:18 PM)Niper.-. escribió: Tanto costaba modificar el mío ? :S
Y toma.
Código PHP: public HandlerComprasMenu ( iIndex, iMenu, iItem ){ if ( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED; } new iMoney = cs_get_user_money ( iIndex ); if ( iMoney >= szTienda [ iItem ] [ PRECIO ] ){ cs_set_user_money ( iIndex, iMoney - szTienda [ iItem ] [ PRECIO ] ) ColorChat ( iIndex, GREEN, "%s Has comprado el item ^4%s^1.", szPrefix, szTienda [ iItem ] [ NOMBRE ] ); } else{ ColorChat ( iIndex, GREEN, "%s Te falta ^3($%d) ^1para comprar el item ^4%s", szPrefix, szTienda [ iItem ] [ PRECIO ] - iMoney, szTienda [ iItem ] [ NOMBRE ] ); cmdTienda ( iIndex ); return PLUGIN_HANDLED; } switch ( iItem ) { case 0:{ if ( g_iTiendaShop [ iIndex ] [ 0 ] ) { //item = 0. ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_rendering ( iIndex, kRenderFxGlowShell, random_num ( 0, 255 ), random_num ( 0, 255 ), random_num ( 0, 255 ), kRenderNormal, 35 ); g_iTiendaShop [ iIndex ] [ 0 ] = true; } case 1: { if ( g_iTiendaShop [ iIndex ] [ 1 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_health ( iIndex, 130 ); g_iTiendaShop [ iIndex ] [ 1 ] = true; } case 2: { if ( g_iTiendaShop [ iIndex ] [ 2 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_give_item ( iIndex, "weapon_hegrenade" ); fm_give_item ( iIndex, "weapon_smokegrenade" ); cs_set_user_bpammo ( iIndex, CSW_SMOKEGRENADE, 2 ); g_iTiendaShop [ iIndex ] [ 2 ] = true; } case 3: { if ( g_iTiendaShop [ iIndex ] [ 3 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } fm_set_user_maxspeed ( iIndex, 350.0 ); set_task ( 20.0, "RemoverVelocidad", iIndex ); //15 Segundos. g_iTiendaShop [ iIndex ] [ 3 ] = true; } case 4: { if ( g_iTiendaShop [ iIndex ] [ 4 ] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste este Item", szPrefix ); return PLUGIN_HANDLED; } g_iTiendaShop [ iIndex ] [ 4 ] = true; } } return PLUGIN_HANDLED; }
Sigue teniendo el mismo problema que comento antes.
Código PHP: public HandlerComprasMenu ( iIndex, iMenu, iItem ){ if ( iItem == MENU_EXIT ) { menu_destroy ( iMenu ); return PLUGIN_HANDLED; } new iMoney = cs_get_user_money ( iIndex ); if ( iMoney < szTienda [ iItem ] [ PRECIO ] ){ ColorChat ( iIndex, GREEN, "%s Te falta ^3($%d) ^1para comprar el item ^4%s", szPrefix, szTienda [ iItem ] [ PRECIO ] - iMoney, szTienda [ iItem ] [ NOMBRE ] ); cmdTienda ( iIndex ); return PLUGIN_HANDLED; } else if( g_iTiendaShop[iIndex][iItem] ) { ColorChat ( iIndex, GREEN, "%s Ya compraste el item ^4%s", szPrefix, szTienda[iItem][NOMBRE]); cmdTienda ( iIndex ); return PLUGIN_HANDLED; }
switch ( iItem ) { case 0: fm_set_rendering ( iIndex, kRenderFxGlowShell, random_num ( 0, 255 ), random_num ( 0, 255 ), random_num ( 0, 255 ), kRenderNormal, 35 ); case 1: fm_set_user_health ( iIndex, 130 ); case 2: { fm_give_item ( iIndex, "weapon_hegrenade" ); fm_give_item ( iIndex, "weapon_smokegrenade" ); cs_set_user_bpammo ( iIndex, CSW_SMOKEGRENADE, 2 ); } case 3: { fm_set_user_maxspeed ( iIndex, 350.0 ); set_task ( 20.0, "RemoverVelocidad", iIndex ); // 20 Segundos. } }
g_iTiendaShop [iIndex][iItem] = true; cs_set_user_money ( iIndex, iMoney - szTienda [ iItem ] [ PRECIO ] ) ColorChat ( iIndex, GREEN, "%s Has comprado el item ^4%s^1.", szPrefix, szTienda [ iItem ] [ NOMBRE ] );
return PLUGIN_HANDLED; }
Ayudaaaa
|