hlmod.hu

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



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: Bing [Bot] 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: Pluginok szüneteltetése joggal
HozzászólásElküldve: 2014.03.19. 21:15 
Offline
Tud valamit

Csatlakozott: 2012.04.16. 22:32
Hozzászólások: 104
Megköszönt másnak: 14 alkalommal
Megköszönték neki: 10 alkalommal
Sziasztok!
Egy olyan pluginra lenne szükségem, ami a pausecfg plugint jogra engedi. Mindegy hogyan oldjátok meg, csak valamilyen mód legyen rá, hogy csak az az ember tudjon plugint szüneteltetni akit én akarok. Ez lehet ID-s, lehet jog-os bármi:)
Köszi szépen:))

_________________
Ha segítettem: Kép

Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Pluginok szüneteltetése joggal
HozzászólásElküldve: 2014.03.20. 04:06 
Offline
Őskövület
Avatar

Csatlakozott: 2011.12.28. 00:35
Hozzászólások: 2736
Megköszönt másnak: 56 alkalommal
Megköszönték neki: 275 alkalommal
White#Angel írta:
Sziasztok!
Egy olyan pluginra lenne szükségem, ami a pausecfg plugint jogra engedi. Mindegy hogyan oldjátok meg, csak valamilyen mód legyen rá, hogy csak az az ember tudjon plugint szüneteltetni akit én akarok. Ez lehet ID-s, lehet jog-os bármi:)
Köszi szépen:))


