Advertisement
Guest User

Pause check & kick, by Vanter

a guest
Jun 30th, 2014
809
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.94 KB | None | 0 0
  1. //First copy this on top of your script.
  2.  
  3. #define                   COLOR_RED                     0xFF0000AA              //{FF0000}
  4.  
  5. forward KickPlayer(ID);
  6. public KickPlayer(ID)
  7. {
  8.      Kick(ID);
  9.      return 1;
  10. }
  11.  
  12. forward PauseCheck(playerid);
  13. public PauseCheck(playerid)
  14. {
  15.     new Float:x, Float:y, Float:z;
  16.     GetPlayerPos(playerid, x, y, z);
  17.     if(GetPVarFloat(playerid,"pausex1") == 0)
  18.     {
  19.          SetPVarFloat(playerid,"pausex1",x);
  20.          SetPVarFloat(playerid,"pausey1",y);
  21.          return 1;
  22.     }
  23.     if(GetPVarFloat(playerid,"pausex1") != 0)
  24.     {
  25.          SetPVarFloat(playerid,"pausex2",x);
  26.          SetPVarFloat(playerid,"pausey2",y);
  27.          if(GetPVarFloat(playerid,"pausex1") == GetPVarFloat(playerid,"pausex2") && GetPVarFloat(playerid,"pausey1") == GetPVarFloat(playerid,"pausey2"))
  28.          {
  29.            if(!IsPlayerAdmin) //if player is not RCON logged in.
  30.            {
  31.              new string[128];
  32.              new pname[24];
  33.              GetPlayerName(playerid,pname,sizeof(pname));
  34.              format(string, sizeof(string), "~r~KICKED!");
  35.              GameTextForPlayer(playerid, string, 3000, 1);
  36.              SendClientMessage(playerid,COLOR_RED,"[KICKED] You have been kicked from the server. [Reason: Paused player]");
  37.              format(string,sizeof(string),"[SERVER KICK] %s(%d) has been kicked. [Reason: Paused player]",pname,playerid);
  38.              SendClientMessageToAll(COLOR_RED,string);
  39.              format(string,sizeof(string),"13[SERVER KICK] %s(%d) has been kicked. [Reason: Paused player]",pname,playerid);
  40.              SetTimerEx("KickPlayer",1000,false,"i",playerid);
  41.              return 1;
  42.             }
  43.          }
  44.          SetPVarFloat(playerid,"pausex1",0);
  45.          SetPVarFloat(playerid,"pausey1",0);
  46.     }
  47.     return 1;
  48. }
  49.  
  50. //Add this under OnPlayerDeath if you don't have a reset variables public.
  51.  
  52.     SetPVarFloat(playerid,"pausex1",0);
  53.     SetPVarFloat(playerid,"pausey1",0);
  54.    
  55.     SetPVarFloat(playerid,"pausex2",0);
  56.     SetPVarFloat(playerid,"pausey2",0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement