Guest User

Filter Script Fome, Sede & Sono

a guest
Nov 24th, 2018
1,568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 22.16 KB | None | 0 0
  1. // Incluides
  2.  
  3. #include <a_samp>
  4. #include <progress>
  5. #include <cpstream>
  6. #include <dini>
  7. #include <zcmd>
  8.  
  9. //  Defines
  10.  
  11. #define minutos(%0) (1000 * %0 * 60)
  12. #define checknome   CPS_GetPlayerCheckpoint(playerid)
  13. #define cardapio                                    6661
  14. #define PASTA_FOMESEDESONO          "/FomeSedeSono/%s.ini"
  15.  
  16. //  News    
  17. new checkareavip;
  18. new checkcluckinbell;
  19. new checkbar;
  20. new checkburger;
  21. new checkrestaurante;
  22. new checkrosquinha;
  23. new checkbar2;
  24. new checkpizzaria;
  25. new Text:TextoFome;
  26. new Text:TextoSede;
  27. new Text:TextoSono;
  28. new Text:TelaSono;
  29. new dormindo[MAX_PLAYERS];
  30. new file[256];
  31. new StatusOn[MAX_PLAYERS];  
  32. new timerfome[MAX_PLAYERS];
  33. new timersede[MAX_PLAYERS];
  34. new timersono[MAX_PLAYERS];
  35. new Bar:BarraFome;
  36. new Bar:BarraSede;
  37. new Bar:BarraSono;
  38.  
  39. //  Forwards
  40.  
  41. forward Fome(playerid);
  42. forward Sede(playerid);
  43. forward Sono(playerid);
  44. forward Acordar(playerid);
  45.  
  46. //  Publics
  47.  
  48. public OnPlayerEnterCheckpoint(playerid)
  49. {
  50. if(checknome == checkareavip || checknome == checkcluckinbell || checknome == checkbar || checknome == checkburger || checknome == checkbar2 || checknome == checkrosquinha || checknome == checkrestaurante || checknome == checkpizzaria){
  51. return mostrarcardapio(playerid);
  52. }
  53. return 1;
  54. }
  55.  
  56. public OnFilterScriptInit()
  57. {
  58.  
  59. //  Checkpoints
  60.  
  61.  
  62.     checkpizzaria = CPS_AddCheckpoint(375.7330,-119.7702,1001.4995, 1.0, 50);
  63.     checkbar2 = CPS_AddCheckpoint(495.6680,-75.6510,998.7578, 1.0, 50);
  64.     checkrosquinha = CPS_AddCheckpoint(379.2641,-190.3609,1000.6328, 1.0, 50);
  65.     checkrestaurante = CPS_AddCheckpoint(450.3708,-83.8357,999.5547, 1.0, 50);
  66.     checkareavip = CPS_AddCheckpoint(-787.9170,500.7348,1371.7422, 1.0, 50);
  67.     checkcluckinbell = CPS_AddCheckpoint(369.6572,-6.2929,1001.8589, 1.0, 50);
  68.     checkbar = CPS_AddCheckpoint(-224.8297,1401.8036,27.7656, 1.0, 50);
  69.     checkburger = CPS_AddCheckpoint(376.5179,-68.2242,1001.5151, 1.0, 50);
  70.  
  71. // Texto de sono
  72.    
  73.     TextoFome = TextDrawCreate(562.111083, 278.257659, "Fome");
  74.     TextDrawBackgroundColor(TextoFome, 255);
  75.     TextDrawFont(TextoFome, 2);
  76.     TextDrawLetterSize(TextoFome, 0.310000, 1.100000);
  77.     TextDrawColor(TextoFome, -1);
  78.     TextDrawSetOutline(TextoFome, 1);
  79.     TextDrawSetProportional(TextoFome, 1);
  80.    
  81.  /// Texto de sede
  82.  
  83.     TextoSede = TextDrawCreate(562.222290, 307.626708, "Sede");
  84.     TextDrawBackgroundColor(TextoSede, 255);
  85.     TextDrawFont(TextoSede, 2);
  86.     TextDrawLetterSize(TextoSede, 0.320000, 1.100000);
  87.     TextDrawColor(TextoSede, -1);
  88.     TextDrawSetOutline(TextoSede, 1);
  89.     TextDrawSetProportional(TextoSede, 1);
  90.    
  91.  /// Texto de sono
  92.  
  93.     TextoSono = TextDrawCreate(562.222290, 339.982208, "Sono");
  94.     TextDrawBackgroundColor(TextoSono, 255);
  95.     TextDrawFont(TextoSono, 2);
  96.     TextDrawLetterSize(TextoSono, 0.320000, 1.100000);
  97.     TextDrawColor(TextoSono, -1);
  98.     TextDrawSetOutline(TextoSono, 1);
  99.     TextDrawSetProportional(TextoSono, 1);
  100.    
  101.  /// Barrinhas fome/sede/sono
  102.     BarraFome = CreateProgressBar(553.00, 300.00, 55.50, 3.20, -16776961, 100.0);
  103.     SetProgressBarMaxValue(BarraFome, 100);
  104.     BarraSede = CreateProgressBar(553.00, 331.00, 55.50, 3.20, 16711935, 100.0);
  105.     SetProgressBarMaxValue(BarraSede, 100);
  106.     BarraSono = CreateProgressBar(553.00, 362.00, 55.50, 3.20, 7777255, 100.0);
  107.     SetProgressBarMaxValue(BarraSono, 100);
  108.    
  109. // TextDraw tela preta do sono //
  110.     TelaSono = TextDrawCreate(-30.000000, -5.000000, "TelaPreta");
  111.     TextDrawBackgroundColor(TelaSono, 255);
  112.     TextDrawFont(TelaSono, 1);
  113.     TextDrawLetterSize(TelaSono, 0.700000, 53.099998);
  114.     TextDrawColor(TelaSono, -1);
  115.     TextDrawSetOutline(TelaSono, 0);
  116.     TextDrawSetProportional(TelaSono, 1);
  117.     TextDrawSetShadow(TelaSono, 1);
  118.     TextDrawUseBox(TelaSono, 1);
  119.     TextDrawBoxColor(TelaSono, 255);
  120.     TextDrawTextSize(TelaSono, 650.000000, 30.000000);
  121.     return 1;
  122. }
  123. public OnFilterScriptExit()
  124. {
  125.     HideProgressBarForAll(BarraFome);
  126.     HideProgressBarForAll(BarraSede);
  127.     HideProgressBarForAll(BarraSono);
  128.     TextDrawDestroy(TextoFome);
  129.     TextDrawDestroy(TextoSede);
  130.     TextDrawDestroy(TextoSono);
  131.     return 1;
  132. }
  133.  
  134. public OnPlayerSpawn(playerid)  
  135. {  
  136.     new aname[MAX_PLAYER_NAME];
  137.     GetPlayerName(playerid, aname, sizeof(aname));
  138.     format(file, sizeof(file), PASTA_FOMESEDESONO, aname);
  139.     if(!dini_Exists(file)){
  140.     dini_Create(file);
  141.     dini_Set(file, "Sede", "0");
  142.     dini_Set(file, "Fome", "0");
  143.     dini_Set(file, "Sono", "0");
  144.     dini_Set(file, "StatusOn", "0");
  145.     }
  146.     if(dini_Exists(file)){
  147.     SetProgressBarValue(BarraFome, dini_Int(file, "Fome"));
  148.     SetProgressBarValue(BarraSede, dini_Int(file, "Sede"));
  149.     SetProgressBarValue(BarraSono, dini_Int(file, "Sono"));
  150.     SetPVarInt(playerid,"Fome", dini_Int(file, "Fome"));  
  151.     SetPVarInt(playerid,"Sede", dini_Int(file, "Sede"));
  152.     SetPVarInt(playerid,"Sono", dini_Int(file, "Sono"));
  153.     ShowProgressBarForPlayer(playerid, BarraFome);
  154.     ShowProgressBarForPlayer(playerid, BarraSede);
  155.     ShowProgressBarForPlayer(playerid, BarraSono);
  156.     UpdateProgressBar(BarraFome, playerid);
  157.     UpdateProgressBar(BarraSede, playerid);
  158.     UpdateProgressBar(BarraSono, playerid);
  159.     dormindo[playerid] = 0;
  160.     StatusOn[playerid] = dini_Int(file, "StatusOn");   
  161.      
  162.     TextDrawShowForPlayer(playerid, TextoFome);  
  163.     TextDrawShowForPlayer(playerid, TextoSede);  
  164.     TextDrawShowForPlayer(playerid, TextoSono);  
  165.  
  166.     if(StatusOn[playerid] == 0){
  167.     timerfome[playerid] = SetTimerEx("Fome", 420000, true, "i", playerid);  
  168.     timersede[playerid] = SetTimerEx("Sede", 300000, true, "i", playerid);
  169.     timersono[playerid] = SetTimerEx("Sono", 600000, true, "i", playerid)
  170.     StatusOn[playerid] = 1;
  171.     }
  172.  
  173. }
  174.     return 1;  
  175. }  
  176.  
  177. public OnPlayerDeath(playerid, killerid, reason)
  178. {
  179. if(GetPVarInt(playerid,"Fome") >= 95){
  180. SetProgressBarValue(BarraFome,-10);
  181. UpdateProgressBar(BarraFome,playerid);
  182. SetPVarInt(playerid,"Fome",-10);  
  183. UpdateProgressBar(BarraSono,playerid);
  184. }
  185. if(GetPVarInt(playerid,"Sede") >= 95){
  186. SetProgressBarValue(BarraSede,-10);
  187. UpdateProgressBar(BarraSede,playerid);
  188. SetPVarInt(playerid,"Sede",-10);
  189. UpdateProgressBar(BarraSono,playerid);
  190. }
  191. return 1;
  192. }
  193.  
  194. public Fome(playerid)
  195. {
  196.     SetPVarInt(playerid,"Fome",GetPVarInt(playerid,"Fome")+5);
  197.     SetProgressBarValue(BarraFome, GetPVarInt(playerid,"Fome"));
  198.     UpdateProgressBar(BarraFome,playerid);
  199.     if(GetPVarInt(playerid,"Fome") == 75)
  200.     {
  201.         new Float:Vida;
  202.         GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-15.0);
  203.         SendClientMessage(playerid,-1,"{AA3333}| INFO | Vá até um restaurante comer ou você irá morrer de fome!");
  204.     }
  205.     if(GetPVarInt(playerid,"Fome") == 80)
  206.     {
  207.         new Float:Vida;
  208.         GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-20.0);
  209.         SendClientMessage(playerid,-1,"{AA3333}| INFO | Vá até um restaurante comer ou você irá morrer de fome!");
  210.     }
  211.     if(GetPVarInt(playerid,"Fome") == 85)
  212.     {
  213.         new Float:Vida;
  214.         GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-25.0);
  215.         SendClientMessage(playerid,-1,"{AA3333}| INFO | Vá até um restaurante comer ou você irá morrer de fome!");
  216.     }
  217.     if(GetPVarInt(playerid,"Fome") == 90)
  218.     {
  219.         new Float:Vida;
  220.         GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-20.0);
  221.         SendClientMessage(playerid,-1,"{AA3333}| INFO | Vá até um restaurante comer ou você irá morrer de fome!");
  222.     }
  223.     if(GetPVarInt(playerid,"Fome") == 100)
  224.     {
  225.         new Float:Vida;
  226.         GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-20.0);
  227.         SendClientMessage(playerid,-1,"{AA3333}| INFO | Vá até um restaurante comer ou você irá morrer de fome!");
  228.     }
  229.    
  230.     return 1;
  231. }
  232.  
  233. public Sede(playerid)
  234. {
  235.     SetPVarInt(playerid,"Sede",GetPVarInt(playerid,"Sede")+5);
  236.     SetProgressBarValue(BarraSede, GetPVarInt(playerid,"Sede"));
  237.     UpdateProgressBar(BarraSede,playerid);
  238.     if(GetPVarInt(playerid,"Sede") == 75)
  239.     {
  240.         new Float:Vida;
  241.         GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-15.0);
  242.         SendClientMessage(playerid,-1,"{AA3333}| INFO | Vá até um restaurante beber ou você irá morrer de sede!");
  243.     }
  244.     if(GetPVarInt(playerid,"Sede") == 80)
  245.     {
  246.         new Float:Vida;
  247.         GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-20.0);
  248.         SendClientMessage(playerid,-1,"{AA3333}| INFO | Vá até um restaurante beber ou você irá morrer de sede!");
  249.     }
  250.     if(GetPVarInt(playerid,"Sede") == 85)
  251.     {
  252.         new Float:Vida;
  253.         GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-25.0);
  254.         SendClientMessage(playerid,-1,"{AA3333}| INFO | Vá até um restaurante beber ou você irá morrer de sede!");
  255.     }
  256.     if(GetPVarInt(playerid,"Sede") == 90)
  257.     {
  258.         new Float:Vida;
  259.         GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-20.0);
  260.         SendClientMessage(playerid,-1,"{AA3333}| INFO | Vá até um restaurante beber ou você irá morrer de sede!");
  261.     }
  262.     if(GetPVarInt(playerid,"Sede") >= 100)
  263.     {
  264.         new Float:Vida;
  265.         GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-25.0);
  266.         SendClientMessage(playerid,-1,"{AA3333}| INFO | Vá até um restaurante beber ou você irá morrer de sede!");
  267.     }
  268.  
  269.  
  270.     return 1;
  271. }
  272.  
  273. public Sono(playerid)
  274. {
  275.  
  276.     SetPVarInt(playerid,"Sono",GetPVarInt(playerid,"Sono")+5);
  277.     SetProgressBarValue(BarraSono, GetPVarInt(playerid,"Sono"));
  278.     UpdateProgressBar(BarraSono,playerid);
  279.     if(GetPVarInt(playerid,"Sono") == 90){
  280.     if(dormindo[playerid] == 0){
  281.    
  282.         SendClientMessage(playerid,-1,"{00BFFF}| INFO | Você está com sono, durma ou irá desmaiar!");
  283.     }
  284.     }
  285.     if(GetPVarInt(playerid,"Sono") == 95){
  286.     if(dormindo[playerid] == 0){
  287.         SendClientMessage(playerid,-1,"{00BFFF}| INFO | Você está com sono, durma ou irá desmaiar!");
  288.     }
  289.     }
  290.     if(GetPVarInt(playerid,"Sono") == 100)
  291.     {
  292.         if(dormindo[playerid] == 0){
  293.         SendClientMessage(playerid,-1,"{00BFFF}| INFO | Você desmaiou de sono!");
  294.         ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
  295.         TogglePlayerControllable(playerid,0);
  296.         TextDrawShowForPlayer(playerid, TelaSono);
  297.         SetTimerEx("Acordar", 60000, false, "i", playerid);
  298.         dormindo[playerid] = 1;
  299.         }
  300.         return 1;
  301.     }
  302.  
  303.     return 1;
  304. }
  305.  
  306.  
  307. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  308. {
  309.     if(dialogid == cardapio)
  310.     {    
  311.          if(response)
  312.          {
  313.             switch(listitem)
  314.             {
  315.                 case 0:
  316.                 {
  317.                  mostrarcardapio(playerid);
  318.                 }
  319.                 case 1:
  320.                 {
  321.                 if(GetPVarInt(playerid,"Fome") >= 1){
  322.                 SendClientMessage(playerid,0xFFFF00AA,"| INFO | Você está comendo um X-Bacon!");
  323.                 GivePlayerMoney(playerid, -10);
  324.                 SetPVarInt(playerid,"Fome",GetPVarInt(playerid,"Fome")-25);
  325.                 SetProgressBarValue(BarraFome, GetPVarInt(playerid,"Fome"));
  326.                 SetPlayerHealth(playerid,100);
  327.                 UpdateProgressBar(BarraFome,playerid);
  328.                 ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
  329.                 mostrarcardapio(playerid);
  330.                 }else{
  331.                 SendClientMessage(playerid,-1,"{FF0000}| ERRO | Você não está com fome!");
  332.                 SetPVarInt(playerid,"Fome",0);
  333.                 SetProgressBarValue(BarraFome, GetPVarInt(playerid,"Fome"));
  334.                 UpdateProgressBar(BarraFome,playerid);
  335.                 }
  336.                 }
  337.                 case 2:
  338.                 {
  339.                 if(GetPVarInt(playerid,"Fome") >= 1){
  340.                 SendClientMessage(playerid,0xFFFF00AA,"| INFO | Você está comendo um X-Tudo!");
  341.                 GivePlayerMoney(playerid, -26);
  342.                 SetPVarInt(playerid,"Fome",GetPVarInt(playerid,"Fome")-25);
  343.                 SetProgressBarValue(BarraFome, GetPVarInt(playerid,"Fome"));
  344.                 SetPlayerHealth(playerid,100);
  345.                 UpdateProgressBar(BarraFome,playerid);
  346.                 ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
  347.                 mostrarcardapio(playerid);
  348.                 }else{
  349.                 SendClientMessage(playerid,-1,"{FF0000}| ERRO | Você não está com fome!");
  350.                 SetPVarInt(playerid,"Fome",0);
  351.                 SetProgressBarValue(BarraFome, GetPVarInt(playerid,"Fome"));
  352.                 UpdateProgressBar(BarraFome,playerid);
  353.                 }
  354.                 }
  355.                 case 3:
  356.                 {
  357.                 if(GetPVarInt(playerid,"Fome") >= 1){
  358.                 SendClientMessage(playerid,0xFFFF00AA,"| INFO | Você está comendo um X-Salada!");
  359.                 GivePlayerMoney(playerid, -12);
  360.                 SetPlayerHealth(playerid,100);
  361.                 SetPVarInt(playerid,"Fome",GetPVarInt(playerid,"Fome")-25);
  362.                 SetProgressBarValue(BarraFome, GetPVarInt(playerid,"Fome"));
  363.                 UpdateProgressBar(BarraFome,playerid);
  364.                 ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
  365.                 mostrarcardapio(playerid);
  366.                 }else{
  367.                 SendClientMessage(playerid,-1,"{FF0000}| ERRO | Você não está com fome!");
  368.                 SetPVarInt(playerid,"Fome",0);
  369.                 SetProgressBarValue(BarraFome, GetPVarInt(playerid,"Fome"));
  370.                 UpdateProgressBar(BarraFome,playerid);
  371.                 }
  372.                 }
  373.                 case 4:
  374.                 {
  375.                 if(GetPVarInt(playerid,"Fome") >= 1){
  376.                 SendClientMessage(playerid,0xFFFF00AA,"| INFO | Você está comendo uma Pizza de brocólis!");
  377.                 GivePlayerMoney(playerid, -35);
  378.                 SetPVarInt(playerid,"Fome",GetPVarInt(playerid,"Fome")-25);
  379.                 SetProgressBarValue(BarraFome, GetPVarInt(playerid,"Fome"));
  380.                 UpdateProgressBar(BarraFome,playerid);
  381.                 ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
  382.                 mostrarcardapio(playerid);
  383.                 SetPlayerHealth(playerid,100);
  384.                 }else{
  385.                 SendClientMessage(playerid,-1,"{FF0000}| ERRO | Você não está com fome!");
  386.                 SetPVarInt(playerid,"Fome",0);
  387.                 SetProgressBarValue(BarraFome, GetPVarInt(playerid,"Fome"));
  388.                 UpdateProgressBar(BarraFome,playerid);
  389.                 }
  390.                 }
  391.                 case 5:
  392.                 {
  393.                 if(GetPVarInt(playerid,"Fome") >= 1){
  394.                 SendClientMessage(playerid,0xFFFF00AA,"| INFO | Você está comendo uma Pizza de bauru!");
  395.                 GivePlayerMoney(playerid, -32);
  396.                 SetPVarInt(playerid,"Fome",GetPVarInt(playerid,"Fome")-25);
  397.                 SetProgressBarValue(BarraFome, GetPVarInt(playerid,"Fome"));
  398.                 SetPlayerHealth(playerid,100);
  399.                 UpdateProgressBar(BarraFome,playerid);
  400.                 ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
  401.                 mostrarcardapio(playerid);
  402.                 }else{
  403.                 SendClientMessage(playerid,-1,"{FF0000}| ERRO | Você não está com fome!");
  404.                 SetPVarInt(playerid,"Fome",0);
  405.                 SetProgressBarValue(BarraFome, GetPVarInt(playerid,"Fome"));
  406.                 UpdateProgressBar(BarraFome,playerid);
  407.                 }
  408.                 }
  409.                 case 6:
  410.                 {
  411.                 if(GetPVarInt(playerid,"Fome") >= 1){
  412.                 SendClientMessage(playerid,0xFFFF00AA,"| INFO | Você está comendo uma Pizza 4 queijos!");
  413.                 GivePlayerMoney(playerid, -44);
  414.                 SetPVarInt(playerid,"Fome",GetPVarInt(playerid,"Fome")-25);
  415.                 SetProgressBarValue(BarraFome, GetPVarInt(playerid,"Fome"));
  416.                 SetPlayerHealth(playerid,100);
  417.                 UpdateProgressBar(BarraFome,playerid);
  418.                 ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
  419.                 mostrarcardapio(playerid);
  420.                 }else{
  421.                 SendClientMessage(playerid,-1,"{FF0000}| ERRO | Você não está com fome!");
  422.                 SetPVarInt(playerid,"Fome",0);
  423.                 SetProgressBarValue(BarraFome, GetPVarInt(playerid,"Fome"));
  424.                 UpdateProgressBar(BarraFome,playerid);
  425.                 }
  426.                 }
  427.                 case 7:
  428.                 {
  429.                 mostrarcardapio(playerid);
  430.                 }
  431.                 case 8:
  432.                 {
  433.                 if(GetPVarInt(playerid,"Sede") >= 1){
  434.                 SendClientMessage(playerid,0xFFFF00AA,"| INFO | Você está bebendo uma Cola-Cola!");
  435.                 GivePlayerMoney(playerid, -6);
  436.                 SetPVarInt(playerid,"Sede",GetPVarInt(playerid,"Sede")-25);
  437.                 SetPlayerHealth(playerid,100);
  438.                 SetProgressBarValue(BarraSede, GetPVarInt(playerid,"Sede"));
  439.                 UpdateProgressBar(BarraSede,playerid);
  440.                 ApplyAnimation(playerid,"BAR","dnk_stndM_loop ",3.0, 0, 0, 0, 0, 0);
  441.                 mostrarcardapio(playerid);
  442.                 }else{
  443.                 SendClientMessage(playerid,-1,"{FF0000}| ERRO | Você não está com sede!");
  444.                 SetPVarInt(playerid,"Sede",0);
  445.                 SetProgressBarValue(BarraSede, GetPVarInt(playerid,"Sede"));
  446.                 UpdateProgressBar(BarraSede,playerid);
  447.                 }
  448.                 }
  449.                 case 9:
  450.                 {
  451.                 if(GetPVarInt(playerid,"Sede") >= 1){
  452.                 SendClientMessage(playerid,0xFFFF00AA,"| INFO | Você está bebendo uma Fanta!");
  453.                 GivePlayerMoney(playerid, -6);
  454.                 SetPlayerHealth(playerid,100);
  455.                 SetPVarInt(playerid,"Sede",GetPVarInt(playerid,"Sede")-25);
  456.                 SetProgressBarValue(BarraSede, GetPVarInt(playerid,"Sede"));
  457.                 UpdateProgressBar(BarraSede,playerid);
  458.                 ApplyAnimation(playerid,"BAR","dnk_stndM_loop ",3.0, 0, 0, 0, 0, 0);
  459.                 mostrarcardapio(playerid);
  460.                 }else{
  461.                 SendClientMessage(playerid,-1,"{FF0000}| ERRO | Você não está com sede!");
  462.                 SetPVarInt(playerid,"Sede",0);
  463.                 SetProgressBarValue(BarraSede, GetPVarInt(playerid,"Sede"));
  464.                 UpdateProgressBar(BarraSede,playerid);
  465.                 }
  466.                 }
  467.                 case 10:
  468.                 {
  469.                 if(GetPVarInt(playerid,"Sede") >= 1){
  470.                 SendClientMessage(playerid,0xFFFF00AA,"| INFO | Você está bebendo uma Sprite!");
  471.                 GivePlayerMoney(playerid, -4);
  472.                 SetPVarInt(playerid,"Sede",GetPVarInt(playerid,"Sede")-25);
  473.                 SetPlayerHealth(playerid,100);
  474.                 SetProgressBarValue(BarraSede, GetPVarInt(playerid,"Sede"));
  475.                 UpdateProgressBar(BarraSede,playerid);
  476.                 ApplyAnimation(playerid,"BAR","dnk_stndM_loop ",3.0, 0, 0, 0, 0, 0);
  477.                 mostrarcardapio(playerid);
  478.                 }else{
  479.                 SendClientMessage(playerid,-1,"{FF0000}| ERRO | Você não está com sede!");
  480.                 SetPVarInt(playerid,"Sede",0);
  481.                 SetProgressBarValue(BarraSede, GetPVarInt(playerid,"Sede"));
  482.                 UpdateProgressBar(BarraSede,playerid);
  483.                 }
  484.                 }
  485.                 case 11:
  486.                 {
  487.                 if(GetPVarInt(playerid,"Sede") >= 1){
  488.                 SendClientMessage(playerid,0xFFFF00AA,"| INFO | Você está bebendo um Guaraná Jesus!");
  489.                 GivePlayerMoney(playerid, -9);
  490.                 SetPVarInt(playerid,"Sede",GetPVarInt(playerid,"Sede")-25);
  491.                 SetPlayerHealth(playerid,100);
  492.                 SetProgressBarValue(BarraSede, GetPVarInt(playerid,"Sede"));
  493.                 UpdateProgressBar(BarraSede,playerid);
  494.                 ApplyAnimation(playerid,"BAR","dnk_stndM_loop ",3.0, 0, 0, 0, 0, 0);
  495.                 mostrarcardapio(playerid);
  496.                 }else{
  497.                 SendClientMessage(playerid,-1,"{FF0000}| ERRO | Você não está com sede!");
  498.                 SetPVarInt(playerid,"Sede",0);
  499.                 SetProgressBarValue(BarraSede, GetPVarInt(playerid,"Sede"));
  500.                 UpdateProgressBar(BarraSede,playerid);
  501.                 }
  502.                 }
  503.                 case 12:
  504.                 {
  505.                 if(GetPVarInt(playerid,"Sede") >= 1){
  506.                 SendClientMessage(playerid,0xFFFF00AA,"| INFO | Você está bebendo uma Pepsi!");
  507.                 GivePlayerMoney(playerid, -5);
  508.                 SetPVarInt(playerid,"Sede",GetPVarInt(playerid,"Sede")-25);
  509.                 SetProgressBarValue(BarraSede, GetPVarInt(playerid,"Sede"));
  510.                 SetPlayerHealth(playerid,100);
  511.                 UpdateProgressBar(BarraSede,playerid);
  512.                 ApplyAnimation(playerid,"BAR","dnk_stndM_loop ",3.0, 0, 0, 0, 0, 0);
  513.                 mostrarcardapio(playerid);
  514.                 }else{
  515.                 SendClientMessage(playerid,-1,"{FF0000}| ERRO | Você não está com sede!");
  516.                 SetPVarInt(playerid,"Sede",0);
  517.                 SetProgressBarValue(BarraSede, GetPVarInt(playerid,"Sede"));
  518.                 UpdateProgressBar(BarraSede,playerid);
  519.                 }
  520.                 }
  521.             }
  522.     }
  523.     }
  524.     return 0;
  525. }
  526.  
  527. public OnPlayerDisconnect(playerid)
  528. {  
  529.     new aname[MAX_PLAYER_NAME];
  530.     GetPlayerName(playerid, aname, sizeof(aname));
  531.     new conta [ 256 ];
  532.     format(conta, sizeof(conta), PASTA_FOMESEDESONO, aname);
  533.     StatusOn[playerid] = 0;
  534.     dini_IntSet(conta,"Fome", GetPVarInt(playerid,"Fome"));
  535.     dini_IntSet(conta,"Sede", GetPVarInt(playerid,"Sede"));
  536.     dini_IntSet(conta,"Sono", GetPVarInt(playerid,"Sono"));
  537.     dini_IntSet(conta,"StatusOn", 0);
  538.     KillTimer(timerfome[playerid]);
  539.     KillTimer(timersede[playerid]);
  540.     KillTimer(timersono[playerid]);
  541.     return 1;
  542. }  
  543.  
  544.  
  545. CMD:dormir(playerid,params[])
  546. {  
  547.     if(GetPVarInt(playerid,"Sono") >= 85){
  548.     if(dormindo[playerid] == 0){
  549.     SendClientMessage(playerid,-1,"{00BFFF}| SONO | Dormindo...");
  550.     ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
  551.     TogglePlayerControllable(playerid,0);
  552.     TextDrawShowForPlayer(playerid, TelaSono);
  553.     dormindo[playerid] = 1;
  554.     SetTimerEx("Acordar", 60000, false, "i", playerid);
  555.     GameTextForPlayer(playerid, "~b~Dormindo..." , 60000, 4);
  556.     }else SendClientMessage(playerid,-1,"{FF0000}| ERRO | Você já está dormindo");
  557.     }else SendClientMessage(playerid,-1,"{FF0000}| ERRO | Você não está com sono");
  558.     return 1;
  559. }
  560.  
  561.  
  562. stock mostrarcardapio(playerid)
  563. {
  564.     new string[1700];
  565.     strcat(string, "{FF0000} {FF0000} Alimento\tPreço\n"); // 0
  566.     strcat(string, "{FF0000} {FF0000} Comidas\n"); // 0
  567.     strcat(string, "{FF0000}-{FFFFFF} X-Bacon\t{0088FF}R$10,00\n"); //   1
  568.     strcat(string, "{FF0000}-{FFFFFF} X-Tudo\t{0088FF}R$26,00\n"); // 2
  569.     strcat(string, "{FF0000}-{FFFFFF} X-Salada\t{0088FF}R$12,00 \n"); // 3
  570.     strcat(string, "{FF0000}-{FFFFFF} Pizza de brócolis\t{0088FF}R$35,00 \n"); // 4
  571.     strcat(string, "{FF0000}-{FFFFFF} Pizza de bauru\t{0088FF}R$32,00\n"); // 5
  572.     strcat(string, "{FF0000}-{FFFFFF} Pizza 4 queijos\t{0088FF}R$44,00 \n"); // 6
  573.     strcat(string, "{FF0000}-{FF0000} Bebidas\n");// 7
  574.     strcat(string, "{FF0000}-{FFFFFF} Coca-Cola\t{0088FF}R$06,00 \n");// 8
  575.     strcat(string, "{FF0000}-{FFFFFF} Fanta\t{0088FF}R$06,00  \n");// 9
  576.     strcat(string, "{FF0000}-{FFFFFF} Sprite\t{0088FF}R$04,00 \n");// 10
  577.     strcat(string, "{FF0000}-{FFFFFF} Guaraná Jesus\t{0088FF}R$09,00 \n");// 11
  578.     strcat(string, "{FF0000}-{FFFFFF} Pepsi\t{0088FF}R$05,00\n");// 12
  579.     ShowPlayerDialog(playerid, cardapio, DIALOG_STYLE_TABLIST_HEADERS, "Cardápio", string, "Comprar", "Sair");
  580.     return 1;
  581. }
  582.  
  583. public Acordar(playerid)
  584. {
  585. TextDrawHideForPlayer(playerid, TelaSono);
  586. SendClientMessage(playerid,-1,"{00BFFF}| INFO | Você acordou!");
  587. dormindo[playerid] = 0;
  588. SetPVarInt(playerid,"Sono",GetPVarInt(playerid,"Sono")-100);
  589. SetProgressBarValue(BarraSono, GetPVarInt(playerid,"Sono"));
  590. UpdateProgressBar(BarraSono,playerid);
  591. TogglePlayerControllable(playerid,1);
  592. GameTextForPlayer(playerid, "~r~Acordado!" , 3000, 4);
  593. ClearAnimations(playerid);
  594. }
  595.  
  596.  
  597. //By GuiLopez_ - Fórum SA-MP
Advertisement
Add Comment
Please, Sign In to add comment