hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.02. 02:24



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: Google [Bot], Majestic-12 [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ő


Lezárt fórum  A témát lezárták, nem szerkesztheted a hozzászólásaid, és nem küldhetsz új hozzászólást.  [ 2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: rtv
HozzászólásElküldve: 2015.05.06. 11:02 
Offline
Nagyúr
Avatar

Csatlakozott: 2013.09.14. 08:21
Hozzászólások: 547
Megköszönt másnak: 95 alkalommal
Megköszönték neki: 71 alkalommal
üdv.
rtv plugint meglehet ugy oldani ha többen vagyunk megtörténik ugye a szavazás
és egyböl rakja is el a mappot? köszi addig is.

SMA Forráskód: [ Mindet kijelol ]
  1. /*
  2. * Made by DA
  3. *
  4. * Description:
  5. * This plugin allows the players on your server to vote for a mapvoting.
  6. * The players can say in the chat "/rockthevote", "rockthevote" or "rtv" to vote for the vote.
  7. * The maps will be automaticle loaded from the maps.ini (if it exists) or from the mapcycle.txt.
  8. *
  9. *
  10. * Installation:
  11. * 1. Download the rockthevote_custom.sma and compile it on your local machine.
  12. * 2. Put the rockthevote_custom.amxx in your plugins folder.
  13. * 3. Add at the end from the plugins.ini this line: rockthevote_custom.amxx
  14. * 4. Open your amxx.cfg (mod/addons/amxmodx/configs/) and add the cvar's.
  15. * 5. Restart or change the map from your server.
  16. *
  17. *
  18. * CVAR's:
  19. * amx_timevote number - Default 5 - After 5 MINUTES (Default) is rockthevote allowed.
  20. * amx_howmanypercentage float - Default 0.30 - When 30% (Default) of the players said rockthevote then comes the mapvote.
  21. * amx_howmanyvotes number - Default 8 - When 8 (default) players said rockthevote then comes the mapvote.
  22. * amx_rocktime time - Default 10 - After 10 (default) seconds the voting is over and the server change the map.
  23. *
  24. *
  25. * Credits:
  26. * Deagles - The main idea
  27. * arkshine - Some code
  28. * X-olent - Percentage idea
  29. *
  30. */
  31.  
  32. #include <amxmodx>
  33. #include <amxmisc>
  34.  
  35. #define PLUGIN "RockTheVote"
  36. #define AUTHOR "DA"
  37. #define VERSION "1.8"
  38.  
  39. #define MAX_MAPS 5
  40. #define MAX_MAP_LENGTH 64
  41. #define MAPSINI "maps.ini"
  42.  
  43. new rtv[33], howmanyvotes, task_time, keycount[MAX_MAPS], s_Maps[MAX_MAPS][MAX_MAP_LENGTH], count;
  44. new presskeys, howmanyvotesperc, timevote, directmapchange, bool:NextRoundChangeMap = false, nextmap[MAX_MAP_LENGTH];
  45.  
  46. public plugin_init()
  47. {
  48. register_plugin(PLUGIN, VERSION, AUTHOR);
  49. register_dictionary("mapchooser.txt");
  50. register_dictionary("common.txt");
  51. register_clcmd("say", "rockthevote");
  52. register_menu("Chose your Map", 1023, "gonna_chose");
  53. howmanyvotes = register_cvar("amx_howmanyvotes", "8");
  54. howmanyvotesperc = register_cvar("amx_howmanypercentage", "0.30");
  55. task_time = register_cvar("amx_rocktime", "10.0");
  56. timevote = register_cvar("amx_timevote", "5");
  57. directmapchange = register_cvar( "amx_directmapchange", "0" );
  58.  
  59. register_logevent ( "RoundStart", 2, "1=Round_Start" );
  60.  
  61. for (new i=0; i < MAX_MAPS+2; i++)
  62. presskeys = presskeys | (1<<i)
  63. }
  64.  
  65. public client_disconnect(id)
  66. {
  67. if (rtv[id-1] == id)
  68. {
  69. rtv[id-1] = 0;
  70. count--;
  71. }
  72. }
  73.  
  74. public RoundStart()
  75. {
  76. if ( !get_pcvar_num( directmapchange ) && NextRoundChangeMap )
  77. {
  78. server_cmd( "amx_map %s", nextmap );
  79. }
  80. }
  81.  
  82. public rockthevote(id)
  83. {
  84. new said[192];
  85. read_args(said, 192);
  86. if ((contain(said, "/rockthevote") != -1) || (contain(said, "rockthevote") != -1) || (contain(said, "rtv") != -1))
  87. {
  88. if (get_gametime() < (get_pcvar_float(timevote) * 60.0))
  89. client_print(id, print_chat, "Vote is currently not allowed. Wait %d minutes.", (floatround(((get_pcvar_float(timevote) * 60.0) - get_gametime()) / 60.0)));
  90. else
  91. {
  92. if (rtv[id-1] == id)
  93. client_print(id, print_chat, "You have already voted!");
  94. else
  95. {
  96. rtv[id-1] = id;
  97. count++;
  98.  
  99. static num;
  100. num = get_playersnum();
  101. num = floatround((get_pcvar_float(howmanyvotesperc) * num));
  102. if ((num == count) || (count >= get_pcvar_num(howmanyvotes)))
  103. {
  104. // AMXX Nextmap Chooser by cheap_suit
  105. if(find_plugin_byfile("mapchooser.amxx") != INVALID_PLUGIN_ID)
  106. {
  107. new oldWinLimit = get_cvar_num("mp_winlimit"), oldMaxRounds = get_cvar_num("mp_maxrounds");
  108. set_cvar_num("mp_winlimit",0);
  109. set_cvar_num("mp_maxrounds",-1);
  110.  
  111. if(callfunc_begin("voteNextmap","mapchooser.amxx") == 1)
  112. callfunc_end();
  113.  
  114. set_cvar_num("mp_winlimit",oldWinLimit);
  115. set_cvar_num("mp_maxrounds",oldMaxRounds);
  116. set_task(get_pcvar_float(task_time), "change_map", true);
  117. return PLUGIN_CONTINUE;
  118. }
  119.  
  120. StartTheVote();
  121. return PLUGIN_CONTINUE;
  122. }
  123. static name[32];
  124. get_user_name( id, name, charsmax( name ) );
  125.  
  126. client_print ( 0, print_chat, "%s vote was added. Need %d or %d^%^% to start voting!", name, (get_pcvar_num(howmanyvotes)-count), (floatround(get_pcvar_float(howmanyvotesperc) * 100.00)))
  127. }
  128. }
  129. }
  130. return PLUGIN_CONTINUE;
  131. }
  132.  
  133. public gonna_chose(id, key)
  134. {
  135. if (key < MAX_MAPS)
  136. {
  137. keycount[key]++;
  138. static name[32]
  139. get_user_name(id, name, charsmax(name));
  140. client_print(0, print_chat, "%L", LANG_PLAYER, "X_CHOSE_X", name, s_Maps[key]);
  141. }
  142. }
  143.  
  144. StartTheVote()
  145. {
  146. if (!RetrieveMaps(s_Maps))
  147. return PLUGIN_CONTINUE;
  148.  
  149. static i, chosetext[256];
  150. count=0;
  151.  
  152. formatex(chosetext, charsmax(chosetext), "\y%L:\w^n^n", LANG_SERVER, "CHOOSE_NEXTM");
  153. for (i=0; i < MAX_MAPS; i++)
  154. formatex(chosetext, charsmax(chosetext), "%s%d. %s^n", chosetext, i+1, s_Maps[i]);
  155.  
  156.  
  157. formatex(chosetext, charsmax(chosetext), "%s^n%d. %L", chosetext, MAX_MAPS+2, LANG_SERVER, "NONE");
  158. client_cmd(0, "spk Gman/Gman_Choose2");
  159. client_print(0, print_chat, "%L", LANG_SERVER, "TIME_CHOOSE");
  160. show_menu(0, presskeys, chosetext, 15, "Chose your Map");
  161. set_task(get_pcvar_float(task_time), "change_map", false);
  162. return PLUGIN_CONTINUE;
  163. }
  164.  
  165.  
  166. bool:RetrieveMaps(s_MapsFound[][])
  167. {
  168. new s_File[256], s_ConfigsDir[256];
  169. get_configsdir(s_ConfigsDir, 255);
  170. formatex(s_File, 255, "%s/%s", s_ConfigsDir, MAPSINI);
  171.  
  172. if (!file_exists(s_File))
  173. get_cvar_string("mapcyclefile", s_File, charsmax(s_File));
  174.  
  175. new s_CurrentMap[MAX_MAP_LENGTH];
  176. get_mapname(s_CurrentMap, charsmax(s_CurrentMap));
  177.  
  178. new p_File = fopen(s_File, "rt");
  179. new Array:a_Maps;
  180. new i_MapsCount = SaveAllMaps(p_File, a_Maps);
  181.  
  182. new bool:b_Error = true, i;
  183. switch (i_MapsCount)
  184. {
  185. case 0 : log_amx("There are no maps in the %s.", s_File);
  186. case 1 .. MAX_MAPS : log_amx("Not enough maps found. (requires at least %d maps)", MAX_MAPS + 1 );
  187. default : b_Error = false;
  188. }
  189. if (b_Error)
  190. {
  191. fclose(p_File);
  192. ArrayDestroy(a_Maps);
  193. return false;
  194. }
  195. fclose(p_File);
  196.  
  197. new i_Rand, i_Cnt;
  198. while (i_Cnt != MAX_MAPS)
  199. {
  200. i_Rand = random_num(0, ArraySize(a_Maps) - 1);
  201. ArrayGetString(a_Maps, i_Rand, s_MapsFound[i_Cnt], MAX_MAP_LENGTH - 1);
  202.  
  203. if (equal(s_MapsFound[i_Cnt], s_CurrentMap))
  204. {
  205. continue;
  206. }
  207.  
  208. for (i = 0; i < i_Cnt; i++)
  209. {
  210. if (equal(s_MapsFound[i], s_MapsFound[i_Cnt]))
  211. {
  212. break;
  213. }
  214. }
  215.  
  216. if (i == i_Cnt)
  217. {
  218. ArrayDeleteItem(a_Maps, i_Rand);
  219. i_Cnt++;
  220. }
  221. }
  222. ArrayDestroy(a_Maps);
  223. return true;
  224. }
  225.  
  226. SaveAllMaps(p_File, &Array:a_Maps)
  227. {
  228. a_Maps = ArrayCreate(MAX_MAP_LENGTH);
  229. new s_Buffer[MAX_MAP_LENGTH]
  230.  
  231. while (!feof(p_File))
  232. {
  233. fgets(p_File, s_Buffer, charsmax(s_Buffer));
  234. trim(s_Buffer);
  235. if (!s_Buffer[0] || s_Buffer[0] == ';' || (s_Buffer[0] == '/' && s_Buffer[1] == '/'))
  236. {
  237. continue;
  238. }
  239. if (is_map_valid(s_Buffer))
  240. {
  241. ArrayPushString(a_Maps, s_Buffer);
  242. }
  243. }
  244. return ArraySize(a_Maps);
  245. }
  246.  
  247. public change_map(bool:chooserornot)
  248. {
  249. if (!chooserornot)
  250. {
  251. static keypuffer=0, i=0;
  252. for (i=0; i < MAX_MAPS; i++)
  253. if (keycount[i] > keycount[keypuffer])
  254. keypuffer = i;
  255.  
  256. copy(nextmap, charsmax(nextmap), s_Maps[keypuffer]);
  257. }
  258. else
  259. get_cvar_string("amx_nextmap", nextmap, charsmax(nextmap));
  260.  
  261. log_amx("Map will be changed to %s.", nextmap)
  262. if (chooserornot)
  263. client_print(0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_NEXT", nextmap);
  264.  
  265. if ( !get_pcvar_num( directmapchange ) )
  266. {
  267. set_hudmessage(210, 0, 0, 0.05, 0.45, 1, 20.0, 10.0, 0.5, 0.15, 4);
  268. show_hudmessage(0, "This is the final round");
  269.  
  270. NextRoundChangeMap = true;
  271. }
  272.  
  273. else
  274. {
  275. server_cmd("amx_map %s", nextmap);
  276. }
  277. }
  278.  

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 
 Hozzászólás témája: Re: rtv
HozzászólásElküldve: 2015.06.04. 14:00 
Offline
Veterán
Avatar

Csatlakozott: 2011.06.07. 15:29
Hozzászólások: 1728
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 63 alkalommal
A téma címe, utaljon a kérdésedre, amit írtál. Az hogy "rtv", az egy dolog, de nem jövünk rá, mit szeretnél, csak akkor ha belelépek a témába. Kérlek erre figyelj legközelebb.


Hozzászólás jelentése
Vissza a tetejére
   
 
Hozzászólások megjelenítése:  Rendezés  
Lezárt fórum  A témát lezárták, nem szerkesztheted a hozzászólásaid, és nem küldhetsz új hozzászólást.  [ 2 hozzászólás ] 


Ki van itt

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


Nem nyithatsz témákat ebben a fórumban.
Nem 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