Raised This Month: $ Target: $400
 0% 

Bomb award rewritting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
miketyz
New Member
Join Date: Jun 2008
Old 06-27-2008 , 03:30   Bomb award rewritting
Reply With Quote #1

Hi all,

First of all, I would like to tell you that you are making a great job with amxx because the game would not have been the same without this plugin. Wish you best.

I have a problem with one of "my" script (I used a amx pluggin that I totally modify for amxx). Here is my script.

Code:
/*
* BombAwards  version 1.0        Date:30/05/2008
*
* Original version 0.1.3 made by Coolzsb
*
* Modified by MiKeTyZ (AMX Mod X 1.8, linux dedicated server)
*/


/*
* Description
*       This plugin basically give award to those who plant or defuse the bomb.
*       The terrorist can have health if they plant and money/frags if the bomb explosed.
*       The CT can have health/money/frags when they got the bomb defused.
*
* cvars:
*   bomb_awards                 < flags >               -- default is a
*       "a" - hp awards
*       "b" - frags awards
*       "c" - money awards
*   bombawards_hp               <hp to be award>        -- default is 50
*   bombawards_frags            <frags to be award>     -- default is 3
*   bombawards_money            <money to be award>     -- default is 500
*/

/*
* Changelog:
* 30/05/08 :
*       - Get the 0.1.3 version of the plugin
*       - Re-indent and re-organize the source
*       - Modify the information in the register plugin
*       - Change the cvars names
*       - Add a description of the plugin
*       - Delete useless global variables "realdefuser" and "realplanter"
*       - Modified the double frag award that terrorist received
*         for planted and explosed bombing
*       - Modify the cvars init and retrieving
* 02/06/08
*       - Delete the useless events
*/
#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN  "BombAward"
#define VERSION "1.0"
#define AUTHOR  "Coolzsb/MiKeTyZ"

new awardshp, awardsfrags, awardsmoney
new g_awardmode, g_awardshp, g_awardsfrags, g_awardsmoney

public plugin_init(){
        register_plugin(PLUGIN,VERSION,AUTHOR)

        g_awardmode     = register_cvar("bomb_awards","abc")
        g_awardshp      = register_cvar("bombawards_hp","50")
        g_awardsfrags   = register_cvar("bombawards_frags","3")
        g_awardsmoney   = register_cvar("bombawards_money","500")
}

// Get the configuration cvars values
public get_awardmode() {
        new awardmode[10]
        get_pcvar_string(g_awardmode,awardmode,10)

        awardshp=get_pcvar_num(g_awardshp)
        if ((awardshp<0 )||(awardshp>155)){
                awardshp=50
        }

        awardsfrags=get_pcvar_num(g_awardsfrags)
        if ((awardsfrags<0 )||(awardsfrags>5)){
                awardsfrags=3
        }

        awardsmoney=get_pcvar_num(g_awardsmoney)
        if ((awardsmoney<0)||(awardsmoney>2000)){
                awardsmoney=500
        }

        return read_flags(awardmode)
}

// Award if bomb is planted (health award only)
public bomb_planted( planter ){
        new awardmode = get_awardmode()

        if (awardmode&1){
                if (get_user_health(planter)<100){
                        set_user_health(planter,get_user_health(planter)+awardshp)
                }
                else{
                        set_user_health(planter,100 + awardshp)
                }
        }
}

// Award if bomb is defused (health, money and frag award)
public bomb_defused( defuser ){
        new awardmode = get_awardmode()

        if (awardmode&1){
                if (get_user_health(defuser)<100){
                        set_user_health(defuser,get_user_health(defuser)+awardshp)
                }
                else{
                        set_user_health(defuser,100+awardshp)
                }
                if (awardmode&2){
                        set_user_frags(defuser,get_user_frags(defuser)+awardsfrags)
                }
                if (awardmode&4){
                        if ((cs_get_user_money(defuser)+awardsmoney)<16000){
                                cs_set_user_money(defuser,cs_get_user_money(defuser)+awardsmoney)
                        }
                        else{
                                cs_set_user_money(defuser,16000)
                        }
                }
        }
}

// Award if bomb explosed (money and frag award)
public  bomb_explode ( planter, defuser ){
        new awardmode = get_awardmode()

        if (awardmode&2){
                set_user_frags(planter,get_user_frags(planter)+awardsfrags)
        }
        if (awardmode&4){
                if ((cs_get_user_money(planter)+awardsmoney)<16000){
                        cs_set_user_money(planter,cs_get_user_money(planter)+awardsmoney)
                }
                else{
                        cs_set_user_money(planter,16000)
                }
        }
}
My problem is that some time the award is given 2 times (I guess especially for the bomb planter when the bomb explosed but not sure)... For exemple, a bomb explose and the planter get 6 points whereas it should get 3. I am not sure the code is wrong but maybe I missed something.
miketyz is offline
DA
Veteran Member
Join Date: Nov 2005
Location: Germany/Münster
Old 06-27-2008 , 12:24   Re: Bomb award rewritting
Reply With Quote #2

Maybe you award for bomb planting and bomb explode?
__________________
DA 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 21:51.


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