Advertisement
Guest User

Bloqueador by Toggle

a guest
Apr 20th, 2011
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. // Sistema para bloquear a usuarios /bloquear.
  2. // Créditos: Toggle
  3. /***** ] Includes [ *****/
  4. #include <a_samp>
  5.  
  6. /***** ] Defines [ *****/
  7. #define ROSA 0xC2A2DAAA
  8. #define BLANCO 0xFFFFFFFF
  9.  
  10. /***** ] New's [ ******/
  11. new File:archivo;
  12.  
  13. /***** ] OnPlayerConnect [ *****/
  14. public OnPlayerConnect(playerid)
  15. {
  16. new nombre[MAX_PLAYER_NAME];
  17. new string[256];
  18. GetPlayerName(playerid, nombre,sizeof(nombre));
  19. format(string, sizeof(string), "Bloqueados/%s.ini", nombre);
  20. if(fexist(string))
  21. {
  22. SendClientMessage(playerid, 0xFF0000FF, "Esta cuenta está bloqueada. Por lo tanto usted no podrá jugar aqui.");
  23. SendClientMessage(playerid, 0xFF0000FF, "Si quiere más información acuda a nuestro foro.");
  24. Kick(playerid);
  25. }
  26. return 1;
  27. }
  28.  
  29. /***** ] OnPlayerCommandText [ *****/
  30. public OnPlayerCommandText(playerid, cmdtext[])
  31. {
  32. new cmd[256], idx, giveplayerid;
  33. new Nombre[MAX_PLAYER_NAME];
  34. new giveplayername[MAX_PLAYER_NAME];
  35. GetPlayerName(playerid, Nombre, sizeof(Nombre));
  36. new string[256];
  37. cmd = strtok(cmdtext, idx);
  38.  
  39. if(strcmp(cmd, "/bloquear", true) == 0)
  40. {
  41. new tmp[256];
  42. tmp = strtok(cmdtext, idx);
  43. if(!strlen(tmp)){
  44. SendClientMessage(playerid, BLANCO, "Use: /bloquear [ID del Jugador]");
  45. return 1;
  46. }
  47. giveplayerid = strval(tmp);
  48. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  49. if(IsPlayerAdmin(playerid))
  50. {
  51. if(IsPlayerConnected(playerid))
  52. {
  53. new str[256];
  54. format(str, sizeof(str), "Bloqueados/%s.ini", giveplayername);
  55. archivo = fopen(str, io_write);
  56. if(archivo)
  57. {
  58. format(str,sizeof(str), "Este usuario ha sido bloqueado por algun motivo.");
  59. fwrite(archivo, str);
  60. fclose(archivo);
  61. }
  62. Kick(giveplayerid);
  63. format(string, sizeof(string), "La cuenta de %s ha sido bloqueada por el Administrador: %s.", giveplayername, Nombre);
  64. SendClientMessageToAll(0xFF0000FF,string);
  65. printf("%s",string);
  66. }
  67. else
  68. {
  69. SendClientMessage(playerid, 0xFF0000FF, "ID Invalida.");
  70. }
  71. }
  72. else
  73. {
  74. SendClientMessage(playerid, 0xFF0000FF, "No estás autorizado a usar el comando.");
  75. }
  76. return 1;
  77. }
  78. return 0;
  79. }
  80.  
  81. /***** ] Strtok [ *****/
  82. strtok(const string[], &index)
  83. {
  84. new length = strlen(string);
  85. while ((index < length) && (string[index] <= ' '))
  86. {
  87. index++;
  88. }
  89.  
  90. new offset = index;
  91. new result[20];
  92. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  93. {
  94. result[index - offset] = string[index];
  95. index++;
  96. }
  97. result[index - offset] = EOS;
  98. return result;
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement