Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
Wklejka w1pgtlhd9t2q dodana przez MaxiKINGer, 15.07.2013 19:21
z include
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203.
/***************************************************
Cvar: amx_knifeonly_time okresla przez jaki czas
nie mozemy podniesc/kupic/uzyc jakiejkolwiek broni
poza nozem i C4. Jezeli przyjmuje wartosc <=0.0
to brana jest pod uwage wartosc cvar'a mp_freezetime
1.0 - wersja poczatkowa
1.1 - zmiana spobu metody uzywanej do broni: hamsandwich -> fakemeta
***************************************************/
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>
new bool: gCan_pickup[33]
new bool: gIn_game[33]
new pcTime, pcFreez
new Float: gAlowtime
public plugin_init()
{
register_plugin("Only Knife At Start", "1.1", "Pavulon")
pcFreez = get_cvar_pointer("mp_freezetime")
pcTime = register_cvar("amx_knifeonly_time", "0.0")
RegisterHam(Ham_Spawn,"player","pre_player_spawn",0)
register_event("WeapPickup","event_weappickup","be")
register_event("CurWeapon","event_curweapon","be", "1=1")
register_event("DeathMsg","event_deathmsg","a")
}
public plugin_cfg()
{
gAlowtime = get_pcvar_float(pcTime)
if (gAlowtime<=0.0)
gAlowtime = get_pcvar_float(pcFreez)
}
public client_putinserver(id)
{
gCan_pickup[id] = false
gIn_game[id] = false
}
public client_disconnect(id)
{
gIn_game[id] = false
gCan_pickup[id] = false
}
public pre_player_spawn(id)
{
gCan_pickup[id] = false
if (task_exists(id))
remove_task(id)
set_task(gAlowtime, "allow_pickup", id)
if (gIn_game[id])
strip_prev(id)
gIn_game[id] = true
return HAM_IGNORED
}
public event_deathmsg()
{
gCan_pickup[read_data(2)] = false
}
public allow_pickup(id)
{
gCan_pickup[id] = true
}
public event_curweapon(id)
{
if (gCan_pickup[id]) return PLUGIN_HANDLED
new wId = read_data(2)
if (wId==6 || wId==29) return PLUGIN_HANDLED
new task_array[2]
task_array[0] = id
task_array[1] = wId
set_task(0.05,"strip_weapon",_ , task_array, 2)
return PLUGIN_HANDLED
}
public event_weappickup(id)
{
if (gCan_pickup[id]) return PLUGIN_HANDLED
new wId = read_data(1)
if (wId==6 || wId==29) return PLUGIN_HANDLED
new task_array[2]
task_array[0] = id
task_array[1] = wId
set_task(0.05,"strip_weapon",_ , task_array, 2)
return PLUGIN_HANDLED
}
public strip_weapon(task_array[2])
{
new id = task_array[0]
if(!is_user_connected(id)) return
fm_strip_user_gun(id, task_array[1])
//ham_strip_weapon(id, task_array[1])
}
stock strip_prev(id)
{
new Weapons[32]
new numWeapons, i, wId
get_user_weapons(id, Weapons, numWeapons)
for (i=0; i<numWeapons; i++)
{
wId = Weapons[i]
if (wId==CSW_KNIFE || wId==CSW_C4)
continue
fm_strip_user_gun(id, wId)
//ham_strip_weapon(id, wId)
}
if(get_user_team(id)==1){
engclient_cmd(id, "weapon_knife")
}
if(get_user_team(id)==2){
give_item(id, "weapon_deagle");
}
}
stock bool:fm_strip_user_gun(index, weapon)
{
new ent_class[32];
new clip, ammo;
if (!weapon && !(weapon = get_user_weapon(index, clip, ammo)))
return false;
get_weaponname(weapon, ent_class, sizeof ent_class - 1);
new ent_weap
while ((ent_weap = engfunc(EngFunc_FindEntityByString, ent_weap, "classname", ent_class)) && pev(ent_weap, pev_owner) != index) {}
if (!ent_weap)
return false;
if (weapon == CSW_SMOKEGRENADE || weapon == CSW_FLASHBANG || weapon == CSW_HEGRENADE) {
set_pev(index, pev_weapons,pev(index, pev_weapons) & ~(1<<weapon))
cs_set_user_bpammo(index,weapon,0)
} else {
engclient_cmd(index, "drop", ent_class);
new ent_box = pev(ent_weap, pev_owner);
if (!ent_box || ent_box == index)
return false;
dllfunc(DLLFunc_Think, ent_box);
}
return true;
}
/*stock ham_strip_weapon(id, wId)
{
new weapon[20]
get_weaponname (wId, weapon, 19)
if(!equal(weapon,"weapon_",7)) return 0
new wEnt
while((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
if(!wEnt) return 0
if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt)
if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0
ExecuteHamB(Ham_Item_Kill,wEnt)
set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId))
if (wId == CSW_SMOKEGRENADE || wId == CSW_FLASHBANG || wId == CSW_HEGRENADE)
cs_set_user_bpammo(id,wId,0)
client_print(0, print_chat, "HamStrip")
return 1
}*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{ rtf1 ansi deff0{ fonttbl{ f0 fnil Tahoma;}}n viewkind4 uc1 pard lang1045 f0 fs16 n par }
*/
Dodanych wklejek: 15354
Powered By (Pav32) Pastebin © 2011


Dodatki SourceMod


