AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   HideNSeek XP Mod v0.0.1 (v0.0.3 in beta with v0.0.4 in progress) (https://forums.alliedmods.net/showthread.php?t=110031)

Exolent[jNr] 11-24-2009 00:45

HideNSeek XP Mod v0.0.1 (v0.0.3 in beta with v0.0.4 in progress)
 
1 Attachment(s)
HideNSeek XP Mod
Version 0.0.1
by Exolent


BETA VERSION

Introduction:

This mod is a an extension to any HideNSeek gameplay.
Players gain experience by playing on the server.
The players then can use that experience to buy levels for special upgrades (listed later).
The higher level of the upgrade, the more powerful, or useful it becomes.
Your experience points are a combined total from your overall gameplay.
However, the levels you buy with those points are only contributed to the specific team you are on.
You can buy Level 5 on Terrorist, but still be Level 1 on Counter-Terrorist.
The XP points required to buy each level is calculated with this easy system:
- If first level, use the first set amount of XP points required from the plugin.
- Otherwise, the XP points required is twice the amount of points from the last level.


Terrorist Upgrades:
  • Grenade Chance
    - Every time the round starts, you will have a chance to receive your grenade.
    - The higher the level, the higher the chance of you getting the grenade.
  • Flashbang #1 Chance
    - Every time the round starts, you will have a chance to receive your first flashbang.
    - The higher the level, the higher the chance of you getting the flashbang.
  • Flashbang #2 Chance
    - Every time the round starts, you will have a chance to receive your second flashbang.
    - The higher the level, the higher the chance of you getting the flashbang.
    - The only difference between this and the first is that they are different upgrades.
    - You can upgrade #1 to be maximum level and have this one still at Level 1.
  • Smoke Grenade Chance
    - Every time the round starts, you will have a chance to receive your smoke grenade.
    - The higher the level, the higher the chance of you getting the smoke grenade.


Both Team Upgrades:
  • Extra Health
    - Every time you spawn, you will be given an additional set of health depending on your level.
    - The higher the level, the more health you get.
  • Armor
    - Every time you spawn, you will be given a set amount of armor depending on your level.
    - The higher the level, the more armor you get.
  • Respawn Chance
    - Every time you die and still have a teammate alive, you will be given the chance to respawn.
    - The higher the level, the higher the chance of you respawning.
    - You can only respawn once per round.
  • Fall Damage Reducer
    - Every time you take damage from falling down, the damage will be reduced according to your level.
    - The higher the level, the less fall damage you take.


Client Commands:
  • say /xp OR say /exp
    - Brings up the XP Menu.
    - In that menu, you can see your current XP points, see a help screen for how this mod works, open a menu designated for each upgrade, or see the levels of other players in the server.
    - In each upgrade-specific menu, you can choose a help screen to understand what the upgrade does, or choose to upgrade your level.


Admin Commands:
  • hnsxp_give_xp <nick, #userid, authid> <xp>
    - Gives <xp> amount to <player>.
    - <xp> must be greater than 0.
    - Cannot use on bots, immunity players, or yourself.
    - Requires admin flag L (RCON).
  • hnsxp_remove_xp <nick, #userid, authid> <xp>
    - Takes away <xp> amount from <player>.
    - <xp> must be greater than 0.
    - Cannot use on bots, immunity players, or yourself.
    - Requires admin flag L (RCON).


Cvars:
  • hnsxp_xp_suicide <xp>
    - The amount of xp subtracted from a player if the player suicides.
    - Default: 5
  • hnsxp_xp_kill <xp>
    - The amount of xp given to a player when the player kills someone.
    - Default: 4
  • hnsxp_xp_headshot <xp>
    - The amount of xp added to the kill xp if the kill was a headshot.
    - Default: 3
  • hnsxp_xp_grenade <xp>
    - The amount of xp added to the kill xp if the kill was from a grenade.
    - Default: 6
  • hnsxp_xp_survive <xp>
    - The amount of xp given to the player if the player is a terrorist and is alive when the round ends.
    - Default: 2
  • hnsxp_xp_win <xp>
    - The amount of xp given to all players on the team that wins the round.
    - Default: 3
  • hnsxp_spawn_nade_delay <seconds>
    - The delay from the start of the round when the player receives nades.
    - This is the same as the countdown of the hide timer in HideNSeek, so the player gets the nades when the timer hits 0.
    - Change it to 0 to give the nades instantly on player spawn/round start.
    - Default: 10


Plugin Configurations:

Open the .sma file, and edit these values:
Code:

// =================================================
// BEGIN EDITING HERE
// =================================================

// Should the plugin save player data in SQL database?
// To save player data in a vault, change "#define USING_SQL" to "//#define USING_SQL"
// To save player data in SQL, change "//#define USING_SQL" to "#define USING_SQL"

//#define USING_SQL

// The prefix in all of the plugin's messages

new const MESSAGE_TAG[] =                "[HNS XP]";

// If the player hasn't ever been to your server, they will get this much xp to start with

#define ENTRY_XP                        100

// These determine if these abilities should be enabled or disabled
// 1 = enabled
// 0 = disabled

#define ENABLE_GRENADE                        1
#define ENABLE_FLASHBANG_1                1
#define ENABLE_FLASHBANG_2                1
#define ENABLE_SMOKEGRENADE                1
#define ENABLE_TERR_HEALTH                1
#define ENABLE_CT_HEALTH                1
#define ENABLE_TERR_ARMOR                1
#define ENABLE_CT_ARMOR                        1
#define ENABLE_TERR_RESPAWN                1
#define ENABLE_CT_RESPAWN                1
#define ENABLE_TERR_NOFALL                1
#define ENABLE_CT_NOFALL                1

// The maximum level for each ability

#define MAXLEVEL_GRENADE                8
#define MAXLEVEL_FLASHBANG_1                4
#define MAXLEVEL_FLASHBANG_2                4
#define MAXLEVEL_SMOKEGRENADE                4
#define MAXLEVEL_TERR_HEALTH                10
#define MAXLEVEL_CT_HEALTH                5
#define MAXLEVEL_TERR_ARMOR                8
#define MAXLEVEL_CT_ARMOR                6
#define MAXLEVEL_TERR_RESPAWN                2
#define MAXLEVEL_CT_RESPAWN                2
#define MAXLEVEL_TERR_NOFALL                8
#define MAXLEVEL_CT_NOFALL                8

// The xp amount required to buy the first level

#define FIRST_XP_GRENADE                100
#define FIRST_XP_FLASHBANG_1                100
#define FIRST_XP_FLASHBANG_2                100
#define FIRST_XP_SMOKEGRENADE                100
#define FIRST_XP_TERR_HEALTH                100
#define FIRST_XP_CT_HEALTH                100
#define FIRST_XP_TERR_ARMOR                100
#define FIRST_XP_CT_ARMOR                100
#define FIRST_XP_TERR_RESPAWN                1000
#define FIRST_XP_CT_RESPAWN                2000
#define FIRST_XP_TERR_NOFALL                100
#define FIRST_XP_CT_NOFALL                100

// The maximum chance possible for this ability (happens when player has maximum level)

#define CHANCE_MAX_GRENADE                100
#define CHANCE_MAX_FLASHBANG_1                100
#define CHANCE_MAX_FLASHBANG_2                100
#define CHANCE_MAX_SMOKEGRENADE                100
#define CHANCE_MAX_TERR_RESPAWN                50
#define CHANCE_MAX_CT_RESPAWN                50
#define CHANCE_MAX_TERR_NOFALL                80
#define CHANCE_MAX_CT_NOFALL                80

// =================================================
// STOP EDITING HERE
// =================================================

When you are done, save the .sma and compile it here:
http://www.amxmodx.org/webcompiler.cgi
If you are getting compiler errors that don't make sense or the site is slow, you can use this one:
http://webcomp.ak-team.com/


Plugin Requirements:
  • Steam
  • AMX Mod X 1.8.0 or higher
    If you are having problems, please use the latest version of AMXX
  • CStrike Addon
  • HamSandwich Module
  • Fun Module
  • RegEx Module
  • If using SQL:
    - SQLx Module
    If not using SQL:
    - NVault Module


Plugin API:

This plugin contains natives to allow other plugins to communicate with it.
Code:

/*
 * Returns a players XP points
 *
 * @param                client - The player index to get points of
 *
 * @return                The XP points of client
 *
 */

native hnsxp_get_user_xp(client);

/*
 * Sets <xp> points to client
 *
 * @param                client - The player index to set points to
 * @param                xp - The amount of XP points to set to client
 *
 * @return                The XP points of client
 *
 */

native hnsxp_set_user_xp(client, xp);

/*
 * Adds <xp> points to client
 *
 * @param                client - The player index to add points to
 * @param                xp - The amount of XP points to add to client
 *
 * @return                The XP points of client
 *
 */

stock hnsxp_add_user_xp(client, xp)
{
        return hnsxp_set_user_xp(client, hnsxp_get_user_xp(client) + xp);
}

/*
 * Subtracts <xp> points from client
 *
 * @param                client - The player index to subtract points from
 * @param                xp - The amount of XP points to subtract from client
 *
 * @return                The XP points of client
 *
 */

stock hnsxp_sub_user_xp(client, xp)
{
        return hnsxp_set_user_xp(client, hnsxp_get_user_xp(client) - xp);
}

Add that code to the top of your code and make sure your plugin is underneath the XP plugin in the plugins.ini


Changelog:

Version 0.0.1
  • Initial Release


Notes:

Please post all suggestions, comments, or improvements you may have.
Do not say anything about Non-Steam support because you will be ignored.

DarkSkif 11-24-2009 01:50

Re: HideNSeek XP Mod by Exolent
 
Nice :)

