Portal SAMP
[Pedido] Da para otimizar esse sistema? - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Pedido] Da para otimizar esse sistema? (/showthread.php?tid=1123)



Da para otimizar esse sistema? - MatheuzPatoo - 23/04/2021

Código PHP:
new EntradaMercadoNegro;
new 
SaidaMercadoNegro;

new 
EntradaPrefeituraLS;
new 
SaidaPrefeituraLS;

new 
EntradaPoliciaMilitar;
new 
SaidaPoliciaMilitar;

new 
EntradaPoliciaFederal;
new 
SaidaPoliciaFederal;

new 
EntradaPRF;
new 
SaidaPRF;

new 
EntradaPoliciaBope;
new 
SaidaPoliciaBope;

new 
EntradaEscolaDeLicencasLS;
new 
SaidaEscolaDeLicencasLS;

new 
EntradaLoteriaDowntownLS;
new 
SaidaLoteriaDowntownLS;

new 
EntradaBancoSulLS;
new 
SaidaBancoSulLS;

new 
EntradaBancoLesteLS;
new 
SaidaBancoLesteLS;

new 
EntradaBancoOesteLS;
new 
SaidaBancoOesteLS;

public 
OnGameModeInit()
{
    EntradaMercadoNegro CreatePickup(131811420.7308,-1849.0535,13.9688);//[ENTRADA = MERCADO NEGRO]
    SaidaMercadoNegro CreatePickup(13181965.1273,2108.0007,1011.0303);//[SAIDA = PREFEITURA LS]
   
    EntradaPrefeituraLS 
CreatePickup(131811480.9438,-1771.2585,18.7958);//[ENTRADA = PREFEITURA LS]
    SaidaPrefeituraLS CreatePickup(13181389.9741,173.8266,1008.3828);//[SAIDA = PREFEITURA LS]
   
    EntradaPoliciaMilitar 
CreatePickup(131811555.0052,-1675.6299,16.1953);//[ENTRADA = POLICIA MILITAR]
    SaidaPoliciaMilitar CreatePickup(13181246.6895,62.6177,1003.6406);//[SAIDA = POLICIA MILITAR]
   
    EntradaPoliciaFederal 
CreatePickup(131812793.4915,-1087.5383,30.7188);//[ENTRADA = POLICIA FEDERAL]
    SaidaPoliciaFederal CreatePickup(13181288.8136,167.3451,1007.1719);//[SAIDA = POLICIA FEDERAL]
   
    EntradaPRF 
CreatePickup(13181, -93.4661,-1576.8896,3.0755);//[ENTRADA = POLICIA RODOVIARIA FEDERAL]
    SaidaPRF CreatePickup(131812215.0239,-1150.5393,1025.7969);//[SAIDA = POLICIA RODOVIARIA FEDERAL]
   
    EntradaPoliciaBope 
CreatePickup(13181328.4875,-1512.6652,36.0391);//[ENTRADA = POLICIA BOPE]
    SaidaPoliciaBope CreatePickup(13181322.2091,302.7661,999.1484);//[SAIDA = POLICIA BOPE]
   
    EntradaPoliciaBope 
CreatePickup(13181328.4875,-1512.6652,36.0391);//[ENTRADA = POLICIA BOPE]
    SaidaPoliciaBope CreatePickup(13181322.2091,302.7661,999.1484);//[SAIDA = POLICIA BOPE]
   
    EntradaEscolaDeLicencasLS 
CreatePickup(131811411.7230,-1699.7758,13.5395);//[ENTRADA = ESCOLA DE LICEN�AS LS]
    SaidaEscolaDeLicencasLS CreatePickup(13181, -2027.1364,-104.1583,1035.1719);//[SAIDA = ESCOLA DE LICEN�AS LS]
   
    EntradaLoteriaDowntownLS 
CreatePickup(131811631.8282,-1172.6462,24.0843);//[ENTRADA = LOTERIA DOWNTOWN LS]
    SaidaLoteriaDowntownLS CreatePickup(13181389.9741,173.8266,1008.3828);//[SAIDA = LOTERIA DOWNTOWN LS]
   
    EntradaBancoSulLS 
CreatePickup(13181940.9291,-1717.6973,13.9582);//[ENTRADA = BANCO SUL LS]
    SaidaBancoSulLS CreatePickup(13181389.9741,173.8266,1008.3828);//[SAIDA = BANCO SUL LS]
   
    EntradaBancoLesteLS 
CreatePickup(13181593.5140,-1250.5427,18.2385);//[ENTRADA = BANCO LESTE LS]
    SaidaBancoLesteLS CreatePickup(13181389.9741,173.8266,1008.3828);//[SAIDA = BANCO LESTE LS]
   
    EntradaBancoOesteLS 
CreatePickup(131811457.0880,-1010.7911,26.8438);//[ENTRADA = BANCO OESTE LS]
    SaidaBancoOesteLS CreatePickup(13181389.9741,173.8266,1008.3828);//[SAIDA = BANCO OESTE LS]
    return 1;



Dá para melhorar esse sistema? acho q usando enum dá mas n estou sabendo fazer!



RE: Da para otimizar esse sistema? - WeebSide - 23/04/2021

Acho que esses news sao desnecessario pode usar o creatpickup sem as news a nao ser que vc va usar para fazer alguma comparaçao ou usar em alguma chamada


RE: Da para otimizar esse sistema? - xbruno1000x - 23/04/2021

Cria os pickups sem as new's na OnGameModeInit e cria a entrada e saída usando if(newkeys & 16) e if(IsPlayerInRangeOfPoint, COORDENADA DO PICKUP). Assim o player irá entrar nos interiores pressionando F.


RE: Da para otimizar esse sistema? - Vel - 23/04/2021

Código:
new const Float: PickupPos[][][] = {
  { // MercadoNegro
    { 1420.7308, -1849.0535, 13.9688 }, // Entrada
    { 965.1273, 2108.0007, 1011.0303 } // Saida
  },
  { // PrefeituraLS
    { 1480.9438, -1771.2585, 18.7958 }, // Entrada
    { 389.9741, 173.8266, 1008.3828 } // Saida
  },
  { // PoliciaMilitar
    { 1555.0052, -1675.6299, 16.1953 }, // Entrada
    { 246.6895, 62.6177, 1003.6406 } // Saida
  },
  { // PoliciaFederal
    { 2793.4915, -1087.5383, 30.7188 }, // Entrada
    { 288.8136, 167.3451, 1007.1719 } // Saida
  },
  { // PRF
    { -93.4661, -1576.8896, 3.0755 }, // Entrada
    { 2215.0239, -1150.5393, 1025.7969 } // Saida
  },
  { // PoliciaBope
    { 328.4875, -1512.6652, 36.0391 }, // Entrada
    { 322.2091, 302.7661, 999.1484 } // Saida
  },
  { // EscolaDeLicencasLS
    { 1411.723, -1699.7758, 13.5395 }, // Entrada
    { -2027.1364, -104.1583, 1035.1719 } // Saida
  },
  { // LoteriaDowntownLS
    { 1631.8282, -1172.6462, 24.0843 }, // Entrada
    { 389.9741, 173.8266, 1008.3828 } // Saida
  },
  { // BancoSulLS
    { 940.9291, -1717.6973, 13.9582 }, // Entrada
    { 389.9741, 173.8266, 1008.3828 } // Saida
  },
  { // BancoLesteLS
    { 593.514, -1250.5427, 18.2385 }, // Entrada
    { 389.9741, 173.8266, 1008.3828 } // Saida
  },
  { // BancoOesteLS
    { 1457.088, -1010.7911, 26.8438 }, // Entrada
    { 389.9741, 173.8266, 1008.3828 } // Saida
  }
};

new Pickup[sizeof(PickupPos)][2];

public OnGameModeInit() {
  for (new i; i < sizeof(PickupPos); i++) {
    for (new j; j < sizeof(PickupPos[]); j++) {
      Pickup[i][j] = CreatePickup(1318, 1, PickupPos[i][j][0], PickupPos[i][j][1], PickupPos[i][j][2]);
    }
  }
}