Senior Member
|
04-28-2021
, 20:28
[L4D2] Shop [v4.5 | 20 March 2022]
|
#1
|
Description:
Well, it is a plugin updated from [L4D2] Item buying System v1.36
I re-coded the source and updated more functions.
Update Log:
Features:- Native functions call
- Save functions (Using SQLite Database, no need to setup anything)
- Support Dedicated or Listen server
- Support !buy <item> command
- Points Transfer
- Handling Fee (for Points Transfer only)
- More useful information for clients
- Collected all items into the shop
- Special Functions (Trial / Permanent)
- Special Bag (Enable/Disable Special Functions)
- Admin Menu (Reward, Confiscate, Set)
- Log actions into the .log file
- Multiple Languages
- New code style
- etc.
Current Special Functions (SF):
Extra items:
How to use?- Type !buy in the game to open Shop menu.
- Type !buy <item> in the game to buy an item by command.
- type !admin and find 'Shop Commands' to open the shop admin menu.
- type !rb or !repeatbuy to repeatedly buy.
- type !kill to suicide.
- Edit an item cost in the cfg to -1 to disable the item.
- You can copy others plugin functions to make your own special functions.
When will save points?
To avoid making the server lag, I just added two triggers for it. - Round end
- Player disconnected
Native functions:
Spoiler
PHP Code:
/**
* Gets the version of Shop
* @param buffer string buffer
* @return current version of rank system in form of a float
*/
native int Shop_GetVersion(char[] buffer);
/**
* Get client points
*
* @param client client index
* @return client points
*/
native int Shop_GetPoints(int client);
/**
* Buy item
*
* @param client client index
* @param buffer item name
* @param price item price
* @param team team (default: survivor)
* @return true if buying item is successful
*/
native bool Shop_BuyItem(int client, char[] buffer, int price, int team = 2);
/**
* Upgrade Weapon
*
* @param client client index
* @param buffer item name
* @param price item price
* @return true if buying item is successful
*/
native bool Shop_UpgradeWeapon(int client, char[] buffer, int price);
/**
* Upgrade Weapon
*
* @param client client index
* @param index SF index
* @param price SF price
* @param isPermanent is Permanent
* @return true if buying is successful
*/
native bool Shop_BuySF(int client, int index, int price, bool isPermanent);
/**
* Check is sf on
*
* @param client client index
* @param index SF index
* @return true if sf is on
*/
native bool Shop_IsSFOn(int client, int index);
/**
* Get SF Index by function no.
*
* @param functionNo functionNo (string)
* @return index of functionNo
*/
native int Shop_GetFunctionIndex(char[] functionNo);
/**
* Check is sf on
*
* @param client client index
* @param index SF index
* @param isPermanent isPermanent (default: false)
* @return true if sf is on
*/
native bool Shop_GetClientSFOn(int client, int index, bool isPermanent = false);
/**
* Get Eanbled Ammo Color Index
*
* @param client client index
* @return -1 if not found
*/
native int Shop_GetEanbledAmmoColorIndex(int client);
/**
* Buy function (reduce points)
*
* @param client client index
* @param item item name
* @param price item price
* @param bPrint print purchase is successful?
* @return true if reduciing point is successful
*/
native bool Shop_Checkout(const int client, const char[] item, const int price, bool bPrint = true);
/**
* Check Shop is off
*
* @param client client index
* @param shopId shopId (refer to shop_cv)
* @return true if shop is off
*/
native bool Shop_IsShopOff(int client, int shopId);
/**
* Call an agent to help you buy somethings
*
* @param client client index
* @param shopId shopId (refer to shop_cv)
* @param itemId itemId (refer to shop_cv)
* @return 0
*/
native int Shop_CallAgent(int client, int shopId, int itemId);
/**
* Set SF (round) on/off
*
* @param client client index
* @param sfId sf id
* @param bOn itemId (refer to shop_cv)
* @return 0
*/
native int Shop_SetSFOn(int client, int sfId, bool bOn = true);
/**
* Set first sfid on and set second sfid to false
*
* @param client client index
* @param sfIds sfIds
* @param bSave Will save to DB?
* @return 0
*/
native int Shop_SetSFOffWhenSFOn(int client, int[] sfIds, bool bSave = false);
/**
* Add points to client
*
* @param client client index
* @param points amouint of points
* @param bSave Will save to DB?
* @return 0
*/
native int Shop_AddPoints(int client, int points, bool bSave = false);
/**
* Reduce points to client
*
* @param client client index
* @param point sfIds
* @param bSave Will save to DB?
* @return 0
*/
native int Shop_ReducePoints(int client, int points, bool bSave = false);
/**
* Set client points
*
* @param client client index
* @param point sfIds
* @param bSave Will save to DB?
* @return 0
*/
native int Shop_SetPoints(int client, int points, bool bSave = false);
////
//
/**
* Registers a module for points system
*
* @param modulename String that contains the module to be registered's name
* @return false if successful true if already registered, true should never happen.
*/
native bool Shop_RegisterModule(const char[] modulename);
/**
* Unregisters a module for points system
*
* @param modulename String that contains the module to be unregistered's name
* @return none
*/
native void Shop_UnregisterModule(const char[] modulename);
/**
* Called when Points System is loaded
*
* @return none
*/
forward void OnShopLoaded();
/**
* Called when Points System is unloaded
*
* @return none
*/
forward void OnShopUnloaded();
ConVars:
PHP Code:
// This file was auto-generated by SourceMod (v1.11.0.6825)
// ConVars for plugin "l4d2_shop.smx"
// Will notify all players when a player buy an item? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_buy_notify_all_on "1"
// Shop is on for coop mode? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_coop_on "1"
// How many points buying an adrenaline costs. -1=Disabled
// -
// Default: "43"
shop_cost_adrenaline "43"
// How many points calling an airstrike (crosshair) costs. -1=Disa
// -
// Default: "88"
shop_cost_airstrike_on_crosshair "88"
// How many points calling an airstrike (positin) costs. -1=Disabl
// -
// Default: "88"
shop_cost_airstrike_on_position "88"
// How many points refilling ammo costs. -1=Disabled
// -
// Default: "12"
shop_cost_ammo "12"
// How many points buying a auto shotgun costs. -1=Disabled
// -
// Default: "30"
shop_cost_autoshotgun "30"
// How many points buying a baseball bat costs. -1=Disabled
// -
// Default: "9"
shop_cost_baseball_bat "9"
// How many points buying a chainsaw costs. -1=Disabled
// -
// Default: "16"
shop_cost_chainsaw "16"
// How many points buying a cola bottles costs. -1=Disabled
// -
// Default: "68"
shop_cost_cola_bottles "68"
// How many points buying a cricket bat costs. -1=Disabled
// -
// Default: "9"
shop_cost_cricket_bat "9"
// How many points buying a crowbar costs. -1=Disabled
// -
// Default: "9"
shop_cost_crowbar "9"
// How many points buying a defibrillator costs. -1=Disabled
// -
// Default: "50"
shop_cost_defibrillator "50"
// How many points buying an electric guitar costs. -1=Disabled
// -
// Default: "9"
shop_cost_electric_guitar "9"
// How many points upgrading explosive ammo costs. -1=Disabled
// -
// Default: "12"
shop_cost_explosive_ammo "12"
// How many points buying a extinguisher costs. -1=Disabled
// -
// Default: "40"
shop_cost_extinguisher "40"
// How many points buying a fireaxe costs. -1=Disabled
// -
// Default: "9"
shop_cost_fireaxe "9"
// How many points buying a firework crate costs. -1=Disabled
// -
// Default: "18"
shop_cost_fireworkcrate "18"
// How many points buying a first_aid_kit costs. -1=Disabled
// -
// Default: "88"
shop_cost_first_aid_kit "88"
// How many points buying a flamethrower costs. -1=Disabled
// -
// Default: "-1"
shop_cost_flamethrower "-1"
// How many points buying a frying pan costs. -1=Disabled
// -
// Default: "9"
shop_cost_frying_pan "9"
// How many points buying a gas can costs. -1=Disabled
// -
// Default: "18"
shop_cost_gascan "18"
// How many points buying a gnome costs. -1=Disabled
// -
// Default: "68"
shop_cost_gnome "68"
// How many points buying a golf club costs. -1=Disabled
// -
// Default: "9"
shop_cost_golfclub "9"
// How many points buying a grenade launcher costs. -1=Disabled
// -
// Default: "38"
shop_cost_grenade_launcher "38"
// How many points buying a hunting rifle costs. -1=Disabled
// -
// Default: "25"
shop_cost_hunting_rifle "25"
// How many points upgrading incendiary ammo costs. -1=Disabled
// -
// Default: "12"
shop_cost_incendiary_ammo "12"
// How many points becoming a boomer costs. -1=Disabled
// -
// Default: "10"
shop_cost_infected_boomer "10"
// How many points becoming a charger costs. -1=Disabled
// -
// Default: "7"
shop_cost_infected_charger "7"
// How many points becoming a mega mob costs. -1=Disabled
// -
// Default: "23"
shop_cost_infected_director_force_panic_event "23"
// How many points heal costs. -1=Disabled
// -
// Default: "10"
shop_cost_infected_health "10"
// How many points becoming a hunter costs. -1=Disabled
// -
// Default: "5"
shop_cost_infected_hunter "5"
// How many points becoming a jockey costs. -1=Disabled
// -
// Default: "7"
shop_cost_infected_jockey "7"
// How many points suicide costs. -1=Disabled
// -
// Default: "4"
shop_cost_infected_kill "4"
// How many points generating a mini-event/mob costs. -1=Disabled
// -
// Default: "18"
shop_cost_infected_mob "18"
// How many points becoming a smoker costs. -1=Disabled
// -
// Default: "7"
shop_cost_infected_smoker "7"
// How many points becoming a spitter costs. -1=Disabled
// -
// Default: "7"
shop_cost_infected_spitter "7"
// How many points becoming a tank costs. -1=Disabled
// -
// Default: "50"
shop_cost_infected_tank "50"
// How many points generating a witch costs. -1=Disabled
// -
// Default: "30"
shop_cost_infected_witch "30"
// How many points buying a katana costs. -1=Disabled
// -
// Default: "9"
shop_cost_katana "9"
// How many points buying a knife costs. -1=Disabled
// -
// Default: "5"
shop_cost_knife "5"
// How many points upgrading laser sight costs. -1=Disabled
// -
// Default: "10"
shop_cost_laser_sight "10"
// How many points buying a 3 lethal ammo costs. -1=Disabled
// -
// Default: "60"
shop_cost_lethal_ammo_3 "60"
// How many points buying a fireaxe costs. -1=Disabled
// -
// Default: "9"
shop_cost_machete "9"
// How many points buying a molotov costs. -1=Disabled
// -
// Default: "28"
shop_cost_molotov "28"
// How many points buying a oxygen tank costs. -1=Disabled
// -
// Default: "18"
shop_cost_oxygentank "18"
// How many points buying a pain pills costs. -1=Disabled
// -
// Default: "43"
shop_cost_pain_pills "43"
// How many points buying a pipe bomb costs. -1=Disabled
// -
// Default: "28"
shop_cost_pipe_bomb "28"
// How many points buying a pistol costs. -1=Disabled
// -
// Default: "5"
shop_cost_pistol "5"
// How many points buying a pistol magnum costs. -1=Disabled
// -
// Default: "13"
shop_cost_pistol_magnum "13"
// How many points buying a pitchfork costs. -1=Disabled
// -
// Default: "9"
shop_cost_pitchfork "9"
// How many points buying a SMG costs. -1=Disabled
// -
// Default: "300"
shop_cost_premanent_AUTO_BHOP "300"
// How many points buying a green laser tag costs. -1=Disabled
// -
// Default: "4000"
shop_cost_premanent_BLUE_AMMO "4000"
// How many points buying a green laser tag costs. -1=Disabled
// -
// Default: "6000"
shop_cost_premanent_GOLD_AMMO "6000"
// How many points buying a gary laser tag costs. -1=Disabled
// -
// Default: "1000"
shop_cost_premanent_GRAY_AMMO "1000"
// How many points buying a green laser tag costs. -1=Disabled
// -
// Default: "3000"
shop_cost_premanent_GREEN_AMMO "3000"
// How many points buying a qing gong costs. -1=Disabled
// -
// Default: "300"
shop_cost_premanent_QING_GONG "300"
// How many points buying a red laser tag costs. -1=Disabled
// -
// Default: "9999"
shop_cost_premanent_RED_AMMO "9999"
// How many points buying a propane tank costs. -1=Disabled
// -
// Default: "18"
shop_cost_propanetank "18"
// How many points buying a pumpshotgun costs. -1=Disabled
// -
// Default: "13"
shop_cost_pumpshotgun "13"
// How many points buying a rifle costs. -1=Disabled
// -
// Default: "30"
shop_cost_rifle "30"
// How many points buying an AK47 rifle costs. -1=Disabled
// -
// Default: "30"
shop_cost_rifle_ak47 "30"
// How many points buying a desert rifle costs. -1=Disabled
// -
// Default: "30"
shop_cost_rifle_desert "30"
// How many points buying a heavy gun M60 costs. -1=Disabled
// -
// Default: "160"
shop_cost_rifle_m60 "160"
// How many points buying a SG552 rifle costs. -1=Disabled
// -
// Default: "30"
shop_cost_rifle_sg552 "30"
// How many points buying a shotgun chrome costs. -1=Disabled
// -
// Default: "13"
shop_cost_shotgun_chrome "13"
// How many points buying a shotgun_spas costs. -1=Disabled
// -
// Default: "30"
shop_cost_shotgun_spas "30"
// How many points buying a shovel costs. -1=Disabled
// -
// Default: "9"
shop_cost_shovel "9"
// How many points buying a SMG costs. -1=Disabled
// -
// Default: "13"
shop_cost_smg "13"
// How many points buying a MP5 SMG costs. -1=Disabled
// -
// Default: "13"
shop_cost_smg_mp5 "13"
// How many points buying a Silenced SMG costs. -1=Disabled
// -
// Default: "13"
shop_cost_smg_silenced "13"
// How many points buying an AWP costs. -1=Disabled
// -
// Default: "50"
shop_cost_sniper_awp "50"
// How many points buying a sniper military costs. -1=Disabled
// -
// Default: "25"
shop_cost_sniper_military "25"
// How many points buying a scout costs. -1=Disabled
// -
// Default: "40"
shop_cost_sniper_scout "40"
// How many points buying a tonfa costs. -1=Disabled
// -
// Default: "9"
shop_cost_tonfa "9"
// How many points buying a SMG costs. -1=Disabled
// -
// Default: "30"
shop_cost_trial_AUTO_BHOP "30"
// How many points buying a green laser tag costs. -1=Disabled
// -
// Default: "400"
shop_cost_trial_BLUE_AMMO "400"
// How many points buying a green laser tag costs. -1=Disabled
// -
// Default: "600"
shop_cost_trial_GOLD_AMMO "600"
// How many points buying a gary laser tag costs. -1=Disabled
// -
// Default: "200"
shop_cost_trial_GRAY_AMMO "200"
// How many points buying a green laser tag costs. -1=Disabled
// -
// Default: "300"
shop_cost_trial_GREEN_AMMO "300"
// How many points buying a qing gong costs. -1=Disabled
// -
// Default: "30"
shop_cost_trial_QING_GONG "30"
// How many points buying a red laser tag costs. -1=Disabled
// -
// Default: "999"
shop_cost_trial_RED_AMMO "999"
// How many points buying an explosive upgrade pack costs. -1=Dis
// -
// Default: "18"
shop_cost_upgradepack_explosive "18"
// How many points buying an incendiary upgrade pack costs. -1=Di
// -
// Default: "18"
shop_cost_upgradepack_incendiary "18"
// How many points buying a vomitjar costs. -1=Disabled
// -
// Default: "28"
shop_cost_vomitjar "28"
// Will server save points? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_db_on "1"
// How many points rewarded to player who used defibrillator 0=Disabled
// -
// Default: "5"
// Minimum: "0.000000"
shop_earn_defibrillate "5"
// How many points for healing someone. 0=Disabled
// -
// Default: "5"
// Minimum: "0.000000"
shop_earn_heal "5"
// How many points for killing a certain number of infected. 0=Disabled
// -
// Default: "1"
// Minimum: "0.000000"
shop_earn_infected "1"
// How many killed infected does it take to earn points? Headshot and minigun kills can be used to rank up extra kills. 0=Disabled
// -
// Default: "10"
// Minimum: "0.000000"
shop_earn_infected_num "10"
// How many points for protecting someone. 0=Disabled
// -
// Default: "1"
// Minimum: "0.000000"
shop_earn_protect "1"
// How many points rewarded to player who rescued the dead client. 0=Disabled
// -
// Default: "2"
// Minimum: "0.000000"
shop_earn_rescued "2"
// How many points for reviving someone. 0=Disabled
// -
// Default: "2"
// Minimum: "0.000000"
shop_earn_revive "2"
// How many points for reviving someone who is in ledge hang/ 0=Disabled
// -
// Default: "1"
// Minimum: "0.000000"
shop_earn_revive_ledge_hang "1"
// How many points for killing a special infected. 0=Disabled
// -
// Default: "1"
// Minimum: "0.000000"
shop_earn_special "1"
// How many points you get for burning a tank. 0=Disabled
// -
// Default: "3"
// Minimum: "0.000000"
shop_earn_tank_burn "3"
// How many additional points you get for killing a tank. 0=Disabled
// -
// Default: "2"
// Minimum: "0.000000"
shop_earn_tank_killed "2"
// How many points you get for killing a witch. 0=Disabled
// -
// Default: "10"
// Minimum: "0.000000"
shop_earn_witch "10"
// How many extra points you get for killing a witch in one shot. 0=Disabled
// -
// Default: "10"
// Minimum: "0.000000"
shop_earn_witch_in_one_shot "10"
// Only dead infected can buy respawn? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_infected_buy_respawn_on "1"
// How many points you get [as a charger] after impact on survivor, for 1 pummel damage. 0=Disabled
// -
// Default: "1"
// Minimum: "0.000000"
shop_infected_earn_charge "1"
// How many points you get [as a charger] when hitting nearby survivors. 0=Disabled
// -
// Default: "1"
// Minimum: "0.000000"
shop_infected_earn_charge_collateral "1"
// How many points you get [as a smoker] when you pull a survivor. 0=Disabled
// -
// Default: "1"
// Minimum: "0.000000"
shop_infected_earn_grab "1"
// How many points infected get for hurting survivors a number of times. 0=Disabled
// -
// Default: "2"
// Minimum: "0.000000"
shop_infected_earn_hurt "2"
// How many points you get for incapacitating a survivor 0=Disabled
// -
// Default: "5"
// Minimum: "0.000000"
shop_infected_earn_incapacitate "5"
// How many points you get when jumping on a survivor. 0=Disabled
// -
// Default: "1"
// Minimum: "0.000000"
shop_infected_earn_jockey_ride "1"
// How many points you get [as a hunter] when you pounce a survivor. 0=Disabled
// -
// Default: "1"
// Minimum: "0.000000"
shop_infected_earn_pounce "1"
// How many points you get for killing a survivor 0=Disabled
// -
// Default: "10"
// Minimum: "0.000000"
shop_infected_earn_survivor "10"
// How many points you get [as a boomer] when you vomit/explode on a survivor. 0=Disabled
// -
// Default: "1"
// Minimum: "0.000000"
shop_infected_earn_vomit "1"
// Inovice display type. 0=simple, 1=detail
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_inovice_type "1"
// How many tanks can be spawned in a round.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "60.000000"
shop_limit_tanks "1"
// How many witches can be spawned in a round.
// -
// Default: "2"
// Minimum: "0.000000"
// Maximum: "60.000000"
shop_limit_witches "2"
// Shop system is on? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_on "1"
// Shop is on for realism mode? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_realism_on "1"
// How many points players will have after resetting point every round? (works with db_on=0 only)
// -
// Default: "0"
shop_reset_points "0"
// Will clear points every round? 0=OFF, 1=On (works with db_on=0 only)
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_round_clear_on "0"
// Shop is on for scavenger mode? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_scavenger_on "1"
// Enable Soecial functions? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_sf_on "1"
// Open the airstrike shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_airstrike_on "1"
// Open the ammos shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_ammoss_on "1"
// Open the guns shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_guns_on "1"
// Open the infected item shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_infected_item_on "1"
// Where do player respawn after buying infected? 0=Near Survivors, 1=Current location
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_infected_respawn "0"
// Open the main shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_main_on "1"
// Open the ammos shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_medicines_on "1"
// Open the melees shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_melees_on "1"
// Open the others shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_others_on "1"
// Open the rifles shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_riflese_on "1"
// Open the bag? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_sf_bag_on "1"
// Open the ammos shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_sf_on "1"
// Open the permanet shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_sf_permanet_on "1"
// Open the tansfer shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_sf_transfer_on "1"
// Open the trial shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_sf_trial_on "1"
// Open the shotgunsc shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_shotguns_on "1"
// Open the smgs shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_smgs_on "1"
// Open the snupers shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_snipers_on "1"
// Open the throwables shop? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_shop_throwables_on "1"
// Can survivor suicide by !kill? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_suicide_cmd_on "1"
// Shop is on for survival mode? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_survival_on "1"
// Shop is on for team survival mode? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_team_survival_on "1"
// Shop is on for team versus mode? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_team_versus_on "1"
// Percentage of handling fee for each transferring point.
// -
// Default: "20"
// Minimum: "0.000000"
// Maximum: "99.000000"
shop_transfer_handling_fee "20"
// Will notify all players who did transferring? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_transfer_notify_all_on "1"
// l4d2_shop version.
// -
// Default: "v4.5"
shop_version "v4.5"
// Shop is on for versus mode? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_versus_on "1"
Notice:
If you found any bugs, please feel free to let me know.
Pre-Installation:
Nope. (all file included in .zip)
Installation:
Just unzip it to the sourcemod directory.
Translations:- en - pan0s
- zho - pan0s
- chi - pan0s
Contact me:
Steam
Way to add a new SF:
You can refer l4d2_shop_XXXX, XXXX is SF file name.
Spoiler
Step 1:: Add your new SF code before , SF_SIZE.
( file: include\shop_cv.inc)
e.g.:
PHP Code:
// Shop code enum (datatype)
enum
{
AUTO_BHOP
, GRAY_AMMO
, GREEN_AMMO
, BLUE_AMMO
, GOLD_AMMO
, RED_AMMO
, MY_NEW_SF // <--- Your new SF
, SF_SIZE
}
Step 2: Add your new SF function no. to g_sSF.
e.g.:
PHP Code:
// Special functoins
STR g_sSF[][][] =
{ // FunctionNo Trial price permanent price Description FunctionID:
{ "AUTO_BHOP", "30", "300", "buying a SMG"} // 0
, { "GRAY_AMMO", "200", "1000", "buying a gary laser tag"} // 1
, { "GREEN_AMMO", "300", "3000", "buying a green laser tag"} // 2
, { "BLUE_AMMO", "400", "4000", "buying a green laser tag"} // 3
, { "GOLD_AMMO", "600", "6000", "buying a green laser tag"} // 4
, { "RED_AMMO", "999", "9999", "buying a red laser tag"} // 5
, { "MY_NEW_SF", "10", "1000", "buying a my new SF"} // 6 <-- You new SF
};
Step 3: Add native code to the new SF plug-in
PHP Code:
//
....
public Plugin myinfo =
{
name = "Shop SF - China Qing Gong",
author = "pan xiaohai modified by pan0s",
description = "China Qing Gong",
url = "https://forums.alliedmods.net/showthread.php?p=1118287",
version = PLUGIN_VERSION,
}
// ====================================================================================================
// pan0s | Native function call
// ====================================================================================================
#include <shop_fn>
#include <shop_cv>
#include <pan0s>
#define SHOP_LIB "l4d2_shop"
bool g_isShopLoaded;
public void OnPluginEnd()
{
if(LibraryExists(SHOP_LIB) && g_isShopLoaded)
g_isShopLoaded = false;
}
public void OnShopLoaded()
{
if(LibraryExists(SHOP_LIB))
g_isShopLoaded = true;
else
SetFailState("%T", "Module: Error 2", LANG_SERVER);
}
public void OnShopUnloaded()
{
g_isShopLoaded = false;
}
// ====================================================================================================
...
Step 4: Add checking to main code block.
You need to find which function is main on the plugin.
Refer to functions in shop_fn.inc to help you do what you want.)
PHP Code:
public ...
{
if(!Shop_IsSFOn(client, QING_GONG)) return Plugin_Continue; // may return only;
}
Step 5: compile l4d2_shop.sp , all sf sources l4d2_shop_XXXX.sp, and your SF source.
Last step: (Thanks kazya3 for reminding)
Add translation text (l4d2_weapons.phrases.txt):
PHP Code:
"MY_NEW_SF"
{
"en" "MY NEW SF"
}
Ways to add a new Item:
Spoiler
Step 1.
Add the command into the (Find which shop you want to put it into) (find them in shop_cv.inc)
e.g.
PHP Code:
// Shop items ------------------------------------>
...
STR g_sShopMelees[][][] =
{ //item name price Description Melee ID:
{ "katana", "9", "buying a katana"} // 0
...
, { "crowbar", "9", "buying a crowbar"} // 15
, { "you_new_melee", "9", "buying a you_new_melee"} // 16
};
Step 2.
Add translation text (l4d2_weapons.phrases.txt):
PHP Code:
"you_new_melee"
{
"en" "Your New Weapon"
}
Step 3.
If the new item command is not "give", you may need to manually handle it
PHP Code:
if(StrEqual(item, "extinguisher"))
{
CheckHavingGunToUseItem(client, item);
ExternalCmd(client, "sm_giveext", 1);
}
else if(IndexOf(item, 32, "airstrike", 9) != -1)
{
int target = 0;
/* Create an Airstrike. Usage:
// sm_strikes <#userid|name> <type:
1=Aim position.
2=On position>
OR vector position <X> <Y> <Z> <angle>
*/
char crosshair[] = "crosshair";
char position[] = "position";
if(IndexOf(item, 32, crosshair, sizeof(crosshair)) != -1) target = 1;
else if (IndexOf(item, 32, position, sizeof(position)) != -1) target = 2;
ExternalCmd(client, "sm_strikes", target);
}
//<---------- Add an else if(){} here , refer to above. IndexOf(item, 32, "airstrike", 9) != -1 means the item name that has "airstrike", -1 = don't have
else CheatCommand(client, "give", item);
Done.
https://forums.alliedmods.net/showpo...1&postcount=52
https://forums.alliedmods.net/showpo...1&postcount=89
Use pan0s.inc v1.2 to compile all .sp
__________________
Last edited by pan0s; 05-15-2023 at 08:10.
Reason: update version
|
|