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(id, TEAM_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(id, TEAM_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(id, CS_TEAM_CT)
ExecuteHamB(Ham_CS_RoundRespawn, id);
new szName[32]
get_user_name(id, szName, charsmax(szName))
set_dhudmessage( 0, 255, 0, -1.0, 0.80, 0, 0.1, 0.1, 10.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(VictimID, KillerID, iGIB)
{
// 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(PlayerID, print_center, "You have to be a zombie to use this command!");
return PLUGIN_HANDLED;
}
// Player not alive?
if( !is_user_alive(PlayerID) )
{
client_print(PlayerID, print_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(PlayerID, print_center, "You do not have enough tablets to buy antidote!");
return PLUGIN_HANDLED;
}
// Successfully buy antidote!
client_print(PlayerID, print_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(PlayerID, CS_TEAM_CT, CS_CT_GIGN);
ExecuteHamB(Ham_CS_RoundRespawn, PlayerID);
g_iTablets[PlayerID] -= get_pcvar_num(g_pcvarAntidotePrice);
}
public ClCmd_ShowTablets(PlayerID)
{
// Show current quantity of tablets in a normal chat message!
client_print(PlayerID, print_chat, "You currently have: %i Tablets!", g_iTablets[PlayerID]);
}
public Task_Advertisement()
{
// Advertisement task function
client_print(0, print_chat, "This server is running Base Builder Antidote System by PrInCe.");
client_print(0, print_chat, "To by antidote using the command: /antidote.");
}