Senior Member
Join Date: Apr 2014
Location: somewhere in universe
|
09-12-2014
, 03:19
[Solved] Zp Human Armor
|
#1
|
i modified original source from mercylez Zp Anti-Infection Armor to Buy 100 & 200 Armor Items , but when i want to buy 200 Armor its Giving only 100 !!! and when i reach limit of armor, i try to buy more
its taking all my ammo packs left only 1 ammo pack.. anyone some help pls ?
modified source
PHP Code:
#include <amxmodx> #include <fakemeta> #include <zombieplague>
/*================================================================================ [Plugin Customization] =================================================================================*/
new const g_item_name1[] = "Armor \y(100ap)" new const g_item_name2[] = "Armor \y(200ap)" new const g_sound_buyarmor[] = "items/ammopickup2.wav" const g_item_cost = 5 const g_item2_cost = 10
/*===============================================================================*/
// Item IDs new g_itemid_humanarmor1 new g_itemid_humanarmor2
new g_maxplayers, g_msgSayText, cvar_armor_amount1, cvar_armor_amount2, cvar_armor_limit new g_MsgSync; public plugin_init() { register_plugin("[ZP] Extra Item: Anti-Infection Armor", "1.1", "MeRcyLeZZ, 93()|29!/<") g_itemid_humanarmor1 = zp_register_extra_item(g_item_name1, g_item_cost, ZP_TEAM_HUMAN) g_itemid_humanarmor2 = zp_register_extra_item(g_item_name2, g_item2_cost, ZP_TEAM_HUMAN) cvar_armor_amount1 = register_cvar("zp_armor_amount1", "100") cvar_armor_amount2 = register_cvar("zp_armor_amount2", "200") cvar_armor_limit = register_cvar("zp_armor_limit", "235") g_msgSayText = get_user_msgid("SayText") g_maxplayers = get_maxplayers() g_MsgSync = CreateHudSyncObj(); }
public plugin_precache() { precache_sound(g_sound_buyarmor) }
// Human buys our upgrade, give him some armor public zp_extra_item_selected(id, itemid) { if (itemid != g_itemid_humanarmor1 && itemid != g_itemid_humanarmor2) return; if ((pev(id, pev_armorvalue)) >= get_pcvar_num(cvar_armor_limit)) { zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_item_cost && g_item2_cost) zp_colored_print(id, "^x04[ZP]^x01 You Already Have^x04One") return; } new name5[ 32 ] get_user_name( id, name5, 31 ) if (itemid == g_itemid_humanarmor1) { set_pev(id, pev_armorvalue, float(min(pev(id, pev_armorvalue) + get_pcvar_num(cvar_armor_amount1), get_pcvar_num(cvar_armor_limit)))) engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM) zp_colored_print(id,"^x04[ZP] %s^x01 bought^x04 Armor (100ap)^x01 !", name5) set_hudmessage( 255, 145, 0, -1.0, 0.7, 1, 0.0, 5.0, 1.0, 1.0, -1 ) ShowSyncHudMsg( 0, g_MsgSync, "%s has been equiped with 100 AP!", name5 ) }
if (itemid == g_itemid_humanarmor2) { set_pev(id, pev_armorvalue, float(min(pev(id, pev_armorvalue) + get_pcvar_num(cvar_armor_amount2), get_pcvar_num(cvar_armor_limit)))) engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM) zp_colored_print(id,"^x04[ZP] %s^x01 bought^x04 Armor (200ap)^x01 !", name5) set_hudmessage( 255, 145, 0, -1.0, 0.7, 1, 0.0, 5.0, 1.0, 1.0, -1 ) ShowSyncHudMsg( 0, g_MsgSync, "%s has been equiped with 200 AP!", name5 ) } }
// Colored chat print zp_colored_print(target, const message[], any:...) { static buffer[512], i, argscount argscount = numargs() // Send to everyone if (!target) { static player for (player = 1; player <= g_maxplayers; player++) { // Not connected if (!is_user_connected(player)) continue; // Remember changed arguments static changed[5], changedcount // [5] = max LANG_PLAYER occurencies changedcount = 0 // Replace LANG_PLAYER with player id for (i = 2; i < argscount; i++) { if (getarg(i) == LANG_PLAYER) { setarg(i, 0, player) changed[changedcount] = i changedcount++ } } // Format message for player vformat(buffer, charsmax(buffer), message, 3) // Send it message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, player) write_byte(player) write_string(buffer) message_end() // Replace back player id's with LANG_PLAYER for (i = 0; i < changedcount; i++) setarg(changed[i], 0, LANG_PLAYER) } } // Send to specific target else { // Format message for player vformat(buffer, charsmax(buffer), message, 3) // Send it message_begin(MSG_ONE, g_msgSayText, _, target) write_byte(target) write_string(buffer) message_end() } }
original source
PHP Code:
/*================================================================================ ------------------------------------------------- -*- [ZP] Extra Item: Anti-Infection Armor 1.1 -*- ------------------------------------------------- ~~~~~~~~~~~~~~~ - Description - ~~~~~~~~~~~~~~~ This item gives humans some armor that offers protection against zombie injuries. ================================================================================*/
#include <amxmodx> #include <fakemeta> #include <zombieplaguenew>
/*================================================================================ [Plugin Customization] =================================================================================*/
new const g_item_name[] = "Armura Anti-Infectie" new const g_sound_buyarmor[] = "items/ammopickup2.wav" const g_item_cost = 15
/*===============================================================================*/
// Item IDs new g_itemid_humanarmor
new g_maxplayers, g_msgSayText, cvar_armor_amount, cvar_armor_limit
public plugin_init() { register_plugin("[ZP] Extra Item: Anti-Infection Armor", "1.1", "MeRcyLeZZ, 93()|29!/<") g_itemid_humanarmor = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN) cvar_armor_amount = register_cvar("zp_armor_amount", "150") cvar_armor_limit = register_cvar("zp_armor_limit", "750") g_msgSayText = get_user_msgid("SayText") g_maxplayers = get_maxplayers() }
public plugin_precache() { precache_sound(g_sound_buyarmor) }
// Human buys our upgrade, give him some armor public zp_extra_item_selected(id, itemid) { if (itemid != g_itemid_humanarmor) return; if ((pev(id, pev_armorvalue)) >= get_pcvar_num(cvar_armor_limit)) { zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_item_cost) zp_colored_print(id, "^x04[ZP]^x01 Aveti deja cantitatea maxima de armura") return; } set_pev(id, pev_armorvalue, float(min(pev(id, pev_armorvalue) + get_pcvar_num(cvar_armor_amount), get_pcvar_num(cvar_armor_limit)))) engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM) }
// Colored chat print zp_colored_print(target, const message[], any:...) { static buffer[512], i, argscount argscount = numargs() // Send to everyone if (!target) { static player for (player = 1; player <= g_maxplayers; player++) { // Not connected if (!is_user_connected(player)) continue; // Remember changed arguments static changed[5], changedcount // [5] = max LANG_PLAYER occurencies changedcount = 0 // Replace LANG_PLAYER with player id for (i = 2; i < argscount; i++) { if (getarg(i) == LANG_PLAYER) { setarg(i, 0, player) changed[changedcount] = i changedcount++ } } // Format message for player vformat(buffer, charsmax(buffer), message, 3) // Send it message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, player) write_byte(player) write_string(buffer) message_end() // Replace back player id's with LANG_PLAYER for (i = 0; i < changedcount; i++) setarg(changed[i], 0, LANG_PLAYER) } } // Send to specific target else { // Format message for player vformat(buffer, charsmax(buffer), message, 3) // Send it message_begin(MSG_ONE, g_msgSayText, _, target) write_byte(target) write_string(buffer) message_end() } }
__________________
Last edited by ghost95v; 09-12-2014 at 12:08.
|
|