Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
Wklejka 1udp5jf8xvk6i dodana przez killer98, 30.04.2014 19:16
gangi
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203.
#include <amxmodx> #include <amxmisc> #include <hamsandwich> #include <celltrie> #include <sqlx> #include <jailbreak> #include <colorchat> #define PLUGIN "Jail Gangi" #define VERSION "1.0" #define AUTHOR "Cypis" #define MAX_PEOPLE 5 #define MIN_ZYCZENIA 10 enum GANG_FLAGS { USER = 0, ADMINS, ASSIST } new const user_ranga[][] = {"", " (Zalozyciel)", " (Zastepca)"}; new GANG_FLAGS:user_flags[33]; new user_gang[33]; new bool:user_wczytalo[33]; new bool:create_gang[33]; new nazwa_gracza[33][35]; new Handle:info; new gszQuery[512+256]; new Trie:gnGangName new Trie:gnGangIle; new user_zyczenia[33]; new user_bunty[33]; new bool:nielicz; new msgid_sayText; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); RegisterHam(Ham_Killed, "player", "SmiercGraczaPost", 1); register_clcmd("say /rankg", "RankStats"); register_clcmd("say /topg", "Top15"); register_clcmd("say /gang", "MenuGang"); register_clcmd("say /gangi", "MenuGang"); register_clcmd("nazwa_gangu", "CreateNameGang"); register_clcmd("say_team", "cmdSayGang"); msgid_sayText = get_user_msgid("SayText"); register_message(msgid_sayText,"handleSayText"); } public plugin_cfg() { new pcvar_host, pcvar_user, pcvar_pass, pcvar_db; new szHost[32], szUser[32], szPass[32], szDb[32]; pcvar_host = register_cvar("jail_gang_host", "ip"); pcvar_user = register_cvar("jail_gang_user", "login"); pcvar_pass = register_cvar("jail_gang_pass", "haslo"); pcvar_db = register_cvar("jail_gang_db", "database"); get_pcvar_string(pcvar_host, szHost, 31); get_pcvar_string(pcvar_user, szUser, 31); get_pcvar_string(pcvar_pass, szPass, 31); get_pcvar_string(pcvar_db, szDb, 31); info = SQL_MakeDbTuple(szHost, szUser, szPass, szDb); new error, szError[128]; new Handle:hConn = SQL_Connect(info, error, szError, 127); if(error){ log_amx("[Gangi] Error: %s", szError); return; } gnGangName = TrieCreate(); gnGangIle = TrieCreate(); new Handle:query; SQL_FormatQuery("CREATE TABLE IF NOT EXISTS `GangName` (`id` int(10) NOT NULL AUTO_INCREMENT, `Name` varchar(32) NOT NULL, `Ilosc` int(10) NOT NULL DEFAULT '1', PRIMARY KEY (`id`));") query = SQL_PrepareQuery(hConn, gszQuery) SQL_Execute(query) SQL_FreeHandle(query); SQL_FormatQuery("CREATE TABLE IF NOT EXISTS `GangUser` (`id` int(10) NOT NULL DEFAULT '0', `Name` varchar(32) NOT NULL, `Zabicia` int(10) NOT NULL DEFAULT '0', `Zyczenia` int(10) NOT NULL DEFAULT '0', `Flaga` int(5) NOT NULL DEFAULT '0', PRIMARY KEY (`Name`));"); query = SQL_PrepareQuery(hConn, gszQuery); SQL_Execute(query) SQL_FreeHandle(query); query = SQL_PrepareQuery(hConn,"SELECT * FROM `GangName` WHERE 1"); if(!SQL_Execute(query)) { SQL_QueryError(query, szError, 127); log_amx("[Gangi] Nie mozna zaladowac gangow (%s)", szError); } else if(SQL_NumResults(query)) { new szNazwa[32], szInt[10]; while(SQL_MoreResults(query)) { num_to_str(SQL_ReadResult(query, 0), szInt, 9); SQL_ReadResult(query, 1, szNazwa, 31); TrieSetCell(gnGangIle, szInt, SQL_ReadResult(query, 2)); // numer gangu przypisany do ilosci ludzi w nim TrieSetString(gnGangName, szInt, szNazwa); // numeru gangu przypisana do nazwy gangu SQL_NextRow(query); } SQL_FreeHandle(query); } SQL_FreeHandle(hConn); } //RANK STATS public RankStats(id) { new menu = menu_create("Rank Stats:", "Handel_RankStats"); menu_additem(menu, "Twoj rank Buntów"); menu_additem(menu, "Twoj rank Zyczen"); menu_setprop(menu, MPROP_EXITNAME, "Wyjdz"); menu_display(id, menu); } public Handel_RankStats(id, menu, item) { if(item == MENU_EXIT) return; new data[2]; data[0] = id; data[1] = item; SQL_FormatQuery("SELECT COUNT(*) FROM `GangUser` WHERE `%s` >= %d;", item? "Zyczenia": "Zabicia", item? user_zyczenia[id]: user_bunty[id]); SQL_ThreadQuery(info, "PobierzRank", gszQuery, data, 2); } public PobierzRank(failstate, Handle:query, error[], errnum, data[], size){ if(failstate != TQUERY_SUCCESS){ log_amx("<Query> Error: %s", error); return; } new id = data[0]; if(!is_user_connected(id) && !is_user_connecting(id)) return; ColorChat(id, TEAM_COLOR, "^x04[RANK]^x01 Masz ^x03%i^x01 %s zajmujesz miejsce ^x03%i", data[1]? user_zyczenia[id]: user_bunty[id], data[1]? "zyczen": "buntow", SQL_ReadResult(query, 0)); } //TOP 15 public Top15(id) { new menu = menu_create("Top 15:", "Handel_Top"); menu_additem(menu, "Top 15 Buntów"); menu_additem(menu, "Top 15 Zyczen"); menu_setprop(menu, MPROP_EXITNAME, "Wyjdz"); menu_display(id, menu); } public Handel_Top(id, menu, item) { if(item == MENU_EXIT) return; new data[2]; data[0] = id; data[1] = item; SQL_FormatQuery("SELECT * FROM `GangUser` ORDER BY `%s` DESC LIMIT 15", item? "Zyczenia": "Zabicia"); SQL_ThreadQuery(info, "PobierzTop", gszQuery, data, 2); } public PobierzTop(failstate, Handle:query, error[], errnum, data[], size){ if(failstate != TQUERY_SUCCESS){ log_amx("<Query> Error: %s", error); return; } new id = data[0]; if(!is_user_connected(id) && !is_user_connecting(id)) return; if(SQL_NumRows(query)) { new buffer[2048], szName[41], iLen=0, i=0; iLen = copy(buffer[iLen], 2047-iLen, "<body bgcolor=#FFFFFF><table width=100%% cellpadding=2 cellspacing=0 border=0>"); iLen += formatex(buffer[iLen], 2047-iLen, "<tr align=center bgcolor=#52697B><th width=5%%> # <th width=35%% align=left> Gracz: <th width=20%%> Najwiecej %s", (data[1]? "йcze
Dodanych wklejek: 11179
Powered By (Pav32) Pastebin © 2011