KadiR 11-24-2009 03:57

Re: HideNSeek XP Mod by Exolent
 
Nice, testing it when I getting home :)

tuty 11-24-2009 04:00

Re: HideNSeek XP Mod by Exolent
 
sweet plugin

Arkshine 11-24-2009 05:27

Re: HideNSeek XP Mod by Exolent
 
Why do you use nvault when you could use sqlite with the same code than mysql ; just changing the drivers affinity.

Javivi 11-24-2009 12:28

Re: HideNSeek XP Mod by Exolent
 
Job Good :p

xPaw 11-24-2009 12:33

Re: HideNSeek XP Mod by Exolent
 
g_armor_enabled[CsTeams+(CsTeams:1)]

wtf?

Exolent[jNr] 11-24-2009 12:43

Re: HideNSeek XP Mod by Exolent
 
Quote:

Originally Posted by Arkshine (Post 997752)
Why do you use nvault when you could use sqlite with the same code than mysql ; just changing the drivers affinity.

Didn't think about doing that, since I never have used sqlite.
So, I should do this:
Code:
// plugin_init( ) #if defined USING_SQL SQL_SetAffinity( "sqlx" ); #else SQL_SetAffinity( "sqlite" ); #endif

Quote:

Originally Posted by xPaw (Post 997792)
g_armor_enabled[CsTeams+(CsTeams:1)]

wtf?

Oops. That was on an older version that I forgot to delete. :mrgreen:

Javivi 11-24-2009 12:45

Re: HideNSeek XP Mod by Exolent
 
Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Warning: Indeterminate array size in "sizeof" expression (symbol "") on line 1917
Warning: Indeterminate array size in "sizeof" expression (symbol "") on line 1923
Warning: Indeterminate array size in "sizeof" expression (symbol "") on line 1929
Warning: Indeterminate array size in "sizeof" expression (symbol "") on line 1935
Warning: Indeterminate array size in "sizeof" expression (symbol "") on line 1941
Warning: Indeterminate array size in "sizeof" expression (symbol "") on line 1947
Header size:          2624 bytes
Code size:            63868 bytes
Data size:          114812 bytes
Stack/heap size:      16384 bytes; max. usage is unknown, due to recursion
Total requirements:  197688 bytes

6 Warnings.
Done.


Exolent[jNr] 11-24-2009 12:49

Re: HideNSeek XP Mod by Exolent
 
Compiles fine for me.

EDIT:

I see what it was. Fixed.


All times are GMT -4. The time now is 14:25.

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