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

[Hosties] DrugShop for JailBreak


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Jasonbourne
Senior Member
Join Date: Nov 2011
Location: Sydney , AUS
Plugin ID:
4498
Plugin Version:
1.0.5
Plugin Category:
Fun Stuff
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Terrorists accumulate cash by winning rounds and can buy one of 5 drugs when they reach $16000. 10 drugs of a certain type can be redeemed for a pistol. The pistol given is determined by which drug is being redeemed.
    Old 01-22-2015 , 06:31   [Hosties] DrugShop for JailBreak
    Reply With Quote #1

    DrugShop for JailBreak


    /* Introduction */
    Terrorists accumulate cash by winning rounds and can buy one of 5 drugs when they reach $16000.
    10 drugs of a certain type can be redeemed for a pistol. The pistol given is determined by which drug is being redeemed.

    /* Modules */
    [DrugShop] Confiscate
    If a CT sees a T buying or selling drugs then they will confiscate those drugs and it will be added to their drug totals.
    Where multiple CT's can see the drug trade, only the closest will confiscate the drugs.
    To activate this module, move ds_confiscate.smx to your plugin folder.

    /* Setup */
    Add one of the following to your databases.cfg in /addons/sourcemod/config/
    PHP Code:
    If you have a MySQL database:
    "drugshop"
    {
        
    "driver"                        "mysql"
        "host"                          "<your-database-host>"
        "database"                      "<your-database-name>"
        "user"                          "<username>"
        "pass"                          "<password>"
    }

    If 
    you dont have a MySQL database (it will host a SQLite db on your gameserver):
    "drugshop"
    {
        
    "driver"                        "sqlite"
        "host"                          "localhost"
        "database"                      "drugshop"
        "user"                          "root"
        "pass"                          ""

    The plugin will automatically create the necessary tables.

    Drag and drop drugshop.smx to your plugins directory: /addons/sourcemod/plugins/

    Drag and drop drugshop.phrases.txt to your translations directory: /addons/sourcemod/translations/

    /* Commands */
    PHP Code:
    say !drugshop in chat to open the menu 
    /* Global Forwards */
    PHP Code:
    /**
     * Called after a drug purchase is made.
     *
     * @param auth               Full steam ID of client making purchase.
     * @param drug_name          Name of the drug being purchased.
     * @param drug               ID of the drug being purchased.
     * @param num_drugs          Number of drugs purchased.
     */ 
    forward OnDrugBuy(const String:auth[], const String:drug_name[], drugnum_drugs);

    /**
     * Called after a drug is sold.
     *
     * @param auth               Full steam ID of client making purchase.
     * @param drug_name          Name of the drug being purchased.
     * @param drug               ID of the drug being purchased.
     * @param num_drugs          Number of drugs sold.
     */ 
    forward OnDrugSell(const String:auth[], const String:drug_name[], drugnum_drugs);

    /**
     * Called when drugs per pistol is changed.
     *
     * @param num_drugs          Number of drugs it costs to buy a pistol.
     */ 
    forward OnDrugsPerPistolChanged(num_drugs);

    /**
     * Called when cost per drug is changed.
     *
     * @param cost               Cost to purchase a Drug.
     */ 
    forward OnCostPerDrugChanged(cost);

    /**
     * Called when a Weapon name is changed.
     *
     * @param weapon_name        New Weapon name.
     * @param weapon_id          Weapon ID.
     */ 
    forward OnWeaponNameChanged(const String:weapon_name[], weapon_id);

    /**
     * Called when a Drug name is changed.
     *
     * @param drug_name          New Drug name.
     * @param drug               Drug ID.
     */ 
    forward OnDrugNameChanged(const String:drug_name[], drug); 
    /* Natives */
    PHP Code:
    /**
     * Add (or remove by specifying -ve num_drugs) drugs to/from a player.
     *
     * @param auth               Full steam id of client making purchase.
     * @param drug               Name of the drug being purchased.
     * @param num_drugs          Number of drugs purchased.
     * @noreturn
     */ 
    native DrugShop_AddDrugs(const String:auth[], drugnum_drugs);

    /**
     * Gets the name of a drug for a specified index.
     *
     * @param drug_name          Name of the drug.
     * @param drug               Drug index between 0 & 4.
     * @param drug               Max length of name string.
     * @return                   true on success.
     */ 
    native DrugShop_GetDrugName(const String:drug_name[], drugmax_size);

    /**
     * Gets the name of a weapon for a specified index.
     *
     * @param weapon_name        Name of the weapon. (pass in empty string atleast size 32)
     * @param weapon             Weapon index between 0 & 4.
     * @param drug               Max length of name string.
     * @return                   True on success.
     */ 
    native DrugShop_GetWeaponName(const String:weapon_name[], weaponmax_size);

    /**
     * Gets the ID of a drug for a specified drug name.
     *
     * @param drug_name          Name of the drug.
     * @return                   Drug index number on success or -1 if name not found.
     */ 
    native DrugShop_GetDrugID(const String:drug_name[]);

    /**
     * Gets the ID of a weapon for a specified weapon name.
     *
     * @param weapon_name        Name of the weapon.
     * @return                   Weapon index number on success or -1 if name not found.
     */ 
    native DrugShop_GetWeaponID(const String:weapon_name[]);

    /**
     * Gets the number of drugs required to be traded for a pistol.
     *
     * @return                   Number of drugs_per_pitol required to be traded for a pistol.
     */ 
    native DrugShop_GetDrugsPerPistol();

    /**
     * Gets the cost per drug.
     *
     * @return                   Cost of each drug purchase.
     */ 
    native DrugShop_GetCostPerDrug();

    /**
     * Sets the number of drugs required to be traded for a pistol.
     *
     * @param num_drugs          Amount of drugs required to trade for a pistol. (must be > 0)
     * @return                   True on success.
     */ 
    native DrugShop_SetDrugsPerPistol(num_drugs);

    /**
     * Sets the cost per drug.
     *
     * @param cost               Cost per drug. (must be > 0)
     * @return                   True on success.
     */ 
    native DrugShop_SetCostPerDrug(cost);

    /**
     * Sets the name of a drug for a specified index.
     *
     * @param drug_name          Name of the drug.
     * @param drug               Drug index between 0 & 4.
     * @return                   true on success.
     */ 
    native DrugShop_SetDrugName(const String:drug_name[], drug);

    /**
     * Sets the name of a weapon for a specified index.
     *
     * @param weapon_name        Name of the weapon.
     * @param weapon             Weapon index between 0 & 4.
     * @return                   True on success.
     */ 
    native DrugShop_SetWeaponName(const String:weapon_name[], weapon);

    /**
     * Sets the number of a given drug for a user.
     *
     * @param auth               Steam ID of the user to modify.
     * @param drug               Drug index between 0 & 4.
     * @param num_drugs          Number of drugs to set.
     * @return                   True on success.
     */ 
    native DrugShop_SetNumDrugs(const String:auth[], drugnum_drugs);

    /**
     * Gets the number of a given drug for a user.
     *
     * @param auth               Steam ID of the user to modify.
     * @param drug               Drug index between 0 & 4.
     * @return                   Number of Drugs.
     */ 
    native DrugShop_GetNumDrugs(const String:auth[], drug);

    /**
     * Checks if a given steam ID is in the database
     *
     * @param auth               Steam ID of the user to modify.
     * @return                   True if exists else False.
     */ 
    native bool:DrugShop_CheckUserExists(const String:auth[]);

    /**
     * Insert new user into the datbase
     *
     * @param auth               Steam ID of the user to modify.
     * @noreturn                   
     */ 
    native DrugShop_AddNewUser(const String:auth[]); 
    /* Changelog */
    PHP Code:
    v1.0.5 Added ds_confiscate addon
    v1.0.4 Added even more natives
    v1.0.3 Added translations 
    and fixed some formatting
    v1.0.2 Added Forwards
    v1.0.1 Added a heap of Natives 
    test code
    v1.0.0 Initial Release 
    /* To Do */
    PHP Code:
    No features requested :( 
    Attached Files
    File Type: smx drugshop.smx (17.9 KB, 457 views)
    File Type: sp Get Plugin or Get Source (drugshop.sp - 396 views - 21.2 KB)
    File Type: txt drugshop.phrases.txt (735 Bytes, 515 views)
    File Type: smx ds_confiscate.smx (12.9 KB, 471 views)
    File Type: sp Get Plugin or Get Source (ds_confiscate.sp - 359 views - 5.4 KB)
    File Type: inc drugshop.inc (6.0 KB, 436 views)

    Last edited by Jasonbourne; 01-29-2015 at 00:18.
    Jasonbourne is offline
    Jasonbourne
    Senior Member
    Join Date: Nov 2011
    Location: Sydney , AUS
    Old 01-22-2015 , 06:42   Re: [Hosties] DrugShop
    Reply With Quote #2

    Reserved
    Jasonbourne is offline
    shadowdragon
    Senior Member
    Join Date: Dec 2012
    Old 01-22-2015 , 08:14   Re: [Hosties] DrugShop
    Reply With Quote #3

    Well done, looks like some fun.
    __________________
    Sorry for my poor English!
    ________________________________
    I can do CSS/CSGO plugin request for little money!
    shadowdragon is offline
    Mitchell
    ~lick~
    Join Date: Mar 2010
    Old 01-22-2015 , 09:41   Re: [Hosties] DrugShop
    Reply With Quote #4

    if you're going to store information in MySQL save the information in a variable, then only send the information to a sql database at mapend, or round_end.
    Mitchell is offline
    Jasonbourne
    Senior Member
    Join Date: Nov 2011
    Location: Sydney , AUS
    Old 01-22-2015 , 18:36   Re: [Hosties] DrugShop
    Reply With Quote #5

    Update v1.0.1 - Added Natives and Test code
    Update v1.0.2 - Added Forwards
    Update v1.0.3 - Added Translations

    Last edited by Jasonbourne; 01-23-2015 at 06:10.
    Jasonbourne is offline
    Jasonbourne
    Senior Member
    Join Date: Nov 2011
    Location: Sydney , AUS
    Old 01-24-2015 , 04:36   Re: [Hosties] DrugShop for JailBreak
    Reply With Quote #6

    Update v1.0.4 Added 4 more Natives and fixed a whole heap of formatting

    Last edited by Jasonbourne; 01-24-2015 at 04:36.
    Jasonbourne is offline
    shadowdragon
    Senior Member
    Join Date: Dec 2012
    Old 01-24-2015 , 05:27   Re: [Hosties] DrugShop for JailBreak
    Reply With Quote #7

    Wow man your really going all out with this haha. good job when i get a JB server i will be using this for sure
    __________________
    Sorry for my poor English!
    ________________________________
    I can do CSS/CSGO plugin request for little money!
    shadowdragon is offline
    Jasonbourne
    Senior Member
    Join Date: Nov 2011
    Location: Sydney , AUS
    Old 01-27-2015 , 08:51   Re: [Hosties] DrugShop for JailBreak
    Reply With Quote #8

    Updated to V1.0.5 to include ds_confiscate module!

    CT's will confiscate (and get to keep) drugs if they see a trade happening in front of them.
    Attached Files
    File Type: smx ds_confiscate.smx (12.9 KB, 365 views)
    File Type: sp Get Plugin or Get Source (ds_confiscate.sp - 305 views - 5.4 KB)
    File Type: txt drugshop.phrases.txt (735 Bytes, 323 views)

    Last edited by Jasonbourne; 01-27-2015 at 08:57.
    Jasonbourne is offline
    SAM29
    New Member
    Join Date: Jan 2015
    Old 01-28-2015 , 06:27   Re: [Hosties] DrugShop for JailBreak
    Reply With Quote #9

    Hi. I have an error when i try to compile your ds_confiscate.sp and drugshop.sp
    "fatal error 120: cannot read from file: "drugshop""
    Can you help me?
    SAM29 is offline
    Jasonbourne
    Senior Member
    Join Date: Nov 2011
    Location: Sydney , AUS
    Old 01-28-2015 , 08:08   Re: [Hosties] DrugShop for JailBreak
    Reply With Quote #10

    Quote:
    Originally Posted by SAM29 View Post
    Hi. I have an error when i try to compile your ds_confiscate.sp and drugshop.sp
    "fatal error 120: cannot read from file: "drugshop""
    Can you help me?
    Put drugshop.inc in your scripting/includes folder on the system where you are running the compiler
    Jasonbourne 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 11:01.


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