PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <engine>
#include <fun>
#include <hamsandwich>
//////////////////////////////////////////
//////// //////////
///////* Defines */////////
//////// //////////
//////////////////////////////////////////
#define TASK_MENU_DISLPAY_TIME 3.0
#define OFFSET_PRIMARYWEAPON 116
#define OFFSET_PRIMARYWEAPON 116
#define OFFSET_C4_SLOT 372
//////////////////////////////////////////
//////// //////////
///////* Pcvar News */////////
//////// //////////
//////////////////////////////////////////
new g_Enable;
new gCvarLLMS
new gCvarBKidG
new gCvarCEarmor
new gCvarJThealth
new gCvarPShealth
new gCvarPSarmor
new gCvarPSMS
new gCvarWOhealth
new gCvarWOarmor
new gCvarWOMS
new gCvarNaderMS
new gCvarNoSeeFS
new gCvarNoSeeInvisible
new gCvarNoSeeHealth
new g_GameName
new g_Text
//////////////////////////////////////////
//////// //////////
///////* Other News */////////
//////// //////////
//////////////////////////////////////////
new g_Hudhelp
new g_MaxPlayers;
//////////////////////////////////////////
//////// ////
///////* Removal of Buyzone *///
//////// ` ////
//////////////////////////////////////////
new g_fwSpawn;
new gBuyzone;
new Float:gBuyzoneMin[3] = {-8192.0, -8192.0, -8192.0}
new Float:gBuyzoneMax[3] = {-8191.0, -8191.0, -8191.0}
new const entitys[][] =
{
"func_buyzone"
}
//////////////////////////////////////////
//////// //////////
///////* Constants */////////
//////// //////////
//////////////////////////////////////////
// Constant For Weapons
new const iWeapBits =
1 << CSW_P228 |
1 << CSW_SCOUT |
1 << CSW_XM1014 |
1 << CSW_ELITE |
1 << CSW_FIVESEVEN |
1 << CSW_SG550 |
1 << CSW_USP |
1 << CSW_GLOCK18 |
1 << CSW_AWP |
1 << CSW_M3 |
1 << CSW_G3SG1 |
1 << CSW_DEAGLE |
1 << CSW_KNIFE |
1 << CSW_HEGRENADE |
1 << CSW_SMOKEGRENADE |
1 << CSW_FLASHBANG;
// Constant for Custom Models
new const CUSTOM_MODELS[33][] =
{
"",
"models/WesternMod/v_p228.mdl",
"",
"models/WesternMod/v_scout.mdl",
"models/WesternMod/v_hegrenade.mdl",
"models/WesternMod/v_xm1014.mdl",
"",
"",
"",
"models/WesternMod/v_smokegrenade.mdl",
"models/WesternMod/v_elite.mdl",
"models/WesternMod/v_fiveseven.mdl",
"",
"models/WesternMod/v_sg550.mdl",
"",
"",
"models/WesternMod/v_usp.mdl",
"models/WesternMod/v_glock18.mdl",
"models/WesternMod/v_awp.mdl",
"",
"",
"models/WesternMod/v_m3.mdl",
"",
"",
"models/WesternMod/v_g3sg1.mdl",
"models/WesternMod/v_flashbang.mdl",
"models/WesternMod/v_deagle.mdl",
"",
"",
"models/WesternMod/v_knife.mdl",
"",
"",
""
};
//////////////////////////////////////////
//////// //////
///////* Precache Models */////
//////// //////
//////////////////////////////////////////
public plugin_precache()
{
precache_model("models/WesternMod/v_p228.mdl")
precache_model("models/WesternMod/v_scout.mdl")
precache_model("models/WesternMod/v_xm1014.mdl")
precache_model("models/WesternMod/v_elite.mdl")
precache_model("models/WesternMod/v_fiveseven.mdl")
precache_model("models/WesternMod/v_sg550.mdl")
precache_model("models/WesternMod/v_usp.mdl")
precache_model("models/WesternMod/v_glock18.mdl")
precache_model("models/WesternMod/v_awp.mdl")
precache_model("models/WesternMod/v_m3.mdl")
precache_model("models/WesternMod/v_g3sg1.mdl")
precache_model("models/WesternMod/v_deagle.mdl")
precache_model("models/WesternMod/v_knife.mdl")
precache_model("models/WesternMod/v_flashbang.mdl")
precache_model("models/WesternMod/v_hegrenade.mdl")
precache_model("models/WesternMod/v_smokegrenade.mdl")
//////////////////////////////////////////
//////// /////
///////* Precache Buyzone *////
//////// /////
//////////////////////////////////////////
g_fwSpawn = register_forward(FM_Spawn, "fw_Spawn")
gBuyzone = create_entity("func_buyzone");
engfunc(EngFunc_SetSize, gBuyzone, gBuyzoneMin, gBuyzoneMax)
dllfunc(DLLFunc_Spawn, gBuyzone)
}
/////////////////////////////////////////
//////// ///////
///////* Register Plugin *//////
//////// ///////
/////////////////////////////////////////
public plugin_init()
{
////////////////////////////////////////
//////// /////
///////* Register random stuff *////
//////// /////
////////////////////////////////////////
// Register plugin
register_plugin("Western Mod", "1.0", "One/TitANious");
// Unregister Buyzone
unregister_forward(FM_Spawn, g_fwSpawn)
// Task for menu
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
// The game description
register_forward(FM_GetGameDescription,"fw_GameDesc");
// The task for Hud Help Message
set_task(1.0, "mod_ihelp", 0, "", 0, "b");
// Register the menu
register_menucmd(register_menuid("Menu"), 1023, "We_Menu");
// The Help MOTD
register_clcmd("say /help", "help_motd");
// Again Help MOTD just in say_team
register_clcmd("say_team /help", "help_motd");
// Just something for msg
g_Text = get_user_msgid("SayText");
// Registering the model
register_event("CurWeapon", "Event_CurWeapon", "be", "1=1");
// Blocking drop
register_clcmd("drop", "blockDrop")
// You can't pick things up, except c4 bomb
register_forward(FM_Touch,"fwTouch");
// Get maxplayers
g_MaxPlayers = get_maxplayers();
//////////////////////////////////////////
//////// //////
///////* Register Pcvars */////
//////// //////
//////////////////////////////////////////
// For Enable
g_Enable = register_cvar("amx_western_mod", "1");
// For Lucky Luke Maxspeed
gCvarLLMS = register_cvar("WM_LLMS", "300.0")
// For Billy the Kids Gravity
gCvarBKidG = register_cvar("WM_BKidG", "0.6")
// For Clint Eastwoods armor
gCvarCEarmor = register_cvar("WM_CEarmor", "255")
// For Johnny Thunder health
gCvarJThealth = register_cvar("WM_JThealth", "255")
// For Pow Wow Smith health
gCvarPShealth = register_cvar("WM_PShealth", "255")
// For Pow Wow Smith armor
gCvarPSarmor = register_cvar("WM_PSarmor", "255")
// For Pow Wow Smith maxspeed
gCvarPSMS = register_cvar("WM_PSMS", "200")
// For Warren Olneys health
gCvarWOhealth = register_cvar("WM_WOhealth", "255")
// For Warren Olneys armor
gCvarWOarmor = register_cvar("WM_WOarmor", "255")
// For Warren Olneys maxspeed
gCvarWOMS = register_cvar("WM_WOMS", "200")
// For Charlie Naders maxspeed
gCvarNaderMS = register_cvar("WM_NaderMS", "310")
// For Chilli NoSees footstep
gCvarNoSeeFS = register_cvar("WM_NoSeeFS", "1")
// Chilli NoSees invisiblety
gCvarNoSeeInvisible = register_cvar("WM_NoSeeInvisible", "30")
// For Chilli NoSees health
gCvarNoSeeHealth = register_cvar("WM_NoSeeHealth", "150")
// For the gamename, which is in the right cornor
g_GameName = register_cvar("amx_gamename", "Western Mod by One and TitANious");
// Should the help hud be there?
g_Hudhelp = register_cvar("amx_hudhelp", "1");
}
/////////////////////////////////////////////////
//////// //////////
///////* Removal of Buyzone */////////
//////// //////////
/////////////////////////////////////////////////
public fw_Spawn(entity)
{
if (!pev_valid(entity)) return FMRES_IGNORED;
new classname[32]
pev(entity, pev_classname, classname, sizeof classname - 1)
for (new i = 0; i < sizeof entitys; i++)
{
if (equal(classname, entitys[i]))
{
engfunc(EngFunc_RemoveEntity, entity)
return FMRES_SUPERCEDE;
}
}
return FMRES_IGNORED;
}
/////////////////////////////////////////////////
//////// /////
///////* You cant pick weapons up! *////
//////// /////
/////////////////////////////////////////////////
public fwTouch( ent , id )
{
if ( !( 1 <= id <= g_MaxPlayers ) || !pev_valid( ent ) || !( pev( ent , pev_flags ) & FL_ONGROUND ) )
return FMRES_IGNORED;
//This will block picking up all weapons except backpack (c4)
static szEntModel[32];
pev( ent , pev_model , szEntModel , 31 );
return equal( szEntModel , "models/w_backpack.mdl" ) ? FMRES_IGNORED : FMRES_SUPERCEDE;
}
//////////////////////////////////////////
//////// //////////
///////* Blocking drop */////////
//////// //////////
//////////////////////////////////////////
public blockDrop() return PLUGIN_HANDLED
//////////////////////////////////////////
//////// //////////
///////* Strips weapons */////////
//////// //////////
//////////////////////////////////////////
StripUserWeapons(id)
{
new iC4Ent = get_pdata_cbase(id, OFFSET_C4_SLOT)
if( iC4Ent > 0 )
{
set_pdata_cbase(id, OFFSET_C4_SLOT, FM_NULLENT)
}
strip_user_weapons(id)
set_pdata_int(id, OFFSET_PRIMARYWEAPON, 0)
if( iC4Ent > 0 )
{
entity_set_int(id, EV_INT_weapons, entity_get_int(id, EV_INT_weapons) | (1<<CSW_C4))
set_pdata_cbase(id, OFFSET_C4_SLOT, iC4Ent)
cs_set_user_bpammo(id, CSW_C4, 1)
cs_set_user_plant(id, 1)
}
return PLUGIN_HANDLED
}
//////////////////////////////////////////
//////// //////////
///////* Models */////////
//////// //////////
//////////////////////////////////////////
public Event_CurWeapon(id)
{
new iWeapon = read_data(2);
if( pev_valid( id ) && ( iWeapBits & ( 1 << iWeapon ) ) )
set_pev( id , pev_viewmodel2 , CUSTOM_MODELS[iWeapon] );
}
//////////////////////////////////////////
//////// //////////
///////* Cfg File */////////
//////// //////////
//////////////////////////////////////////
public plugin_cfg()
{
if(get_pcvar_num(g_Enable) == 0)
return PLUGIN_HANDLED;
new configsDir[32],file[192];
get_configsdir(configsDir, sizeof configsDir - 1);
formatex(file,sizeof file - 1,"%s/western.cfg",configsDir);
if(file_exists(file))
{
server_cmd("exec %s", file);
}
else
{
log_amx("####################################");
log_amx("[ERROR] western.cfg not Found!");
log_amx("####################################");
}
return PLUGIN_CONTINUE;
}
//////////////////////////////////////////
//////// //////////
///////* Task Menu */////////
//////// //////////
//////////////////////////////////////////
public fwHamPlayerSpawnPost(id)
{
if(get_pcvar_num(g_Enable) == 0)
return HAM_SUPERCEDE;
set_task(TASK_MENU_DISLPAY_TIME, "choose_menu", id);
return HAM_IGNORED;
}
///////////////////////////////////////////////
//////// ///////
///////* Things for the menu *//////
//////// ///////
///////////////////////////////////////////////
public choose_menu(id) {
if(!is_user_alive(id) && is_user_bot(id))
return PLUGIN_HANDLED;
new menu = menu_create("\rChoose the Hero!", "We_Menu")
menu_additem(menu, "\wLucky Luke", "1", 0)
menu_additem(menu, "\wBilly the Kid", "2", 0)
menu_additem(menu, "\wClint Eastwood", "3", 0)
menu_additem(menu, "\wJohnny Thunder", "4", 0)
menu_additem(menu, "\wPow Wow Smith", "5", 0)
menu_additem(menu, "\wWarren Olney", "6", 0)
menu_additem(menu, "\wCharlie Nader", "7", 0)
menu_additem(menu, "\wChilli NoSee", "8", 0)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
return PLUGIN_HANDLED;
}
//////////////////////////////////////////
//////// //////////
///////* The menu */////////
//////// //////////
//////////////////////////////////////////
public We_Menu(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
StripUserWeapons(id)
give_item( id, "weapon_knife" )
give_item( id, "weapon_awp" )
give_item( id, "ammo_338magnum" )
give_item( id, "ammo_338magnum" )
give_item( id, "ammo_338magnum" )
give_item( id, "ammo_338magnum" )
give_item( id, "ammo_338magnum" )
give_item( id, "weapon_deagle")
give_item( id, "ammo_50ae")
give_item( id, "ammo_50ae")
give_item( id, "ammo_50ae")
give_item( id, "ammo_50ae")
give_item( id, "ammo_50ae")
set_user_maxspeed(id, get_pcvar_float(gCvarLLMS));
client_print(id, print_chat,"^x01You are now ^x04Lucky Luke.");
}
case 2:
{
StripUserWeapons(id)
give_item( id, "weapon_knife")
give_item( id, "weapon_g3sg1")
give_item( id, "ammo_762nato")
give_item( id, "ammo_762nato")
give_item( id, "ammo_762nato")
give_item( id, "ammo_762nato")
give_item( id, "ammo_762nato")
give_item( id, "ammo_762nato")
give_item( id, "weapon_p228")
give_item( id, "ammo_357sig")
give_item( id, "ammo_357sig")
give_item( id, "ammo_357sig")
give_item( id, "ammo_357sig")
set_user_gravity ( id, get_pcvar_float(gCvarBKidG));
client_print(id, print_chat,"^x01You are now ^x04 Billy the Kid.");
}
case 3:/* Clint Eastwood */
{
StripUserWeapons(id)
give_item( id, "weapon_knife" )
give_item( id, "weapon_sg550" )
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "weapon_elite")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
set_user_armor( id, get_pcvar_num(gCvarCEarmor));
client_print(id, print_chat,"^x01You are now ^x04Clint Eastwood.");
}
case 4:/* Johnny Thunder */
{
StripUserWeapons(id)
give_item( id, "weapon_knife" )
give_item( id, "weapon_scout" )
give_item( id, "ammo_762nato" )
give_item( id, "ammo_762nato" )
give_item( id, "ammo_762nato" )
give_item( id, "ammo_762nato" )
give_item( id, "ammo_762nato" )
give_item( id, "weapon_glock18")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
set_user_health( id, get_pcvar_num(gCvarJThealth));
client_print(id, print_chat,"^x01You are now ^x04Johnny Thunder.");
}
case 5:/* Pow Wow Smith */
{
StripUserWeapons(id)
give_item( id, "weapon_knife" )
give_item( id, "weapon_m3")
give_item( id, "ammo_buckshot")
give_item( id, "ammo_buckshot")
give_item( id, "ammo_buckshot")
give_item( id, "ammo_buckshot")
give_item( id, "weapon_usp")
give_item( id, "ammo_45acp")
give_item( id, "ammo_45acp")
give_item( id, "ammo_45acp")
give_item( id, "ammo_45acp")
set_user_armor( id, get_pcvar_num(gCvarPShealth));
set_user_health( id, get_pcvar_num(gCvarPSarmor));
set_user_maxspeed(id, get_pcvar_float(gCvarPSMS));
client_print(id, print_chat,"^x01You are now ^x04Pow Wow Smith.");
}
case 6:/* Warren Olney */
{
StripUserWeapons(id)
give_item( id, "weapon_knife" )
give_item( id, "weapon_xm1014")
give_item( id, "ammo_buckshot")
give_item( id, "ammo_buckshot")
give_item( id, "ammo_buckshot")
give_item( id, "ammo_buckshot")
give_item( id, "weapon_fiveseven")
give_item( id, "ammo_57mm")
give_item( id, "ammo_57mm")
give_item( id, "ammo_57mm")
give_item( id, "ammo_57mm")
set_user_armor( id, get_pcvar_num(gCvarWOarmor));
set_user_health( id, get_pcvar_num(gCvarWOhealth));
set_user_maxspeed(id, get_pcvar_float(gCvarWOMS));
client_print(id, print_chat,"^x01You are now ^x04Warren Olney.");
}
case 7:/* Charlie Nader */
{
StripUserWeapons(id)
give_item( id, "weapon_knife")
give_item( id, "weapon_glock18")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item( id, "weapon_flashbang" )
give_item( id, "weapon_flashbang" )
give_item( id, "weapon_hegrenade" )
give_item( id, "weapon_smokegrenade" )
set_user_maxspeed( id, get_pcvar_float(gCvarNaderMS));
client_print(id, print_chat,"^x01You are now ^x04Charlie Nader.");
}
case 8:/* Chilli NoSee */
{
StripUserWeapons(id)
give_item( id, "weapon_knife" )
set_user_rendering(id,kRenderFxGlowShell,0,0, 0,kRenderTransAlpha,get_pcvar_num(gCvarNoSeeInvisible));
set_user_footsteps ( id, get_pcvar_num(gCvarNoSeeFS));
set_user_health ( id, get_pcvar_num(gCvarNoSeeHealth))
client_print(id, print_chat,"^x01You are now ^x04Chilli NoSee.");
}
}
return 0;
}
//////////////////////////////////////////
//////// //////
///////* Game Description */////
//////// //////
//////////////////////////////////////////
public fw_GameDesc()
{
if(get_pcvar_num(g_Enable) == 0)
return FMRES_IGNORED;
new gamename[32];
get_pcvar_string(g_GameName, gamename, 31);
forward_return(FMV_STRING, gamename);
return FMRES_SUPERCEDE;
}
//////////////////////////////////////////
//////// //////////
///////* Hud Message */////////
//////// //////////
//////////////////////////////////////////
public mod_ihelp()
{
if(get_pcvar_num(g_Hudhelp) == 1)
{
set_hudmessage(255,255,255,0.75,0.05,0, 1.0, 1.0, 0.1, 0.2, 13);
show_hudmessage(0, "This server is running Western Mod 1.0 by TitANious and One^nType /help to know more!");
}
return PLUGIN_CONTINUE;
}
//////////////////////////////////////////
//////// //////////
///////* MOTD Help */////////
//////// //////////
//////////////////////////////////////////
public help_motd(id)
{
const SIZE = 1024;
new msg[SIZE+1],len = 0;
len += formatex(msg[len], SIZE - len, "<html><body style=^"background-color:black;color:white;font-size:16^"");
len += formatex(msg[len], SIZE - len, "Choose a hero<br>");
len += formatex(msg[len], SIZE - len, "Lucky Luke:<br>");
len += formatex(msg[len], SIZE - len, "He have a AWP, DEgle and faster run speed.<br>");
len += formatex(msg[len], SIZE - len, "Billy the Kid:<br>");
len += formatex(msg[len], SIZE - len, "He have a g3sg1 a p228 and lower gravity<br>");
len += formatex(msg[len], SIZE - len, "Clint Eastwood:<br>");
len += formatex(msg[len], SIZE - len, "He got a sg550, dual elites and more armor<br>");
len += formatex(msg[len], SIZE - len, "Johnny Thunder:<br>");
len += formatex(msg[len], SIZE - len, "He have a scout, a glock18 and more health<br>");
len += formatex(msg[len], SIZE - len, "Pow Wow Smith<br>");
len += formatex(msg[len], SIZE - len, "He have a m3, a usp, more health, more armor, but lower speed<br>");
len += formatex(msg[len], SIZE - len, "Warren Olney<br>");
len += formatex(msg[len], SIZE - len, "He have a xm1014, a fiveseven, more health, more armor, but lower speed<br>");
len += formatex(msg[len], SIZE - len, "Charlie Nader<br>");
len += formatex(msg[len], SIZE - len, "He got a glock18, all nades and faster speed <br>");
len += formatex(msg[len], SIZE - len, "Chilli NoSee<br>");
len += formatex(msg[len], SIZE - len, "He have no footsteps, faster runspeed and you can nearly not see him, a perfect assassin<br>");
len += formatex(msg[len], SIZE - len, "</body></html>");
show_motd(id, msg, "Western Mod Help");
return PLUGIN_CONTINUE;
}
//////////////////////////////////////////////
//////// /////
///////* Stock for color_print *////
//////// /////
//////////////////////////////////////////////
stock color_print(id, const message[], {Float,Sql,Result,_}:...)
{
new Buffer[128],Buffer2[128];
new players[32], index, num, i;
formatex(Buffer2, sizeof Buffer2 - 1, "%s",message);
vformat(Buffer, sizeof Buffer - 1, Buffer2, 3);
get_players(players, num,"c");
if(id)
{
message_begin(MSG_ONE_UNRELIABLE, g_Text, _, id);
write_byte(id);
write_string(Buffer);
message_end();
}
else
{
for(i = 0; i < num;i++)
{
index = players[i];
if(!is_user_connected(index))
continue;
message_begin(MSG_ONE_UNRELIABLE, g_Text, _, index);
write_byte(index);
write_string(Buffer);
message_end();
}
}
}