Advertisement
Guest User

Filterscript by Biker09

a guest
Mar 30th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.37 KB | None | 0 0
  1. #define FILTERSCRIPT
  2. #include <a_samp>
  3. #include <zcmd>
  4.  
  5. #define Farbe/* --->*/ 0x00FF00FF //<--- Hier deine Farbe eintragen
  6.  
  7. new Text3D:Label;
  8.  
  9. public OnFilterScriptInit()
  10. {
  11.     print("\n--------------------------------------");
  12.     print(" ###Filterscript by Biker09###");
  13.     print("--------------------------------------\n");
  14.     return 1;
  15. }
  16.  
  17. CMD:createlabelonplayer(playerid,params[])
  18. {
  19.      if(IsPlayerAdmin(playerid))
  20.      {
  21.            new Float:X,Float:Y,Float:Z,Reichweite,Text[128],pID,str[128],str2[128];
  22.            if(sscanf(params,"usi",pID,Text,Reichweite))return SendClientMessage(playerid,0x646464FF,"/createlabelonplayer [Spieler] [Text] [Reichweite]");
  23.            if(IsPlayerConnected(pID))
  24.            {
  25.                GetPlayerPos(pID,X,Y,Z);
  26.                format(str,sizeof(str),"%s",Text);
  27.                Label = Create3DTextLabel(str,Farbe,X,Y,Z,Reichweite,0,0);
  28.                format(str2,sizeof(str2),"Du hast an der Position von %s ein 3DText Label erstellt!",pID);
  29.                SendClientMessage(playerid,Farbe,str2);
  30.            }
  31.            else
  32.            {
  33.                 SendClientMessage(playerid,Farbe,"Der Spieler ist nicht online!");
  34.            }
  35.      }
  36.      return 1;
  37. }
  38.  
  39. CMD:deletelabel(playerid,cmdtext[])
  40. {
  41.      if(IsPlayerAdmin(playerid))
  42.      {
  43.          Delete3DTextLabel(Label);
  44.      }
  45.      return 1;
  46. }
  47.  
  48. CMD:createlabel(playerid,params[])
  49. {
  50.      if(IsPlayerAdmin(playerid))
  51.      {
  52.            new Float:X,Float:Y,Float:Z,Reichweite,Text[128],str[128];
  53.            if(sscanf(params,"si",Text,Reichweite))return SendClientMessage(playerid,0x646464FF,"/createlabel [Text] [Reichweite]");
  54.            GetPlayerPos(playerid,X,Y,Z);
  55.            format(str,sizeof(str),"%s",Text);
  56.            Label = Create3DTextLabel(str,Farbe,X,Y,Z,Reichweite,0,0);
  57.            SendClientMessage(playerid,Farbe,"Du hast ein 3DLabel erstellt!");
  58.      }
  59.      return 1;
  60. }
  61.  
  62. stock sscanf(string[], format[], {Float,_}:...)
  63. {
  64.     #if defined isnull
  65.         if (isnull(string))
  66.     #else
  67.         if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  68.     #endif
  69.         {
  70.             return format[0];
  71.         }
  72.     #pragma tabsize 4
  73.     new
  74.         formatPos = 0,
  75.         stringPos = 0,
  76.         paramPos = 2,
  77.         paramCount = numargs(),
  78.         delim = ' ';
  79.     while (string[stringPos] && string[stringPos] <= ' ')
  80.     {
  81.         stringPos++;
  82.     }
  83.     while (paramPos < paramCount && string[stringPos])
  84.     {
  85.         switch (format[formatPos++])
  86.         {
  87.             case '\0':
  88.             {
  89.                 return 0;
  90.             }
  91.             case 'i', 'd':
  92.             {
  93.                 new
  94.                     neg = 1,
  95.                     num = 0,
  96.                     ch = string[stringPos];
  97.                 if (ch == '-')
  98.                 {
  99.                     neg = -1;
  100.                     ch = string[++stringPos];
  101.                 }
  102.                 do
  103.                 {
  104.                     stringPos++;
  105.                     if ('0' <= ch <= '9')
  106.                     {
  107.                         num = (num * 10) + (ch - '0');
  108.                     }
  109.                     else
  110.                     {
  111.                         return -1;
  112.                     }
  113.                 }
  114.                 while ((ch = string[stringPos]) > ' ' && ch != delim);
  115.                 setarg(paramPos, 0, num * neg);
  116.             }
  117.             case 'h', 'x':
  118.             {
  119.                 new
  120.                     num = 0,
  121.                     ch = string[stringPos];
  122.                 do
  123.                 {
  124.                     stringPos++;
  125.                     switch (ch)
  126.                     {
  127.                         case 'x', 'X':
  128.                         {
  129.                             num = 0;
  130.                             continue;
  131.                         }
  132.                         case '0' .. '9':
  133.                         {
  134.                             num = (num << 4) | (ch - '0');
  135.                         }
  136.                         case 'a' .. 'f':
  137.                         {
  138.                             num = (num << 4) | (ch - ('a' - 10));
  139.                         }
  140.                         case 'A' .. 'F':
  141.                         {
  142.                             num = (num << 4) | (ch - ('A' - 10));
  143.                         }
  144.                         default:
  145.                         {
  146.                             return -1;
  147.                         }
  148.                     }
  149.                 }
  150.                 while ((ch = string[stringPos]) > ' ' && ch != delim);
  151.                 setarg(paramPos, 0, num);
  152.             }
  153.             case 'c':
  154.             {
  155.                 setarg(paramPos, 0, string[stringPos++]);
  156.             }
  157.             case 'f':
  158.             {
  159.  
  160.                 new changestr[16], changepos = 0, strpos = stringPos;
  161.                 while(changepos < 16 && string[strpos] && string[strpos] != delim)
  162.                 {
  163.                     changestr[changepos++] = string[strpos++];
  164.                     }
  165.                 changestr[changepos] = '\0';
  166.                 setarg(paramPos,0,_:floatstr(changestr));
  167.             }
  168.             case 'p':
  169.             {
  170.                 delim = format[formatPos++];
  171.                 continue;
  172.             }
  173.             case '\'':
  174.             {
  175.                 new
  176.                     end = formatPos - 1,
  177.                     ch;
  178.                 while ((ch = format[++end]) && ch != '\'') {}
  179.                 if (!ch)
  180.                 {
  181.                     return -1;
  182.                 }
  183.                 format[end] = '\0';
  184.                 if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  185.                 {
  186.                     if (format[end + 1])
  187.                     {
  188.                         return -1;
  189.                     }
  190.                     return 0;
  191.                 }
  192.                 format[end] = '\'';
  193.                 stringPos = ch + (end - formatPos);
  194.                 formatPos = end + 1;
  195.             }
  196.             case 'u':
  197.             {
  198.                 new
  199.                     end = stringPos - 1,
  200.                     id = 0,
  201.                     bool:num = true,
  202.                     ch;
  203.                 while ((ch = string[++end]) && ch != delim)
  204.                 {
  205.                     if (num)
  206.                     {
  207.                         if ('0' <= ch <= '9')
  208.                         {
  209.                             id = (id * 10) + (ch - '0');
  210.                         }
  211.                         else
  212.                         {
  213.                             num = false;
  214.                         }
  215.                     }
  216.                 }
  217.                 if (num && IsPlayerConnected(id))
  218.                 {
  219.                     setarg(paramPos, 0, id);
  220.                 }
  221.                 else
  222.                 {
  223.                     #if !defined foreach
  224.                         #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  225.                         #define __SSCANF_FOREACH__
  226.                     #endif
  227.                     string[end] = '\0';
  228.                     num = false;
  229.                     new
  230.                         name[MAX_PLAYER_NAME];
  231.                     id = end - stringPos;
  232.                     foreach (Player, playerid)
  233.                     {
  234.                         GetPlayerName(playerid, name, sizeof (name));
  235.                         if (!strcmp(name, string[stringPos], true, id))
  236.                         {
  237.                             setarg(paramPos, 0, playerid);
  238.                             num = true;
  239.                             break;
  240.                         }
  241.                     }
  242.                     if (!num)
  243.                     {
  244.                         setarg(paramPos, 0, INVALID_PLAYER_ID);
  245.                     }
  246.                     string[end] = ch;
  247.                     #if defined __SSCANF_FOREACH__
  248.                         #undef foreach
  249.                         #undef __SSCANF_FOREACH__
  250.                     #endif
  251.                 }
  252.                 stringPos = end;
  253.             }
  254.             case 's', 'z':
  255.             {
  256.                 new
  257.                     i = 0,
  258.                     ch;
  259.                 if (format[formatPos])
  260.                 {
  261.                     while ((ch = string[stringPos++]) && ch != delim)
  262.                     {
  263.                         setarg(paramPos, i++, ch);
  264.                     }
  265.                     if (!i)
  266.                     {
  267.                         return -1;
  268.                     }
  269.                 }
  270.                 else
  271.                 {
  272.                     while ((ch = string[stringPos++]))
  273.                     {
  274.                         setarg(paramPos, i++, ch);
  275.                     }
  276.                 }
  277.                 stringPos--;
  278.                 setarg(paramPos, i, '\0');
  279.             }
  280.             default:
  281.             {
  282.                 continue;
  283.             }
  284.         }
  285.         while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  286.         {
  287.             stringPos++;
  288.         }
  289.         while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  290.         {
  291.             stringPos++;
  292.         }
  293.         paramPos++;
  294.     }
  295.     do
  296.     {
  297.         if ((delim = format[formatPos++]) > ' ')
  298.         {
  299.             if (delim == '\'')
  300.             {
  301.                 while ((delim = format[formatPos++]) && delim != '\'') {}
  302.             }
  303.             else if (delim != 'z')
  304.             {
  305.                 return delim;
  306.             }
  307.         }
  308.     }
  309.     while (delim > ' ');
  310.     return 0;
  311. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement