Raised This Month: $51 Target: $400
 12% 

Zombie Escape V2: Shop (1.0.0 - 04.07.2014)


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 07-04-2014 , 06:15   Zombie Escape V2: Shop (1.0.0 - 04.07.2014)
Reply With Quote #1

Zombie Escape V2: Shop
- v1.0.0, last updated : 04.07.2014

Zombie Escape V2: Shop is an Addon for Zombie Escape V2 which adds a Item Shop for both Humans and Zombies.

Requirements
Example Sub-Plugin
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <hamsandwich>
#include <fun>
#include <zev2_core>
#include <zev2_shop>

#define PLUGIN "Zombie Escape V2: The Bloodthirster"
#define VERSION "1.0.0"
#define AUTHOR "Kia"

// ===============================================================================
//     Editing begins here
// ===============================================================================

// Amount in Percent how much Life Steal you gain
#define LIFE_STEAL_PERCENT 4.0

// ===============================================================================
//     and stops here. DO NOT MODIFY BELOW UNLESS YOU KNOW WHAT YOU'RE DOING
// ===============================================================================

// ===============================================================================
//     Variables
// ===============================================================================

/* Boolean */
new bool:g_bHasLifeSteal[33]

// ===============================================================================
//     plugin_init
// ===============================================================================

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
/* ZEV2 */
    
ZEV2_AddItem("The Bloodthirster"125"ZEV2_OnItemBuy"// 1 = Humans; 2 = Zombies
    
    /* Hamsandwich */
    
RegisterHam(Ham_TakeDamage"player""Ham_OnPlayerDamage")
}

// ===============================================================================
//     ZEV2_OnItemBuy
// ===============================================================================

public ZEV2_OnItemBuy(idg_bHasLifeSteal[id] = true 

// ===============================================================================
//     ZEV2_OnHumanInfected
// ===============================================================================

public ZEV2_OnHumanInfected(idg_bHasLifeSteal[id] = false

// ===============================================================================
//     ZEV2_OnZombieWin
// ===============================================================================

public ZEV2_OnZombieWin() arrayset(g_bHasLifeSteal0charsmax(g_bHasLifeSteal))

// ===============================================================================
//     ZEV2_OnHumanWin
// ===============================================================================

public ZEV2_OnHumanWin() arrayset(g_bHasLifeSteal0charsmax(g_bHasLifeSteal))

// ===============================================================================
//     Ham_OnPlayerDamage
// ===============================================================================

public Ham_OnPlayerDamage(iVictimiInflictoriAttackerFloat:fDamageiDamageBits)
{
    if(
iInflictor == iAttacker && is_user_alive(iAttacker) && g_bHasLifeSteal[iAttacker])
        
set_user_health(iAttackerfloatround(get_user_health(iAttacker) + (fDamage 100) * LIFE_STEAL_PERCENT))


Changelog
Quote:
Originally Posted by Version 1.0.0
  • Initial Release.
Attached Files
File Type: sma Get Plugin or Get Source (zombie_escape_v2_shop.sma - 1834 views - 4.6 KB)
File Type: inc zev2_shop.inc (361 Bytes, 742 views)
__________________

Last edited by Kia; 07-04-2014 at 12:04.
Kia is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 07-04-2014 , 06:16   Re: Zombie Escape V2: Shop (1.0.0 - 04.07.2014)
Reply With Quote #2

- Reserved -
__________________
Kia is offline
ArabicMan
Veteran Member
Join Date: Feb 2014
Location: مصر
Old 07-04-2014 , 07:33   Re: Zombie Escape V2: Shop (1.0.0 - 04.07.2014)
Reply With Quote #3

Great job .
ArabicMan is offline
ReD MaN
Member
Join Date: Jun 2014
Location: i dont Know --'
Old 07-04-2014 , 13:37   Re: Zombie Escape V2: Shop (1.0.0 - 04.07.2014)
Reply With Quote #4

Good
__________________
Forum logo : No Steam = No Support

Last edited by ReD MaN; 07-04-2014 at 13:37.
ReD MaN is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-05-2014 , 11:28   Re: Zombie Escape V2: Shop (1.0.0 - 04.07.2014)
Reply With Quote #5

https://mxr.alliedmods.net/amxmodx/s...xmodx.cpp#4696
If you check the link up above, you could see that arrayset loops through a given array as:
PHP Code:
for (int i=0i<sizei++)
{
       
addr[i] = value;

which means that
PHP Code:
arrayset(g_bHasLifeSteal0charsmax(g_bHasLifeSteal)) 
should be
PHP Code:
arrayset(g_bHasLifeSteal0sizeof(g_bHasLifeSteal)) 
By the way, great plugin.
klippy is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-05-2014 , 12:26   Re: Zombie Escape V2: Shop (1.0.0 - 04.07.2014)
Reply With Quote #6

@KliPPy:

PHP Code:
arrayset(g_bHasLifeSteal0sizeof(g_bHasLifeSteal)) 
sizeof is a preprocessor macro so you shoud not use it like sizeof ( string ), it should be sizeof string.

Last edited by HamletEagle; 07-05-2014 at 12:27.
HamletEagle is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-05-2014 , 13:20   Re: Zombie Escape V2: Shop (1.0.0 - 04.07.2014)
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
@KliPPy:

PHP Code:
arrayset(g_bHasLifeSteal0sizeof(g_bHasLifeSteal)) 
sizeof is a preprocessor macro so you shoud not use it like sizeof ( string ), it should be sizeof string.
I know exactly that sizeof is not a function, but that is just my preferred coding style - writing sizeof as it is a function, because there is nothing wrong about it.
klippy is offline
Eagle07
Veteran Member
Join Date: May 2014
Location: Morocco :D
Old 07-06-2014 , 18:35   Re: Zombie Escape V2: Shop (1.0.0 - 04.07.2014)
Reply With Quote #8

Good Job
__________________
Eagle07 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:35.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode