hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.28. 16:49



Jelenlévő felhasználók

Jelenleg 218 felhasználó van jelen :: 0 regisztrált, 0 rejtett és 218 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: nincs regisztrált felhasználó az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: botok
HozzászólásElküldve: 2014.04.28. 07:14 
Offline
Senior Tag
Avatar

Csatlakozott: 2013.11.12. 16:39
Hozzászólások: 258
Megköszönt másnak: 87 alkalommal
Megköszönték neki: 2 alkalommal
Sziasztok... nekem olyan plugin kell ami a bot nézőben van és ne menjen el map váltáskor pl:amxx_addfake ez nincs ott map váltáskor

_________________
Nem szégyen megköszönni :)

'The dictator is coming' :D


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: botok
HozzászólásElküldve: 2014.04.28. 09:30 
Offline
Felfüggesztve
Avatar

Csatlakozott: 2013.06.09. 18:47
Hozzászólások: 2004
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 220 alkalommal
Üdv!

Ez tökéletesen működik, nekem is ez van fent.
Forráskód:

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #include <cstrike>
  5. #include <fun>
  6.  
  7. new const Plugin[] = "FakeFull Original"
  8. new const Version[] = "1.7.6"
  9. new const Author[] = "JTP10181/Freecode/AssKicR"
  10.  
  11. #define MAX_NAMES 256
  12.  
  13. new bool:is_user_ffbot[33]
  14. new bool:checkingStatus = false
  15. new bool:changingBots = false
  16. new botCount = 0, namesread = 0
  17. new namesToUse[MAX_NAMES][33]
  18. new pDelay, pAuto, pPlayers
  19.  
  20. public plugin_init()
  21. {
  22. register_plugin(Plugin,Version,Author)
  23. pAuto = register_cvar("ff_automode","0")
  24. pPlayers = register_cvar("ff_players","2")
  25. pDelay = register_cvar("ff_delay","1")
  26. register_concmd("amx_addfake","botadd",ADMIN_BAN,"<# | @FILL> - add this many bots")
  27. register_concmd("amx_removefake","botremove",ADMIN_BAN,"<# | @ALL> - remove this many bots")
  28. set_task(10.0,"ServerStatus",0,_,_,"b")
  29. ReadNames()
  30.  
  31. //Setup jtp10181 CVAR
  32. new cvarString[256], shortName[16]
  33. copy(shortName,15,"ff")
  34.  
  35. register_cvar("jtp10181","",FCVAR_SERVER|FCVAR_SPONLY)
  36. get_cvar_string("jtp10181",cvarString,255)
  37.  
  38. if (strlen(cvarString) == 0) {
  39. formatex(cvarString,255,shortName)
  40. set_cvar_string("jtp10181",cvarString)
  41. }
  42. else if (contain(cvarString,shortName) == -1) {
  43. format(cvarString,255,"%s,%s",cvarString, shortName)
  44. set_cvar_string("jtp10181",cvarString)
  45. }
  46. }
  47.  
  48. public plugin_natives()
  49. {
  50. set_module_filter("module_filter")
  51. set_native_filter("native_filter")
  52. }
  53.  
  54. public module_filter(const module[])
  55. {
  56. if (!cstrike_running() && equali(module, "cstrike")) {
  57. return PLUGIN_HANDLED
  58. }
  59.  
  60. return PLUGIN_CONTINUE
  61. }
  62.  
  63. public native_filter(const name[], index, trap)
  64. {
  65. if (!trap) return PLUGIN_HANDLED
  66.  
  67. return PLUGIN_CONTINUE
  68. }
  69.  
  70. public botadd(id,level,cid)
  71. {
  72. if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
  73.  
  74. new arg[10], botNum
  75.  
  76. if (read_argc() == 1) botNum = 1
  77. else {
  78. read_argv(1,arg,9)
  79. if (equali(arg,"@FILL")) botNum = get_maxplayers() - get_playersnum(1)
  80. else botNum = str_to_num(arg)
  81. }
  82.  
  83. if (botNum <=0 || botNum > get_maxplayers() - get_playersnum(1)) {
  84. console_print(id,"[AMXX] Invalid number of bots to add")
  85. return PLUGIN_HANDLED
  86. }
  87.  
  88. new Float:botDelay = get_pcvar_float(pDelay)
  89. console_print(id,"[AMXX] Adding %d bots with %.1f second delay for each",botNum,botDelay)
  90. set_task(botDelay,"createBot",0,_,_,"a",botNum)
  91. set_task(botDelay * (botNum + 1),"doneChanging")
  92. changingBots = true
  93.  
  94. return PLUGIN_HANDLED
  95. }
  96.  
  97. public botremove(id,level,cid)
  98. {
  99. if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
  100.  
  101. new arg[10], botNum
  102.  
  103. if (read_argc() == 1) botNum = 1
  104.  
  105. else {
  106. read_argv(1,arg,9)
  107. if (equali(arg,"@ALL")) botNum = botCount
  108. else botNum = str_to_num(arg)
  109. }
  110.  
  111. if (botNum <=0 || botNum > botCount) {
  112. console_print(id,"[AMXX] Invalid number of bots to remove")
  113. return PLUGIN_HANDLED
  114. }
  115.  
  116. new Float:botDelay = get_pcvar_float(pDelay)
  117. console_print(id,"[AMXX] Removing %d bots with %.1f second delay for each",botNum,botDelay)
  118. set_task(botDelay,"removeBot",0,_,_,"a",botNum)
  119. set_task(botDelay * (botNum + 1),"doneChanging")
  120. changingBots = true
  121.  
  122. return PLUGIN_HANDLED
  123. }
  124.  
  125. public client_putinserver(id)
  126. {
  127. //Don't want anyone going invisible on us
  128. set_pev(id, pev_rendermode, kRenderNormal)
  129.  
  130. is_user_ffbot[id] = false
  131. ServerStatus()
  132. }
  133.  
  134. public client_disconnect(id)
  135. {
  136. is_user_ffbot[id] = false
  137. ServerStatus()
  138. }
  139.  
  140. public createBot()
  141. {
  142. new bool:UseAnotherName
  143. new BotName[33], UserNames[33][33]
  144. new name_rand = random_num(0,namesread - 1)
  145. new endLoop = name_rand - 1
  146. if (endLoop < 0) endLoop = namesread - 1
  147.  
  148. //Save all the usernames so we dont have to keep getting them all
  149. for (new x = 1; x <= 32; x++) {
  150. if (!is_user_connected(x)) continue
  151. get_user_name(x,UserNames[x],32)
  152. }
  153.  
  154. do {
  155. UseAnotherName = false
  156. copy(BotName,32,namesToUse[name_rand])
  157.  
  158. for (new id = 1; id <= 32; id++) {
  159.  
  160. if (!is_user_connected(id)) continue
  161.  
  162. if (equali(BotName,UserNames[id])) {
  163. UseAnotherName = true
  164.  
  165. if (name_rand == endLoop) {
  166. UseAnotherName = false
  167. log_amx("ERROR: Ran out of names to use, please add more to botnames.ini")
  168. }
  169.  
  170. name_rand++
  171. if (name_rand > namesread - 1) {
  172. name_rand = 0
  173. }
  174. break
  175. }
  176. }
  177. } while(UseAnotherName)
  178.  
  179. new Bot = engfunc(EngFunc_CreateFakeClient, BotName)
  180.  
  181. if (Bot > 0) {
  182. //Supposed to prevent crashes?
  183. dllfunc(MetaFunc_CallGameEntity, "player", Bot)
  184. set_pev(Bot, pev_flags, FL_FAKECLIENT)
  185.  
  186. //Make Sure they have no model
  187. set_pev(Bot, pev_model, "")
  188. set_pev(Bot, pev_viewmodel2, "")
  189. set_pev(Bot, pev_modelindex, 0)
  190.  
  191. //Make them invisible for good measure
  192. set_pev(Bot, pev_renderfx, kRenderFxNone)
  193. set_pev(Bot, pev_rendermode, kRenderTransAlpha)
  194. set_pev(Bot, pev_renderamt, 0.0)
  195.  
  196. //Set the team if we need to for this mod
  197. set_team(Bot)
  198.  
  199. is_user_ffbot[Bot] = true
  200. botCount++
  201. }
  202. }
  203.  
  204. public removeBot()
  205. {
  206. for(new id = 1; id <= 32; id++) {
  207. if (is_user_ffbot[id]) {
  208. server_cmd("kick #%d",get_user_userid(id))
  209. is_user_ffbot[id] = false
  210. botCount--
  211. return
  212. }
  213. }
  214. }
  215.  
  216. public doneChanging()
  217. {
  218. changingBots = false
  219. }
  220.  
  221. public ServerStatus()
  222. {
  223. if ( !get_pcvar_num(pAuto) ) return
  224. if ( checkingStatus || changingBots ) return
  225.  
  226. checkingStatus = true
  227. new rnd
  228.  
  229. if (botCount > 0) {
  230. for (new id = 1; id <= 32; id++) {
  231.  
  232. if (!is_user_connected(id)) continue
  233. if (!is_user_ffbot[id]) continue
  234. rnd = random_num(1,100)
  235. if (rnd <= 10) {
  236. set_user_frags(id,get_user_frags(id) + 1)
  237. }
  238.  
  239. //Set the team if we need to for this mod
  240. set_team(id)
  241.  
  242. if (get_user_team(id) > 0) {
  243. server_cmd("kick #%d",get_user_userid(id))
  244. is_user_ffbot[id] = false
  245. botCount--
  246. }
  247. }
  248. }
  249.  
  250. new pnum = get_playersnum(1)
  251. new maxplayers = get_maxplayers()
  252. new ff_players = get_pcvar_num(pPlayers)
  253. new Float:botDelay = get_pcvar_float(pDelay)
  254.  
  255. if (ff_players > maxplayers - 2) {
  256. ff_players = maxplayers - 2
  257. set_pcvar_num(pPlayers, ff_players)
  258. }
  259.  
  260. if (botDelay <= 0.0 ) {
  261. log_amx("ERROR: Please set ff_delay to a number higher than 0")
  262. }
  263.  
  264. else if (ff_players > pnum) {
  265. new addnum = ff_players - pnum
  266. set_task(botDelay,"createBot",0,_,_,"a",addnum)
  267. set_task(botDelay * (addnum + 1),"doneChanging")
  268. changingBots = true
  269. }
  270.  
  271. else if (ff_players < pnum) {
  272. new removenum = pnum - ff_players
  273. removenum = min(removenum, botCount)
  274.  
  275. if (removenum > 0) {
  276. set_task(botDelay,"removeBot",0,_,_,"a",removenum)
  277. set_task(botDelay * (removenum + 1),"doneChanging")
  278. changingBots = true
  279. }
  280. }
  281.  
  282. checkingStatus = false
  283. }
  284.  
  285. public set_team(BotID)
  286. {
  287. if (cstrike_running()) {
  288. cs_set_user_team(BotID, CS_TEAM_UNASSIGNED)
  289. }
  290. }
  291.  
  292. public ReadNames() {
  293.  
  294. new botnames_file[128]
  295. get_configsdir(botnames_file, 63)
  296. format(botnames_file,127,"%s/botnames.txt",botnames_file)
  297.  
  298. new botnames = fopen(botnames_file,"r")
  299.  
  300. if (botnames) {
  301. new data[35]
  302.  
  303. while(!feof(botnames)) {
  304.  
  305. if (namesread >= MAX_NAMES) {
  306. log_amx("MAX_NAMES exceeded, not all fake client names were able to load")
  307. break
  308. }
  309.  
  310. fgets(botnames, data, 34)
  311. trim(data)
  312.  
  313. new len = strlen(data)
  314. if (len <= 0) return
  315. if (data[len]-1 == '^n') data[--len] = 0
  316.  
  317. if (equal(data,"") || equal(data,"#",1)) continue
  318.  
  319. copy(namesToUse[namesread],32,data)
  320. namesread++
  321. }
  322.  
  323. fclose(botnames)
  324. }
  325. else {
  326. new failmsg[128]
  327. formatex(failmsg,128,"Unable to read file ^"%s^", it is required to load bot names from", botnames_file)
  328. log_amx(failmsg)
  329. set_fail_state(failmsg)
  330. }
  331. }


Telepítés:

1, Alakítsd át az SMA -t, AMXX -é, majd másold fel FTP -re, a plugins mappába.
2, configs mappa, és azon belül plugins.ini -be írd be a plugin nevét.
3, Maradunk a configs mappán belül, és feltöltjük a botnames.txt -t is, ugyan is itt fogjuk tudni megadni a botok nevét. DOWNLOAD

Mapváltás után NEM tűnik el a bot.
Tesztelve, működik!


Charlie224 írta:
Sziasztok... nekem olyan plugin kell ami a bot nézőben van és ne menjen el map váltáskor pl:amxx_addfake ez nincs ott map váltáskor

_________________
Ha elnyerte valamelyik témában a hozzászólásom a tetszésedet melyet olvastál, akkor egy egyszerű gombnyomással kifejezheted, hogy tetszett.

Ők köszönték meg Anonymous1337 nek ezt a hozzászólást (összesen 2): Charlie224 (2014.04.28. 12:56) • DecToR (2015.12.22. 08:29)
  Népszerűség: 4.55%


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 2 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 14 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole