Raised This Month: $ Target: $400
 0% 

Subplugin Submission [ZP50] Addon: Player Level Upgrades.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 04-15-2015 , 15:18   [ZP50] Addon: Player Level Upgrades.
Reply With Quote #1

Descriptions:
This plugin upgrades human: health, armor, speed, gravity, attacker power, starter ammopacks and gear up base on current player level.

Modules:
#include <hamsandwich>
#include <cstrike>
#include <engine>
#include <fun>

Requirement:
Stats, Level, Ranking API.

Cvars:
xp_level_health -- upgrade health.
xp_level_armor -- upgrade armor.
xp_level_speed -- upgrade speed.
xp_level_gravity -- upgrade gravity.
xp_level_damage -- upgrade attack power (this cvar update once on new round).
xp_level_pack -- upgrade starter ammopacks.
xp_level_item -- upgrade gear up.

Credits:
SergiCruz -- original plugin.

Changes Log:
Spoiler
Attached Files
File Type: sma Get Plugin or Get Source (zp_addon_level.sma - 1554 views - 6.2 KB)
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019

Last edited by yokomo; 04-15-2015 at 15:19.
yokomo is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 04-15-2015 , 22:51   Re: [ZP50] Addon: Player Level Upgrades.
Reply With Quote #2

GJ, should cache because it call too often in Ham_TakeDamage forward. Really? why? then its advisable to update the attack power in new round?

Last edited by wicho; 04-16-2015 at 01:00.
wicho is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 04-16-2015 , 02:59   Re: [ZP50] Addon: Player Level Upgrades.
Reply With Quote #3

Quote:
Originally Posted by wicho View Post
GJ, should cache because it call too often in Ham_TakeDamage forward. Really? why? then its advisable to update the attack power in new round?
Read the code and you will understand, the cvar is to control whether damage upgrade is enable/disable. Not for it attack power value.

Imagine 31 players attack 1 zombie with rifle at once, in this situation the Ham_TakeDamage will be call too often. That's why need to cache to prevent calling get_pcvar_num native.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 04-18-2015 , 13:41   Re: [ZP50] Addon: Player Level Upgrades.
Reply With Quote #4

very nice
you should make one system for zombies too, like zombie level and human level

Last edited by Depresie; 04-18-2015 at 13:41.
Depresie is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 04-18-2015 , 14:27   Re: [ZP50] Addon: Player Level Upgrades.
Reply With Quote #5

Quote:
Originally Posted by Depresie View Post
very nice
you should make one system for zombies too, like zombie level and human level
Since you already know about amxx and pawn i think you can code your own plugin. I've made some zombie classes using this API and it has HP, gravity and speed upgrades too. You can use my plugin as a base code.

See https://forums.alliedmods.net/showpo...7&postcount=22
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 04-18-2015 , 19:58   Re: [ZP50] Addon: Player Level Upgrades.
Reply With Quote #6

will give it a try next week maybe if i'll have time im kind of busy right now fixing some gameplay issues for my server
Depresie is offline
Fresh522
Member
Join Date: Mar 2015
Location: Bulgaria
Old 04-19-2015 , 15:55   Re: [ZP50] Addon: Player Level Upgrades.
Reply With Quote #7

Only for ZP 5.0 . I want it for ZP 4.3 but its really nice plugin
Fresh522 is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 04-20-2015 , 19:02   Re: [ZP50] Addon: Player Level Upgrades.
Reply With Quote #8

For zp 4.3, try

Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#include <fun>

#include <zombieplague>
#include <zpexpmod>

#define PLUGIN "ZP Player Level"
#define VERSION "0.0.1"
#define AUTHOR "wbyokomo"

#define MAX_LEVEL 20
#define TASK_ITEM 20174

new Float:PlayerHealth[MAX_LEVEL] =
{
    100.0, // 0
    105.0, // 1
    110.0, // 2
    115.0, // 3
    120.0, // 4
    125.0, // 5
    130.0, // 6
    135.0, // 7
    140.0, // 8
    145.0, // 9
    150.0, // 10
    160.0, // 11
    170.0, // 12
    180.0, // 13
    190.0, // 14
    200.0, // 15
    210.0, // 16
    220.0, // 17
    230.0, // 18
    240.0 // 19
}

new Float:PlayerArmor[MAX_LEVEL] =
{
    0.0, // 0
    0.0, // 1
    0.0, // 2
    0.0, // 3
    0.0, // 4
    0.0, // 5
    0.0, // 6
    15.0, // 7
    15.0, // 8
    25.0, // 9
    25.0, // 10
    50.0, // 11
    50.0, // 12
    50.0, // 13
    50.0, // 14
    75.0, // 15
    75.0, // 16
    100.0, // 17
    100.0, // 18
    100.0 // 19
}

new Float:PlayerSpeed[MAX_LEVEL] =
{
    240.0, // 0
    240.0, // 1
    240.0, // 2
    240.0, // 3
    245.0, // 4
    245.0, // 5
    245.0, // 6
    245.0, // 7
    250.0, // 8
    255.0, // 9
    260.0, // 10
    265.0, // 11
    270.0, // 12
    275.0, // 13
    280.0, // 14
    285.0, // 15
    290.0, // 16
    295.0, // 17
    300.0, // 18
    300.0 // 19
}

new Float:PlayerGravity[MAX_LEVEL] =
{
    1.0, // 0
    1.0, // 1
    1.0, // 2
    1.0, // 3
    0.95, // 4
    0.95, // 5
    0.9, // 6
    0.9, // 7
    0.9, // 8
    0.85, // 9
    0.8, // 10
    0.75, // 11
    0.7, // 12
    0.65, // 13
    0.6, // 14
    0.6, // 15
    0.55, // 16
    0.5, // 17
    0.5, // 18
    0.5 // 19
}

new Float:PlayerDamage[MAX_LEVEL] =
{
    1.0, // 0
    1.0, // 1
    1.0, // 2
    1.0, // 3
    1.0, // 4
    1.1, // 5
    1.1, // 6
    1.1, // 7
    1.1, // 8
    1.1, // 9
    1.2, // 10
    1.2, // 11
    1.2, // 12
    1.2, // 13
    1.2, // 14
    1.3, // 15
    1.3, // 16
    1.3, // 17
    1.4, // 18
    1.4 // 19
}

new PlayerPacks[MAX_LEVEL] =
{
    0, // 0
    0, // 1
    0, // 2
    0, // 3
    5, // 4
    5, // 5
    5, // 6
    10, // 7
    10, // 8
    10, // 9
    15, // 10
    15, // 11
    20, // 12
    20, // 13
    20, // 14
    25, // 15
    25, // 16
    30, // 17
    30, // 18
    30 // 19
}

new CvarHealth, CvarArmor, CvarSpeed, CvarGravity, CvarDamage, CvarPack, CvarItem
new cDamage
new iMaxClients, bool:bIsConnected[33], iLevel[33]
#define IsPlayerConnected(%0) (1<=%0<=iMaxClients && bIsConnected[%0])

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    iMaxClients = get_maxplayers()
    CvarHealth = register_cvar("xp_level_health", "1")
    CvarArmor = register_cvar("xp_level_armor", "1")
    CvarSpeed = register_cvar("xp_level_speed", "1")
    CvarGravity = register_cvar("xp_level_gravity", "1")
    CvarDamage = register_cvar("xp_level_damage", "1")
    CvarPack = register_cvar("xp_level_pack", "1")
    CvarItem = register_cvar("xp_level_item", "1")
    
    register_event("HLTV", "OnNewRound", "a", "1=0", "2=0")
    RegisterHam(Ham_TakeDamage, "player", "OnPlayerTakeDamage")
}

public OnNewRound()
{
    cDamage = get_pcvar_num(CvarDamage) //should cache because it call too often in 'Ham_TakeDamage' forward.
}

public client_putinserver(id)
{
    bIsConnected[id] = true
}

public client_disconnect(id)
{
    bIsConnected[id] = false
    remove_task(id+TASK_ITEM)
}

public xp_user_login(id, level, exp)
{
    iLevel[id] = level
    if(get_pcvar_num(CvarPack)) zp_set_user_ammopacks(id, zp_get_user_ammopacks(id)+PlayerPacks[level]); //give free ammopacks once player join the server.
}

public xp_user_levelup(id, level, exp)
{
    iLevel[id] = level
}

public zp_user_humanized_post(id)
{
    if(!zp_get_user_survivor(id)) SetPlayerPower(id);
}

public OnPlayerTakeDamage(victim, inflictor, attacker, Float:damage, damagetype)
{
    if(!cDamage) return HAM_IGNORED;
    if(victim == attacker) return HAM_IGNORED;
    if(!(damagetype & DMG_BULLET)) return HAM_IGNORED;
    if(!IsPlayerConnected(attacker)) return HAM_IGNORED;
    
    if(zp_get_user_zombie(victim) && !zp_get_user_zombie(attacker))
    {
        damage *= PlayerDamage[iLevel[attacker]]
        SetHamParamFloat(4, damage)
        return HAM_IGNORED;
    }
    
    return HAM_IGNORED;
}

SetPlayerPower(id)
{
    new cLevel = iLevel[id]
    
    if(get_pcvar_num(CvarHealth))
    {
        if(entity_get_float(id, EV_FL_health) < PlayerHealth[cLevel]) entity_set_float(id, EV_FL_health, PlayerHealth[cLevel]);
    }
    
    if(get_pcvar_num(CvarArmor))
    {
        if(entity_get_float(id, EV_FL_armorvalue) < PlayerArmor[cLevel]) entity_set_float(id, EV_FL_armorvalue, PlayerArmor[cLevel]);
    }
    
    if(get_pcvar_num(CvarSpeed))
    {
        set_user_maxspeed(id, PlayerSpeed[cLevel], false)
    }
    
    if(get_pcvar_num(CvarGravity))
    {
        entity_set_float(id, EV_FL_gravity, PlayerGravity[cLevel])
    }
    
    if(get_pcvar_num(CvarItem))
    {
        if(cLevel >= 8)
        {
            remove_task(id+TASK_ITEM)
            set_task(1.0, "TaskGiveItem", id+TASK_ITEM)
        }
    }
}

public TaskGiveItem(id)
{
    id-=TASK_ITEM
    if(!is_user_alive(id) || zp_get_user_zombie(id)) return; //recheck
    
    switch(iLevel[id])
    {
        case 8..13:
        {
            if(user_has_weapon(id, CSW_HEGRENADE)) cs_set_user_bpammo(id, CSW_HEGRENADE, cs_get_user_bpammo(id, CSW_HEGRENADE)+1);
            else give_item(id, "weapon_hegrenade");
        }
        case 14..16:
        {
            if(user_has_weapon(id, CSW_HEGRENADE)) cs_set_user_bpammo(id, CSW_HEGRENADE, cs_get_user_bpammo(id, CSW_HEGRENADE)+2);
            else give_item(id, "weapon_hegrenade");
            
            if(user_has_weapon(id, CSW_FLASHBANG)) cs_set_user_bpammo(id, CSW_FLASHBANG, cs_get_user_bpammo(id, CSW_FLASHBANG)+2);
            else give_item(id, "weapon_flashbang");
        }
        case 17..19:
        {
            if(user_has_weapon(id, CSW_HEGRENADE)) cs_set_user_bpammo(id, CSW_HEGRENADE, cs_get_user_bpammo(id, CSW_HEGRENADE)+3);
            else give_item(id, "weapon_hegrenade");
            
            if(user_has_weapon(id, CSW_FLASHBANG)) cs_set_user_bpammo(id, CSW_FLASHBANG, cs_get_user_bpammo(id, CSW_FLASHBANG)+3);
            else give_item(id, "weapon_flashbang");
            
            if(user_has_weapon(id, CSW_SMOKEGRENADE)) cs_set_user_bpammo(id, CSW_SMOKEGRENADE, cs_get_user_bpammo(id, CSW_SMOKEGRENADE)+3);
            else give_item(id, "weapon_smokegrenade");
        }
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Depresie is offline
Reply


Thread Tools
Display Modes

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 14:45.


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