hlmod.hu

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



Jelenlévő felhasználók

Jelenleg 130 felhasználó van jelen :: 2 regisztrált, 0 rejtett és 128 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], Google [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  [ 3 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: [CS:S] !rules
HozzászólásElküldve: 2013.05.02. 18:18 
Offline
Tud valamit

Csatlakozott: 2013.01.21. 10:10
Hozzászólások: 138
Megköszönt másnak: 20 alkalommal
Megköszönték neki: 6 alkalommal
Sziasztok! Ezt kellene nekem lemagyarosítani


SMA Forráskód: [ Mindet kijelol ]
  1. /////////////////////////////////////////////////////////
  2. /////////////// INCLUDES / DEFINES
  3. /////////////////////////////////////////////////////////
  4.  
  5. #pragma semicolon 1
  6.  
  7. #include <sourcemod>
  8. #include <sdktools>
  9. #undef REQUIRE_PLUGIN
  10. #include <adminmenu>
  11.  
  12. #define VERSION "1.5"
  13.  
  14. new Handle:g_CvarDescMode = INVALID_HANDLE;
  15. new Handle:g_CvarShowOnConnect = INVALID_HANDLE;
  16. new Item = 0;
  17.  
  18. /////////////////////////////////////////////////////////
  19. /////////////// PLUGIN INFO
  20. /////////////////////////////////////////////////////////
  21.  
  22. public Plugin:myinfo =
  23. {
  24. name = "Rules Plugin",
  25. author = "nynCuKaH",
  26. description = "Rules plugin for server",
  27. version = VERSION,
  28. url = "www.energy-games.ru"
  29. };
  30.  
  31. /////////////////////////////////////////////////////////
  32. /////////////// ESSENTIAL FUNCTIONS
  33. /////////////////////////////////////////////////////////
  34.  
  35. public OnPluginStart()
  36. {
  37. // Register Client / Admins Commands
  38. RegConsoleCmd("sm_rules", RulesMenu_Func);
  39. RegAdminCmd("sm_showrules", ShowRules, ADMFLAG_GENERIC);
  40.  
  41. g_CvarDescMode = CreateConVar("sm_rules_descmode", "0", "Set to 0 if you want description to be show on a menu ,and 1 if you want it to show on chat .");
  42. g_CvarShowOnConnect = CreateConVar("sm_rules_noconnect", "0", "Set to 1 If you dont want menu to show on players connection .");
  43.  
  44. }
  45.  
  46. /////////////////////////////////////////////////////////
  47. /////////////// ON CLIENT CONNECTING TO SERVER SEND RULES
  48. /////////////////////////////////////////////////////////
  49.  
  50. public OnClientPostAdminCheck(client)
  51. {
  52. if (!GetConVarInt(g_CvarShowOnConnect))
  53. {
  54. CreateRulesMenu(client, 0);
  55. }
  56. return Plugin_Handled;
  57. }
  58.  
  59. /////////////////////////////////////////////////////////
  60. /////////////// CMD HANDLERs
  61. /////////////////////////////////////////////////////////
  62.  
  63. public Action:RulesMenu_Func(client, args)
  64. {
  65. // Function To Create the menu and send it to client
  66. CreateRulesMenu(client, 0);
  67. return Plugin_Handled;
  68. }
  69.  
  70. public Action:ShowRules(client, args)
  71. {
  72. // Send admins a list of players to send the Rules menu
  73. new Handle:PlayersMenu = CreateMenu(ShowRulesHandler);
  74. SetMenuTitle(PlayersMenu, "Send rules for player");
  75. SetMenuExitButton(PlayersMenu, true);
  76. AddTargetsToMenu2(PlayersMenu, client, COMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED);
  77. DisplayMenu(PlayersMenu, client, 15);
  78. return Plugin_Handled;
  79. }
  80.  
  81. /////////////////////////////////////////////////////////
  82. /////////////// MENUs / MENUs HANDLERs
  83. /////////////////////////////////////////////////////////
  84.  
  85. public Action:CreateRulesMenu(client, item)
  86. {
  87. new Handle:RulesMenu = CreateMenu(RulesMenuHandler);
  88. SetMenuTitle(RulesMenu, "Server Rules");
  89.  
  90. new Handle:kv = CreateKeyValues("Rules");
  91. FileToKeyValues(kv, "addons/sourcemod/configs/rules.cfg");
  92.  
  93. if (!KvGotoFirstSubKey(kv))
  94. {
  95. return Plugin_Continue;
  96. }
  97.  
  98. decl String:RuleNumber[64];
  99. decl String:RuleName[255];
  100.  
  101. do
  102. {
  103. KvGetSectionName(kv, RuleNumber, sizeof(RuleNumber));
  104. KvGetString(kv, "name", RuleName, sizeof(RuleName));
  105. // Add Each Rule to the menu
  106. AddMenuItem(RulesMenu, RuleNumber, RuleName);
  107. } while (KvGotoNextKey(kv));
  108. CloseHandle(kv);
  109. // Send Menu to client
  110. DisplayMenuAtItem(RulesMenu, client, item, 15);
  111.  
  112. return Plugin_Handled;
  113. }
  114.  
  115. public HandlerBackToMenu(Handle:menu, MenuAction:action, param1, param2)
  116. {
  117. if (action == MenuAction_Select)
  118. {
  119. CreateRulesMenu(param1, Item);
  120. }
  121. else if (action == MenuAction_Cancel)
  122. {
  123. PrintToServer("Client %d's menu was cancelled. Reason: %d", param1, param2);
  124. }
  125.  
  126. else if (action == MenuAction_End)
  127. {
  128. CloseHandle(menu);
  129. }
  130. }
  131.  
  132.  
  133. public RulesMenuHandler(Handle:menu, MenuAction:action, param1, param2)
  134. {
  135. if (action == MenuAction_Select)
  136. {
  137. new Handle:kv = CreateKeyValues("Rules");
  138. FileToKeyValues(kv, "addons/sourcemod/configs/rules.cfg");
  139.  
  140. if (!KvGotoFirstSubKey(kv))
  141. {
  142. return Plugin_Handled;
  143. }
  144.  
  145. decl String:buffer[255];
  146. decl String:choice[255];
  147. GetMenuItem(menu, param2, choice, sizeof(choice));
  148.  
  149. do
  150. {
  151. KvGetSectionName(kv, buffer, sizeof(buffer));
  152. if (StrEqual(buffer, choice))
  153. {
  154. decl String:ruleName[255];
  155. decl String:ruleDescription[255];
  156. decl String:ruleDescription2[255];
  157. decl String:ruleDescription3[255];
  158. decl String:ruleDescription4[255];
  159. decl String:ruleDescription5[255];
  160. KvGetString(kv, "name", ruleName, sizeof(ruleName));
  161. KvGetString(kv, "description", ruleDescription, sizeof(ruleDescription));
  162. KvGetString(kv, "description2", ruleDescription2, sizeof(ruleDescription2));
  163. KvGetString(kv, "description3", ruleDescription3, sizeof(ruleDescription3));
  164. KvGetString(kv, "description4", ruleDescription4, sizeof(ruleDescription4));
  165. KvGetString(kv, "description5", ruleDescription5, sizeof(ruleDescription5));
  166.  
  167. if (GetConVarInt(g_CvarDescMode))
  168. {
  169. PrintToChat(param1, "\x04[nRules] \x03%s : \x01%s", ruleName, ruleDescription);
  170. Item = GetMenuSelectionPosition();
  171. CreateRulesMenu(param1, Item);
  172. }
  173. else
  174. {
  175. decl String:Rule[255];
  176. decl String:Desc[255];
  177. decl String:Desc2[255];
  178. decl String:Desc3[255];
  179. decl String:Desc4[255];
  180. decl String:Desc5[255];
  181. Format(Rule, sizeof(Rule), "%s", ruleName);
  182. Format(Desc, sizeof(Desc), "%s", ruleDescription);
  183. Format(Desc2, sizeof(Desc2), "%s", ruleDescription2);
  184. Format(Desc3, sizeof(Desc3), "%s", ruleDescription3);
  185. Format(Desc4, sizeof(Desc4), "%s", ruleDescription4);
  186. Format(Desc5, sizeof(Desc5), "%s", ruleDescription5);
  187. Item = GetMenuSelectionPosition();
  188. new Handle:DescriptionPanel = CreatePanel();
  189. SetPanelTitle(DescriptionPanel, Rule);
  190. DrawPanelText(DescriptionPanel, " ");
  191. DrawPanelText(DescriptionPanel, Desc);
  192. DrawPanelText(DescriptionPanel, Desc2);
  193. DrawPanelText(DescriptionPanel, Desc3);
  194. DrawPanelText(DescriptionPanel, Desc4);
  195. DrawPanelText(DescriptionPanel, Desc5);
  196. DrawPanelText(DescriptionPanel, " ");
  197. DrawPanelItem(DescriptionPanel, "Back");
  198. SendPanelToClient(DescriptionPanel, param1, HandlerBackToMenu, 15);
  199. }
  200.  
  201.  
  202. }
  203. } while (KvGotoNextKey(kv));
  204. CloseHandle(kv);
  205. }
  206. else if (action == MenuAction_Cancel)
  207. {
  208. PrintToServer("Client %d's menu was cancelled. Reason: %d", param1, param2);
  209. }
  210.  
  211. else if (action == MenuAction_End)
  212. {
  213. CloseHandle(menu);
  214. }
  215.  
  216. return Plugin_Handled;
  217. }
  218.  
  219. public ShowRulesHandler(Handle:menu, MenuAction:action, param1, param2)
  220. {
  221. if (action == MenuAction_Select)
  222. {
  223. decl String:UserId[64];
  224. GetMenuItem(menu, param2, UserId, sizeof(UserId));
  225. new i_UserId = StringToInt(UserId);
  226. new client = GetClientOfUserId(i_UserId);
  227. CreateRulesMenu(client, 1);
  228. }
  229.  
  230. else if (action == MenuAction_Cancel)
  231. {
  232. PrintToServer("Client %d's menu was cancelled. Reason: %d", param1, param2);
  233. }
  234.  
  235. else if (action == MenuAction_End)
  236. {
  237. CloseHandle(menu);
  238. }
  239.  
  240. return Plugin_Handled;
  241.  
  242. }


Előre is köszönöm.

_________________
See you next time! :)

Ha hasznosnak találtad a hozzászólásomat, köszönd meg a Kép lenyomásával..!! :)


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: [CS:S] !rules
HozzászólásElküldve: 2013.05.07. 14:10 
Offline
Tiszteletbeli
Avatar

Csatlakozott: 2012.10.09. 13:48
Hozzászólások: 1439
Megköszönték neki: 174 alkalommal
Aktuális még?

_________________
Minden jót! :)


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: [CS:S] !rules
HozzászólásElküldve: 2013.05.26. 18:56 
Offline
Tud valamit

Csatlakozott: 2013.01.21. 10:10
Hozzászólások: 138
Megköszönt másnak: 20 alkalommal
Megköszönték neki: 6 alkalommal
BeepBeep írta:
Aktuális még?



IGEN! :) Most meg pláne, mivel van szerverem is :P CS SOURCE :D

_________________
See you next time! :)

Ha hasznosnak találtad a hozzászólásomat, köszönd meg a Kép lenyomásával..!! :)


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  [ 3 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 1 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