Advertisement
Guest User

AntiGod by DraKoN

a guest
Aug 7th, 2010
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.14 KB | None | 0 0
  1. #include <a_samp>
  2. #define NARANJA 0xF97804FF
  3. new Float:GODX;
  4. new Float:GODY;
  5. new Float:GODZ;
  6. new Float:ComandoGod;
  7. public OnPlayerCommandText(playerid, cmdtext[])
  8. {
  9.     new cmd[128];
  10.     new idx;
  11.     if(strcmp(cmd, "/god", true) == 0)
  12.     {
  13.           new tmp[20];
  14.           tmp = comandos(cmdtext, idx);
  15.           if(GetDistanceBetweenPlayers(playerid,strval(tmp))>20)
  16.           {
  17.                return SendClientMessage(playerid,NARANJA,"[INCORRECT]: Jugador Longe Demas");
  18.           }
  19.           if(GetPlayerInterior(strval(tmp)>0))
  20.           {
  21.                return SendClientMessage(playerid,NARANJA,"[INCORRECT]: Jugador en Interior");
  22.           }
  23.           if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, NARANJA, "[INCORRECT]: El Jugador si encontra OFF-LINE");
  24.           if(strval(tmp) == playerid) return SendClientMessage(playerid, NARANJA, "[INCORRECT]: No Pode Reportar a Ti");
  25.           if(strlen(tmp) == 0) return SendClientMessage(playerid, NARANJA, "Uso del Comando: /god [ID]");
  26.           GetPlayerHealth(strval(tmp),ComandoGod);
  27.           SetPlayerHealth(strval(tmp),80);
  28.           GetPlayerPos(strval(tmp), GODX, GODY, GODZ);
  29.           SetPlayerPos(strval(tmp), GODX, GODY, GODZ+20);
  30.           SetTimerEx("CheckGod",2000,false,"ii",playerid,strval(tmp));//No Altere Tiempo
  31.           SendClientMessage(playerid,NARANJA, "[INFO]: Para llevar a cabo con éxito congelaremos durante 2  segundos");
  32.           TogglePlayerControllable(playerid,0);
  33.           return 1;
  34.     }
  35.     return 0;
  36. }
  37. stock GetDistanceBetweenPlayers(playerid,playerid2)
  38. {
  39.     new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
  40.     new Float:dis;
  41.     GetPlayerPos(playerid,x1,y1,z1);
  42.     GetPlayerPos(playerid2,x2,y2,z2);
  43.     dis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs          (floatsub(z2,z1)),2));
  44.     return floatround(dis);
  45. }
  46. comandos(const string[], &index)//strtok Mudada
  47. {
  48.         new length = strlen(string);
  49.         while ((index < length) && (string[index] <= ' '))
  50.         {
  51.             index++;
  52.         }
  53.         new offset = index;
  54.         new result[20];
  55.         while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  56.         {
  57.             result[index - offset] = string[index];
  58.             index++;
  59.         }
  60.         result[index - offset] = EOS;
  61.         return result;
  62. }
  63.  
  64. forward CheckGod(health1,playerid);
  65. public CheckGod(health1,playerid)
  66. {
  67.      new string[62+MAX_PLAYER_NAME+MAX_PLAYER_NAME];
  68.      new Float:x, Float:y, Float:z;
  69.      GetPlayerPos(playerid, x, y, z);
  70.      if(z != GODZ) return 0;
  71.      new Float:health;
  72.      GetPlayerHealth(playerid,health);
  73.      if(health >= 80)
  74.      {
  75.           new name2[MAX_PLAYER_NAME];
  76.           GetPlayerName(health1, name2, sizeof(name2));
  77.           new name[MAX_PLAYER_NAME];
  78.           GetPlayerName(playerid, name, sizeof(name));
  79.           format(string, sizeof(string),"-AntiGod-: %s ha banned for GodMod (By: %s [/god])",name,name2);
  80.           SendClientMessageToAll(NARANJA, string);
  81.           Ban(playerid);
  82.      }
  83.      SetPlayerHealth(playerid,ComandoGod);
  84.      TogglePlayerControllable(health1,1);
  85.      return 1;
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement