[Ajuda] Localizar
#1

Salve.
Tф desenvolvendo um sistema de Localizar cada bairro, fazer com que o Player dк /Localizar [ Bairro ] , o localiza automaticamente.
Comando
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[50 char];
    new msg[180], id;
    if( !strcmp( cmd, "/localizar", true ))
        {
            tmp = strtok( cmdtext, zone );
            if( !strlen( tmp ))
            {
                SendClientMessage( playerid, VERMELHO, "[ GPS Bairro ] Uso correto: /Localizar [ Bairro/OFF ]" );
                return 1;
            }
            if( !strcmp( tmp, "off", true ))
            {
                if( GPS[ playerid ] )
                {
                    GPS[ playerid ] = false;
                    DisablePlayerCheckpoint( playerid );
                    SendClientMessage( playerid, VERDE, "[ > ] O GPSPlayer foi desligado." );
                }
                else SendClientMessage( playerid, VERMELHO, "[ > ] O GPSPlayer nгo estб ligado !" );
                }
                return 1;
            }
            if( IsPlayerConnected( strval( tmp )) )
            {
                    if( strval( tmp ) != playerid )
                    {
                        if( GPS[ playerid ] )
                        GPS[ playerid ] = SetTimerEx( "GPSAtualizado", 500, true, "dd", zone, strval( tmp ));
                        new
                            nick[ 24 ]
                        ;
                        GetPlayerName( strval( tmp ), nick, 24 );
                        format( msg, 128, "[ > ] Vocк estб localizando o Bairro : %s ( Cidade: %d )", zone, strval( tmp ));
                        SendClientMessage( playerid, VERDE, msg );
                    }
                    else SendClientMessage( playerid, VERMELHO, "[ x ] Vocк nгo pode localizar vocк mesmo !" );
                }
 return 1;
 }
Reply
#2

Mas qual o problema?

Para vocк fazer isso, deve checar se o jogador estб em uma бrea, as бreas correspondentes aos bairros, e entгo atualizar no GPS.
Reply
#3

Mas o sistema nгo й GPS local.
Й para localizar um determinado bairro.
O problema й na hora de dar /localizar [ Bairro ]
Reply
#4

Strtok jб bem antiga e complicada, sugiro utilizar sscanf e ZCMD.

Exemplo simples:

PHP код:
CMD:localizarbairro(playeridparams[])
{
      new 
bairro[50];
      if(
sscanf(params"s[50]"bairro)) return SendClientMessage(playerid, -1"Uso correto: /localizarbairro [BAIRRO]");
      
      
// ... Resto do comando... 
      // Se ele nгo retornar acima, pegarб o nome do bairro que vocк digitou

Reply
#5

Nгo resultou
Irei resumir oque eu quero fazer .
No /LocalizarBairro apenas o Jogador Digitar o nome do Bairro no comando EX: /localizarbairro Ganton
e no GM achar o Ganton e mandar as coordenadas para o mini-mapa.
pawn Код:
static const SanAndreasZones[ ][ MainZone ] =
{
    {"The Big Ear",                 {-410.00,1403.30,-3.00,-137.90,1681.20,200.00}},
    {"Aldea Malvada",               {-1372.10,2498.50,0.00,-1277.50,2615.30,200.00}},
    {"Angel Pine",                  {-2324.90,-2584.20,-6.10,-1964.20,-2212.10,200.00}},
    {"Arco del Oeste",              {-901.10,2221.80,0.00,-592.00,2571.90,200.00}},
    {"Avispa Country Club",         {-2646.40,-355.40,0.00,-2270.00,-222.50,200.00}},
    {"Avispa Country Club",         {-2831.80,-430.20,-6.10,-2646.40,-222.50,200.00}},
    {"Avispa Country Club",         {-2361.50,-417.10,0.00,-2270.00,-355.40,200.00}},
    {"Avispa Country Club",         {-2667.80,-302.10,-28.80,-2646.40,-262.30,71.10}},
    {"Avispa Country Club",         {-2470.00,-355.40,0.00,-2270.00,-318.40,46.10}},
    {"Avispa Country Club",         {-2550.00,-355.40,0.00,-2470.00,-318.40,39.70}},
    {"Back o Beyond",               {-1166.90,-2641.10,0.00,-321.70,-1856.00,200.00}},
    {"Battery Point",               {-2741.00,1268.40,-4.50,-2533.00,1490.40,200.00}},
    {"Bayside",                     {-2741.00,2175.10,0.00,-2353.10,2722.70,200.00}},
    {"Bayside Marina",              {-2353.10,2275.70,0.00,-2153.10,2475.70,200.00}},
    {"Beacon Hill",                 {-399.60,-1075.50,-1.40,-319.00,-977.50,198.50}},
    {"Blackfield",                  {964.30,1203.20,-89.00,1197.30,1403.20,110.90}},
    {"Blackfield",                  {964.30,1403.20,-89.00,1197.30,1726.20,110.90}},
    {"Blackfield Chapel",           {1375.60,596.30,-89.00,1558.00,823.20,110.90}},
    {"Blackfield Chapel",           {1325.60,596.30,-89.00,1375.60,795.00,110.90}},
    {"Blackfield Intersection",     {1197.30,1044.60,-89.00,1277.00,1163.30,110.90}},
    {"Blackfield Intersection",     {1166.50,795.00,-89.00,1375.60,1044.60,110.90}},
    {"Blackfield Intersection",     {1277.00,1044.60,-89.00,1315.30,1087.60,110.90}},
    {"Blackfield Intersection",     {1375.60,823.20,-89.00,1457.30,919.40,110.90}},
    {"Blueberry",                   {104.50,-220.10,2.30,349.60,152.20,200.00}},
    {"Blueberry",                   {19.60,-404.10,3.80,349.60,-220.10,200.00}},
    {"Blueberry Acres",             {-319.60,-220.10,0.00,104.50,293.30,200.00}},
    {"Caligula's Palace",           {2087.30,1543.20,-89.00,2437.30,1703.20,110.90}},
    {"Caligula's Palace",           {2137.40,1703.20,-89.00,2437.30,1783.20,110.90}},
    {"Calton Heights",              {-2274.10,744.10,-6.10,-1982.30,1358.90,200.00}},
    {"Chinatown",                   {-2274.10,578.30,-7.60,-2078.60,744.10,200.00}},
    {"City Hall",                   {-2867.80,277.40,-9.10,-2593.40,458.40,200.00}},
    {"Come-A-Lot",                  {2087.30,943.20,-89.00,2623.10,1203.20,110.90}},
    {"Commerce",                    {1323.90,-1842.20,-89.00,1701.90,-1722.20,110.90}},
    {"Commerce",                    {1323.90,-1722.20,-89.00,1440.90,-1577.50,110.90}},
    {"Commerce",                    {1370.80,-1577.50,-89.00,1463.90,-1384.90,110.90}},
    {"Commerce",                    {1463.90,-1577.50,-89.00,1667.90,-1430.80,110.90}},
    {"Commerce",                    {1583.50,-1722.20,-89.00,1758.90,-1577.50,110.90}},
    {"Commerce",                    {1667.90,-1577.50,-89.00,1812.60,-1430.80,110.90}},
    {"Conference Center",           {1046.10,-1804.20,-89.00,1323.90,-1722.20,110.90}},
    {"Conference Center",           {1073.20,-1842.20,-89.00,1323.90,-1804.20,110.90}},
    {"Cranberry Station",           {-2007.80,56.30,0.00,-1922.00,224.70,100.00}},
    {"Creek",                       {2749.90,1937.20,-89.00,2921.60,2669.70,110.90}},
    {"Dillimore",                   {580.70,-674.80,-9.50,861.00,-404.70,200.00}},
    {"Doherty",                     {-2270.00,-324.10,-0.00,-1794.90,-222.50,200.00}},
    {"Doherty",                     {-2173.00,-222.50,-0.00,-1794.90,265.20,200.00}},
    {"Downtown",                    {-1982.30,744.10,-6.10,-1871.70,1274.20,200.00}},
    {"Downtown",                    {-1871.70,1176.40,-4.50,-1620.30,1274.20,200.00}},
    {"Downtown",                    {-1700.00,744.20,-6.10,-1580.00,1176.50,200.00}},
    {"Downtown",                    {-1580.00,744.20,-6.10,-1499.80,1025.90,200.00}},
    {"Downtown",                    {-2078.60,578.30,-7.60,-1499.80,744.20,200.00}},
    {"Downtown",                    {-1993.20,265.20,-9.10,-1794.90,578.30,200.00}},
    {"Downtown Los Santos",         {1463.90,-1430.80,-89.00,1724.70,-1290.80,110.90}},
    {"Downtown Los Santos",         {1724.70,-1430.80,-89.00,1812.60,-1250.90,110.90}},
    {"Downtown Los Santos",         {1463.90,-1290.80,-89.00,1724.70,-1150.80,110.90}},
    {"Downtown Los Santos",         {1370.80,-1384.90,-89.00,1463.90,-1170.80,110.90}},
    {"Downtown Los Santos",         {1724.70,-1250.90,-89.00,1812.60,-1150.80,110.90}},
    {"Downtown Los Santos",         {1370.80,-1170.80,-89.00,1463.90,-1130.80,110.90}},
    {"Downtown Los Santos",         {1378.30,-1130.80,-89.00,1463.90,-1026.30,110.90}},
    {"Downtown Los Santos",         {1391.00,-1026.30,-89.00,1463.90,-926.90,110.90}},
    {"Downtown Los Santos",         {1507.50,-1385.20,110.90,1582.50,-1325.30,335.90}},
    {"East Beach",                  {2632.80,-1852.80,-89.00,2959.30,-1668.10,110.90}},
    {"East Beach",                  {2632.80,-1668.10,-89.00,2747.70,-1393.40,110.90}},
    {"East Beach",                  {2747.70,-1668.10,-89.00,2959.30,-1498.60,110.90}},
    {"East Beach",                  {2747.70,-1498.60,-89.00,2959.30,-1120.00,110.90}},
    {"East Los Santos",             {2421.00,-1628.50,-89.00,2632.80,-1454.30,110.90}},
    {"East Los Santos",             {2222.50,-1628.50,-89.00,2421.00,-1494.00,110.90}},
    {"East Los Santos",             {2266.20,-1494.00,-89.00,2381.60,-1372.00,110.90}},
    {"East Los Santos",             {2381.60,-1494.00,-89.00,2421.00,-1454.30,110.90}},
    {"East Los Santos",             {2281.40,-1372.00,-89.00,2381.60,-1135.00,110.90}},
    {"East Los Santos",             {2381.60,-1454.30,-89.00,2462.10,-1135.00,110.90}},
    {"East Los Santos",             {2462.10,-1454.30,-89.00,2581.70,-1135.00,110.90}},
    {"Easter Basin",                {-1794.90,249.90,-9.10,-1242.90,578.30,200.00}},
    {"Easter Basin",                {-1794.90,-50.00,-0.00,-1499.80,249.90,200.00}},
    {"Easter Bay Airport",          {-1499.80,-50.00,-0.00,-1242.90,249.90,200.00}},
    {"Easter Bay Airport",          {-1794.90,-730.10,-3.00,-1213.90,-50.00,200.00}},
    {"Easter Bay Airport",          {-1213.90,-730.10,0.00,-1132.80,-50.00,200.00}},
    {"Easter Bay Airport",          {-1242.90,-50.00,0.00,-1213.90,578.30,200.00}},
    {"Easter Bay Airport",          {-1213.90,-50.00,-4.50,-947.90,578.30,200.00}},
    {"Easter Bay Airport",          {-1315.40,-405.30,15.40,-1264.40,-209.50,25.40}},
    {"Easter Bay Airport",          {-1354.30,-287.30,15.40,-1315.40,-209.50,25.40}},
    {"Easter Bay Airport",          {-1490.30,-209.50,15.40,-1264.40,-148.30,25.40}},
    {"Easter Bay Chemicals",        {-1132.80,-768.00,0.00,-956.40,-578.10,200.00}},
    {"Easter Bay Chemicals",        {-1132.80,-787.30,0.00,-956.40,-768.00,200.00}},
    {"El Castillo del Diablo",      {-464.50,2217.60,0.00,-208.50,2580.30,200.00}},
    {"El Castillo del Diablo",      {-208.50,2123.00,-7.60,114.00,2337.10,200.00}},
    {"El Castillo del Diablo",      {-208.50,2337.10,0.00,8.40,2487.10,200.00}},
    {"El Corona",                   {1812.60,-2179.20,-89.00,1970.60,-1852.80,110.90}},
    {"El Corona",                   {1692.60,-2179.20,-89.00,1812.60,-1842.20,110.90}},
    {"El Quebrados",                {-1645.20,2498.50,0.00,-1372.10,2777.80,200.00}},
    {"Esplanade East",              {-1620.30,1176.50,-4.50,-1580.00,1274.20,200.00}},
    {"Esplanade East",              {-1580.00,1025.90,-6.10,-1499.80,1274.20,200.00}},
    {"Esplanade East",              {-1499.80,578.30,-79.60,-1339.80,1274.20,20.30}},
    {"Esplanade North",             {-2533.00,1358.90,-4.50,-1996.60,1501.20,200.00}},
    {"Esplanade North",             {-1996.60,1358.90,-4.50,-1524.20,1592.50,200.00}},
    {"Esplanade North",             {-1982.30,1274.20,-4.50,-1524.20,1358.90,200.00}},
    {"Fallen Tree",                 {-792.20,-698.50,-5.30,-452.40,-380.00,200.00}},
    {"Fallow Bridge",               {434.30,366.50,0.00,603.00,555.60,200.00}},
    {"Fern Ridge",                  {508.10,-139.20,0.00,1306.60,119.50,200.00}},
    {"Financial",                   {-1871.70,744.10,-6.10,-1701.30,1176.40,300.00}},
    {"Fisher's Lagoon",             {1916.90,-233.30,-100.00,2131.70,13.80,200.00}},
    {"Flint Intersection",          {-187.70,-1596.70,-89.00,17.00,-1276.60,110.90}},
    {"Flint Range",                 {-594.10,-1648.50,0.00,-187.70,-1276.60,200.00}},
    {"Fort Carson",                 {-376.20,826.30,-3.00,123.70,1220.40,200.00}},
    {"Foster Valley",               {-2270.00,-430.20,-0.00,-2178.60,-324.10,200.00}},
    {"Foster Valley",               {-2178.60,-599.80,-0.00,-1794.90,-324.10,200.00}},
    {"Foster Valley",               {-2178.60,-1115.50,0.00,-1794.90,-599.80,200.00}},
    {"Foster Valley",               {-2178.60,-1250.90,0.00,-1794.90,-1115.50,200.00}},
    {"Frederick Bridge",            {2759.20,296.50,0.00,2774.20,594.70,200.00}},
    {"Gant Bridge",                 {-2741.40,1659.60,-6.10,-2616.40,2175.10,200.00}},
    {"Gant Bridge",                 {-2741.00,1490.40,-6.10,-2616.40,1659.60,200.00}},
>>>>    {"Ganton",                      {2222.50,-1852.80,-89.00,2632.80,-1722.30,110.90}},
Reply
#6

Usa strcmp para comparar o bairro
Reply
#7

Uma base disso seria como ?
Reply
#8

Tudo que vocк precisa estarб aqui: https://sampwiki.blast.hk/wiki/Strcmp.
Reply
#9

Uma base strcmp

pawn Код:
if(!strcmp("ZeZin"))
         {
                   SendClientMessage(playerid, -1, "Vocк й o ZeZin");
         }
         else
         {
                   SendClientMessage(playerid, -1, "Vocк nгo й o ZeZin");
         }
         return 1;
Reply
#10

Quote:
Originally Posted by ZeZin
Посмотреть сообщение
Uma base strcmp

pawn Код:
if(!strcmp("ZeZin"))
         {
                   SendClientMessage(playerid, -1, "Vocк й o ZeZin");
         }
         else
         {
                   SendClientMessage(playerid, -1, "Vocк nгo й o ZeZin");
         }
         return 1;
Neste modo estб incorreto, pois nгo estб comparando nada.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)