NelsonCoutinho

Sistema Admin 0.1

Oct 17th, 2016
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.44 KB | None | 0 0
  1. // Sistema Criado por Smokiie_Gamer
  2. // PS: Fassa Salvamento do Sistema Admin, conforme seu Registro.
  3. //==========================================================================================//
  4. #include <a_samp>
  5. #include <zcmd>
  6. #include <sscanf2>
  7. #include <DOF2>
  8. //==========================================================================================//
  9. #define PASTA_CONTAS "Contas/%s.ini"// Coloque na sua pasta.
  10. #define DIALOG_LOGAR_ADM 1
  11. #define DIALOG_BANIDO 2
  12. //==========================================================================================//
  13. #define SendClientFormat(%0,%1,%2,%3); format(String, sizeof(String), %2, %3); SendClientMessage(%0, %1, String);
  14. #define SendClientFormatToAll(%0,%1,%2); format(String, sizeof(String), %1, %2); SendClientMessageToAll(%0, String);
  15. #define KickEx(%0) SetTimerEx("Kicka", 100, false, "i", %0)
  16. forward Kicka(p);
  17. //==========================================================================================//
  18. enum pInfo
  19. {
  20. Admin
  21. }
  22. //==========================================================================================//
  23. new Jogador[MAX_PLAYERS][pInfo];
  24. new String[100];
  25. new StringContas[100];
  26. new StringBanidos[100];
  27. new Dia, Mes, Ano, Hora, Minuto, Segundo;
  28. //==========================================================================================//
  29. #define VERMELHO 0xFF0000FF
  30. #define GOLD 0xFFD700FF
  31. //==========================================================================================//
  32. #if defined FILTERSCRIPT
  33.  
  34. public OnFilterScriptInit()
  35. {
  36. print("\n--------------------------------------");
  37. print(" Sistema Criado por Smokiie_Gamer");
  38. print("--------------------------------------\n");
  39. return 1;
  40. }
  41. #endif
  42. public OnFilterScriptExit()
  43. {
  44. DOF2_Exit();
  45. return 1;
  46. }
  47.  
  48. public OnPlayerConnect(playerid)
  49. {
  50. if(DOF2_FileExists(StringBanidos))
  51. {
  52. SendClientFormatToAll(VERMELHO, "O(A) Administrador(a) Guardiao kickou o(a) jogador(a) %s ( Motivo: Banido )", Nome(playerid));
  53. new StringCat[1000];
  54. strcat(StringCat, "{FFFFFF}Você está banido deste servidor!\n\n");
  55. strcat(StringCat, " Seguem os Dados:\n\n");
  56. format(String, sizeof(String), "{FF0000}Nick: {FFFFFF}%s\n", Nome(playerid)); strcat(StringCat, String);
  57. format(String, sizeof(String), "{FF0000}Admin Responsável: {FFFFFF}%s\n", DOF2_GetString(StringBanidos, "Admin")); strcat(StringCat, String);
  58. format(String, sizeof(String), "{FF0000}Motivo: {FFFFFF}%s\n", DOF2_GetString(StringBanidos, "Motivo")); strcat(StringCat, String);
  59. format(String, sizeof(String), "{FF0000}Data: {FFFFFF}%d/%d/%d\n", DOF2_GetInt(StringBanidos, "Dia"), DOF2_GetInt(StringBanidos, "Mês"), DOF2_GetInt(StringBanidos, "Ano")); strcat(StringCat, String);
  60. format(String, sizeof(String), "{FF0000}Hora: {FFFFFF}%d:%d\n\n", DOF2_GetInt(StringBanidos, "Hora"), DOF2_GetInt(StringBanidos, "Minuto")); strcat(StringCat, String);
  61. strcat(StringCat, "{FFFFFF}Se isto foi um engano acesse a {00FF00}SeuSite.com\n");// Coloque sue site
  62. strcat(StringCat, "{FFFFFF}e faça sua revisão em banidos seguindo as regras");
  63. ShowPlayerDialog(playerid, DIALOG_BANIDO, DIALOG_STYLE_MSGBOX, "{FF0000}Banido", StringCat, "Fechar", "");
  64. KickEx(playerid);
  65. return 1;
  66. }
  67. return 1;
  68. }
  69.  
  70. public OnPlayerRequestClass(playerid, classid)
  71. {
  72. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  73. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  74. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  75. return 1;
  76. }
  77.  
  78. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  79. {
  80. if(dialogid == DIALOG_LOGAR_ADM)
  81. {
  82. if(response)
  83. {
  84. format(StringContas, sizeof(StringContas), PASTA_CONTAS, Nome(playerid));
  85. if(!strlen(inputtext))
  86. {
  87. ShowPlayerDialog(playerid, DIALOG_LOGAR_ADM, DIALOG_STYLE_PASSWORD, "{00FF00}Logar Adm", "{FFFFFF}Digite sua Senha !\n", "Continuar", "Cancelar");
  88. SendClientMessage(playerid, VERMELHO, "Digite uma senha!");
  89. return 1;
  90. }
  91. if(strlen(inputtext) < 5)
  92. {
  93. ShowPlayerDialog(playerid, DIALOG_LOGAR_ADM, DIALOG_STYLE_PASSWORD, "{00FF00}Logar Adm", "{FFFFFF}Digite sua Senha !\n", "Continuar", "Cancelar");
  94. SendClientMessage(playerid, VERMELHO, "Digite uma senha!");
  95. return 1;
  96. }
  97. if(strcmp(DOF2_GetString("SenhaAdmin.ini", "SenhaAdmin"), inputtext, true) == 0)// Crie 1 Bloco de notas com o Nome SenhaAdmin e guarde como .ini
  98. {
  99. Jogador[playerid][Admin] = DOF2_GetInt(StringContas, "Admin");
  100. SendClientFormat(playerid, GOLD, "Você logou na administração com sucesso! Logado como nível %d", Jogador[playerid][Admin]);
  101. return 1;
  102. }
  103. else
  104. {
  105. ShowPlayerDialog(playerid, DIALOG_LOGAR_ADM, DIALOG_STYLE_PASSWORD, "{00FF00}Logar Adm", "{FFFFFF}Digite sua Senha !\n", "Continuar", "Cancelar");
  106. SendClientMessage(playerid, VERMELHO, "Senha incorreta!");
  107. return 1;
  108. }
  109. }
  110. }
  111. return 1;
  112. }
  113.  
  114.  
  115. CMD:setaradmin(playerid, params[])
  116. {
  117. new ID;
  118. new Nivel;
  119. if(!IsPlayerAdmin(playerid)) return 0;
  120. if(sscanf(params, "ud", ID, Nivel)) return SendClientMessage(playerid, VERMELHO, "Use: /setaradmin (id) (Nivel)");
  121. if(Nivel < 0 || Nivel > 4) return SendClientMessage(playerid, VERMELHO, "Nivel invalido! Use de 0 a 4");
  122. format(StringContas, sizeof(StringContas), PASTA_CONTAS, Nome(ID));
  123. DOF2_SetInt(StringContas, "Admin", Nivel);
  124. Jogador[ID][Admin] = 0;
  125. DOF2_SaveFile();
  126. if(Nivel == (1))
  127. {
  128. SendClientFormat(playerid, GOLD, "Você deu o cargo de Ajudante para o(a) jogador(a) %s[%d].", Nome(ID), ID);
  129. SendClientFormat(ID, GOLD, "O(A) Staff %s deu o cargo de Ajudante para você.", Nome(playerid), playerid);
  130. format(String, sizeof(String), "O(A) Staff %s deu o cargo de Ajudante para o %s", Nome(playerid), Nome(ID));
  131. }
  132. if(Nivel == (2))
  133. {
  134. SendClientFormat(playerid, GOLD, "Você deu o cargo de Moderador(a) para o(a) jogador(a) %s[%d].", Nome(ID), ID);
  135. SendClientFormat(ID, GOLD, "O(A) Staff %s deu o cargo de Moderador(a) para você.", Nome(playerid), playerid);
  136. format(String, sizeof(String), "O Staff %s deu o cargo de Moderador para o %s", Nome(playerid), Nome(ID));
  137. }
  138. if(Nivel == (3))
  139. {
  140. SendClientFormat(playerid, GOLD, "Você deu o cargo de Administrador(a) para o(a) jogador(a) %s[%d].", Nome(ID), ID);
  141. SendClientFormat(ID, GOLD, "O(A) Staff %s deu o cargo de Administrador(a) para você.", Nome(playerid), playerid);
  142. format(String, sizeof(String), "O Staff %s deu o cargo de Administrador para o %s", Nome(playerid), Nome(ID));
  143. }
  144. if(Nivel == (4))
  145. {
  146. SendClientFormat(playerid, GOLD, "Você deu o cargo de Staff para o(a) jogador(a) %s[%d].", Nome(ID), ID);
  147. SendClientFormat(ID, GOLD, "O(A) Staff %s deu o cargo de Staff para você.", Nome(playerid), playerid);
  148. format(String, sizeof(String), "O Staff %s deu o cargo de Staff para o %s", Nome(playerid), Nome(ID));
  149. }
  150. return 1;
  151. }
  152.  
  153. CMD:logaradm(playerid)
  154. {
  155. if(Jogador[playerid][Admin] < 1)
  156. {
  157. format(StringContas, sizeof(StringContas), PASTA_CONTAS, Nome(playerid));
  158. if(DOF2_GetInt(StringContas, "Admin") > 0)
  159. {
  160. ShowPlayerDialog(playerid, DIALOG_LOGAR_ADM, DIALOG_STYLE_PASSWORD, "{00FF00}Logar Adm", "{FFFFFF}Digite a senha que está nos tópicos invisíveis\n do fórum:\n", "Continuar", "Cancelar");
  161. }
  162. else SendClientMessage(playerid, VERMELHO, "Você não é um administrador!");
  163. return 1;
  164. }
  165. else SendClientMessage(playerid, VERMELHO, "Você já está logado como adm!");
  166. return 1;
  167. }
  168. CMD:ir(playerid, params[])
  169. {
  170. new Float: X, Float: Y, Float: Z, ID;
  171. if(Jogador[playerid][Admin] > 0)
  172. {
  173. if(sscanf(params, "d", ID)) return SendClientMessage(playerid, VERMELHO, "Use: /ir (id)");
  174. if(IsPlayerConnected(ID))
  175. {
  176. GetPlayerPos(ID, X, Y, Z);
  177. SetPlayerInterior(playerid, GetPlayerInterior(ID));
  178. SetPlayerPos(playerid, X+2, Y+2, Z);
  179. if(Jogador[playerid][Admin] == 1)
  180. {
  181. SendClientFormat(ID, GOLD, "O(A) Ajudante %s foi até à sua posição!", Nome(playerid));
  182. SendClientFormat(playerid, GOLD, "Você foi até à posição do(a) jogador(a) %s[%i].", Nome(ID), ID);
  183. format(String, sizeof(String), "O(A) Ajudante %s foi até à posição do jogador %s.", Nome(playerid), Nome(ID));
  184. }
  185. if(Jogador[playerid][Admin] == 2)
  186. {
  187. SendClientFormat(ID, GOLD, "O(A) Moderador(a) %s foi até à sua posição!", Nome(playerid));
  188. SendClientFormat(playerid, GOLD, "Você foi até à posição do(a) jogador(a) %s[%i].", Nome(ID), ID);
  189. format(String, sizeof(String), "O(A) Moderador(a) %s foi até à posição do jogador %s.", Nome(playerid), Nome(ID));
  190. }
  191. if(Jogador[playerid][Admin] == 3)
  192. {
  193. SendClientFormat(ID, GOLD, "O(A) Administrador(a) %s foi até à sua posição!", Nome(playerid));
  194. SendClientFormat(playerid, GOLD, "Você foi até à posição do(a) jogador(a) %s[%i].", Nome(ID), ID);
  195. format(String, sizeof(String), "O(A) Administrador(a) %s foi até à posição do jogador %s.", Nome(playerid), Nome(ID));
  196. }
  197. if(Jogador[playerid][Admin] == 4)
  198. {
  199. SendClientFormat(ID, GOLD, "O(A) Staff %s foi até à sua posição!", Nome(playerid));
  200. SendClientFormat(playerid, GOLD, "Você foi até à posição do(a) jogador(a) %s[%i].", Nome(ID), ID);
  201. format(String, sizeof(String), "O(A) Staff %s foi até à posição do jogador %s.", Nome(playerid), Nome(ID));
  202. }
  203. return 1;
  204. }
  205. else SendClientMessage(playerid, VERMELHO, "Jogador não conectado!");
  206. return 1;
  207. }
  208. else SendClientMessage(playerid, VERMELHO, "Você não tem permissão!");
  209. return 1;
  210. }
  211. CMD:trazer(playerid, params[])
  212. {
  213. new
  214. Float: X,
  215. Float: Y,
  216. Float: Z,
  217. ID;
  218. if(Jogador[playerid][Admin] > 0)
  219. {
  220. if(sscanf(params, "d", ID)) return SendClientMessage(playerid, VERMELHO, "Use: /trazer (id)");
  221. if(IsPlayerConnected(ID))
  222. {
  223. GetPlayerPos(playerid, X, Y, Z);
  224. SetPlayerInterior(ID, GetPlayerInterior(playerid));
  225. SetPlayerPos(ID, X+2, Y+2, Z);
  226. if(Jogador[playerid][Admin] == 1)
  227. {
  228. SendClientFormat(ID, GOLD, "O(A) Ajudante %s trouxe você até ele!", Nome(playerid));
  229. SendClientFormat(playerid, GOLD, "Você trouxe o(a) jogador(a) %s[%i].", Nome(ID), ID);
  230. format(String, sizeof(String), "O(A) Ajudante %s trouxe o jogador %s até ele.", Nome(playerid), Nome(ID));
  231. }
  232. if(Jogador[playerid][Admin] == 2)
  233. {
  234. SendClientFormat(ID, GOLD, "O(A) Moderador(a) %s trouxe você até ele!", Nome(playerid));
  235. SendClientFormat(playerid, GOLD, "Você trouxe o(a) jogador(a) %s[%i].", Nome(ID), ID);
  236. format(String, sizeof(String), "O(A) Moderador(a) %s trouxe o jogador %s até ele.", Nome(playerid), Nome(ID));
  237. }
  238. if(Jogador[playerid][Admin] == 3)
  239. {
  240. SendClientFormat(ID, GOLD, "O(A) Administrador(a) %s trouxe você até ele!", Nome(playerid));
  241. SendClientFormat(playerid, GOLD, "Você trouxe o(a) jogador(a) %s[%i].", Nome(ID), ID);
  242. format(String, sizeof(String), "O(A) Administrador(a) %s trouxe o jogador %s até ele.", Nome(playerid), Nome(ID));
  243. }
  244. if(Jogador[playerid][Admin] == 4)
  245. {
  246. SendClientFormat(ID, GOLD, "O(A) Staff %s trouxe você até ele!", Nome(playerid));
  247. SendClientFormat(playerid, GOLD, "Você trouxe o(a) jogador(a) %s[%i].", Nome(ID), ID);
  248. format(String, sizeof(String), "O(A) Staff %s trouxe o jogador %s até ele.", Nome(playerid), Nome(ID));
  249. }
  250. return 1;
  251. }
  252. else SendClientMessage(playerid, VERMELHO, "Jogador não conectado!");
  253. return 1;
  254. }
  255. else SendClientMessage(playerid, VERMELHO, "Você não tem permissão!");
  256. return 1;
  257. }
  258. CMD:ban(playerid, params[])
  259. {
  260. new ID;
  261. new motivo[15];
  262. if(Jogador[playerid][Admin] >= 3)
  263. {
  264. if(sscanf(params, "us", ID, motivo)) return SendClientMessage(playerid, VERMELHO, "Use: /ban (id) (Motivo)");
  265. if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, VERMELHO, "Jogador não conectado!");
  266. if(Jogador[playerid][Admin] == 3)
  267. {
  268. SendClientFormatToAll(VERMELHO, "O(A) Administrador(a) %s baniu o(a) jogador(a) %s ( Motivo: %s )", Nome(playerid), Nome(ID), motivo);
  269. }
  270. if(Jogador[playerid][Admin] == 4)
  271. {
  272. SendClientFormatToAll(VERMELHO, "O(A) Staff %s baniu o(a) jogador(a) %s ( Motivo: %s )", Nome(playerid), Nome(ID), motivo);
  273. }
  274. format(StringContas, sizeof(StringContas), "Banidos/%s.ini", Nome(ID));
  275. getdate(Ano, Mes, Dia);
  276. gettime(Hora, Minuto, Segundo);
  277. DOF2_CreateFile(StringContas);
  278. DOF2_SetString(StringContas, "Admin", Nome(playerid));// Irá Criar Quem Baniu / Motivo / Dia / Mes / Ano / Hora / Minuto / etc...
  279. DOF2_SetString(StringContas, "Motivo", motivo);
  280. DOF2_SetInt(StringContas, "Dia", Dia);
  281. DOF2_SetInt(StringContas, "Mês", Mes);
  282. DOF2_SetInt(StringContas, "Ano", Ano);
  283. DOF2_SetInt(StringContas, "Hora", Hora);
  284. DOF2_SetInt(StringContas, "Minuto", Minuto);
  285. DOF2_SaveFile();
  286. KickEx(ID);
  287. }
  288. else
  289. {
  290. SendClientMessage(playerid, VERMELHO, "Você não tem permissão!");
  291. return 1;
  292. }
  293. return 1;
  294. }
  295.  
  296. CMD:kick(playerid, params[])
  297. {
  298. new
  299. ID,
  300. Motivo[80];
  301. if(Jogador[playerid][Admin] > 0)
  302. {
  303. if(sscanf(params, "us", ID, Motivo)) return SendClientMessage(playerid, VERMELHO, "Use: /Kick (id) (Motivo)");
  304. if(IsPlayerConnected(ID))
  305. {
  306. if(Jogador[playerid][Admin] == 1)
  307. {
  308. SendClientFormatToAll(VERMELHO, "O(A) Ajudante %s kickou o(a) jogador(a) %s ( Motivo: %s )", Nome(playerid), Nome(ID), Motivo);
  309. }
  310. if(Jogador[playerid][Admin] == 2)
  311. {
  312. SendClientFormatToAll(VERMELHO, "O(A) Moderador(a) %s kickou o(a) jogador(a) %s ( Motivo: %s )", Nome(playerid), Nome(ID), Motivo);
  313. }
  314. if(Jogador[playerid][Admin] == 3)
  315. {
  316. SendClientFormatToAll(VERMELHO, "O(A) Administrador(a) %s kickou o(a) jogador(a) %s ( Motivo: %s )", Nome(playerid), Nome(ID), Motivo);
  317. }
  318. if(Jogador[playerid][Admin] == 4)
  319. {
  320. SendClientFormatToAll(VERMELHO, "O(A) Staff %s kickou o(a) jogador(a) %s ( Motivo: %s )", Nome(playerid), Nome(ID), Motivo);
  321. }
  322. KickEx(ID);
  323. }
  324. else SendClientMessage(playerid, VERMELHO, "Jogador não conectado!");
  325. return 1;
  326. }
  327. else SendClientMessage(playerid, VERMELHO, "Você não tem permissão!");
  328. return 1;
  329. }
  330. //=======================================================================================================//
  331. stock Nome(playerid)
  332. {
  333. new name[MAX_PLAYER_NAME];
  334. GetPlayerName(playerid, name, sizeof(name));
  335. return name;
  336. }
  337. public Kicka(p)
  338. {
  339. Kick(p);
  340. return 1;
  341. }
Advertisement
Add Comment
Please, Sign In to add comment