Pitanje vezano za RouteConnector

Započeo darkness1988
13. Sep. 2018. Zaključano
1,000
pregleda
9
postova
darkness1988
2
Rookie
13. Sep. 2018.
Problem(error/warning): Route Connector mi je jednostavno zahtjevan za korištenje i htio bi da me neko posavjetuje kako i što dalje, većinu sam napravio sam. Zapeo sam na NearestPlayerNode. Ispričavam se što sam na dio skripte stavio cijelu filterskriptu jer je vrlo bitno što je definirano. Točnije, tako će biti lakše drugima uvidjeti problem
Dio skripte:
#
include
#include
#include

#define GPS 10
#define GPSLS 11
#define GPSLV 12
#define GPSSF 13

new GPS_Activated = 0;

enum RouteInformation
{
Destination,
CreatedObjects,
bool:calculating,
Lenght
};
new PlayerRoute;

public OnFilterScriptInit()
{
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

public OnPlayerConnect(playerid)
{
    PlayerRoute = -1;
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(GPS_Activated == 1 && PlayerRoute != -1)
    {
        GPS_Activated = 0;
DisableGPS(playerid);
PlayerRoute = 0;
PlayerRoute = -1;
gps_RemovePlayer(playerid);
}
return 1;
}
forward DisableGPS(playerid);
public DisableGPS(playerid)//iskljucivanje GPS
{
for(new i = 0; i < PlayerRoute; ++i)
{
DestroyPlayerObject(playerid,PlayerRoute); //brisanje objekata
}
PlayerRoute = 0;
PlayerRoute = -1;
gps_RemovePlayer(playerid);
return 1;
}
public GPS_WhenRouteIsCalculated(routeid,node_id_array[],amount_of_nodes,Float:distance,Float:Polygon[],Polygon_Size,Float:NodePosX[],Float:NodePosY[],Float:NodePosZ[])//Kada se ruta kreira
{
PlayerRoute = false;// puts the route creation on false
if(amount_of_nodes > 1)
{ // if the number of points in the path is greater than 1
    for(new i = 0; i < amount_of_nodes; ++i)
{
PlayerRoute = CreatePlayerObject(routeid,1318,NodePosX,NodePosY,NodePosZ+1.0,0.0,0.0,0.0,150.0); // create objects by the way ...
    }
    PlayerRoute = amount_of_nodes; // sets the number of points on the road
PlayerRoute = node_id_array[amount_of_nodes-1]; // sets the destination
    gps_AddPlayer(routeid); // adds players to that route
    SendClientMessage(routeid,-1,"Route created, happy way!");
}
else {
SendClientMessage(routeid,-1,"Satellite can not find you at this location, go to the nearest road.");
}

return 1;
}

public OnPlayerClosestNodeIDChange(playerid,old_NodeID,new_NodeID)
{ // when the player arrives at the destination
if(new_NodeID != -1)
{
if(PlayerRoute == new_NodeID) {
SendClientMessage(playerid,-1,"You're at the destination.");
DisableGPS(playerid);
}
}
return 1;
}

CMD:gps(playerid, params[])
{
//        if(!IsPlayerInAnyVehicle(playerid)) return GameTextForPlayer(playerid, "~w~You're not in a vehicle", 3000, 3);
       
        if(PlayerRoute)
{ // This will check if the route is created
SendClientMessage(playerid,-1,"First, delete your chosen route. / gpsoff");
return 1;
}
if(PlayerRoute != -1) // this will be a security check that does not create a player 2 routes first to turn off the old one
{
DisableGPS(playerid);
}
        ShowPlayerDialog(playerid, GPS, DIALOG_STYLE_LIST, "GPS", "Los Santos\nLas Venturas\nSan Fierro", "Select", "Close");
        return 1;
}
CMD:gpsoff(playerid,params[])
{
        if(GPS_Activated == 1 && PlayerRoute != -1)
        {
            DisablePlayerCheckpoint(playerid);
            GameTextForPlayer(playerid, "GPS OFF", 3000, 3);
            GPS_Activated = 0;
            DisableGPS(playerid);
            PlayerRoute = 0;
PlayerRoute = -1;
gps_RemovePlayer(playerid);
        }
        else GameTextForPlayer(playerid, "~w~GPS is not activated", 3000, 3);
        return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
    if(GPS_Activated == 1 && PlayerRoute != -1)
    {
GameTextForPlayer(playerid, "You have reached your destination", 3000, 3);
DisablePlayerCheckpoint(playerid);
GPS_Activated = 0;
DisableGPS(playerid);
PlayerRoute = 0;
PlayerRoute = -1;
gps_RemovePlayer(playerid);
    }
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(response)
    {
            switch(dialogid == GPS)
          {
              case 1:
              {
                  switch(listitem)
                {
          case 0:
          {
          ShowPlayerDialog(playerid, GPSLS, DIALOG_STYLE_LIST, "Los Santos", "Los Santos police department\n", "Select", "Close");
          }
          case 1:
          {
          ShowPlayerDialog(playerid, GPSLV, DIALOG_STYLE_LIST, "Las Venturas", "Las Venturas police department\n", "Select", "Close");
          }
          case 2:
          {
          ShowPlayerDialog(playerid, GPSSF, DIALOG_STYLE_LIST, "San Fierro", "San Fierro police department\n", "Select", "Close");
          }
    }
              }
          }
    }
    if(dialogid == GPSLS)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
//==== Testing with LSPD
                    new PlayerClosest = NearestPlayerNode(playerid); // this will take the closest point where the player is located
    new TempDestination = NearestNodeFromPoint(1533.1295, -1657.7357, 13.3828); // this is taken to the nearest point on the specified coordinates X, Y, Z

if(PlayerClosest == TempDestination)
{ // if the player is already on the target
    SendClientMessage(playerid,-1,"You are already in that location.");
return 1;
}
if(PlayerClosest == -1)
{
SendClientMessage(playerid,-1,"Satellite can not find a destination, please try again.");
return 1;
}
if(TempDestination == -1)
{// if the player is far from the nearest point on the way
SendClientMessage(playerid,-1,"Satellite can not find a destination, please try again.");
return 1;
}
if(CalculatePath(PlayerClosest,TempDestination,playerid, .GrabNodePositions = true))
{ // if the route is created
PlayerRoute = true;
    SendClientMessage(playerid,-1,"Create a route, please wait");
    GameTextForPlayer(playerid, "~w~Check Your minimap!", 3000, 1);
                    GPS_Activated = 1;
                    SetPlayerCheckpoint(playerid, 1533.1295,-1657.7357,13.3828, 8);
}
else SendClientMessage(playerid,-1,"Unknown error, please try again.");
                }
            }
          }
        }
        if(dialogid == GPSLV)
        {
        if(!response) return 0;
        {
            switch(listitem)
            {
                case 0:
                {
                SetPlayerCheckpoint(playerid, 2230.2854,2470.0540,10.8203, 8);
                GameTextForPlayer(playerid, "~w~Check Your minimap", 3000, 2);
                GPS_Activated = 1;
                }
            }
        }
    }
    if(dialogid == GPSSF)
    {
        if(!response) return 0;
        {
            switch(listitem)
            {
                case 0:
                {
                SetPlayerCheckpoint(playerid, -1563.9243,659.6130,7.0391, 8);
                GameTextForPlayer(playerid, "~w~Check Your Minimap", 3000, 3);
                GPS_Activated = 1;
                }
            }
          }
    }
    return 1;
}

Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): [ code ]Compilano bez errora[ /code ]
Slika/video ingame problema(obavezno ako je ingame problem): /
VCappone
4
Enforcer
13. Sep. 2018.
Pawn format?
Test
darkness1988
2
Rookie
13. Sep. 2018.
Jerenić wrote on September 13, 2018, 11:41 am:
Pawn format?
Test

Izvini, krivo sam nesto stavio sa zagradama, može li neki admin edit? Nema veze, ja cu stavit ovamo

#include
#include
#include

#define GPS 10
#define GPSLS 11
#define GPSLV 12
#define GPSSF 13

new GPS_Activated = 0;

enum RouteInformation
{
  Destination,
  CreatedObjects,
  bool:calculating,
  Lenght
};
new PlayerRoute;

public OnFilterScriptInit()
{
  return 1;
}

public OnFilterScriptExit()
{
  return 1;
}

public OnPlayerConnect(playerid)
{
    PlayerRoute = -1;
  return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(GPS_Activated == 1 && PlayerRoute != -1)
    {
        GPS_Activated = 0;
      DisableGPS(playerid);
      PlayerRoute = 0;
      PlayerRoute = -1;
      gps_RemovePlayer(playerid);
    }
    return 1;
}
forward DisableGPS(playerid);
public DisableGPS(playerid)//iskljucivanje GPS
{
  for(new i = 0; i < PlayerRoute; ++i)
  {
      DestroyPlayerObject(playerid,PlayerRoute); //brisanje objekata
  }
  PlayerRoute = 0;
  PlayerRoute = -1;
  gps_RemovePlayer(playerid);
  return 1;
}
public GPS_WhenRouteIsCalculated(routeid,node_id_array[],amount_of_nodes,Float:distance,Float:Polygon[],Polygon_Size,Float:NodePosX[],Float:NodePosY[],Float:NodePosZ[])//Kada se ruta kreira
{
  PlayerRoute = false;// puts the route creation on false
  if(amount_of_nodes > 1)
  { // if the number of points in the path is greater than 1
      for(new i = 0; i < amount_of_nodes; ++i)
      {
        PlayerRoute = CreatePlayerObject(routeid,1318,NodePosX,NodePosY,NodePosZ+1.0,0.0,0.0,0.0,150.0); // create objects by the way ...
      }
      PlayerRoute = amount_of_nodes; // sets the number of points on the road
      PlayerRoute = node_id_array[amount_of_nodes-1]; // sets the destination
      gps_AddPlayer(routeid); // adds players to that route
      SendClientMessage(routeid,-1,"Route created, happy way!");
  }
  else {
      SendClientMessage(routeid,-1,"Satellite can not find you at this location, go to the nearest road.");
  }

  return 1;
}

public OnPlayerClosestNodeIDChange(playerid,old_NodeID,new_NodeID)
{ // when the player arrives at the destination
  if(new_NodeID != -1)
  {
      if(PlayerRoute == new_NodeID) {
        SendClientMessage(playerid,-1,"You're at the destination.");
        DisableGPS(playerid);
      }
  }
  return 1;
}

CMD:gps(playerid, params[])
{
//        if(!IsPlayerInAnyVehicle(playerid)) return GameTextForPlayer(playerid, "~w~You're not in a vehicle", 3000, 3);
       
        if(PlayerRoute)
      { // This will check if the route is created
        SendClientMessage(playerid,-1,"First, delete your chosen route. / gpsoff");
        return 1;
      }
      if(PlayerRoute != -1) // this will be a security check that does not create a player 2 routes first to turn off the old one
      {
        DisableGPS(playerid);
      }
        ShowPlayerDialog(playerid, GPS, DIALOG_STYLE_LIST, "GPS", "Los Santos\nLas Venturas\nSan Fierro", "Select", "Close");
        return 1;
}
CMD:gpsoff(playerid,params[])
{
        if(GPS_Activated == 1 && PlayerRoute != -1)
        {
            DisablePlayerCheckpoint(playerid);
            GameTextForPlayer(playerid, "GPS OFF", 3000, 3);
            GPS_Activated = 0;
            DisableGPS(playerid);
            PlayerRoute = 0;
        PlayerRoute = -1;
        gps_RemovePlayer(playerid);
        }
        else GameTextForPlayer(playerid, "~w~GPS is not activated", 3000, 3);
        return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
    if(GPS_Activated == 1 && PlayerRoute != -1)
    {
      GameTextForPlayer(playerid, "You have reached your destination", 3000, 3);
      DisablePlayerCheckpoint(playerid);
      GPS_Activated = 0;
      DisableGPS(playerid);
      PlayerRoute = 0;
      PlayerRoute = -1;
      gps_RemovePlayer(playerid);
    }
  return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(response)
    {
            switch(dialogid == GPS)
          {
              case 1:
              {
                  switch(listitem)
                {
                case 0:
                {
                ShowPlayerDialog(playerid, GPSLS, DIALOG_STYLE_LIST, "Los Santos", "Los Santos police department\n", "Select", "Close");
                }
                case 1:
                {
                ShowPlayerDialog(playerid, GPSLV, DIALOG_STYLE_LIST, "Las Venturas", "Las Venturas police department\n", "Select", "Close");
                }
                case 2:
                {
                ShowPlayerDialog(playerid, GPSSF, DIALOG_STYLE_LIST, "San Fierro", "San Fierro police department\n", "Select", "Close");
                }
            }
              }
          }
    }
    if(dialogid == GPSLS)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
              //==== Testing with LSPD
                    new PlayerClosest = NearestPlayerNode(playerid); // this will take the closest point where the player is located
                new TempDestination = NearestNodeFromPoint(1533.1295, -1657.7357, 13.3828); // this is taken to the nearest point on the specified coordinates X, Y, Z

              if(PlayerClosest == TempDestination)
              { // if the player is already on the target
                      SendClientMessage(playerid,-1,"You are already in that location.");
                  return 1;
              }
              if(PlayerClosest == -1)
              {
                  SendClientMessage(playerid,-1,"Satellite can not find a destination, please try again.");
                  return 1;
              }
              if(TempDestination == -1)
              {// if the player is far from the nearest point on the way
                  SendClientMessage(playerid,-1,"Satellite can not find a destination, please try again.");
                  return 1;
              }
              if(CalculatePath(PlayerClosest,TempDestination,playerid, .GrabNodePositions = true))
              { // if the route is created
                  PlayerRoute = true;
                  SendClientMessage(playerid,-1,"Create a route, please wait");
                  GameTextForPlayer(playerid, "~w~Check Your minimap!", 3000, 1);
                      GPS_Activated = 1;
                      SetPlayerCheckpoint(playerid, 1533.1295,-1657.7357,13.3828, 8);
              }
              else SendClientMessage(playerid,-1,"Unknown error, please try again.");
                }
            }
          }
        }
        if(dialogid == GPSLV)
        {
        if(!response) return 0;
        {
            switch(listitem)
            {
                case 0:
                {
                SetPlayerCheckpoint(playerid, 2230.2854,2470.0540,10.8203, 8);
                GameTextForPlayer(playerid, "~w~Check Your minimap", 3000, 2);
                GPS_Activated = 1;
                }
            }
        }
    }
    if(dialogid == GPSSF)
    {
        if(!response) return 0;
        {
            switch(listitem)
            {
                case 0:
                {
                SetPlayerCheckpoint(playerid, -1563.9243,659.6130,7.0391, 8);
                GameTextForPlayer(playerid, "~w~Check Your Minimap", 3000, 3);
                GPS_Activated = 1;
                }
            }
          }
    }
    return 1;
}
Danisoni
5
Godfather
14. Sep. 2018.
Å ta je problem?
Timur Script
4
Shot Caller
15. Sep. 2018.
Problm koji je?
darkness1988
2
Rookie
15. Sep. 2018.
Timur Script wrote on September 15, 2018, 10:03 am:
Problm koji je?
Slade wrote on September 14, 2018, 9:56 pm:
Å ta je problem?

Zapeo sam na NearestPlayerNode, ne znam šta i kako dalje. Pratio sam ovaj tutorijal: http://balkan-samp.com/forum/index.php?PHPSESSID=04fbc825jpdo722p4dk6i7kcj7&topic=100478.0

Znam da je route connector dosta zbugovan i to sve, ali bi htio strelice po cesti za gps. Pa bih zamolio ako netko moze malo me savjetovati kako dalje, gdje sta i kako.
darkness1988
2
Rookie
17. Sep. 2018.
Netko?
Danisoni
5
Godfather
17. Sep. 2018.
Zanima me, koji do NearestPlayerNodea ti smeta, uglavnom to ti, koliko znam, služi da provjeriš udaljenost trenutnog (najbližeg nodea) recimo te lokacije, zatim notea tog igrača (playerid), ali budući da nisam 100% siguran da je to tačno, nisam kompetentan da ti dam siguran odgovor, ali mislim da je to to. Imaš Driver-FS koji koristi taj plugin i inc, Taxiji, obicni vozaci i policija po gradu, kucaj Taxi NPC i naci ces na stranom samp forumu, i pogledaj malo za sta se to koristi.
darkness1988
2
Rookie
17. Sep. 2018.
Slade wrote on September 17, 2018, 12:47 pm:
Zanima me, koji do NearestPlayerNodea ti smeta, uglavnom to ti, koliko znam, služi da provjeriš udaljenost trenutnog (najbližeg nodea) recimo te lokacije, zatim notea tog igrača (playerid), ali budući da nisam 100% siguran da je to tačno, nisam kompetentan da ti dam siguran odgovor, ali mislim da je to to. Imaš Driver-FS koji koristi taj plugin i inc, Taxiji, obicni vozaci i policija po gradu, kucaj Taxi NPC i naci ces na stranom samp forumu, i pogledaj malo za sta se to koristi.

Izgleda su ugasili SAMP forume, no nema veze. Snasao sam se i pronasao sam zasto ne radi. Sada mogu sve povezat i gps i truck delivery i sve misije na koje se ide po pickup i cijela ruta gdje se vozi bude prikazana strelicama po cesti. Samo ih jos malo rotiram i posao obavljen. Hvala Puno i moze lock na ovo 😉

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava

© 2026 SmartShark. All rights reserved.

Powered by Momentum|v2026.3.001 Alpha