MacMillan_

Código KICK/BAN ZCMD + SSCANF COMPLETO

May 28th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.56 KB | None | 0 0
  1. #include <a_samp>
  2. #include <ZCMD>
  3. #include <sscanf>
  4.  
  5. #define Kick(%0) SetTimerEx("Kicka", 100, false, "i", %0)
  6. #define Ban(%0) SetTimerEx("Bana", 100, false, "i", %0)
  7.  
  8. //Forwards
  9. forward Kicka(p);
  10. forward Bana(p);
  11.  
  12. public Kicka(p) {
  13.         #undef Kick
  14.         Kick(p);
  15.         #define Kick(%0) SetTimerEx("Kicka", 100, false, "i", %0)
  16.         return 1;
  17. }
  18.  
  19. public Bana(p) {
  20.         #undef Ban
  21.         Ban(p);
  22.         #define Ban(%0) SetTimerEx("Bana", 100, false, "i", %0)
  23.         return 1;
  24. }
  25.  
  26. //COMANDOS
  27. //========================== [KICK] =========================================//
  28. CMD:kick(playerid, params[]) {
  29.         new ID, Motivo[48], string[174], pNomi[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME];
  30.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Você não tem permissão para usar este comando!");
  31.         if(sscanf(params, "us", ID, Motivo)) return SendClientMessage(playerid, -1, "{FF0000}USE :{FFFFFF}/kick [ID] [MOTIVO].");
  32.         if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, "Este jogador não se encontra online.");
  33.         if(strlen(Motivo) > 48) return SendClientMessage(playerid, -1,"Use no máximo 48 caracteres no motivo!");
  34.         GetPlayerName(ID, pNomi, sizeof(pNomi));
  35.         GetPlayerName(playerid, aname, sizeof(aname));
  36.         Kick(ID);
  37.         format(string, sizeof(string),"{FF0000}-| O Administrador %s [ID:%d] kickou o jogador %s [ID:%d]. Motivo : %s |-", aname, playerid, pNomi, ID, Motivo);
  38.         SendClientMessageToAll(-1,string);
  39.         return 1;
  40. }
  41.  
  42. //========================= [BAN] ==========================================//
  43. CMD:ban(playerid, params[]) {
  44.         new ID, Motivo[48], string[174], pNomi[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME];
  45.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Você não tem permissão para usar este comando!");
  46.         if(sscanf(params, "us", ID, Motivo)) return SendClientMessage(playerid, -1, "{FF0000}USE :{FFFFFF}/ban [ID] [MOTIVO] .");
  47.         if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, "Este jogador não se encontra online.");
  48.         if(strlen(Motivo) > 48) return SendClientMessage(playerid, -1,"Use no máximo 48 caracteres no motivo!");
  49.         GetPlayerName(playerid, pNomi, sizeof(pNomi));
  50.         GetPlayerName(ID, aname, sizeof(aname));
  51.         Ban(ID);
  52.         format(string, sizeof(string),"{FF0000}-| O Administrador %s [ID:%d] baniu o jogador %s [ID:%d]. Motivo : %s |-", pNomi, ID, aname, ID, Motivo);
  53.         SendClientMessageToAll(-1,string);
  54.         return 1;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment