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 153x3b0o4az7l dodana przez dasiek, 19.10.2013 09:30
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. 204. 205. 206. 207. 208. 209. 210. 211. 212.
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
new g_bwEnt[33]
#define PLUG_NAME "HATS"
#define PLUG_AUTH "SgtBane"
#define PLUG_VERS "0.2"
#define PLUG_TAG "HATS"
#define menusize 220
new HatFile[64]
new MenuPages, TotalHats
new CurrentMenu[33]
#define MAX_HATS 64
new HATMDL[MAX_HATS][41]
new HATNAME[MAX_HATS][41]
public plugin_init()
{
register_plugin(PLUG_NAME, PLUG_VERS, PLUG_AUTH)
register_concmd("amx_givehat", "Give_Hat", ADMIN_RCON, "<nick> <mdl #>")
register_concmd("amx_removehats", "Remove_Hat", ADMIN_RCON, " - Usun czapki kazdemu.")
register_menucmd(register_menuid("Menu: [Strona"),(1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9),"MenuCommand")
register_clcmd("say /czapki", "ShowMenu", -1, "Shows Knife menu")
}
public ShowMenu(id)
{
CurrentMenu[id] = 1
ShowHats(id)
return PLUGIN_HANDLED
}
public ShowHats(id)
{
new keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)
new szMenuBody[menusize + 1], WpnID
new nLen = format(szMenuBody, menusize, "Menu: [Strona %i/%i]^n",CurrentMenu[id],MenuPages)
// Get Hat Names And Add Them To The List
for (new hatid=0; hatid < 8; hatid++) {
WpnID = ((CurrentMenu[id] * 8) + hatid - 8)
if (WpnID < TotalHats) {
nLen += format(szMenuBody[nLen], menusize-nLen, "^n %i. %s",hatid + 1,HATNAME[WpnID])
}
}
// Next Page And Previous/Close
if (CurrentMenu[id] == MenuPages) {
nLen += format(szMenuBody[nLen], menusize-nLen, "^n^n9. Nastepna Strona")
} else {
nLen += format(szMenuBody[nLen], menusize-nLen, "^n^n9. Nastepna Strona")
}
if (CurrentMenu[id] > 1) {
nLen += format(szMenuBody[nLen], menusize-nLen, "^n . Poprzednia Strona")
} else {
nLen += format(szMenuBody[nLen], menusize-nLen, "^n . Zamknij")
}
show_menu(id, keys, szMenuBody, -1)
return PLUGIN_HANDLED
}
public MenuCommand(id, key)
{
switch(key)
{
case 8: //9 - [Next Page]
{
if (CurrentMenu[id] < MenuPages) CurrentMenu[id]++
ShowHats(id)
return PLUGIN_HANDLED
}
case 9: //0 - [Close]
{
CurrentMenu[id]--
if (CurrentMenu[id] > 0) ShowHats(id)
return PLUGIN_HANDLED
}
default:
{
new HatID = ((CurrentMenu[id] * 8) + key - 8)
if (HatID < TotalHats) {
Set_Hat(id,HatID,id)
}
}
}
return PLUGIN_HANDLED
}
public plugin_precache()
{
new cfgDir[32]
get_configsdir(cfgDir,31)
formatex(HatFile,63,"%s/HatList2.ini",cfgDir)
command_load()
for (new i = 1; i < TotalHats; ++i) {
if (file_exists (HATMDL[i])) {
precache_model(HATMDL[i])
server_print("[%s] Precached %s",PLUG_TAG,HATMDL[i])
} else {
server_print("[%s] Failed to precache %s",PLUG_TAG,HATMDL[i])
}
}
}
public client_connect(id)
{
if(g_bwEnt[id] > 0) engfunc(EngFunc_RemoveEntity,g_bwEnt[id])
g_bwEnt[id] = 0
}
public client_disconnect(id)
{
if(g_bwEnt[id] > 0) engfunc(EngFunc_RemoveEntity,g_bwEnt[id])
g_bwEnt[id] = 0
}
public Give_Hat(id)
{
new smodelnum[5], name[32]
read_argv(1,name,31)
read_argv(2,smodelnum,4)
new player = cmd_target(id,name,2)
if (!player) {
client_print(id,print_chat,"[%s] Player With That Name Does Not Exist.",PLUG_TAG)
return PLUGIN_HANDLED
}
new imodelnum = (str_to_num(smodelnum))
if (imodelnum > MAX_HATS) return PLUGIN_HANDLED
Set_Hat(player,imodelnum,id)
return PLUGIN_CONTINUE
}
public Remove_Hat(id)
{
for (new i = 0; i < get_maxplayers(); ++i) {
if (is_user_connected(i) && g_bwEnt[i] > 0) {
engfunc(EngFunc_RemoveEntity,g_bwEnt[i])
g_bwEnt[i] = 0
}
}
client_print(id,print_chat,"[%s] Usunieto wszystkim czapki.",PLUG_TAG)
return PLUGIN_CONTINUE
}
public Set_Hat(player,imodelnum,targeter)
{
new name[32]
get_user_name(player, name, 31)
if (imodelnum == 0) {
if(g_bwEnt[player] > 0) engfunc(EngFunc_RemoveEntity,g_bwEnt[player])
g_bwEnt[player] = 0
client_print(targeter, print_chat, "[%s] Czapka zostala usunieta %s",PLUG_TAG,name)
} else if (file_exists(HATMDL[imodelnum])) {
if(g_bwEnt[player] < 1) {
g_bwEnt[player] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
if(g_bwEnt[player] > 0)
{
set_pev(g_bwEnt[player], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_bwEnt[player], pev_aiment, player)
set_pev(g_bwEnt[player], pev_rendermode, kRenderNormal)
set_pev(g_bwEnt[player], pev_renderamt, 0.0)
engfunc(EngFunc_SetModel, g_bwEnt[player], HATMDL[imodelnum])
}
} else {
engfunc(EngFunc_SetModel, g_bwEnt[player], HATMDL[imodelnum])
}
client_print(targeter, print_chat, "[%s] %s ustawil sobie czapke %s ",PLUG_TAG,HATNAME[imodelnum],name)
}
}
public command_load()
{
if(file_exists(HatFile)) {
HATMDL[0] = ""
HATNAME[0] = "None"
TotalHats = 1
new sfLineData[128]
new file = fopen(HatFile,"rt")
while(file && !feof(file)) {
fgets(file,sfLineData,127)
// Skip Comment and Empty Lines
if (containi(sfLineData,";") > -1) continue
// BREAK IT UP!
parse(sfLineData, HATMDL[TotalHats],40,HATNAME[TotalHats],40)
TotalHats += 1
if(TotalHats >= MAX_HATS) {
server_print("[%s] Limit Czapek",PLUG_TAG)
break
}
}
if(file) fclose(file)
}
MenuPages = floatround((TotalHats / 8.0), floatround_ceil)
server_print("[%s] Zaladowano %i czapek, utworzono %i stron)",PLUG_TAG,TotalHats,MenuPages)
}
/* 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


