Raised This Month: $32 Target: $400
 8% 

BaseBuilder Antidote System


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff       
Princ123
New Member
Join Date: Apr 2014
Old 03-09-2015 , 14:14   BaseBuilder Antidote System
Reply With Quote #1

BaseBuilder Antidote System

by PrInCe


About Plugin:
This is one plugin who gives you ability to turn back to builders when you are zombie.You don't need money to turn back, but you need TABLETS.

What is Tablets?
When you kill players you got TABLETS. 1 KILL = 1 Tablet (You can change it with cvar).When you dissconect from server, your tablets will be 0.That mean player must kill 30 player (You can change it) then he can turn back to human.

Player Commands:

/antidote - Buy Antidote.
/tablets - Check how many tablets you got.


Cvars:

antidote_price "30" // How many tablets you need to buy Antidote (Default 30)
tablets_for_kill "1" // How many tablets you got for one KILL (Default 1)


Some pictures:





Attached Files
File Type: sma Get Plugin or Get Source (bbantidotesystem.sma - 696 views - 2.4 KB)

Last edited by Princ123; 03-10-2015 at 06:48.
Princ123 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-09-2015 , 14:28   Re: BaseBuilder Antidote System
Reply With Quote #2

PHP Code:
set_task(get_pcvar_float(pcvar_info),"adviserment" "b"
It's wrong, this cvar has an int value, so use get_pcvar_num. To convert it to float, do float(value).
PHP Code:
set_task(float(get_pcvar_num(pcvar_info)),"adviserment" "b"
PHP Code:
public client_connect(id)   
{   
     
tablets_player[id] = 0;  

Since you reset on disconnect, this is not needed.

PHP Code:
new give_tablets get_pcvar_num(tablets_for_kill);
        
tablets_player[attacker] += give_tablets 
Here you use only one time the variable give_tablets, it's not needed. Use get_pcvar_num native directly.

PHP Code:
 new price get_pcvar_num(antidote_price); 
Cache this before the first if, and use price everywhere.

In advertisment function return PLUGIN_HANDLED; is not needed.
__________________
HamletEagle is offline
Princ123
New Member
Join Date: Apr 2014
Old 03-10-2015 , 06:48   Re: BaseBuilder Antidote System
Reply With Quote #3

UPDATE! I fixed, thanks HamletEagle !
Princ123 is offline
Decak
Senior Member
Join Date: Sep 2012
Old 03-10-2015 , 09:07   Re: BaseBuilder Antidote System
Reply With Quote #4

Awesome GL i kupi mi sluske !
Decak is offline
Princ123
New Member
Join Date: Apr 2014
Old 03-10-2015 , 12:28   Re: BaseBuilder Antidote System
Reply With Quote #5

@DecaK Thanks Ocuu
Princ123 is offline
happy_2012
Senior Member
Join Date: Aug 2012
Old 03-22-2015 , 09:49   Re: BaseBuilder Antidote System
Reply With Quote #6

Well, it is a nice idea, but I think you should consider edit the code quite bit.. I mean especially this part:
PHP Code:
public antidote_check(id)
{
    if(
get_user_team(id) == 2)
    {
        
ColorChat(idTEAM_COLOR"^4[BB Antidote]^3 You can't buy Antidote becacuse you are ^4Builder^1 !")
    }
    else
    {
        
Antidote(id);
    }
}


public 
Antidote(id)
{

     if(
tablets_player[id]<get_pcvar_num(antidote_price))
     {   
         
ColorChat(idTEAM_COLOR"^4[BB Antidote]^3 For Antidote you need ^4%i^3 tablets, to see how many you got, say ^4/tablets^1"get_pcvar_num(antidote_price))
     }
     else
     {
 
       
tablets_player[id] -= get_pcvar_num(antidote_price);
       
cs_set_user_team(idCS_TEAM_CT
       
ExecuteHamB(Ham_CS_RoundRespawnid);

       new 
szName[32]
       
get_user_name(idszNamecharsmax(szName))

       
set_dhudmessage02550, -1.00.8000.10.110.0 );
       
show_dhudmessage 0"Player %s buy Antidote!"szName)
     }

Edit:
How about this code? I guess it's quite nice?
PHP Code:
/*
    AMX Mod X script.

    This plugin is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 2 of the License, or (at
    your option) any later version. 
    
    This plugin is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this plugin; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/

#define PLUGIN_VERSION "1.0"

/* Includes */
#include < amxmodx >
#include < cstrike >
#include < hamsandwich >

/* Definitions */
#define MAXPLAYERS 32

/* Integer Arrays */
new g_iTablets[MAXPLAYERS 1];

/* Pcvars */
new g_pcvarTebletPerKill;
new 
g_pcvarAntidotePrice;
new 
g_pcvarAdvertisement;

public 
plugin_init()
{
    
register_plugin("[BB] Antidote System"PLUGIN_VERSION"PrInCe");
    
    
// Player commands
    
register_clcmd("say /antidote",    "ClCmd_BuyAntidote");
    
register_clcmd("say /tablets",    "ClCmd_ShowTablets");
    
    
// Hamsanwich forwards
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled_Post"true);
    
    
// Cvars
    
g_pcvarTebletPerKill register_cvar("bb_tablet_per_kill""1");
    
g_pcvarAntidotePrice register_cvar("bb_antidote_price""30");
    
g_pcvarAdvertisement register_cvar("bb_antidote_ad_time""60");
    
    
// Task
    
set_task(float(get_pcvar_num(g_pcvarAdvertisement)), "Task_Advertisement"___"b");
}

public 
client_disconnect(PlayerID)
{
    
g_iTablets[PlayerID] = 0;
}

public 
fw_PlayerKilled_Post(VictimIDKillerIDiGIB)
{
    
// Committed suicide?
    
if( VictimID == KillerID )
        return;
    
    
// Killer or victim not connected?
    
if( !is_user_connected(VictimID) || !is_user_connected(KillerID) )
        return;
    
    
// Otherwise give tablets
    
g_iTablets[KillerID] += get_pcvar_num(g_pcvarTebletPerKill);
}

public 
ClCmd_BuyAntidote(PlayerID)
{
    
// Player not in terrorists (zombie) team?
    
if( cs_get_user_team(PlayerID) != CS_TEAM_T )
    {
        
client_print(PlayerIDprint_center"You have to be a zombie to use this command!");
        return 
PLUGIN_HANDLED;
    }
    
    
// Player not alive?
    
if( !is_user_alive(PlayerID) )
    {
        
client_print(PlayerIDprint_center"You have to be alive to use this command!");
        return 
PLUGIN_HANDLED;        
    }
    
    
// Player does not have enough tablets?
    
if( g_iTablets[PlayerID] < get_pcvar_num(g_pcvarAntidotePrice) )
    {
        
client_print(PlayerIDprint_center"You do not have enough tablets to buy antidote!");
        return 
PLUGIN_HANDLED;
    }
    
    
// Successfully buy antidote!
    
client_print(PlayerIDprint_center"You have just bought an antidote!");
    
BuyAntidote(PlayerID)
    return 
PLUGIN_HANDLED;    
}

BuyAntidote(PlayerID)
{
    
// Buyer disconnected immediately?
    
if( !is_user_connected(PlayerID) )
        return;
    
    
// Otherwise cure him :)
    
user_kill(PlayerID);
    
cs_set_user_team(PlayerIDCS_TEAM_CTCS_CT_GIGN);
    
ExecuteHamB(Ham_CS_RoundRespawnPlayerID);
    
    
g_iTablets[PlayerID] -= get_pcvar_num(g_pcvarAntidotePrice);
}

public 
ClCmd_ShowTablets(PlayerID)
{
    
// Show current quantity of tablets in a normal chat message!
    
client_print(PlayerIDprint_chat"You currently have: %i Tablets!"g_iTablets[PlayerID]);    
}

public 
Task_Advertisement()
{
    
// Advertisement task function
    
client_print(0print_chat"This server is running Base Builder Antidote System by PrInCe.");    
    
client_print(0print_chat"To by antidote using the command: /antidote.");


Last edited by happy_2012; 03-22-2015 at 10:28.
happy_2012 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-10-2016 , 08:32   Re: BaseBuilder Antidote System
Reply With Quote #7

That is not enough for a new submission. Unapproved.
__________________
HamletEagle 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 06:13.


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