hlmod.hu
https://hlmod.hu/

2 plugin egybe iras
https://hlmod.hu/viewtopic.php?f=10&t=18576
Oldal: 1 / 1

Szerző:  Be$t.# [2014.12.20. 18:42 ]
Hozzászólás témája:  2 plugin egybe iras

Halii valaki segítene 2 plugint egybe irni?
1.Sma
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <nvault>
  4. #include <colorchat>
  5.  
  6. #define PLUGIN "Rangok"
  7. #define VERSION "1.0"
  8. #define AUTHOR "qKKJ"
  9.  
  10. new message[192]
  11. new nev[32]
  12. new Temp[192]
  13. static color[10]
  14. new g_vault
  15. new olesek[33]
  16. new szint[33]
  17.  
  18.  
  19. #define ASD 10
  20.  
  21. //Ha az ASD értéke 10 akkor a szamoknal 10 szám a rangoknál 11 szöveg
  22.  
  23. new const szamok[ASD] = {
  24. 200,
  25. 400,
  26. 600,
  27. 1000,
  28. 1600,
  29. 2000,
  30. 3800,
  31. 4000,
  32. 5000,
  33. 8000
  34. }
  35.  
  36. new const rangok[ASD+1][] = {
  37. "[Tag][LvL1]",
  38. "[Kezdo][LvL2]",
  39. "[Amator][LvL3]",
  40. "[Újonc][LvL4]",
  41. "[Haladó][LvL5]",
  42. "[Profi][LvL6]",
  43. "[Veterán][LvL7]",
  44. "[Mester][LvL8]",
  45. "[Király][LvL9]",
  46. "[Isten][LvL10]‘",
  47. "[LeGenDa][LvL11]"
  48.  
  49. }
  50.  
  51. public plugin_init()
  52. {
  53. register_plugin(PLUGIN, VERSION, AUTHOR)
  54. register_clcmd("say /rang", "hud")
  55. register_clcmd("say", "sayhook")
  56. register_clcmd("say_team", "tshook")
  57. register_event("DeathMsg", "halal", "a")
  58. g_vault = nvault_open("lolmar_xD")
  59.  
  60. }
  61. public hud(id)
  62. {
  63. if(szint[id] != ASD+1)
  64. {
  65.  
  66.  
  67. ColorChat(id, RED, "Szint:^4%s ^1| ^3Ölések:^4%d ^1| ^3Kell még:^4%d",rangok[szint[id]], olesek[id],szamok[szint[id]]-olesek[id] )
  68. }
  69. else {
  70.  
  71. ColorChat(id, GREEN, "Eléerted a ^3Maximalis ^4Szintet.Gratulalunk.")
  72. }
  73.  
  74. }
  75. public sayhook(id)
  76. {
  77.  
  78. read_args (message, 191)
  79. remove_quotes (message)
  80. if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, ""))
  81. {
  82. return PLUGIN_CONTINUE
  83. }
  84. get_user_name(id, nev, 31)
  85.  
  86. if(is_user_admin(id))
  87. {
  88. if(is_user_alive(id)) {
  89. get_user_team(id, color, 9)
  90. formatex(Temp, 191, "^x04*Élo* [Admin]^x04%s ^x03%s^x01 : ^x04 %s", rangok[szint[id]], nev, message)
  91.  
  92. }
  93. else {
  94. get_user_team(id, color, 9)
  95. formatex(Temp, 191, "^x04*Halott* [Admin]^x04%s ^x03%s^x03 : ^x04 %s", rangok[szint[id]], nev, message)
  96. }
  97. }else{
  98. if(is_user_alive(id)) {
  99. get_user_team(id, color, 9)
  100. formatex(Temp, 191, "^x04*Élo* [Játékos]%s ^x03%s^x01 : %s", rangok[szint[id]], nev, message)
  101.  
  102. }
  103. else {
  104. get_user_team(id, color, 9)
  105. formatex(Temp, 191, "^x04*Halott* [Játékos]%s ^x03%s^x01 : %s", rangok[szint[id]], nev, message)
  106. }
  107. }
  108. sendmessage(color)
  109. return PLUGIN_HANDLED
  110. }
  111. public tshook(id)
  112. {
  113. read_args (message, 191)
  114. remove_quotes (message)
  115. if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, ""))
  116. {
  117. return PLUGIN_CONTINUE
  118. }
  119. get_user_name(id, nev, 31)
  120. new playerTeam = get_user_team(id)
  121. new playerTeamName[19]
  122. switch (playerTeam)
  123. {
  124. case 1: {
  125. copy (playerTeamName, 11, "*Terrorista*")
  126.  
  127. }
  128. case 2: {
  129. copy (playerTeamName, 18, "*Anti-Terrorista*")
  130.  
  131. }
  132. default:
  133. copy (playerTeamName, 9, "*Nézo*")
  134. }
  135. if(is_user_admin(id))
  136. {
  137. if(is_user_alive(id))
  138. {
  139. get_user_team(id, color, 9)
  140. formatex(Temp, 191, "^x04*Élo*^x03(%s) ^x04[Admin]^x04%s ^x03%s^x01 : ^x04 %s",playerTeamName, rangok[szint[id]], nev, message)
  141.  
  142. }
  143. else
  144. {
  145. get_user_team(id, color, 9)
  146. formatex(Temp, 191, "^x04*Halott* ^x03(%s)[Admin] ^x04%s ^x03%s^x04 : %s",playerTeamName, rangok[szint[id]], nev, message)
  147. }
  148. }else{
  149. if(is_user_alive(id))
  150. {
  151. get_user_team(id, color, 9)
  152. formatex(Temp, 191, "^x04*Élo* ^x03(%s) ^x04[Játékos]^x04%s ^x03%s^x01 : %s",playerTeamName, rangok[szint[id]], nev, message)
  153.  
  154. }
  155. else
  156. {
  157. get_user_team(id, color, 9)
  158. formatex(Temp, 191, "^x04*Halott* ^x03(%s) ^x04[Játékos]%s ^x03%s^x01 : %s",playerTeamName, rangok[szint[id]], nev, message)
  159. }
  160. }
  161. sendtmessage(color, playerTeam)
  162. return PLUGIN_HANDLED
  163. }
  164. public sendmessage(color[])
  165. {
  166. new teamName[10]
  167. for(new player = 1; player < get_maxplayers(); player++)
  168. {
  169. get_user_team (player, teamName, 9)
  170. teamf (player, color)
  171. elkuldes(player, Temp)
  172. teamf(player, teamName)
  173. }
  174. }
  175. public sendtmessage(color[], playerTeam)
  176. {
  177. new teamName[10]
  178. for (new player = 1; player < get_maxplayers(); player++)
  179. {
  180. if(get_user_team(player) == playerTeam)
  181. {
  182. get_user_team (player, teamName, 9)
  183. elkuldes(player, Temp)
  184. teamf (player, teamName)
  185. teamf (player, color)
  186. }
  187. }
  188. }
  189. public teamf(player, team[])
  190. {
  191. message_begin(MSG_ONE, get_user_msgid("TeamInfo"), _, player)
  192. write_byte(player)
  193. write_string(team)
  194. message_end()
  195. }
  196. public elkuldes(player, Temp[])
  197. {
  198.  
  199. message_begin( MSG_ONE, get_user_msgid( "SayText" ), _, player)
  200. write_byte( player )
  201. write_string( Temp )
  202. message_end()
  203.  
  204. }
  205.  
  206. public client_connect(id)
  207. {
  208. LoadData(id)
  209. }
  210. public client_disconnect(id) SaveData(id)
  211.  
  212. public SaveData(id)
  213. {
  214. new name[32]
  215. get_user_name(id, name, 31)
  216.  
  217. new vaultkey[64],vaultdata[256]
  218. format(vaultkey,63,"%s-rang", name)
  219. format(vaultdata,255,"%i#%i#",olesek[id],szint[id])
  220.  
  221.  
  222. nvault_set(g_vault,vaultkey,vaultdata)
  223. return PLUGIN_CONTINUE
  224. }
  225. public LoadData(id)
  226. {
  227. new name[32]
  228. get_user_name(id, name, 31)
  229. new vaultkey[64],vaultdata[256]
  230.  
  231. format(vaultkey,63,"%s-rang", name)
  232. format(vaultdata,255,"%i#%i#",olesek[id],szint[id])
  233.  
  234. nvault_get(g_vault,vaultkey,vaultdata,255)
  235. replace_all(vaultdata, 255, "#", " ")
  236. new oles[32], level[32]
  237. parse(vaultdata, oles, 31, level, 31)
  238. olesek[id] = str_to_num(oles)
  239. szint[id] = str_to_num(level)
  240. return PLUGIN_CONTINUE
  241. }
  242. public halal()
  243. {
  244. new killer = read_data(1)
  245. new victim = read_data(2)
  246.  
  247. if(killer != victim)
  248. olesek[killer]++
  249.  
  250. while(olesek[killer] >= szamok[szint[killer]])
  251. {
  252. szint[killer]++
  253. }
  254. }
  255. stock print_color(const id, const input[], any:...)
  256. {
  257. new count = 1, players[32]
  258. static msg[191]
  259. vformat(msg, 190, input, 3)
  260.  
  261. replace_all(msg, 190, "!g", "^4")
  262. replace_all(msg, 190, "!y", "^1")
  263. replace_all(msg, 190, "!t", "^3")
  264. replace_all(msg, 190, "á", "A?")
  265. replace_all(msg, 190, "é", "A©")
  266. replace_all(msg, 190, "í", "A)
  267. replace_all(msg, 190, "ó", "Al")
  268. replace_all(msg, 190, "ö", "")
  269. replace_all(msg, 190, "o", "L‘")
  270. replace_all(msg, 190, "ú", "As")
  271. replace_all(msg, 190, "ü", "AL")
  272. replace_all(msg, 190, "u", "")
  273. replace_all(msg, 190, "Á", "")
  274. replace_all(msg, 190, "É", "A‰")
  275. replace_all(msg, 190, "Í", "AT")
  276. replace_all(msg, 190, "Ó", "A“")
  277. replace_all(msg, 190, "Ö", "A–")
  278. replace_all(msg, 190, "O", "")
  279. replace_all(msg, 190, "Ú", "")
  280. replace_all(msg, 190, "Ü", "As")
  281. replace_all(msg, 190, "U", "")
  282.  
  283. if (id) players[0] = id; else get_players(players, count, "ch")
  284. {
  285. for (new i = 0; i < count; i++)
  286. {
  287. if (is_user_connected(players[i]))
  288. {
  289. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  290. write_byte(players[i])
  291. write_string(msg)
  292. message_end()
  293. }
  294. }
  295. }
  296. return PLUGIN_HANDLED
  297. }


2.SMa
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <nvault>
  4. enum Color
  5. {
  6. NORMAL = 1, // clients scr_concolor cvar color
  7. GREEN, // Green Color
  8. TEAM_COLOR, // Red, grey, blue
  9. GREY, // grey
  10. RED, // Red
  11. BLUE, // Blue
  12. }
  13.  
  14. new TeamName[][] =
  15. {
  16. "",
  17. "TERRORIST",
  18. "CT",
  19. "SPECTATOR"
  20. }
  21.  
  22. ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
  23. {
  24. static message[256];
  25.  
  26. switch(type)
  27. {
  28. case NORMAL: // clients scr_concolor cvar color
  29. {
  30. message[0] = 0x01;
  31. }
  32. case GREEN: // Green
  33. {
  34. message[0] = 0x04;
  35. }
  36. default: // White, Red, Blue
  37. {
  38. message[0] = 0x03;
  39. }
  40. }
  41.  
  42. vformat(message[1], 251, msg, 4);
  43. message[192] = '^0';
  44.  
  45. static team, ColorChange, index, MSG_Type;
  46.  
  47. if(id)
  48. {
  49. MSG_Type = MSG_ONE;
  50. index = id;
  51. } else {
  52. index = FindPlayer();
  53. MSG_Type = MSG_ALL;
  54. }
  55.  
  56. team = get_user_team(index);
  57. ColorChange = ColorSelection(index, MSG_Type, type);
  58.  
  59. ShowColorMessage(index, MSG_Type, message);
  60.  
  61. if(ColorChange)
  62. {
  63. Team_Info(index, MSG_Type, TeamName[team]);
  64. }
  65. }
  66.  
  67. ShowColorMessage(id, type, message[])
  68. {
  69. message_begin(type, get_user_msgid("SayText"), _, id);
  70. write_byte(id)
  71. write_string(message);
  72. message_end();
  73. }
  74.  
  75. Team_Info(id, type, team[])
  76. {
  77. message_begin(type, get_user_msgid("TeamInfo"), _, id);
  78. write_byte(id);
  79. write_string(team);
  80. message_end();
  81.  
  82. return 1;
  83. }
  84.  
  85. ColorSelection(index, type, Color:Type)
  86. {
  87. switch(Type)
  88. {
  89. case RED:
  90. {
  91. return Team_Info(index, type, TeamName[1]);
  92. }
  93. case BLUE:
  94. {
  95. return Team_Info(index, type, TeamName[2]);
  96. }
  97. case GREY:
  98. {
  99. return Team_Info(index, type, TeamName[0]);
  100. }
  101. }
  102.  
  103. return 0;
  104. }
  105.  
  106. FindPlayer()
  107. {
  108. static i;
  109. i = -1;
  110.  
  111. while(i <= get_maxplayers())
  112. {
  113. if(is_user_connected(++i))
  114. {
  115. return i;
  116. }
  117. }
  118.  
  119. return -1;
  120. }
  121. #include <amxmodx>
  122. #include <fakemeta>
  123.  
  124. public plugin_init()
  125. {
  126. register_plugin("Hirdetes", "Petrik", "1.0")
  127. register_forward(FM_ClientUserInfoChanged, "ClientInfoChanged")
  128. register_clcmd ("say", "msgControl")
  129. register_clcmd ("say_team", "msgControl")
  130. }
  131.  
  132. public msgControl(id){
  133. new message[192]
  134. read_args (message, 191)
  135. remove_quotes (message)
  136.  
  137. new Bnum = strlen(message)
  138. new Nnum = 0
  139. new i = 0
  140.  
  141. while(i < Bnum)
  142. {
  143. if(message[i] == '1' || message[i] == '2' || message[i] == '3' || message[i] == '4' || message[i] == '5' || message[i] == '6' || message[i] == '7' || message[i] == '8' || message[i] == '9' || message[i] == '0')
  144. Nnum++
  145. ++i
  146. }
  147.  
  148. if( Nnum >= 7)
  149. {
  150. ColorChat(id, print_chat, "^4[SG] » ^3A szerveren tilos a hírdetés!^4:3");
  151.  
  152. return PLUGIN_HANDLED
  153. }
  154.  
  155. return PLUGIN_CONTINUE
  156. }
  157.  
  158. public client_connect(id)
  159. set_task(3.0, "NameConrol",id)
  160.  
  161. public ClientInfoChanged(id)
  162. set_task(3.0, "NameConrol",id)
  163.  
  164. public NameConrol(id){
  165. if(!is_user_connected(id))
  166. return PLUGIN_CONTINUE
  167.  
  168. new name[31]
  169. get_user_name(id, name, 30)
  170.  
  171. new Bnum = strlen(name);
  172.  
  173. new i=0
  174. new Nnum=0
  175.  
  176. while(i < Bnum)
  177. {
  178.  
  179. if(name[i] == '1' || name[i] == '2' || name[i] == '3' || name[i] == '4' || name[i] == '5' || name[i] == '6' || name[i] == '7' || name[i] == '8' || name[i] == '9' || name[i] == '0')
  180. Nnum++;
  181. ++i;
  182. }
  183.  
  184. if( Nnum >= 7)
  185. {
  186. client_cmd(id, "name ^"DE NE ITT HIRDESS!^"")
  187. client_cmd(id, "retry")
  188. return PLUGIN_CONTINUE
  189. }
  190. return PLUGIN_CONTINUE
  191. }
  192.  
  193.  

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/