Advertisement
darkxdll

iFood System by Darkxdll v1.1

Jun 1st, 2020
3,019
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 13.15 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4. #include <zcmd>
  5.  
  6. #define COLOR_RED 0xAA3333AA
  7. #define COLOR_LIME 0x10F441AA
  8. #define COLOR_WHITE 0xFFFFFFAA
  9. #define COLOR_BLUE 0x0000BBAA
  10. #define COLOR_LIGHTBLUE 0x33CCFFAA
  11.  
  12.  
  13. #define GANHO_MIN   2500 //GANHO MINIMO POR ENTREGA
  14. #define GANHO_MAX   9000 //GANHO MAXIMO POR ENTREGA
  15. #define ID_MOTOCA   448  //ID DA MOTOCA DE ENTREGAS
  16.  
  17. #define PRESSED(%0) \
  18.     (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  19.  
  20. new AppLigado[MAX_PLAYERS];
  21. new iFood[MAX_PLAYERS];
  22. new Entregando[MAX_PLAYERS];
  23. new Retiroupedido[MAX_PLAYERS];
  24. new buscandocorridas[MAX_PLAYERS];
  25. new TempoDeResposta[MAX_PLAYERS];
  26. new TemCorrida[MAX_PLAYERS];
  27.  
  28. new PlayerText:texto_novaentrega[MAX_PLAYERS];
  29. new PlayerText:playertextdraw_1[MAX_PLAYERS];
  30. new PlayerText:playertextdraw_2[MAX_PLAYERS];
  31. new PlayerText:playertextdraw_3[MAX_PLAYERS];
  32.  
  33. new Temporizador[][1] = //TEMPO DE ESPERA ENTRE CADA ENTREGA
  34. {
  35.     {5000},
  36.     {8000},
  37.     {10000},
  38.     {12000},
  39.     {16000}
  40. };
  41.  
  42. enum Rests
  43. {
  44.     Float:BrX,
  45.     Float:BrY,
  46.     Float:BrZ,
  47.     Local[64]
  48. }
  49.  
  50. new Restaurantes[][Rests] = //ADICIONE QUANTOS RESTAURANTES QUISER :D ESQUEMA -> (X,Y,Z,"NOME")
  51. {
  52.     {953.6340,-1379.8330,13.3438, "Cluckin' Bell"},// Cluckin Bells
  53.     {1045.5018,-1269.2733,13.6790, "China's Food"},//Chinese Food
  54.     {1126.0450,-1372.2838,13.9844, "Loja de bebidas"},// Loja de bebidas
  55.     {1196.8871,-921.3952,43.0530, "Burguer Shot"},//Burguer Shot
  56.     {1300.6167,-1156.1165,23.8281, "Disk Bebidas"},// Conveniencia 24hrs
  57.     {421.7389,-1758.9269,8.1689, "Pizzaria da Praia"}// Pizzaria Praia
  58. };
  59. new Float:Entregas_ifood[][3] =
  60. {
  61.     {1247.3604,-1101.0178,26.6719},
  62.     {1243.1884,-1076.3695,31.5547},
  63.     {856.1241,-1687.5447,13.5550},
  64.     {840.9093,-1477.0052,13.5930}    //ADICIONE QUANTAS CASAS QUISER, SEGUINDO O ESQUEMA: {X,Y,Z},
  65. };
  66.  
  67. public OnFilterScriptInit()
  68. {
  69.     print("\n--------------------------------------");
  70.     print(" iFood by Brunno Vinicius (darkxdll)");
  71.     print("--------------------------------------\n");
  72.     return 1;
  73. }
  74.  
  75. public OnFilterScriptExit()
  76. {
  77.     return 1;
  78. }
  79.  
  80. public OnPlayerConnect(playerid)
  81. {
  82.     AppLigado[playerid] = 0;
  83.     Retiroupedido[playerid] = 0;
  84.     Entregando[playerid] = 0;
  85.     TemCorrida[playerid] = 0;
  86.    
  87.     texto_novaentrega[playerid] = CreatePlayerTextDraw(playerid, 515.000000, 267.000000, "Nova entrega recebida");
  88.     PlayerTextDrawFont(playerid, texto_novaentrega[playerid], 2);
  89.     PlayerTextDrawLetterSize(playerid, texto_novaentrega[playerid], 0.216666, 1.299980);
  90.     PlayerTextDrawTextSize(playerid, texto_novaentrega[playerid], 100.000000, 128.000000);
  91.     PlayerTextDrawSetOutline(playerid, texto_novaentrega[playerid], 1);
  92.     PlayerTextDrawSetShadow(playerid, texto_novaentrega[playerid], 1);
  93.     PlayerTextDrawAlignment(playerid, texto_novaentrega[playerid], 2);
  94.     PlayerTextDrawColor(playerid, texto_novaentrega[playerid], -1);
  95.     PlayerTextDrawBackgroundColor(playerid, texto_novaentrega[playerid], 255);
  96.     PlayerTextDrawBoxColor(playerid, texto_novaentrega[playerid], -16776961);
  97.     PlayerTextDrawUseBox(playerid, texto_novaentrega[playerid], 1);
  98.     PlayerTextDrawSetProportional(playerid, texto_novaentrega[playerid], 1);
  99.     PlayerTextDrawSetSelectable(playerid, texto_novaentrega[playerid], 0);
  100.  
  101.     playertextdraw_1[playerid] = CreatePlayerTextDraw(playerid, 515.000000, 283.000000, "_");
  102.     PlayerTextDrawFont(playerid, playertextdraw_1[playerid], 2);
  103.     PlayerTextDrawLetterSize(playerid, playertextdraw_1[playerid], 9.499993, 10.250018);
  104.     PlayerTextDrawTextSize(playerid, playertextdraw_1[playerid], 101.000000, 128.000000);
  105.     PlayerTextDrawSetOutline(playerid, playertextdraw_1[playerid], 1);
  106.     PlayerTextDrawSetShadow(playerid, playertextdraw_1[playerid], 1);
  107.     PlayerTextDrawAlignment(playerid, playertextdraw_1[playerid], 2);
  108.     PlayerTextDrawColor(playerid, playertextdraw_1[playerid], -1);
  109.     PlayerTextDrawBackgroundColor(playerid, playertextdraw_1[playerid], 255);
  110.     PlayerTextDrawBoxColor(playerid, playertextdraw_1[playerid], 255);
  111.     PlayerTextDrawUseBox(playerid, playertextdraw_1[playerid], 1);
  112.     PlayerTextDrawSetProportional(playerid, playertextdraw_1[playerid], 1);
  113.     PlayerTextDrawSetSelectable(playerid, playertextdraw_1[playerid], 0);
  114.  
  115.     playertextdraw_2[playerid] = CreatePlayerTextDraw(playerid, 481.000000, 281.000000, "Preview_Model");
  116.     PlayerTextDrawFont(playerid, playertextdraw_2[playerid], 5);
  117.     PlayerTextDrawLetterSize(playerid, playertextdraw_2[playerid], 0.600000, 2.000000);
  118.     PlayerTextDrawTextSize(playerid, playertextdraw_2[playerid], 71.500000, 83.000000);
  119.     PlayerTextDrawSetOutline(playerid, playertextdraw_2[playerid], 0);
  120.     PlayerTextDrawSetShadow(playerid, playertextdraw_2[playerid], 0);
  121.     PlayerTextDrawAlignment(playerid, playertextdraw_2[playerid], 1);
  122.     PlayerTextDrawColor(playerid, playertextdraw_2[playerid], -1);
  123.     PlayerTextDrawBackgroundColor(playerid, playertextdraw_2[playerid], 125);
  124.     PlayerTextDrawBoxColor(playerid, playertextdraw_2[playerid], 0);
  125.     PlayerTextDrawUseBox(playerid, playertextdraw_2[playerid], 0);
  126.     PlayerTextDrawSetProportional(playerid, playertextdraw_2[playerid], 1);
  127.     PlayerTextDrawSetSelectable(playerid, playertextdraw_2[playerid], 0);
  128.     PlayerTextDrawSetPreviewModel(playerid, playertextdraw_2[playerid], 19580);
  129.     PlayerTextDrawSetPreviewRot(playerid, playertextdraw_2[playerid], -32.000000, 0.000000, -20.000000, 1.000000);
  130.     PlayerTextDrawSetPreviewVehCol(playerid, playertextdraw_2[playerid], 1, 1);
  131.  
  132.     playertextdraw_3[playerid] = CreatePlayerTextDraw(playerid, 515.000000, 363.000000, "'Y' para aceitar");
  133.     PlayerTextDrawFont(playerid, playertextdraw_3[playerid], 2);
  134.     PlayerTextDrawLetterSize(playerid, playertextdraw_3[playerid], 0.293332, 1.289999);
  135.     PlayerTextDrawTextSize(playerid, playertextdraw_3[playerid], 208.500000, 128.000000);
  136.     PlayerTextDrawSetOutline(playerid, playertextdraw_3[playerid], 1);
  137.     PlayerTextDrawSetShadow(playerid, playertextdraw_3[playerid], 0);
  138.     PlayerTextDrawAlignment(playerid, playertextdraw_3[playerid], 2);
  139.     PlayerTextDrawColor(playerid, playertextdraw_3[playerid], -1);
  140.     PlayerTextDrawBackgroundColor(playerid, playertextdraw_3[playerid], 255);
  141.     PlayerTextDrawBoxColor(playerid, playertextdraw_3[playerid], 50);
  142.     PlayerTextDrawUseBox(playerid, playertextdraw_3[playerid], 1);
  143.     PlayerTextDrawSetProportional(playerid, playertextdraw_3[playerid], 1);
  144.     PlayerTextDrawSetSelectable(playerid, playertextdraw_3[playerid], 0);
  145.     return 1;
  146. }
  147.  
  148. public OnPlayerDisconnect(playerid, reason)
  149. {
  150.     AppLigado[playerid] = 0;
  151.     Retiroupedido[playerid] = 0;
  152.     Entregando[playerid] = 0;
  153.     TemCorrida[playerid] = 0;
  154.     return 1;
  155. }
  156.  
  157. public OnPlayerSpawn(playerid)
  158. {
  159.     AppLigado[playerid] = 0;
  160.     Retiroupedido[playerid] = 0;
  161.     Entregando[playerid] = 0;
  162.     TemCorrida[playerid] = 0;
  163.     return 1;
  164. }
  165.  
  166. public OnPlayerDeath(playerid, killerid, reason)
  167. {
  168.     AppLigado[playerid] = 0;
  169.     Retiroupedido[playerid] = 0;
  170.     Entregando[playerid] = 0;
  171.     TemCorrida[playerid] = 0;
  172.     return 1;
  173. }
  174.  
  175. public OnPlayerCommandText(playerid, cmdtext[])
  176. {
  177.     return 1;
  178. }
  179.  
  180. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  181. {
  182.     if (PRESSED (KEY_YES) )
  183.     {
  184.         if(Entregando[playerid] == 1 && AppLigado[playerid] == 1 && TemCorrida[playerid] == 1)
  185.         {
  186.             KillTimer(TempoDeResposta[playerid]);
  187.             KillTimer(buscandocorridas[playerid]);
  188.             TemCorrida[playerid] = 0;
  189.             StopAudioStreamForPlayer(playerid);
  190.             PlayerTextDrawHide(playerid,texto_novaentrega[playerid]);
  191.             PlayerTextDrawHide(playerid,playertextdraw_1[playerid]);
  192.             PlayerTextDrawHide(playerid,playertextdraw_2[playerid]);
  193.             PlayerTextDrawHide(playerid,playertextdraw_3[playerid]);
  194.             new rand = random(sizeof(Restaurantes));
  195.             SetPlayerCheckpoint(playerid,Restaurantes[rand][BrX],Restaurantes[rand][BrY],Restaurantes[rand][BrZ], 5);
  196.         }
  197.     }
  198.     return 1;
  199. }
  200.  
  201. public OnPlayerEnterCheckpoint(playerid)
  202. {
  203.     if(Entregando[playerid] == 1 && Retiroupedido[playerid] != 1)
  204.     {
  205.         DisablePlayerCheckpoint(playerid);
  206.         SetTimerEx("SigaEntrega",2000,false,"i",playerid);
  207.         TogglePlayerControllable(playerid,false);
  208.     }
  209.     if(Entregando[playerid] == 1 && Retiroupedido[playerid] == 1)
  210.     {
  211.         DisablePlayerCheckpoint(playerid);
  212.         SetTimerEx("FinalizandoEntrega",2000,false,"i",playerid);
  213.         TogglePlayerControllable(playerid,false);
  214.     }
  215.     return 1;
  216. }
  217. forward SigaEntrega(playerid);
  218. public SigaEntrega(playerid)
  219. {
  220.     new rand = random(sizeof(Entregas_ifood));
  221.     Retiroupedido[playerid] = 1;
  222.     SetPlayerCheckpoint(playerid,Entregas_ifood[rand][0],Entregas_ifood[rand][1],Entregas_ifood[rand][2], 5);
  223.     SendClientMessage(playerid, COLOR_LIGHTBLUE, "[iFood] Siga para a entrega");
  224.     TogglePlayerControllable(playerid, true);
  225.     return 1;
  226. }
  227. forward FinalizandoEntrega(playerid);
  228. public FinalizandoEntrega(playerid)
  229. {
  230.     SendClientMessage(playerid, COLOR_LIME, "[iFood] Entrega realizada com sucesso");
  231.     GivePlayerMoney(playerid, randomEspecial(GANHO_MIN, GANHO_MAX));
  232.     Entregando[playerid] = 0;
  233.     Retiroupedido[playerid] = 0;
  234.     TemCorrida[playerid] = 0;
  235.     AppLigado[playerid] = 1;
  236.     TogglePlayerControllable(playerid, true);
  237.     return 1;
  238. }
  239.  
  240. public OnPlayerUpdate(playerid)
  241. {
  242.     if(AppLigado[playerid] == 1 && Entregando[playerid] != 1 && TemCorrida[playerid] == 0)
  243.     {
  244.         Entregando[playerid] = 1;
  245.         new pseudorand = random(sizeof(Temporizador));
  246.         buscandocorridas[playerid] = SetTimerEx("ChamarEntrega", Temporizador[pseudorand][0], false,"i", playerid);
  247.     }
  248.     return 1;
  249. }
  250. forward ChamarEntrega(playerid);
  251. public ChamarEntrega(playerid)
  252. {
  253.     TempoDeResposta[playerid] = SetTimerEx("PerdeuEntrega", 10000,false,"i",playerid);
  254.     TemCorrida[playerid] = 1;
  255.     PlayAudioStreamForPlayer(playerid, "https://www.fetchtube.com/Mp3Download.php/Did%20I%20Miss%20Request%20New%20%23Uber%20Ringtone%20%F0%9F%98%8E.mp3?filename=9d12b0d588b5f65d2b21191765d66ae6");
  256.     for(new t=0; t < 15; t++)
  257.     {
  258.         SendClientMessage(playerid, -1, "");
  259.     }
  260.     SendClientMessage(playerid,COLOR_LIGHTBLUE, "[iFood] Nova entrega recebida, você possui 10s para aceitar");
  261.     PlayerTextDrawShow(playerid, texto_novaentrega[playerid]);
  262.     PlayerTextDrawShow(playerid, playertextdraw_1[playerid]);
  263.     PlayerTextDrawShow(playerid, playertextdraw_2[playerid]);
  264.     PlayerTextDrawShow(playerid, playertextdraw_3[playerid]);
  265.     return 1;
  266. }
  267.  
  268. forward PerdeuEntrega(playerid);
  269. public PerdeuEntrega(playerid)
  270. {
  271.     DisablePlayerCheckpoint(playerid);
  272.     Entregando[playerid] = 0;
  273.     TemCorrida[playerid] = 0;
  274.     StopAudioStreamForPlayer(playerid);
  275.     PlayerTextDrawHide(playerid,texto_novaentrega[playerid]);
  276.     PlayerTextDrawHide(playerid,playertextdraw_1[playerid]);
  277.     PlayerTextDrawHide(playerid,playertextdraw_2[playerid]);
  278.     PlayerTextDrawHide(playerid,playertextdraw_3[playerid]);
  279.     KillTimer(TempoDeResposta[playerid]);
  280.     return 1;
  281. }
  282.  
  283. stock randomEspecial(minimo,maximo)
  284. {
  285.     new valor = random(maximo-minimo)+minimo;
  286.     return valor;
  287. }
  288.  
  289. CMD:ifood(playerid, params[])
  290. {
  291.     AppLigado[playerid] = 0;
  292.     iFood[playerid] = 1;
  293.     SendClientMessage(playerid, COLOR_BLUE, "[iFood] Bem Vindo ao iFood");
  294.     SendClientMessage(playerid, COLOR_BLUE, "[iFood] Criado por Bruno Vinicius");
  295.     SendClientMessage(playerid, COLOR_BLUE, "[iFood] Comandos: /ifood - /ligarapp - /desligarapp");
  296.     SendClientMessage(playerid, COLOR_BLUE, "[iFood] Moto: /motoca ");
  297.     return 1;
  298. }
  299. CMD:ligarapp(playerid, params[])
  300. {
  301.     if(AppLigado[playerid] == 1)
  302.         return SendClientMessage(playerid, COLOR_RED ,"[iFood] Você já está conectado");
  303.     else
  304.     {
  305.         if(iFood[playerid] == 1)
  306.         {
  307.             if(GetVehicleModel(GetPlayerVehicleID(playerid)) == ID_MOTOCA)
  308.             {
  309.                 SendClientMessage(playerid, COLOR_BLUE, "[iFood] Aplicativo habilitado para receber entregas!");
  310.                 AppLigado[playerid] = 1;
  311.             }
  312.             else
  313.             {
  314.                 SendClientMessage(playerid,COLOR_RED,"[iFood] Desculpe, não aceitamos este modelo de veiculo!");
  315.             }
  316.         }
  317.         else
  318.         {
  319.             SendClientMessage(playerid, COLOR_RED,"[iFood] Falha na autenticação");
  320.         }
  321.     }
  322.     return 1;
  323. }
  324. CMD:desligarapp(playerid, params[])
  325. {
  326.     if(AppLigado[playerid] != 1)
  327.         return SendClientMessage(playerid, COLOR_RED,"[iFood] Você já está desconectado");
  328.     else
  329.     {
  330.         AppLigado[playerid] = 0;
  331.         Entregando[playerid] = 0;
  332.         Retiroupedido[playerid] = 0;
  333.         KillTimer(buscandocorridas[playerid]);
  334.         DisablePlayerCheckpoint(playerid);
  335.         SendClientMessage(playerid, COLOR_LIME, "[iFood] Obrigado pelas entregas, até breve!");
  336.     }
  337.     return 1;
  338. }
  339. CMD:motoca(playerid, params[])
  340. {
  341.     new Float:x, Float:y, Float:z;
  342.     new Float:ang;
  343.     GetPlayerPos(playerid, x,y,z);
  344.     GetPlayerFacingAngle(playerid, ang);
  345.     AddStaticVehicle( 448, x,y,z, ang, 255,255);
  346.     return 1;
  347. }/*
  348. CMD:carro(playerid, params[])
  349. {
  350.     new Float:x, Float:y, Float:z;
  351.     new Float:ang;
  352.     GetPlayerPos(playerid, x,y,z);
  353.     GetPlayerFacingAngle(playerid, ang);
  354.     AddStaticVehicle( 422, x,y,z, ang, 255,255);
  355.     return 1;
  356. }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement