Advertisement
Untonyst

u_fixkick.inc

Aug 31st, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.25 KB | None | 0 0
  1. /*
  2.  *  Fix Kick(), Ban() and BanEx().
  3.  *
  4.  *  Copyright (c) 2016 Anton Styazhkin (Untonyst).
  5.  *
  6.  *  This software is provided 'as-is', without any express or implied warranty.
  7.  *  In no event will the authors be held liable for any damages arising
  8.  *  from the use of this software.
  9.  *
  10.  *  Permission is granted to anyone to use this software for
  11.  *  any purpose, including commercial applications, and to alter it and
  12.  *  redistribute it freely, subject to the following restrictions:
  13.  *
  14.  *  1.  The origin of this software must not be misrepresented; you must not
  15.  *      claim that you wrote the original software. If you use this software in
  16.  *      a product, an acknowledgment in the product documentation would be
  17.  *      appreciated but is not required.
  18.  *  2.  Altered source versions must be plainly marked as such, and must not be
  19.  *      misrepresented as being the original software.
  20.  *  3.  This notice may not be removed or altered from any source distribution.
  21.  */
  22.  
  23. #if defined _u_kickfix_included
  24.     #endinput
  25. #endif
  26. #define _u_kickfix_included
  27.  
  28. #if !defined DEFAULT_TIME_INTERVAL
  29.     #define DEFAULT_TIME_INTERVAL (400)
  30. #endif
  31.  
  32. @__u_Kick(playerid);
  33. @__u_Kick(playerid)
  34. {
  35.     Kick(playerid);
  36. }
  37.  
  38. @__u_Ban(playerid);
  39. @__u_Ban(playerid)
  40. {
  41.     Ban(playerid);
  42. }
  43.  
  44. @__u_BanEx(playerid);
  45. @__u_BanEx(playerid)
  46. {
  47.     new reason[
  48.         #if defined MAX_REASON_TEXT
  49.             MAX_REASON_TEXT
  50.         #else
  51.             128
  52.         #endif
  53.     ];
  54.     GetPVarString(playerid, "BAN_EX_REASON", reason, sizeof(reason));
  55.     DeletePVar(playerid, "BAN_EX_REASON");
  56.     // (c) Daniel_Cortez
  57.     for (new i = 0; ((reason[i] &= 0xFF) != '\0') && (++i != sizeof(reason));) {}
  58.     BanEx(playerid, reason);
  59. }
  60.  
  61. stock
  62.     PlayerKick(playerid, time = DEFAULT_TIME_INTERVAL)
  63. {
  64.     if (!IsPlayerConnected(playerid))
  65.         return 0;
  66.     SetTimerEx("@__u_Kick", time, false, "d", playerid);
  67.     return 1;
  68. }
  69.  
  70. stock
  71.     PlayerBan(playerid, time = DEFAULT_TIME_INTERVAL)
  72. {
  73.     if (!IsPlayerConnected(playerid))
  74.         return 0;
  75.     SetTimerEx("@__u_Ban", time, false, "d", playerid);
  76.     return 1;
  77. }
  78.  
  79. stock
  80.     PlayerBanEx(playerid, reason[], time = DEFAULT_TIME_INTERVAL)
  81. {
  82.     if (!IsPlayerConnected(playerid))
  83.         return 0;
  84.     SetTimerEx("@__u_BanEx", time, false, "d", playerid);
  85.     SetPVarString(playerid, "BAN_EX_REASON", reason);
  86.     return 1;
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement