Mensajes: 811
Temas: 99
Registro en: Jun 2019
Reputación:
8
Mensajes: 3,238
Temas: 47
Registro en: Feb 2015
Reputación:
34
29/10/2019, 05:24 PM
(Última modificación: 29/10/2019, 05:26 PM por Skylar. Edited 1 time in total.)
Código PHP: /* * * [ Knife Shop v 1.5 ] * * * v1.0 * - Iniciacion del plugin. * * v1.2 * - Optimizacion de if's * * v1.3 * - Agregada cvar para recibir puntos * * v1.4 * - Depuracion de codigo * * v1.5 * - Plugin Rehecho y optimizado * */
#include <amxmodx> #include <engine> #include <fakemeta> #include <hamsandwich>
new const KS_PLUGIN[] = "Knife Shop" new const KS_VERSION[] = "1.5" new const KS_AUTHOR[] = "zoolk"
enum DATA_KNIFES { CSW, NAME[40], COST, V_MDL[50], P_MDL[50] }
new const szKnifes[][DATA_KNIFES] = { { CSW_AK47, "AK47", 20, "models/ksKnifes/gut/v_gut.mdl", "models/ksKnifes/gut/p_gut.mdl" }, { CSW_M4A1, "M4A1", 50, "models/ksKnifes/flip/v_flip.mdl", "models/ksKnifes/flip/p_flip.mdl" }, { CSW_AWP, "AWP", 80, "models/ksKnifes/flip/v_flip.mdl", "models/ksKnifes/flip/p_flip.mdl" } }
new const WEAPONENTNAMES[ ][ ] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10", "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_knife", "weapon_p90" };
new g_spdknife[33][sizeof szKnifes] new g_hasknife[33] new g_points[33] new cvr_points_per_kill
public plugin_init() { register_plugin(KS_PLUGIN, KS_VERSION, KS_AUTHOR) cvr_points_per_kill = register_cvar("amx_puntos_muerte", "1") register_clcmd("nightvision", "ShowKnifesMenu") for(new wpn = 0; wpn < sizeof WEAPONENTNAMES; wpn++) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[wpn], "fw_Ham_Item_Deploy_Post", true) RegisterHam(Ham_Killed, "player", "fw_Ham_Killed_Post", true) }
public client_putinserver(id) { g_points[id] = 0 g_hasknife[id] = -1 for(new i = 0; i < sizeof szKnifes; i++) g_spdknife[id][i] = false }
public plugin_precache() { for(new i = 0; i < sizeof szKnifes; i++) { precache_model(szKnifes[i][V_MDL]) precache_model(szKnifes[i][P_MDL]) } }
public ShowKnifesMenu(id) { new menu, len[100] formatex(len, charsmax(len), "Tienda de Cuchillos^n\yPuntos: \r%d", g_points[id]) menu = menu_create(len, "CmdKnifesMenu") for(new i = 0; i < sizeof szKnifes; i++) { if(g_spdknife[id][i]) { formatex(len, charsmax(len), "%s", szKnifes[i][NAME]) if(g_hasknife[id] == i) add(len, charsmax(len), " \y[ACTIVO]") } else { if(g_points[id] >= szKnifes[i][COST]) formatex(len, charsmax(len), "%s \y[COMPRAR]", szKnifes[i][NAME]) else formatex(len, charsmax(len), "%s \r$%d", szKnifes[i][NAME], szKnifes[i][COST]) } menu_additem(menu, len) } menu_display(id, menu) }
public CmdKnifesMenu(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu) return PLUGIN_HANDLED; } if(g_spdknife[id][item]) { if(g_hasknife[id] == item) client_print(id, print_chat, "Ya tienes este knife Activo") else { g_hasknife[id] = item client_print(id, print_chat, "Has seleccionado el knife %s", szKnifes[item][NAME]) if(get_user_weapon(id) == szKnifes[item][CSW]) { entity_set_string(id, EV_SZ_viewmodel, szKnifes[item][V_MDL]) entity_set_string(id, EV_SZ_weaponmodel, szKnifes[item][P_MDL]) } } } else { if(g_points[id] >= szKnifes[item][COST]) { g_spdknife[id][item] = true g_points[id] -= szKnifes[item][COST] client_print(id, print_chat, "Has comprado el knife %s", szKnifes[item][NAME]) ShowKnifesMenu(id) } else client_print(id, print_chat, "Te faltan %d puntos para poder compar el knife %s", szKnifes[item][COST] - g_points[id], szKnifes[item][NAME]) } return PLUGIN_HANDLED; }
public fw_Ham_Item_Deploy_Post(weapon_ent) { new owner = get_pdata_cbase(weapon_ent, 41, 4) if(!pev_valid(owner) || g_hasknife[owner] == -1) return HAM_IGNORED; entity_set_string(owner, EV_SZ_viewmodel, szKnifes[g_hasknife[owner]][V_MDL]) entity_set_string(owner, EV_SZ_weaponmodel, szKnifes[g_hasknife[owner]][P_MDL]) return HAM_IGNORED; }
public fw_Ham_Killed_Post(victim, attacker, shouldgib) { if(victim == attacker || !is_user_alive(attacker)) return HAM_IGNORED; g_points[attacker] += get_pcvar_num(cvr_points_per_kill) return HAM_IGNORED; }
Cambia la dirección de los models
Mensajes: 811
Temas: 99
Registro en: Jun 2019
Reputación:
8
29/10/2019, 05:44 PM
(Última modificación: 29/10/2019, 05:45 PM por andres_1041. Edited 1 time in total.)
(29/10/2019, 05:24 PM)Skylar escribió: Código PHP: /* * * [ Knife Shop v 1.5 ] * * * v1.0 * - Iniciacion del plugin. * * v1.2 * - Optimizacion de if's * * v1.3 * - Agregada cvar para recibir puntos * * v1.4 * - Depuracion de codigo * * v1.5 * - Plugin Rehecho y optimizado * */
#include <amxmodx> #include <engine> #include <fakemeta> #include <hamsandwich>
new const KS_PLUGIN[] = "Knife Shop" new const KS_VERSION[] = "1.5" new const KS_AUTHOR[] = "zoolk"
enum DATA_KNIFES { CSW, NAME[40], COST, V_MDL[50], P_MDL[50] }
new const szKnifes[][DATA_KNIFES] = { { CSW_AK47, "AK47", 20, "models/ksKnifes/gut/v_gut.mdl", "models/ksKnifes/gut/p_gut.mdl" }, { CSW_M4A1, "M4A1", 50, "models/ksKnifes/flip/v_flip.mdl", "models/ksKnifes/flip/p_flip.mdl" }, { CSW_AWP, "AWP", 80, "models/ksKnifes/flip/v_flip.mdl", "models/ksKnifes/flip/p_flip.mdl" } }
new const WEAPONENTNAMES[ ][ ] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10", "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_knife", "weapon_p90" };
new g_spdknife[33][sizeof szKnifes] new g_hasknife[33] new g_points[33] new cvr_points_per_kill
public plugin_init() { register_plugin(KS_PLUGIN, KS_VERSION, KS_AUTHOR) cvr_points_per_kill = register_cvar("amx_puntos_muerte", "1") register_clcmd("nightvision", "ShowKnifesMenu") for(new wpn = 0; wpn < sizeof WEAPONENTNAMES; wpn++) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[wpn], "fw_Ham_Item_Deploy_Post", true) RegisterHam(Ham_Killed, "player", "fw_Ham_Killed_Post", true) }
public client_putinserver(id) { g_points[id] = 0 g_hasknife[id] = -1 for(new i = 0; i < sizeof szKnifes; i++) g_spdknife[id][i] = false }
public plugin_precache() { for(new i = 0; i < sizeof szKnifes; i++) { precache_model(szKnifes[i][V_MDL]) precache_model(szKnifes[i][P_MDL]) } }
public ShowKnifesMenu(id) { new menu, len[100] formatex(len, charsmax(len), "Tienda de Cuchillos^n\yPuntos: \r%d", g_points[id]) menu = menu_create(len, "CmdKnifesMenu") for(new i = 0; i < sizeof szKnifes; i++) { if(g_spdknife[id][i]) { formatex(len, charsmax(len), "%s", szKnifes[i][NAME]) if(g_hasknife[id] == i) add(len, charsmax(len), " \y[ACTIVO]") } else { if(g_points[id] >= szKnifes[i][COST]) formatex(len, charsmax(len), "%s \y[COMPRAR]", szKnifes[i][NAME]) else formatex(len, charsmax(len), "%s \r$%d", szKnifes[i][NAME], szKnifes[i][COST]) } menu_additem(menu, len) } menu_display(id, menu) }
public CmdKnifesMenu(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu) return PLUGIN_HANDLED; } if(g_spdknife[id][item]) { if(g_hasknife[id] == item) client_print(id, print_chat, "Ya tienes este knife Activo") else { g_hasknife[id] = item client_print(id, print_chat, "Has seleccionado el knife %s", szKnifes[item][NAME]) if(get_user_weapon(id) == szKnifes[item][CSW]) { entity_set_string(id, EV_SZ_viewmodel, szKnifes[item][V_MDL]) entity_set_string(id, EV_SZ_weaponmodel, szKnifes[item][P_MDL]) } } } else { if(g_points[id] >= szKnifes[item][COST]) { g_spdknife[id][item] = true g_points[id] -= szKnifes[item][COST] client_print(id, print_chat, "Has comprado el knife %s", szKnifes[item][NAME]) ShowKnifesMenu(id) } else client_print(id, print_chat, "Te faltan %d puntos para poder compar el knife %s", szKnifes[item][COST] - g_points[id], szKnifes[item][NAME]) } return PLUGIN_HANDLED; }
public fw_Ham_Item_Deploy_Post(weapon_ent) { new owner = get_pdata_cbase(weapon_ent, 41, 4) if(!pev_valid(owner) || g_hasknife[owner] == -1) return HAM_IGNORED; entity_set_string(owner, EV_SZ_viewmodel, szKnifes[g_hasknife[owner]][V_MDL]) entity_set_string(owner, EV_SZ_weaponmodel, szKnifes[g_hasknife[owner]][P_MDL]) return HAM_IGNORED; }
public fw_Ham_Killed_Post(victim, attacker, shouldgib) { if(victim == attacker || !is_user_alive(attacker)) return HAM_IGNORED; g_points[attacker] += get_pcvar_num(cvr_points_per_kill) return HAM_IGNORED; }
Cambia la dirección de los models
pero le quitaste los punto al matar
Código PHP: if(g_hasknife[id] == item) client_print(id, print_chat, "Ya tienes este knife Activo") else
porque tampoco quiero que tenga eso ni esto
[/php]
if(g_hasknife[id] == i)
add(len, charsmax(len), " \y[ACTIVO]")
}
else
{
if(g_points[id] >= szKnifes[i][COST])
formatex(len, charsmax(len), "%s \y[COMPRAR]", szKnifes[i][NAME])
else
formatex(len, charsmax(len), "%s \r$%d", szKnifes[i][NAME], szKnifes[i][COST])
}[/php]
I dream of someday being able to have your near.
Mensajes: 3,238
Temas: 47
Registro en: Feb 2015
Reputación:
34
(29/10/2019, 05:44 PM)andres_1041 escribió: (29/10/2019, 05:24 PM)Skylar escribió: Código PHP: /* * * [ Knife Shop v 1.5 ] * * * v1.0 * - Iniciacion del plugin. * * v1.2 * - Optimizacion de if's * * v1.3 * - Agregada cvar para recibir puntos * * v1.4 * - Depuracion de codigo * * v1.5 * - Plugin Rehecho y optimizado * */
#include <amxmodx> #include <engine> #include <fakemeta> #include <hamsandwich>
new const KS_PLUGIN[] = "Knife Shop" new const KS_VERSION[] = "1.5" new const KS_AUTHOR[] = "zoolk"
enum DATA_KNIFES { CSW, NAME[40], COST, V_MDL[50], P_MDL[50] }
new const szKnifes[][DATA_KNIFES] = { { CSW_AK47, "AK47", 20, "models/ksKnifes/gut/v_gut.mdl", "models/ksKnifes/gut/p_gut.mdl" }, { CSW_M4A1, "M4A1", 50, "models/ksKnifes/flip/v_flip.mdl", "models/ksKnifes/flip/p_flip.mdl" }, { CSW_AWP, "AWP", 80, "models/ksKnifes/flip/v_flip.mdl", "models/ksKnifes/flip/p_flip.mdl" } }
new const WEAPONENTNAMES[ ][ ] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10", "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_knife", "weapon_p90" };
new g_spdknife[33][sizeof szKnifes] new g_hasknife[33] new g_points[33] new cvr_points_per_kill
public plugin_init() { register_plugin(KS_PLUGIN, KS_VERSION, KS_AUTHOR) cvr_points_per_kill = register_cvar("amx_puntos_muerte", "1") register_clcmd("nightvision", "ShowKnifesMenu") for(new wpn = 0; wpn < sizeof WEAPONENTNAMES; wpn++) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[wpn], "fw_Ham_Item_Deploy_Post", true) RegisterHam(Ham_Killed, "player", "fw_Ham_Killed_Post", true) }
public client_putinserver(id) { g_points[id] = 0 g_hasknife[id] = -1 for(new i = 0; i < sizeof szKnifes; i++) g_spdknife[id][i] = false }
public plugin_precache() { for(new i = 0; i < sizeof szKnifes; i++) { precache_model(szKnifes[i][V_MDL]) precache_model(szKnifes[i][P_MDL]) } }
public ShowKnifesMenu(id) { new menu, len[100] formatex(len, charsmax(len), "Tienda de Cuchillos^n\yPuntos: \r%d", g_points[id]) menu = menu_create(len, "CmdKnifesMenu") for(new i = 0; i < sizeof szKnifes; i++) { if(g_spdknife[id][i]) { formatex(len, charsmax(len), "%s", szKnifes[i][NAME]) if(g_hasknife[id] == i) add(len, charsmax(len), " \y[ACTIVO]") } else { if(g_points[id] >= szKnifes[i][COST]) formatex(len, charsmax(len), "%s \y[COMPRAR]", szKnifes[i][NAME]) else formatex(len, charsmax(len), "%s \r$%d", szKnifes[i][NAME], szKnifes[i][COST]) } menu_additem(menu, len) } menu_display(id, menu) }
public CmdKnifesMenu(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu) return PLUGIN_HANDLED; } if(g_spdknife[id][item]) { if(g_hasknife[id] == item) client_print(id, print_chat, "Ya tienes este knife Activo") else { g_hasknife[id] = item client_print(id, print_chat, "Has seleccionado el knife %s", szKnifes[item][NAME]) if(get_user_weapon(id) == szKnifes[item][CSW]) { entity_set_string(id, EV_SZ_viewmodel, szKnifes[item][V_MDL]) entity_set_string(id, EV_SZ_weaponmodel, szKnifes[item][P_MDL]) } } } else { if(g_points[id] >= szKnifes[item][COST]) { g_spdknife[id][item] = true g_points[id] -= szKnifes[item][COST] client_print(id, print_chat, "Has comprado el knife %s", szKnifes[item][NAME]) ShowKnifesMenu(id) } else client_print(id, print_chat, "Te faltan %d puntos para poder compar el knife %s", szKnifes[item][COST] - g_points[id], szKnifes[item][NAME]) } return PLUGIN_HANDLED; }
public fw_Ham_Item_Deploy_Post(weapon_ent) { new owner = get_pdata_cbase(weapon_ent, 41, 4) if(!pev_valid(owner) || g_hasknife[owner] == -1) return HAM_IGNORED; entity_set_string(owner, EV_SZ_viewmodel, szKnifes[g_hasknife[owner]][V_MDL]) entity_set_string(owner, EV_SZ_weaponmodel, szKnifes[g_hasknife[owner]][P_MDL]) return HAM_IGNORED; }
public fw_Ham_Killed_Post(victim, attacker, shouldgib) { if(victim == attacker || !is_user_alive(attacker)) return HAM_IGNORED; g_points[attacker] += get_pcvar_num(cvr_points_per_kill) return HAM_IGNORED; }
Cambia la dirección de los models
pero le quitaste los punto al matar
Código PHP: if(g_hasknife[id] == item) client_print(id, print_chat, "Ya tienes este knife Activo") else
porque tampoco quiero que tenga eso ni esto
[/php]
if(g_hasknife[id] == i)
add(len, charsmax(len), " \y[ACTIVO]")
}
else
{
if(g_points[id] >= szKnifes[i][COST])
formatex(len, charsmax(len), "%s \y[COMPRAR]", szKnifes[i][NAME])
else
formatex(len, charsmax(len), "%s \r$%d", szKnifes[i][NAME], szKnifes[i][COST])
}[/php]
Y sacalo vos, parece que ya sabes cómo
Mensajes: 811
Temas: 99
Registro en: Jun 2019
Reputación:
8
29/10/2019, 06:37 PM
(Última modificación: 29/10/2019, 06:38 PM por andres_1041.)
quiero quitarle esto de los puntos
Código PHP: formatex(len, charsmax(len), "%s", szKnifes[i][NAME]) if(g_hasknife[id] == i) add(len, charsmax(len), " \y[ACTIVO]") } else { if(g_points[id] >= szKnifes[i][COST]) formatex(len, charsmax(len), "%s \y[COMPRAR]", szKnifes[i][NAME]) else formatex(len, charsmax(len), "%s \r$%d", szKnifes[i][NAME], szKnifes[i][COST]) } menu_additem(menu, len) } menu_display(id, menu) }
(29/10/2019, 06:36 PM)Skylar escribió: (29/10/2019, 05:44 PM)andres_1041 escribió: (29/10/2019, 05:24 PM)Skylar escribió: Código PHP: /* * * [ Knife Shop v 1.5 ] * * * v1.0 * - Iniciacion del plugin. * * v1.2 * - Optimizacion de if's * * v1.3 * - Agregada cvar para recibir puntos * * v1.4 * - Depuracion de codigo * * v1.5 * - Plugin Rehecho y optimizado * */
#include <amxmodx> #include <engine> #include <fakemeta> #include <hamsandwich>
new const KS_PLUGIN[] = "Knife Shop" new const KS_VERSION[] = "1.5" new const KS_AUTHOR[] = "zoolk"
enum DATA_KNIFES { CSW, NAME[40], COST, V_MDL[50], P_MDL[50] }
new const szKnifes[][DATA_KNIFES] = { { CSW_AK47, "AK47", 20, "models/ksKnifes/gut/v_gut.mdl", "models/ksKnifes/gut/p_gut.mdl" }, { CSW_M4A1, "M4A1", 50, "models/ksKnifes/flip/v_flip.mdl", "models/ksKnifes/flip/p_flip.mdl" }, { CSW_AWP, "AWP", 80, "models/ksKnifes/flip/v_flip.mdl", "models/ksKnifes/flip/p_flip.mdl" } }
new const WEAPONENTNAMES[ ][ ] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10", "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_knife", "weapon_p90" };
new g_spdknife[33][sizeof szKnifes] new g_hasknife[33] new g_points[33] new cvr_points_per_kill
public plugin_init() { register_plugin(KS_PLUGIN, KS_VERSION, KS_AUTHOR) cvr_points_per_kill = register_cvar("amx_puntos_muerte", "1") register_clcmd("nightvision", "ShowKnifesMenu") for(new wpn = 0; wpn < sizeof WEAPONENTNAMES; wpn++) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[wpn], "fw_Ham_Item_Deploy_Post", true) RegisterHam(Ham_Killed, "player", "fw_Ham_Killed_Post", true) }
public client_putinserver(id) { g_points[id] = 0 g_hasknife[id] = -1 for(new i = 0; i < sizeof szKnifes; i++) g_spdknife[id][i] = false }
public plugin_precache() { for(new i = 0; i < sizeof szKnifes; i++) { precache_model(szKnifes[i][V_MDL]) precache_model(szKnifes[i][P_MDL]) } }
public ShowKnifesMenu(id) { new menu, len[100] formatex(len, charsmax(len), "Tienda de Cuchillos^n\yPuntos: \r%d", g_points[id]) menu = menu_create(len, "CmdKnifesMenu") for(new i = 0; i < sizeof szKnifes; i++) { if(g_spdknife[id][i]) { formatex(len, charsmax(len), "%s", szKnifes[i][NAME]) if(g_hasknife[id] == i) add(len, charsmax(len), " \y[ACTIVO]") } else { if(g_points[id] >= szKnifes[i][COST]) formatex(len, charsmax(len), "%s \y[COMPRAR]", szKnifes[i][NAME]) else formatex(len, charsmax(len), "%s \r$%d", szKnifes[i][NAME], szKnifes[i][COST]) } menu_additem(menu, len) } menu_display(id, menu) }
public CmdKnifesMenu(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu) return PLUGIN_HANDLED; } if(g_spdknife[id][item]) { if(g_hasknife[id] == item) client_print(id, print_chat, "Ya tienes este knife Activo") else { g_hasknife[id] = item client_print(id, print_chat, "Has seleccionado el knife %s", szKnifes[item][NAME]) if(get_user_weapon(id) == szKnifes[item][CSW]) { entity_set_string(id, EV_SZ_viewmodel, szKnifes[item][V_MDL]) entity_set_string(id, EV_SZ_weaponmodel, szKnifes[item][P_MDL]) } } } else { if(g_points[id] >= szKnifes[item][COST]) { g_spdknife[id][item] = true g_points[id] -= szKnifes[item][COST] client_print(id, print_chat, "Has comprado el knife %s", szKnifes[item][NAME]) ShowKnifesMenu(id) } else client_print(id, print_chat, "Te faltan %d puntos para poder compar el knife %s", szKnifes[item][COST] - g_points[id], szKnifes[item][NAME]) } return PLUGIN_HANDLED; }
public fw_Ham_Item_Deploy_Post(weapon_ent) { new owner = get_pdata_cbase(weapon_ent, 41, 4) if(!pev_valid(owner) || g_hasknife[owner] == -1) return HAM_IGNORED; entity_set_string(owner, EV_SZ_viewmodel, szKnifes[g_hasknife[owner]][V_MDL]) entity_set_string(owner, EV_SZ_weaponmodel, szKnifes[g_hasknife[owner]][P_MDL]) return HAM_IGNORED; }
public fw_Ham_Killed_Post(victim, attacker, shouldgib) { if(victim == attacker || !is_user_alive(attacker)) return HAM_IGNORED; g_points[attacker] += get_pcvar_num(cvr_points_per_kill) return HAM_IGNORED; }
Cambia la dirección de los models
pero le quitaste los punto al matar
Código PHP: if(g_hasknife[id] == item) client_print(id, print_chat, "Ya tienes este knife Activo") else
porque tampoco quiero que tenga eso ni esto
[/php]
if(g_hasknife[id] == i)
add(len, charsmax(len), " \y[ACTIVO]")
}
else
{
if(g_points[id] >= szKnifes[i][COST])
formatex(len, charsmax(len), "%s \y[COMPRAR]", szKnifes[i][NAME])
else
formatex(len, charsmax(len), "%s \r$%d", szKnifes[i][NAME], szKnifes[i][COST])
}[/php]
Y sacalo vos, parece que ya sabes cómo
Amigo no lo que te dire no es forma de regaño ni nada de eso pero en realidad si yo supiese no te preguntara como se hace
I dream of someday being able to have your near.
Mensajes: 3,238
Temas: 47
Registro en: Feb 2015
Reputación:
34
Código PHP: /* * * [ Knife Shop v 1.5 ] * * * v1.0 * - Iniciacion del plugin. * * v1.2 * - Optimizacion de if's * * v1.3 * - Agregada cvar para recibir puntos * * v1.4 * - Depuracion de codigo * * v1.5 * - Plugin Rehecho y optimizado * */
#include <amxmodx> #include <engine> #include <fakemeta> #include <hamsandwich>
new const KS_PLUGIN[] = "Knife Shop" new const KS_VERSION[] = "1.5" new const KS_AUTHOR[] = "zoolk"
enum DATA_KNIFES { CSW, NAME[40], V_MDL[50], P_MDL[50] }
new const szKnifes[][DATA_KNIFES] = { { CSW_AK47, "AK47", "models/ksKnifes/gut/v_gut.mdl", "models/ksKnifes/gut/p_gut.mdl" }, { CSW_M4A1, "M4A1", "models/ksKnifes/flip/v_flip.mdl", "models/ksKnifes/flip/p_flip.mdl" }, { CSW_AWP, "AWP", "models/ksKnifes/flip/v_flip.mdl", "models/ksKnifes/flip/p_flip.mdl" } }
new const WEAPONENTNAMES[ ][ ] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10", "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_knife", "weapon_p90" };
new g_spdknife[33][sizeof szKnifes] new g_hasknife[33]
public plugin_init() { register_plugin(KS_PLUGIN, KS_VERSION, KS_AUTHOR) register_clcmd("nightvision", "ShowKnifesMenu") for(new wpn = 0; wpn < sizeof WEAPONENTNAMES; wpn++) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[wpn], "fw_Ham_Item_Deploy_Post", true) }
public client_putinserver(id) { g_hasknife[id] = -1 for(new i = 0; i < sizeof szKnifes; i++) g_spdknife[id][i] = false }
public plugin_precache() { for(new i = 0; i < sizeof szKnifes; i++) { precache_model(szKnifes[i][V_MDL]) precache_model(szKnifes[i][P_MDL]) } }
public ShowKnifesMenu(id) { new menu, len[100] formatex(len, charsmax(len), "Tienda de Cuchillos") menu = menu_create(len, "CmdKnifesMenu") for(new i = 0; i < sizeof szKnifes; i++) { if(g_spdknife[id][i]) { formatex(len, charsmax(len), "%s", szKnifes[i][NAME]) if(g_hasknife[id] == i) add(len, charsmax(len), " \y[ACTIVO]") } menu_additem(menu, len) } menu_display(id, menu) }
public CmdKnifesMenu(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu) return PLUGIN_HANDLED; } if(g_spdknife[id][item]) { if(g_hasknife[id] == item) client_print(id, print_chat, "Ya tienes este knife Activo") else { g_hasknife[id] = item client_print(id, print_chat, "Has seleccionado el knife %s", szKnifes[item][NAME]) if(get_user_weapon(id) == szKnifes[item][CSW]) { entity_set_string(id, EV_SZ_viewmodel, szKnifes[item][V_MDL]) entity_set_string(id, EV_SZ_weaponmodel, szKnifes[item][P_MDL]) } } } return PLUGIN_HANDLED; }
public fw_Ham_Item_Deploy_Post(weapon_ent) { new owner = get_pdata_cbase(weapon_ent, 41, 4) if(!pev_valid(owner) || g_hasknife[owner] == -1) return HAM_IGNORED; entity_set_string(owner, EV_SZ_viewmodel, szKnifes[g_hasknife[owner]][V_MDL]) entity_set_string(owner, EV_SZ_weaponmodel, szKnifes[g_hasknife[owner]][P_MDL]) return HAM_IGNORED; }
Ahí está
|