pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

samp.tilens private pastebin - collaborative debugging tool What's a private pastebin?


Posted by Deathmanthys on Sun 2 Nov 05:21
report abuse | View followups from Anonymous | download | new post

  1. #include <a_samp>
  2. #include <dini>
  3. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  4. forward ExtractParametersFromString(const string[], number, out[]);
  5. #define COLOR_AMARILLO 0xFFFF00
  6. #define COLOR_AZUL 0x0066FF
  7. #define COLOR_ROJO 0xFF3300
  8. #define COLOR_VERDEFLOJO 0x00FF00
  9. #define COLOR_NARANJA 0xFF9900
  10. #define COLOR_CELESTE 0x00FFFF
  11. #define COLOR_SYSTEM 0xEFEFF7AA
  12. #define COLOR_VERDE 0x00CC00
  13. #define COLOR_VERDEOSCURO 0x006600
  14. #define COLOR_BLANCO 0xFFFFFF
  15. #define COLOR_MARRON 0x996600
  16. #define COLOR_NEGRO 0x000000
  17. #define COLOR_AZULMARINO 0x0066CC
  18. #define COLOR_LILA 0xCC66FF
  19. #define COLOR_ROSA 0xFF66FF
  20. #define COLOR_GREY 0xAFAFAFAA
  21. #define COLOR_VERDE1 0x33AA33AA
  22. #define COLOR_RED 0xAA3333AA
  23. #define COLOR_YELLOW 0xFFFF00AA
  24. #define COLOR_PINK 0xFF66FFAA
  25. #define COLOR_BLUE 0x0000BBAA
  26. #define COLOR_WHITE 0xFFFFFFAA
  27. #define COLOR_AQUA 0x00FFFFFF
  28. #define COLOR_AQUAGRN 0x7FFFD4FF
  29. #define COLOR_BLUEVILOT 0x8A2BE2FF
  30. #define COLOR_LTGREEN 0x7FFF00FF
  31. #define COLOR_DKGREEN 0x006400FF
  32. #define COLOR_GOLD 0xFFD700FF
  33. #define COLOR_GOLDENROD 0xDAA520FF
  34. #define COLOR_LIGHTBLUE 0x33CCFFAA
  35. #define COLOR_DARKRED 0x660000AA
  36. #define COLOR_ORANGE 0xFF9900AA
  37. #define COLOR_GREEN 0x33AA33AA
  38. public OnFilterScriptInit()
  39. {
  40.         print("\n--------------------------------------------");
  41.         print("Banco\n");
  42.         print("1.0");
  43.         print("--------------------------------------------\n");
  44.         return 1;
  45. }
  46. //------------------------------------------------------------------------------
  47. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  48. {//Public Enemy
  49.         new Float:oldposx, Float:oldposy, Float:oldposz;
  50.         new Float:tempposx, Float:tempposy, Float:tempposz;
  51.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  52.         tempposx = (oldposx -x);
  53.         tempposy = (oldposy -y);
  54.         tempposz = (oldposz -z);
  55.         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  56.         {
  57.                 return 1;
  58.         }
  59.         return 0;
  60. }
  61. //------------------------------------------------------------------------------
  62. public ExtractParametersFromString(const string[], number, out[])
  63.     new length = strlen(string);
  64.     new indexStart = 0;
  65.     new indexEnd = 0;
  66.         new numParInStr = 0;
  67.         out[0]=EOS;
  68.         while ((numParInStr < number) && (indexEnd < length))
  69.         {
  70.                 indexStart = indexEnd;
  71.                 while ((indexEnd < length) && (string[indexEnd] != ' '))
  72.             {
  73.                     indexEnd++;
  74.                 }
  75.         numParInStr++;
  76.         if((numParInStr < number) && (indexEnd < length) && (string[indexEnd] == ' ')) indexEnd++;
  77.         }
  78.         if(numParInStr!=number) return 0;
  79.         new offset = indexStart;
  80.         for(new i=indexStart; i<indexEnd; i++)
  81.         {
  82.                   out[i - offset] = string[i];
  83.         }
  84.         out[indexEnd-offset] = EOS;
  85.         return 1;
  86. }
  87. //------------------------------------------------------------------------------
  88. public OnPlayerConnect(playerid)
  89. {
  90.     new playername[256];
  91.         GetPlayerName(playerid, playername, 256);
  92.         new str[256];
  93.         format(str,sizeof(str),"bank/%s", playername);
  94.         if(dini_Exists(str))
  95.         {
  96.             print("wii cargó");
  97.         }
  98.         else
  99.         {
  100.             format(str,sizeof(str),"bank/%s", playername);
  101.             if(!dini_Exists(str)) dini_Create(str);
  102.                 dini_IntSet(str, "bank",0);
  103.         }
  104.         return 1;
  105. }
  106. //------------------------------------------------------------------------------
  107. public OnPlayerCommandText(playerid, cmdtext[])
  108. {
  109.         new cmd[256];
  110.         ExtractParametersFromString(cmdtext, 1, cmd);
  111.        
  112.         if(strcmp(cmd, "/depositar", true) == 0)
  113.         {
  114.             if(PlayerToPoint(100, playerid,827.9430,4.9825,1004.1870) || PlayerToPoint(100, playerid,212.6392,-8.1615,1001.2109) || PlayerToPoint(100, playerid,346.4020,172.5660,1014.1875) || PlayerToPoint(100, playerid,-2662.8271,1411.1824,906.2734) || PlayerToPoint(100, playerid,-26.9156,-55.3495,1003.5469))
  115.             {
  116.                 new nummoney2[256];
  117.                     new nummoney;
  118.                 new oldmoney;
  119.                 new pmoney;
  120.                 new newmoney;
  121.                 new playername[256];
  122.                 new str[256];
  123.                 GetPlayerName(playerid, playername, 256);
  124.                 if(!ExtractParametersFromString(cmdtext, 2, nummoney2))
  125.                         {
  126.                 SendClientMessage(playerid, COLOR_WHITE, "USO: /depositar [cantidad]");
  127.                                 return 1;
  128.                         }
  129.                         else
  130.                         {
  131.                                 nummoney = strval(nummoney2);
  132.                         }
  133.                         if(GetPlayerMoney(playerid) < nummoney)
  134.                         {
  135.                                 SendClientMessage(playerid, COLOR_RED, "No tienes suficiente dinero");
  136.                         }
  137.                         else
  138.                         {
  139.  
  140.                         format(str,sizeof(str),"bank/%s", playername);
  141.                         oldmoney = dini_Int(str,"bank");
  142.                         newmoney = nummoney+oldmoney;
  143.                         dini_IntSet(str, "bank",newmoney);
  144.                         pmoney = GetPlayerMoney(playerid);
  145.                         ResetPlayerMoney(playerid);
  146.                         GivePlayerMoney(playerid, pmoney-nummoney);
  147.                         new string[256];
  148.                         format(string,sizeof(string),"Depositaste: %d$, ahora tienes %d$.",nummoney,newmoney);
  149.                         SendClientMessage(playerid,COLOR_GREEN,string);
  150.                         }
  151.                 }
  152.                 else
  153.                 {
  154.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, "Debes estar en un ATM 24/7.");
  155.                 }
  156.                 return 1;
  157.         }
  158.         if(strcmp(cmd, "/retirar", true) == 0)
  159.         {
  160.             if(PlayerToPoint(100, playerid,827.9430,4.9825,1004.1870) || PlayerToPoint(100, playerid,212.6392,-8.1615,1001.2109) || PlayerToPoint(100, playerid,346.4020,172.5660,1014.1875) || PlayerToPoint(100, playerid,-2662.8271,1411.1824,906.2734) || PlayerToPoint(100, playerid,-26.9156,-55.3495,1003.5469))
  161.             {
  162.                 new nummoney2[256];
  163.                 new nummoney;
  164.                 new oldmoney;
  165.                 new newmoney;
  166.                 new playername[256];
  167.                 new str[256];
  168.                 GetPlayerName(playerid, playername, 256);
  169.                 if(!ExtractParametersFromString(cmdtext, 2, nummoney2))
  170.                         {
  171.                      SendClientMessage(playerid, COLOR_WHITE, "USO: /retirar [cantidad]");
  172.                         }
  173.                         else
  174.                         {
  175.                                 nummoney = strval(nummoney2);
  176.                         }
  177.                 format(str,sizeof(str),"bank/%s", playername);
  178.                 oldmoney = dini_Int(str,"bank");
  179.                         if(oldmoney < nummoney)
  180.                         {
  181.                                 SendClientMessage(playerid, COLOR_RED, "No tienes esa cantidad de dinero en tu cuenta");
  182.                         }
  183.                         else
  184.                         {
  185.                         newmoney = oldmoney-nummoney;
  186.                                 dini_IntSet(str, "bank",newmoney);
  187.                         GivePlayerMoney(playerid, nummoney);
  188.                         new string[256];
  189.                         format(string,sizeof(string),"  Ahora Tienes: %d$ en tu cuenta bancaria.", newmoney);
  190.                         SendClientMessage(playerid,COLOR_GREEN,string);
  191.                         }
  192.                 }
  193.                 else
  194.                 {
  195.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, "No estas en un ATM 24/7.");
  196.                 }
  197.                 return 1;
  198.         }
  199.         if(strcmp(cmd, "/saldo", true) == 0)
  200.         {
  201.                 new playername[256];
  202.                 new str[256];
  203.                 new money2;
  204.             GetPlayerName(playerid, playername, 256);
  205.             format(str,sizeof(str),"bank/%s", playername);
  206.             money2 = dini_Int(str,"bank");
  207.                 format(str,sizeof(str),"  Tu Dinero: %d$", money2);
  208.         SendClientMessage(playerid, 0xF0F0F0FF, "Cuenta Bancaria:");
  209.         SendClientMessage(playerid, COLOR_WHITE, str);
  210.                 return 1;
  211.         }
  212.         return 0;
  213. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post