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 04:49
report abuse | download | new post

  1. #include <a_samp>
  2.  
  3. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  4. #define COLOR_ACEPTO 0x40808096
  5. #define COLOR_GRAD1 0xB4B5B7FF
  6. #define COLOR_GRAD2 0xBFC0C2FF
  7. #define COLOR_GRAD3 0xCBCCCEFF
  8. #define COLOR_GRAD4 0xD8D8D8FF
  9. #define COLOR_GRAD5 0xE3E3E3FF
  10. #define COLOR_GRAD6 0xF0F0F0FF
  11. #define COLOR_GREY 0xAFAFAFAA
  12. #define COLOR_GREEN 0x33AA33AA
  13. #define COLOR_RED 0xAA3333AA
  14. #define COLOR_YELLOW 0xFFFF00AA
  15. #define COLOR_WHITE 0xFFFFFFAA
  16. #define COLOR_BLUE 0x0000BBAA
  17. #define COLOR_LIGHTBLUE 0x33CCFFAA
  18. #define COLOR_ORANGE 0xFF9900AA
  19. #define COLOR_LIME 0x99FF00AA
  20. #define COLOR_BLACK 0x000000AA
  21. #define COLOR_SYSTEM 0xFFFFFFAA
  22. #define COLOR_AZUL 0x0066FF
  23. #define COLOR_AMARILLOBAJO 0xF5E7AD96
  24.  
  25. #define tiempo 300000 // Tiempo de sorteo: 5 Minutos (Default)
  26. #define costo 50 // Costo del Boleto
  27.  
  28. forward Loteria(playerid);
  29.  
  30. new string[256];
  31. new pueden = 0;
  32. new premio;
  33. new rand;
  34. new compro[MAX_PLAYERS]=-1; // -1 = no compro.
  35.  
  36. public OnFilterScriptInit()
  37. {
  38.         print("\n--------------------------------------------");
  39.         print(" Loteria de DanielSNM ~ Con numeros comprables");
  40.         print("-------------------v1.4---------------------\n");
  41.         return 1;
  42. }
  43. public OnPlayerCommandText(playerid, cmdtext[])
  44. {
  45.         dcmd(nueva,5,cmdtext);
  46.         dcmd(boleto,6,cmdtext);
  47.         if (strcmp("/loterias", cmdtext, true, 10) == 0)
  48.         {
  49.                 SendClientMessage(playerid,COLOR_GREEN,"-------Loterias-------");
  50.                 SendClientMessage(playerid,COLOR_YELLOW,"/nueva [premio] - Crear nueva Loteria (ADM).");
  51.                 SendClientMessage(playerid,COLOR_YELLOW,"/boleto [numero 0 - 10] - Comprar boleto. (Costo = $50)");
  52.                 return 1;
  53.         }
  54.         return 0;
  55. }
  56.  
  57. dcmd_nueva(playerid , params[])
  58. {
  59.    premio = strval(params);
  60.    if(strlen(params)) {
  61.         if(IsPlayerAdmin(playerid)) {
  62.                 pueden=1;
  63.                 for(new i; i < MAX_PLAYERS; i++) {
  64.                                 compro[i]=-1;
  65.                                 }
  66.                                 format(string,256,"Has creado una loteria, en 5min se sorteara, el premio es de %d",premio);
  67.                                 SendClientMessage(playerid,COLOR_ORANGE,string);
  68.                                 format(string,256,"~y~En 10 min, se sortea una loteria por ~r~$%d ~n~~g~compra un boleto con /boleto [numero 0 - 45]",premio);
  69.                                 GameTextForAll(string,5000,5);
  70.                                 new rando = random(10);
  71.                                 rand=rando;
  72.                                 SetTimer("Loteria",tiempo,0);
  73.                 }
  74.    }
  75.    return 1;
  76. }
  77.  
  78. dcmd_boleto(playerid, params[])
  79. {
  80.         new numero;
  81.         numero = strval(params);
  82.         if(strlen(params)) {
  83.             if(pueden==1) {
  84.                         compro[playerid]=numero;
  85.                         pueden=0;
  86.                         format(string,256,"Has comprado el numero: %d, $-50!",compro[playerid]);
  87.                         SendClientMessage(playerid,COLOR_GREEN,string);
  88.                 }
  89.         }
  90.         return 1;
  91. }
  92.  
  93. public Loteria(playerid)
  94. {
  95.         for(new i; i < MAX_PLAYERS; i++)
  96.         {
  97.             if(compro[i]==-1)
  98.                 {
  99.                 return 1;
  100.             }
  101.             else
  102.             {
  103.         if(compro[i]==rand)
  104.                         {
  105.                 GivePlayerMoney(playerid,premio);
  106.                 SendClientMessage(playerid,COLOR_YELLOW,"HAS GANADO LA LOTERIAAA!!!!");
  107.                 }
  108.                 else
  109.                 {
  110.                 SendClientMessage(playerid,COLOR_RED,"No ganaste nada, Intenta Otro Dia!");
  111.                 format(string,256,"El Numero era %d",rand);
  112.                 SendClientMessageToAll(COLOR_AMARILLOBAJO,string);
  113.                 }
  114.                 }
  115.         }
  116.         return 1;
  117. }

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