Advertisement
Guest User

iFood System by darkxdll

a guest
May 31st, 2020
593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.61 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. new AppLigado[MAX_PLAYERS];
  18. new iFood[MAX_PLAYERS];
  19. new Entregando[MAX_PLAYERS];
  20. new Retiroupedido[MAX_PLAYERS];
  21. new buscandocorridas[MAX_PLAYERS];
  22.  
  23. new Temporizador[][1] = //TEMPO DE ESPERA ENTRE CADA ENTREGA
  24. {
  25.     {5000},
  26.     {8000},
  27.     {10000},
  28.     {12000},
  29.     {16000}
  30. };
  31.  
  32. enum Rests
  33. {
  34.     Float:BrX,
  35.     Float:BrY,
  36.     Float:BrZ,
  37.     Local[64]
  38. }
  39.  
  40. new Restaurantes[][Rests] = //ADICIONE QUANTOS RESTAURANTES QUISER :D ESQUEMA -> (X,Y,Z,"NOME")
  41. {
  42.     {953.6340,-1379.8330,13.3438, "Cluckin' Bell"},// Cluckin Bells
  43.     {1045.5018,-1269.2733,13.6790, "China's Food"},//Chinese Food
  44.     {1126.0450,-1372.2838,13.9844, "Loja de bebidas"},// Loja de bebidas
  45.     {1196.8871,-921.3952,43.0530, "Burguer Shot"},//Burguer Shot
  46.     {1300.6167,-1156.1165,23.8281, "Disk Bebidas"},// Conveniencia 24hrs
  47.     {421.7389,-1758.9269,8.1689, "Pizzaria da Praia"}// Pizzaria Praia
  48. };
  49. new Float:Entregas_ifood[][3] =
  50. {
  51.     {1247.3604,-1101.0178,26.6719},
  52.     {1243.1884,-1076.3695,31.5547},
  53.     {856.1241,-1687.5447,13.5550},
  54.     {840.9093,-1477.0052,13.5930}    //ADICIONE QUANTAS CASAS QUISER, SEGUINDO O ESQUEMA: {X,Y,Z},
  55. };
  56.  
  57. public OnFilterScriptInit()
  58. {
  59.     print("\n--------------------------------------");
  60.     print(" iFood by Brunno Vinicius (darkxdll)");
  61.     print("--------------------------------------\n");
  62.     return 1;
  63. }
  64.  
  65. public OnFilterScriptExit()
  66. {
  67.     return 1;
  68. }
  69.  
  70. public OnPlayerConnect(playerid)
  71. {
  72.     AppLigado[playerid] = 0;
  73.     Retiroupedido[playerid] = 0;
  74.     Entregando[playerid] = 0;
  75.     return 1;
  76. }
  77.  
  78. public OnPlayerDisconnect(playerid, reason)
  79. {
  80.     AppLigado[playerid] = 0;
  81.     Retiroupedido[playerid] = 0;
  82.     Entregando[playerid] = 0;
  83.     return 1;
  84. }
  85.  
  86. public OnPlayerSpawn(playerid)
  87. {
  88.     AppLigado[playerid] = 0;
  89.     Retiroupedido[playerid] = 0;
  90.     Entregando[playerid] = 0;
  91.     return 1;
  92. }
  93.  
  94. public OnPlayerDeath(playerid, killerid, reason)
  95. {
  96.     AppLigado[playerid] = 0;
  97.     Retiroupedido[playerid] = 0;
  98.     Entregando[playerid] = 0;
  99.     return 1;
  100. }
  101.  
  102. public OnPlayerCommandText(playerid, cmdtext[])
  103. {
  104.     return 1;
  105. }
  106.  
  107. public OnPlayerEnterCheckpoint(playerid)
  108. {
  109.     if(Entregando[playerid] == 1 && Retiroupedido[playerid] != 1)
  110.     {
  111.         DisablePlayerCheckpoint(playerid);
  112.         SetTimerEx("SigaEntrega",2000,false,"i",playerid);
  113.         TogglePlayerControllable(playerid,false);
  114.     }
  115.     if(Entregando[playerid] == 1 && Retiroupedido[playerid] == 1)
  116.     {
  117.         DisablePlayerCheckpoint(playerid);
  118.         SetTimerEx("FinalizandoEntrega",2000,false,"i",playerid);
  119.         TogglePlayerControllable(playerid,false);
  120.     }
  121.     return 1;
  122. }
  123. forward SigaEntrega(playerid);
  124. public SigaEntrega(playerid)
  125. {
  126.     new rand = random(sizeof(Entregas_ifood));
  127.     Retiroupedido[playerid] = 1;
  128.     SetPlayerCheckpoint(playerid,Entregas_ifood[rand][0],Entregas_ifood[rand][1],Entregas_ifood[rand][2], 5);
  129.     SendClientMessage(playerid, COLOR_LIGHTBLUE, "[iFood] Siga para a entrega");
  130.     TogglePlayerControllable(playerid, true);
  131.     return 1;
  132. }
  133. forward FinalizandoEntrega(playerid);
  134. public FinalizandoEntrega(playerid)
  135. {
  136.     SendClientMessage(playerid, COLOR_LIME, "[iFood] Entrega realizada com sucesso");
  137.     GivePlayerMoney(playerid, randomEspecial(GANHO_MIN, GANHO_MAX));
  138.     Entregando[playerid] = 0;
  139.     Retiroupedido[playerid] = 0;
  140.     AppLigado[playerid] = 1;
  141.     TogglePlayerControllable(playerid, true);
  142.     return 1;
  143. }
  144.  
  145. public OnPlayerUpdate(playerid)
  146. {
  147.     if(AppLigado[playerid] == 1 && Entregando[playerid] != 1)
  148.     {
  149. //      new msgteste[128];
  150.         new pseudorand = random(sizeof(Temporizador));
  151.         buscandocorridas[playerid] = SetTimerEx("ChamarEntrega", Temporizador[pseudorand][0], false,"i", playerid);
  152. //      format(msgteste,sizeof(msgteste), "%d", Temporizador[pseudorand][0]);
  153. //      SendClientMessage(playerid,0xFFFFFFFF, msgteste);
  154.         Entregando[playerid] = 1;
  155.     }
  156.     return 1;
  157. }
  158. forward ChamarEntrega(playerid);
  159. public ChamarEntrega(playerid)
  160. {
  161.     new Float:x,Float:y,Float:z;
  162.     GetPlayerPos(playerid,x,y,z);
  163.     PlayerPlaySound(playerid,1149,x,y,z);
  164.     SendClientMessage(playerid,COLOR_LIME, "[iFood] ~~ENTREGA RECEBIDA~~");
  165.     SendClientMessage(playerid,COLOR_LIME, "[iFood] Vá para o local marcado no GPS para retirar o pedido");
  166.     new rand = random(sizeof(Restaurantes));
  167.     SetPlayerCheckpoint(playerid,Restaurantes[rand][BrX],Restaurantes[rand][BrY],Restaurantes[rand][BrZ], 5);
  168.     return 1;
  169. }
  170.  
  171. stock randomEspecial(minimo,maximo)
  172. {
  173.     new valor = random(maximo-minimo)+minimo;
  174.     return valor;
  175. }
  176.  
  177. CMD:ifood(playerid, params[])
  178. {
  179.     AppLigado[playerid] = 0;
  180.     iFood[playerid] = 1;
  181.     SendClientMessage(playerid, COLOR_BLUE, "[iFood] Bem Vindo ao iFood");
  182.     SendClientMessage(playerid, COLOR_BLUE, "[iFood] Criado por Bruno Vinicius");
  183.     SendClientMessage(playerid, COLOR_BLUE, "[iFood] Comandos: /ifood - /ligarapp - /desligarapp");
  184.     SendClientMessage(playerid, COLOR_BLUE, "[iFood] Moto: /motoca ");
  185.     return 1;
  186. }
  187. CMD:ligarapp(playerid, params[])
  188. {
  189.     if(AppLigado[playerid] == 1)
  190.         return SendClientMessage(playerid, COLOR_RED ,"[iFood] Você já está conectado");
  191.     else
  192.     {
  193.         if(iFood[playerid] == 1)
  194.         {
  195.             if(GetVehicleModel(GetPlayerVehicleID(playerid)) == ID_MOTOCA)
  196.             {
  197.                 SendClientMessage(playerid, COLOR_BLUE, "[iFood] Aplicativo habilitado para receber entregas!");
  198.                 AppLigado[playerid] = 1;
  199.             }
  200.             else
  201.             {
  202.                 SendClientMessage(playerid,COLOR_RED,"[iFood] Desculpe, não aceitamos este modelo de veiculo!");
  203.             }
  204.         }
  205.         else
  206.         {
  207.             SendClientMessage(playerid, COLOR_RED,"[iFood] Falha na autenticação");
  208.         }
  209.     }
  210.     return 1;
  211. }
  212. CMD:desligarapp(playerid, params[])
  213. {
  214.     if(AppLigado[playerid] != 1)
  215.         return SendClientMessage(playerid, COLOR_RED,"[iFood] Você já está desconectado");
  216.     else
  217.     {
  218.         AppLigado[playerid] = 0;
  219.         Entregando[playerid] = 0;
  220.         Retiroupedido[playerid] = 0;
  221.         KillTimer(buscandocorridas[playerid]);
  222.         DisablePlayerCheckpoint(playerid);
  223.         SendClientMessage(playerid, COLOR_LIME, "[iFood] Obrigado pelas entregas, até breve!");
  224.     }
  225.     return 1;
  226. }
  227. CMD:motoca(playerid, params[])
  228. {
  229.     new Float:x, Float:y, Float:z;
  230.     new Float:ang;
  231.     GetPlayerPos(playerid, x,y,z);
  232.     GetPlayerFacingAngle(playerid, ang);
  233.     AddStaticVehicle( 448, x,y,z, ang, 255,255);
  234.     return 1;
  235. }/*
  236. CMD:carro(playerid, params[])
  237. {
  238.     new Float:x, Float:y, Float:z;
  239.     new Float:ang;
  240.     GetPlayerPos(playerid, x,y,z);
  241.     GetPlayerFacingAngle(playerid, ang);
  242.     AddStaticVehicle( 422, x,y,z, ang, 255,255);
  243.     return 1;
  244. }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement