Advertisement
Seregamil

System

May 11th, 2013
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6.  
  7.  
  8. #define dcmd(%1,%2,%3) if((strcmp((%3)[1],#%1,true,(%2))==0)&&((((%3)[(%2)+1]==0)&&(dcmd_%1(playerid,"")))||(((%3)[(%2)+1]==32)&&(dcmd_%1(playerid,(%3)[(%2)+2]))))) return 1
  9.  
  10. #define m_arg 12 // 12/4=3 zones
  11.  
  12. main()
  13. {
  14. zones("1,5,7,2,8,3,9,6");
  15. }
  16.  
  17. new Float:pos[m_arg][4];
  18. new count;
  19.  
  20. zones(arg[])
  21. {
  22. new idx = 0;
  23. new zz;
  24. count=0;
  25. for(new x;x!=m_arg;x++)
  26. {
  27. new Float:ok = floatstr(strtok(arg, idx, ','));
  28. if(ok == 0.0) break;
  29.  
  30. if(zz==4) zz=0;
  31. pos[x][zz] = ok;
  32. printf("%f", pos[x][zz]);
  33. zz++;
  34. count++;//êîëè÷åñòâî çîí ++
  35. }
  36. infoArea();
  37. }
  38.  
  39. infoArea()
  40. {
  41. new i = count / 4; //êîëè÷åñòâî ãàíã çîí
  42. printf("%d", i);
  43. new z = 0;
  44. new zz;
  45. while(z!=i)
  46. {
  47. for(new x;x!=4;x++)
  48. {
  49. if(zz==4)zz=0;
  50. printf("Zone %d: pos: %f",z,pos[x][zz]);
  51. zz++;
  52. }
  53. z++;
  54. }
  55. }
  56.  
  57. strtok(const string[], &index,seperator=' ')
  58. {
  59. new length = strlen(string);
  60. new offset = index;
  61. new result[256];
  62. while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
  63. {
  64. result[index - offset] = string[index];
  65. index++;
  66. }
  67. result[index - offset] = EOS;
  68. if ((index < length) && (string[index] == seperator)) index++;
  69. return result;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement