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): /
