but before i do i would apreciate it if some experianced scripters check it (or it is well writen, no bug, etc.). thx for your time
Code:
/* Plugin generated by AMXX-Studio */
/* With help from: Kraugh */
/* cvar: "amxx_ammoforhp" "1/0" */
/* say /ammo to gain ammo, loose HP */
/* say_team /ammo to gain ammo, loose HP */
#include <amxmodx>
#include <fun>
#include <cstrike>
#define PLUGIN "ammoforhp"
#define VERSION "1.0"
#define AUTHOR "wouter"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /ammo", "cmd_ammo")
register_clcmd("say_team /ammo", "cmd_ammo")
register_cvar("amxx_ammoforhp", "1")
}
public cmd_ammo(id) {
if ( ! get_cvar_num("amxx_ammoforhp") )
return PLUGIN_HANDLED
new AmmoCost = 10 // Change how much hp you loose for the ammo
new life = get_user_health(id)
if ( !is_user_alive(id) || life <= AmmoCost) {
client_print(id, print_chat, "[AmmoForHp] You are not alive or do not have enough HP!")
return PLUGIN_HANDLED
}
new clip, ammo, weapon = get_user_weapon(id,clip,ammo);
switch(weapon) {
case CSW_P228: {
give_item(id,"ammo_357sig")
}
case CSW_SCOUT: {
give_item(id,"ammo_762nato")
}
case CSW_HEGRENADE: {
client_print(id, print_chat, "[AmmoForHp] There is no ammo for this item!")
return PLUGIN_HANDLED
}
case CSW_XM1014: {
give_item(id,"ammo_buckshot")
}
case CSW_C4: {
client_print(id, print_chat, "[AmmoForHp] There is no ammo for this item!")
return PLUGIN_HANDLED
}
case CSW_MAC10: {
give_item(id,"ammo_45acp")
}
case CSW_AUG: {
give_item(id,"ammo_556nato")
}
case CSW_SMOKEGRENADE: {
client_print(id, print_chat, "[AmmoForHp] There is no ammo for this item!")
return PLUGIN_HANDLED
}
case CSW_ELITE: {
give_item(id,"ammo_9mm")
}
case CSW_FIVESEVEN: {
give_item(id,"ammo_57mm")
}
case CSW_UMP45: {
give_item(id,"ammo_45acp")
}
case CSW_SG550: {
give_item(id,"ammo_556nato")
}
case CSW_GALIL: {
give_item(id,"ammo_308")
}
case CSW_FAMAS: {
give_item(id,"ammo_556nato")
}
case CSW_USP: {
give_item(id,"ammo_45acp")
}
case CSW_GLOCK18: {
give_item(id,"ammo_9mm")
}
case CSW_AWP: {
give_item(id,"ammo_338magnum")
}
case CSW_MP5NAVY: {
give_item(id,"ammo_9mm")
}
case CSW_M249: {
give_item(id,"ammo_556natobox")
}
case CSW_M3: {
give_item(id,"ammo_buckshot")
}
case CSW_M4A1: {
give_item(id,"ammo_556nato")
}
case CSW_TMP: {
give_item(id,"ammo_9mm")
}
case CSW_G3SG1: {
give_item(id,"ammo_762nato")
}
case CSW_FLASHBANG: {
client_print(id, print_chat, "[AmmoForHp] There is no ammo for this item!")
return PLUGIN_HANDLED
}
case CSW_DEAGLE: {
give_item(id,"ammo_50ae")
}
case CSW_SG552: {
give_item(id,"ammo_556nato")
}
case CSW_AK47: {
give_item(id,"ammo_762nato")
}
case CSW_KNIFE: {
client_print(id, print_chat, "[AmmoForHp] There is no ammo for this item!")
return PLUGIN_HANDLED
}
case CSW_P90: {
give_item(id,"ammo_57mm")
}
default: return PLUGIN_CONTINUE
}
set_user_health(id, get_user_health(id) - AmmoCost)
client_print(id, print_chat, "[AmmoForHp] You have exchanged health for ammo!")
return PLUGIN_HANDLED
}
Code:
/* Plugin generated by AMXX-Studio */
/*
Many help form [ --<-@ ] Black Rose end ^_^Satan^_^
Thx you guys
say \camouflage // client cmd
say_team \camouflage // client cmd
amxx_camouflage <1/0> // enable / disable by admin
*/
#include <amxmodx>
#include <fun>
#include <cstrike>
new PLUGIN[]="Camouflage"
new AUTHOR[]="wouter"
new VERSION[]="1.00"
new CamoCost = 16000 // Edit this to change the price of the Camouflage
new bool:HasCamo[33]
new CTModels[] =
{
"urban", "gsg9",
"gign", "sas"
}
new TModels[] =
{
"terror", "leet",
"artic", "guerilla"
}
public client_connect(id) {
HasCamo[id] = false
}
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "DeathEvent", "a")
register_event("ResetHUD", "ResetHud", "a")
register_clcmd("say /camouflage", "cmd_camouflage")
register_clcmd("say_team /camouflage", "cmd_camouflage")
register_cvar("amxx_camouflage", "1")
}
public cmd_camouflage(id) {
if ( ! get_cvar_num("amxx_camouflage") )
return PLUGIN_HANDLED
new money = cs_get_user_money(id)
new CsTeams:team = cs_get_user_team(id)
if ( !is_user_alive(id) || money < CamoCost ) {
client_print(id, print_chat, "You are not alive or do not have enough money!")
return PLUGIN_HANDLED
}
if ( HasCamo[id] == false ) {
cs_set_user_money( id, cs_get_user_money(id) - CamoCost )
client_print( id, print_chat, "You have bought a camouflage!" )
HasCamo[id] = true
if (team == CS_TEAM_CT) {
cs_set_user_model(id, TModels)
return PLUGIN_CONTINUE;
}
else if (team == CS_TEAM_T) {
cs_set_user_model(id, CTModels)
return PLUGIN_CONTINUE
}
}
return PLUGIN_HANDLED
}
public DeathEvent() {
if ( ! get_cvar_num("amxx_camouflage") )
return PLUGIN_HANDLED
new id = read_data(2)
if ( HasCamo[id] == true ) {
set_task( 1.0, "reset_model", id )
}
return PLUGIN_HANDLED
}
public ResetHud(id) {
if ( ! get_cvar_num("amxx_camouflage") )
return PLUGIN_HANDLED
new CsTeams:team = cs_get_user_team(id)
if ( HasCamo[id] == true ) {
if (team == CS_TEAM_CT) {
cs_set_user_model(id, TModels)
}
else if (team == CS_TEAM_T) {
cs_set_user_model(id, CTModels)
}
}
return PLUGIN_HANDLED
}
public reset_model(id) {
cs_reset_user_model(id)
HasCamo[id] = false
}