Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit f843d5d

Browse files
authored
Add starter weapons (#71)
1 parent 318d109 commit f843d5d

File tree

4 files changed

+57
-12
lines changed

4 files changed

+57
-12
lines changed

cstrike/addons/amxmodx/configs/csdm/config.ini

+8-3
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,13 @@ always_open_menu = 0
103103
; Block default spawn items (usp, glock)
104104
block_default_items = 0
105105

106+
; Starter weapons for players
107+
; Can only put weapons available from Equip Menu
108+
starter_secondary = "weapon_deagle"
109+
starter_primary = "weapon_ak47"
110+
106111
; ========== Auto Items ===========
107-
; Format for autoitems is:
112+
; Format for autoitems is:
108113
; "item_name" "team" "amount|ammo"
109114
; 0 - default amount
110115
; all - any
@@ -122,10 +127,10 @@ weapon_knife "all" 0
122127
; weapon_hegrenade "all" 0
123128
; weapon_deagle "all" 0
124129

125-
; ========== Equip Menu ==========
130+
; ========== Equip Menu ==========
126131
; Format for equip menus is:
127132
; "WeaponName" "Display Name"
128-
; Example:
133+
; Example:
129134
; weapon_m4a1 "Colt M4A1 Carbine"
130135

131136
[secondary]

cstrike/addons/amxmodx/configs/csdm/extraconfigs/_de_dust2.ini

+8-3
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,13 @@ always_open_menu = 0
103103
; Block default spawn items (usp, glock)
104104
block_default_items = 0
105105

106+
; Starter weapons for players
107+
; Can only put weapons available from Equip Menu
108+
starter_secondary = "weapon_deagle"
109+
starter_primary = "weapon_ak47"
110+
106111
; ========== Auto Items ===========
107-
; Format for autoitems is:
112+
; Format for autoitems is:
108113
; "item_name" "team" "amount|ammo"
109114
; 0 - default amount
110115
; all - any
@@ -122,10 +127,10 @@ weapon_knife "all" 0
122127
; weapon_hegrenade "all" 0
123128
; weapon_deagle "all" 0
124129

125-
; ========== Equip Menu ==========
130+
; ========== Equip Menu ==========
126131
; Format for equip menus is:
127132
; "WeaponName" "Display Name"
128-
; Example:
133+
; Example:
129134
; weapon_m4a1 "Colt M4A1 Carbine"
130135

131136
[secondary]

cstrike/addons/amxmodx/configs/csdm/extraconfigs/_prefix_de.ini

+8-3
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,13 @@ always_open_menu = 0
103103
; Block default spawn items (usp, glock)
104104
block_default_items = 0
105105

106+
; Starter weapons for players
107+
; Can only put weapons available from Equip Menu
108+
starter_secondary = "weapon_deagle"
109+
starter_primary = "weapon_ak47"
110+
106111
; ========== Auto Items ===========
107-
; Format for autoitems is:
112+
; Format for autoitems is:
108113
; "item_name" "team" "amount|ammo"
109114
; 0 - default amount
110115
; all - any
@@ -122,10 +127,10 @@ weapon_knife "all" 0
122127
; weapon_hegrenade "all" 0
123128
; weapon_deagle "all" 0
124129

125-
; ========== Equip Menu ==========
130+
; ========== Equip Menu ==========
126131
; Format for equip menus is:
127132
; "WeaponName" "Display Name"
128-
; Example:
133+
; Example:
129134
; weapon_m4a1 "Colt M4A1 Carbine"
130135

131136
[secondary]

cstrike/addons/amxmodx/scripting/CSDM_ReAPI/csdm_equip_manager.sma

+33-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ enum EquipMenu_s
5959

6060
new HookChain:g_hGiveDefaultItems, HookChain:g_hBuyWeaponByWeaponID, HookChain:g_hHasRestrictItem
6161
new Array:g_aArrays[arraylist_e], Trie:g_tCheckItemName
62-
new g_iPreviousSecondary[MAX_CLIENTS + 1] = { 2, ... }, g_iPreviousPrimary[MAX_CLIENTS + 1] = { 1, ... }, bool:g_bOpenMenu[MAX_CLIENTS + 1], bool:g_bAlwaysRandom[MAX_CLIENTS + 1]
62+
new g_iPreviousSecondary[MAX_CLIENTS + 1] = {INVALID_INDEX, ...}, g_iPreviousPrimary[MAX_CLIENTS + 1] = {INVALID_INDEX, ...}, bool:g_bOpenMenu[MAX_CLIENTS + 1], bool:g_bAlwaysRandom[MAX_CLIENTS + 1]
6363
new Float:g_flPlayerBuyTime[MAX_CLIENTS + 1]
6464

6565
new g_iSecondarySection, g_iPrimarySection, g_iBotSecondarySection, g_iBotPrimarySection
@@ -69,6 +69,8 @@ new EquipTypes:g_iEquipMode = EQUIP_MENU, bool:g_bBlockDefaultItems = true
6969
new bool:g_bAlwaysOpenMenu, Float:g_flFreeBuyTime, g_iFreeBuyMoney
7070
new bool:g_bHasMapParameters, mp_maxmoney
7171

72+
new g_szStarterPrimary[20], g_szStarterSecondary[20]
73+
new g_iStarterPrimary = INVALID_INDEX, g_iStarterSecondary = INVALID_INDEX
7274

7375
public plugin_init()
7476
{
@@ -97,6 +99,26 @@ public CSDM_Initialized(const szVersion[])
9799

98100
public plugin_cfg()
99101
{
102+
new eWeaponData[equip_data_s]
103+
104+
for(new i = 0; i < g_iNumPrimary; i++) {
105+
ArrayGetArray(g_aArrays[Primary], i, eWeaponData)
106+
107+
if(equal(g_szStarterPrimary, eWeaponData[szWeaponName])) {
108+
g_iStarterPrimary = i
109+
break
110+
}
111+
}
112+
113+
for(new i = 0; i < g_iNumSecondary; i++) {
114+
ArrayGetArray(g_aArrays[Secondary], i, eWeaponData)
115+
116+
if(equal(g_szStarterSecondary, eWeaponData[szWeaponName])) {
117+
g_iStarterSecondary = i
118+
break
119+
}
120+
}
121+
100122
CheckForwards()
101123
}
102124

@@ -180,8 +202,8 @@ public CSDM_RestartRound(const bool:bNewGame)
180202

181203
public client_putinserver(pPlayer)
182204
{
183-
g_iPreviousSecondary[pPlayer] = 2
184-
g_iPreviousPrimary[pPlayer] = 1
205+
g_iPreviousSecondary[pPlayer] = g_iStarterSecondary
206+
g_iPreviousPrimary[pPlayer] = g_iStarterPrimary
185207
g_bOpenMenu[pPlayer] = false
186208
g_bAlwaysRandom[pPlayer] = false
187209
g_flPlayerBuyTime[pPlayer] = 0.0
@@ -453,6 +475,14 @@ public ReadCfg_Settings(const szLineData[], const iSectionID)
453475
{
454476
g_bBlockDefaultItems = bool:(str_to_num(szValue))
455477
}
478+
else if(equali(szKey, "starter_primary"))
479+
{
480+
copy(g_szStarterPrimary, charsmax(g_szStarterPrimary), szValue)
481+
}
482+
else if(equali(szKey, "starter_secondary"))
483+
{
484+
copy(g_szStarterSecondary, charsmax(g_szStarterSecondary), szValue)
485+
}
456486
}
457487
}
458488

0 commit comments

Comments
 (0)