Szia!
Alapból jogra van a pausecfg plugin!
Mondjuk én átírtam a jogot.
ADMIN_RESERVATION = "a" jog.
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. // Uncomment if you want to have two new commands
  5. // amx_off - pause plugins not marked as unpauseable
  6. // amx_on - enable plugins not marked as unpauseable
  7. #define DIRECT_ONOFF
  8.  
  9. #define MAX_SYSTEM 32
  10.  
  11. new g_menuPos[33]
  12. new g_fileToSave[64]
  13. new g_coloredMenus
  14. new g_Modified
  15. new g_addCmd[] = "amx_pausecfg add ^"%s^""
  16. new g_system[MAX_SYSTEM]
  17. new g_systemNum
  18.  
  19. public plugin_init()
  20. {
  21. register_plugin("Pause Plugins", AMXX_VERSION_STR, "AMXX Dev Team")
  22. register_dictionary("pausecfg.txt")
  23. register_dictionary("common.txt")
  24. register_dictionary("admincmd.txt")
  25.  
  26. register_concmd("amx_pausecfg", "cmdPlugin", ADMIN_RESERVATION,"- list commands for pause/unpause management")
  27. register_clcmd("amx_pausecfgmenu", "cmdMenu", ADMIN_RESERVATION, "- pause/unpause plugins with menu")
  28. #if defined DIRECT_ONOFF
  29. register_concmd("amx_off", "cmdOFF", ADMIN_RESERVATION, "- pauses some plugins")
  30. register_concmd("amx_on", "cmdON", ADMIN_RESERVATION, "- unpauses some plugins")
  31. #endif
  32. register_menucmd(register_menuid("Pause/Unpause Plugins"), 1023, "actionMenu")
  33.  
  34. g_coloredMenus = colored_menus()
  35. get_configsdir(g_fileToSave, 63);
  36. format(g_fileToSave, 63, "%s/pausecfg.ini", g_fileToSave);
  37.  
  38. return PLUGIN_CONTINUE
  39. }
  40.  
  41. #if defined DIRECT_ONOFF
  42. public cmdOFF(id, level, cid)
  43. {
  44. if (cmd_access(id, level, cid, 1))
  45. pausePlugins(id)
  46.  
  47. return PLUGIN_HANDLED
  48. }
  49.  
  50. public cmdON(id, level, cid)
  51. {
  52. if (cmd_access(id, level, cid, 1))
  53. unpausePlugins(id)
  54.  
  55. return PLUGIN_HANDLED
  56. }
  57. #endif
  58.  
  59. public plugin_cfg()
  60. {
  61. loadSettings(g_fileToSave)
  62.  
  63. // Put here titles of plugins which you don't want to pause
  64. server_cmd(g_addCmd, "Admin Base")
  65. server_cmd(g_addCmd, "Admin Base (SQL)")
  66. server_cmd(g_addCmd, "Pause Plugins")
  67. server_cmd(g_addCmd, "TimeLeft")
  68. server_cmd(g_addCmd, "NextMap")
  69. server_cmd(g_addCmd, "Slots Reservation")
  70. }
  71.  
  72. public actionMenu(id, key)
  73. {
  74. switch (key)
  75. {
  76. case 6:
  77. {
  78. if (file_exists(g_fileToSave))
  79. {
  80. delete_file(g_fileToSave)
  81. client_print(id, print_chat, "* %L", id, "PAUSE_CONF_CLEARED")
  82. }
  83. else
  84. client_print(id, print_chat, "* %L", id, "PAUSE_ALR_CLEARED")
  85.  
  86. displayMenu(id, g_menuPos[id])
  87. }
  88. case 7:
  89. {
  90. if (saveSettings(g_fileToSave))
  91. {
  92. g_Modified = 0
  93. client_print(id, print_chat, "* %L", id, "PAUSE_CONF_SAVED")
  94. }
  95. else
  96. client_print(id, print_chat, "* %L", id, "PAUSE_SAVE_FAILED")
  97.  
  98. displayMenu(id, g_menuPos[id])
  99. }
  100. case 8: displayMenu(id, ++g_menuPos[id])
  101. case 9: displayMenu(id, --g_menuPos[id])
  102. default:
  103. {
  104. new option = g_menuPos[id] * 6 + key
  105. new file[32], status[2]
  106.  
  107. get_plugin(option, file, 31, status, 0, status, 0, status, 0, status, 1)
  108.  
  109. switch (status[0])
  110. {
  111. // "running"
  112. case 'r': pause("ac", file)
  113.  
  114. // "debug"
  115. case 'd': pause("ac", file)
  116.  
  117. // "paused"
  118. case 'p':
  119. {
  120. g_Modified = 1
  121. unpause("ac", file)
  122. }
  123.  
  124. // "stopped"
  125. case 's':
  126. {
  127. client_print(id, print_chat, "%L", id, "CANT_UNPAUSE_PLUGIN", file);
  128. }
  129. }
  130.  
  131. displayMenu(id, g_menuPos[id])
  132. }
  133. }
  134.  
  135. return PLUGIN_HANDLED
  136. }
  137.  
  138. getStatus(id, code, &statusCode, lStatus[], lLen)
  139. {
  140. switch (code)
  141. {
  142. // "running"
  143. case 'r':
  144. {
  145. statusCode = 'O'
  146. format(lStatus, lLen, "%L", id, "ON")
  147. }
  148.  
  149. // "debug"
  150. case 'd':
  151. {
  152. statusCode = 'O'
  153. format(lStatus, lLen, "%L", id, "ON")
  154. }
  155.  
  156. // "stopped"
  157. case 's':
  158. {
  159. statusCode = 'S'
  160. format(lStatus, lLen, "%L", id, "STOPPED")
  161. }
  162.  
  163. // "paused"
  164. case 'p':
  165. {
  166. statusCode = 'O'
  167. format(lStatus, lLen, "%L", id, "OFF")
  168. }
  169.  
  170. // "bad load"
  171. case 'b':
  172. {
  173. statusCode = 'E'
  174. format(lStatus, lLen, "%L", id, "ERROR")
  175. }
  176. default:
  177. {
  178. statusCode = 'L'
  179. format(lStatus, lLen, "%L", id, "LOCKED")
  180. }
  181. }
  182. }
  183.  
  184. isSystem(id)
  185. {
  186. for (new a = 0; a < g_systemNum; ++a)
  187. if (g_system[a] == id)
  188. return 1
  189. return 0
  190. }
  191.  
  192. displayMenu(id, pos)
  193. {
  194. if (pos < 0) return
  195.  
  196. new filename[32], title[32], status[8], statusCode
  197. new datanum = get_pluginsnum()
  198. new menu_body[512], start = pos * 6, k = 0
  199.  
  200. if (start >= datanum)
  201. start = pos = g_menuPos[id] = 0
  202.  
  203. new len = format(menu_body, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "PAUSE_UNPAUSE", pos + 1, ((datanum / 6) + ((datanum % 6) ? 1 : 0)))
  204. new end = start + 6, keys = MENU_KEY_0|MENU_KEY_8|MENU_KEY_7
  205.  
  206. if (end > datanum)
  207. end = datanum
  208.  
  209. for (new a = start; a < end; ++a)
  210. {
  211. get_plugin(a, filename, 31, title, 31, status, 0, status, 0, status, 1)
  212. getStatus(id, status[0], statusCode, status, 7)
  213.  
  214. if (isSystem(a) || (statusCode != 'O' && statusCode != 'S'))
  215. {
  216. if (g_coloredMenus)
  217. {
  218. len += format(menu_body[len], 511-len, "\d%d. %s\R%s^n\w", ++k, title, status)
  219. } else {
  220. ++k
  221. len += format(menu_body[len], 511-len, "#. %s %s^n", title, status)
  222. }
  223. } else {
  224. keys |= (1<<k)
  225. len += format(menu_body[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++k, title, status)
  226. }
  227. }
  228.  
  229. len += format(menu_body[len], 511-len, "^n7. %L^n", id, "CLEAR_PAUSED")
  230. len += format(menu_body[len], 511-len, g_coloredMenus ? "8. %L \y\R%s^n\w" : "8. %L %s^n", id, "SAVE_PAUSED", g_Modified ? "*" : "")
  231.  
  232. if (end != datanum)
  233. {
  234. format(menu_body[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  235. keys |= MENU_KEY_9
  236. }
  237. else
  238. format(menu_body[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  239.  
  240. show_menu(id, keys, menu_body, -1, "Pause/Unpause Plugins")
  241. }
  242.  
  243. public cmdMenu(id, level, cid)
  244. {
  245. if (cmd_access(id, level, cid, 1))
  246. displayMenu(id, g_menuPos[id] = 0)
  247.  
  248. return PLUGIN_HANDLED
  249. }
  250.  
  251. pausePlugins(id)
  252. {
  253. new filename[32], title[32], status[2]
  254. new count = 0, imax = get_pluginsnum()
  255.  
  256. for (new a = 0; a < imax; ++a)
  257. {
  258. get_plugin(a, filename, 31, title, 31, status, 0, status, 0, status, 1)
  259.  
  260. if (!isSystem(a) && status[0] == 'r' && pause("ac", filename))
  261. {
  262. //console_print(id, "Pausing %s (file ^"%s^")", title, filename)
  263. ++count
  264. }
  265. }
  266.  
  267. console_print(id, "%L", id, (count == 1) ? "PAUSED_PLUGIN" : "PAUSED_PLUGINS", count)
  268. }
  269.  
  270. unpausePlugins(id)
  271. {
  272. new filename[32], title[32], status[2]
  273. new count = 0, imax = get_pluginsnum()
  274.  
  275. for (new a = 0; a < imax; ++a)
  276. {
  277. get_plugin(a, filename, 31, title, 31, status, 0, status, 0, status, 1)
  278.  
  279. if (!isSystem(a) && status[0] == 'p' && unpause("ac", filename))
  280. {
  281. //console_print(id, "Unpausing %s (file ^"%s^")", title, filename)
  282. ++count
  283. }
  284. }
  285.  
  286. console_print(id, "%L", id, (count == 1) ? "UNPAUSED_PLUGIN" : "UNPAUSED_PLUGINS", count)
  287. }
  288.  
  289. findPluginByFile(arg[32], &len)
  290. {
  291. new name[32], title[32], status[2]
  292. new inum = get_pluginsnum()
  293.  
  294. for (new a = 0; a < inum; ++a)
  295. {
  296. get_plugin(a, name, 31, title, 31, status, 0, status, 0, status, 1)
  297.  
  298. if (equali(name, arg, len) && (
  299. status[0] == 'r' || /*running*/
  300. status[0] == 'p' || /*paused*/
  301. status[0] == 's' || /*stopped*/
  302. status[0] == 'd' )) /*debug*/
  303. {
  304. len = copy(arg, 31, name)
  305. return a
  306. }
  307. }
  308.  
  309. return -1
  310. }
  311.  
  312. findPluginByTitle(name[], file[], len)
  313. {
  314. new title[32], status[2]
  315. new inum = get_pluginsnum()
  316.  
  317. for (new a = 0; a < inum; ++a)
  318. {
  319. get_plugin(a, file, len, title, 31, status, 0, status, 0, status, 1)
  320.  
  321. if (equali(title, name))
  322. return a
  323. }
  324.  
  325. return -1
  326. }
  327.  
  328. public cmdPlugin(id, level, cid)
  329. {
  330. if (!cmd_access(id, level, cid, 1))
  331. return PLUGIN_HANDLED
  332.  
  333. new cmds[32]
  334. read_argv(1, cmds, 31)
  335.  
  336. if (equal(cmds, "add") && read_argc() > 2)
  337. {
  338. read_argv(2, cmds, 31)
  339. new file[2]
  340.  
  341. if ((g_system[g_systemNum] = findPluginByTitle(cmds, file, 0)) != -1)
  342. {
  343. if (g_systemNum < MAX_SYSTEM)
  344. g_systemNum++
  345. else
  346. console_print(id, "%L", id, "CANT_MARK_MORE")
  347. }
  348. }
  349. else if (equal(cmds, "off"))
  350. {
  351. pausePlugins(id)
  352. }
  353. else if (equal(cmds, "on"))
  354. {
  355. unpausePlugins(id)
  356. }
  357. else if (equal(cmds, "save"))
  358. {
  359. if (saveSettings(g_fileToSave))
  360. {
  361. g_Modified = 0
  362. console_print(id, "%L", id, "PAUSE_CONF_SAVED")
  363. }
  364. else
  365. console_print(id, "%L", id, "PAUSE_SAVE_FAILED")
  366. }
  367. else if (equal(cmds, "clear"))
  368. {
  369. if (file_exists(g_fileToSave))
  370. {
  371. delete_file(g_fileToSave)
  372. console_print(id, "%L", id, "PAUSE_CONF_CLEARED")
  373. }
  374. else
  375. console_print(id, "%L", id, "PAUSE_ALR_CLEARED")
  376. }
  377. else if (equal(cmds, "pause"))
  378. {
  379. new arg[32], a, len = read_argv(2, arg, 31)
  380.  
  381. if (len && ((a = findPluginByFile(arg, len)) != -1) && !isSystem(a) && pause("ac", arg))
  382. console_print(id, "%L %L", id, "PAUSE_PLUGIN_MATCH", arg, id, "PAUSED")
  383. else
  384. console_print(id, "%L", id, "PAUSE_COULDNT_FIND", arg)
  385. }
  386. else if (equal(cmds, "enable"))
  387. {
  388. new arg[32], a, len = read_argv(2, arg, 31)
  389.  
  390. if (len && (a = findPluginByFile(arg, len)) != -1 && !isSystem(a))
  391. {
  392. if (unpause("ac", arg))
  393. {
  394. console_print(id, "%L %L", id, "PAUSE_PLUGIN_MATCH", arg, id, "UNPAUSED")
  395. }
  396. else
  397. {
  398. console_print(id, "%L", id, "CANT_UNPAUSE_PLUGIN", arg)
  399. }
  400. }
  401. else
  402. {
  403. console_print(id, "%L", id, "PAUSE_COULDNT_FIND", arg)
  404. }
  405. }
  406. else if (equal(cmds, "stop"))
  407. {
  408. new arg[32], a, len = read_argv(2, arg, 31)
  409.  
  410. if (len && (a = findPluginByFile(arg, len)) != -1 && !isSystem(a) && pause("dc", arg))
  411. {
  412. g_Modified = 1
  413. console_print(id, "%L %L", id, "PAUSE_PLUGIN_MATCH", arg, id, "STOPPED")
  414. }
  415. else
  416. console_print(id, "%L", id, "PAUSE_COULDNT_FIND", arg)
  417. }
  418. else if (equal(cmds, "list"))
  419. {
  420. new lName[32], lVersion[32], lAuthor[32], lFile[32], lStatus[32]
  421.  
  422. format(lName, 31, "%L", id, "NAME")
  423. format(lVersion, 31, "%L", id, "VERSION")
  424. format(lAuthor, 31, "%L", id, "AUTHOR")
  425. format(lFile, 31, "%L", id, "FILE")
  426. format(lStatus, 31, "%L", id, "STATUS")
  427.  
  428. new arg1[8], running = 0
  429. new start = read_argv(2, arg1, 7) ? str_to_num(arg1) : 1
  430.  
  431. if (--start < 0)
  432. start = 0
  433.  
  434. new plgnum = get_pluginsnum()
  435.  
  436. if (start >= plgnum)
  437. start = plgnum - 1
  438.  
  439. console_print(id, "^n----- %L -----", id, "PAUSE_LOADED")
  440. console_print(id, " %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s", lName, lVersion, lAuthor, lFile, lStatus)
  441.  
  442. new plugin[32], title[32], version[16], author[32], status[16]
  443. new end = start + 10
  444.  
  445. if (end > plgnum) end = plgnum
  446.  
  447. for (new a = start; a < end; ++a)
  448. {
  449. get_plugin(a, plugin, 31, title, 31, version, 15, author, 31, status, 15)
  450. if (status[0] == 'r') ++running
  451. console_print(id, " [%3d] %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s", a + 1, title, version, author, plugin, status)
  452. }
  453.  
  454. console_print(id, "----- %L -----", id, "PAUSE_ENTRIES", start + 1, end, plgnum, running)
  455.  
  456. if (end < plgnum)
  457. console_print(id, "----- %L -----", id, "PAUSE_USE_MORE", end + 1)
  458. else
  459. console_print(id, "----- %L -----", id, "PAUSE_USE_BEGIN")
  460. } else {
  461. console_print(id, "%L", id, "PAUSE_USAGE")
  462. console_print(id, "%L:", id, "PAUSE_COMMANDS")
  463. console_print(id, "%L", id, "COM_PAUSE_OFF")
  464. console_print(id, "%L", id, "COM_PAUSE_ON")
  465. console_print(id, "%L", id, "COM_PAUSE_STOP")
  466. console_print(id, "%L", id, "COM_PAUSE_PAUSE")
  467. console_print(id, "%L", id, "COM_PAUSE_ENABLE")
  468. console_print(id, "%L", id, "COM_PAUSE_SAVE_PAUSED")
  469. console_print(id, "%L", id, "COM_PAUSE_CLEAR_PAUSED")
  470. console_print(id, "%L", id, "COM_PAUSE_LIST")
  471. console_print(id, "%L", id, "COM_PAUSE_ADD")
  472. }
  473.  
  474. return PLUGIN_HANDLED
  475. }
  476.  
  477. saveSettings(filename[])
  478. {
  479. if (file_exists(filename))
  480. delete_file(filename)
  481.  
  482. new text[256], file[32], title[32], status[2]
  483. new inum = get_pluginsnum()
  484.  
  485. if (!write_file(filename, ";Generated by Pause Plugins Plugin. Do not modify!^n;Title Filename"))
  486. return 0
  487.  
  488. for (new a = 0; a < inum; ++a)
  489. {
  490. get_plugin(a, file, 31, title, 31, status, 0, status, 0, status, 1)
  491.  
  492. // "paused"
  493. if (status[0] == 'p')
  494. {
  495. format(text, 255, "^"%s^" ;%s", title, file)
  496. write_file(filename, text)
  497. }
  498. }
  499.  
  500. return 1
  501. }
  502.  
  503. loadSettings(filename[])
  504. {
  505. if (!file_exists(filename))
  506. return 0
  507.  
  508. new name[256], file[32], i, pos = 0
  509.  
  510. while (read_file(filename, pos++, name, 255, i))
  511. {
  512. if (name[0] != ';' && parse(name, name, 31) && (i = findPluginByTitle(name, file, 31) != -1))
  513. pause("ac", file)
  514. }
  515.  
  516. return 1
  517. }
  518.  

_________________
****

Ők köszönték meg pixxa112 nek ezt a hozzászólást: White#Angel (2014.03.20. 07:02)
  Népszerűség: 2.27%


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 11 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