[FilterScript] Simple GPS
#1

Hello, I've currently been working on a new GPS filterscript. You only need to use one command and that is /gps(you can change it to suit your needs).
This is a very basic and easy to edit GPS, you can edit it to how you need it.
Includes:
a_samp
zcmd.

Defines:
Код:
#define GPS 10 //Main GPS Dialog
#define GPSLS 11 // LS Dialog
#define GPSLV 12// LV Dialog
#define GPSSF 13// SF Dialog
Command
Код:
CMD:gps(playerid, params[])
{
	if(IsPlayerInAnyVehicle(playerid))//Checks if player is in any vehicle
 	{
	ShowPlayerDialog(playerid, GPS, DIALOG_STYLE_LIST, "GPS", "Los Santos\nLas Venturas\nSan Fierro", "Select", "Close"); // If player is in vehicle then shows dialog
	return 1;
 	}
 	GameTextForPlayer(playerid, "~r~You're not in a vehicle", 2000, 1);// Sends a GameText if player is not in the vehicle
	return 1;
}
You can add more places in the dialog.

Update dated command!
Код:
CMD:gps(playerid, params[])
{
	if(IsPlayerInAnyVehicle(playerid))
 	{
 	if(GetPlayerVehicleSeat(playerid) == 0)
  	{
	ShowPlayerDialog(playerid, GPS, DIALOG_STYLE_LIST, "GPS", "Los Santos\nLas Venturas\nSan Fierro", "Select", "Close");
	return 1;
	}
 	GameTextForPlayer(playerid, "~r~You're not the vehicle driver", 2000, 1);
 	}
 	GameTextForPlayer(playerid, "~r~You're not in a vehicle", 2000, 1);
	return 1;
}
This code now checks if you're a passenger or the driver

If you're not using ZCMD then remove #include <zcmd> and put this:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/gps", true))
	{
   	if(IsPlayerInAnyVehicle(playerid))
 	{
	ShowPlayerDialog(playerid, GPS, DIALOG_STYLE_LIST, "GPS", "Los Santos\nLas Venturas\nSan Fierro", "Select", "Close");
	return 1;
 	}
 	GameTextForPlayer(playerid, "~r~You're not in a vehicle", 2000, 1);
	return 1;
	}
	return 0;
}
OnDialogResponse:
Код:
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");// Los Santos Dialog
               }
               case 1:
               {
               ShowPlayerDialog(playerid, GPSLV, DIALOG_STYLE_LIST, "Las Venturas", "Las Venturas police department\n", "Select", "Close"); // Las Venturas Dialog
               }
               case 2:
               {
               ShowPlayerDialog(playerid, GPSSF, DIALOG_STYLE_LIST, "San Fierro", "San Fierro police department\n", "Select", "Close"); // San Fierro Dialog
               }
           }
        }
 	  }
    }
    if(dialogid == GPSLS)
    {
        if(!response) return 0;
        {
            switch(listitem)
            {
                case 0:
                {
                 SetPlayerCheckpoint(playerid, 1533.1295,-1657.7357,13.3828, 8); // If pressed Los Santos Police Department
                 GameTextForPlayer(playerid, "~g~Los Santos police department is located on your minimap!", 2000, 1); // Sends GameText telling player that he has selected Los Santos police department
                }
            }
          }
    	}
   	if(dialogid == GPSLV)
   	{
    	if(!response) return 0;
    	{
            switch(listitem)
            {
                case 0:
                {
                 SetPlayerCheckpoint(playerid, 2230.2854,2470.0540,10.8203, 8); // If pressed Las Venturas police department
                 GameTextForPlayer(playerid, "~g~Las Venturas police department is located on your minimap!", 2000, 1); // Sends GameText to tell player has pressed Las Venturas police department
                }
            }
        }
    }
    if(dialogid == GPSSF)
    {
        if(!response) return 0;
        {
            switch(listitem)
            {
                case 0:
                {
                 SetPlayerCheckpoint(playerid, -1563.9243,659.6130,7.0391, 8); //If pressed San Fierro police department
                 GameTextForPlayer(playerid, "~g~San Fierro police department is located on your minimap!", 2000, 1); // Sends GameText to tell player has pressed San Fierro police department
                }
            }
          }
    	}
    return 1;
}
You can edit it if you have added more in.

If the player leaves the vehicle

Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
	DisablePlayerCheckpoint(playerid);// Disables checkpoint
	return 1;
}
When player gets to his destination

Код:
public OnPlayerEnterCheckpoint(playerid)
{
	GameTextForPlayer(playerid, "You have reached your destination", 2000, 1);// Tells player he has reached his destination
	DisablePlayerCheckpoint(playerid);// Disables checkpoint
	return 1;
}
Pastebin: http://pastebin.com/gfh4hqyx

*******: https://www.youtube.com/watch?v=rJg2...ature=*********

Sreenshots:


Thanks to Jakwob for helping a bit with the OnDialogResponse.
Thanks for reading, and hope you like my GPS filterscript!
Reply
#2

Updated it so it checks if you are a driver or not!
Reply
#3

Ehy, well done dude.
Reply
#4

Quote:

Ehy, well done dude.

Thank you Flori!
Reply
#5

awesome script bro
Reply
#6

its nice. it would be cool if you could set it so instead of using /gps you could use key 'N' to bring up the dialog and it will make for quick gps when on the move. i have made a code for this here

instead of using:
pawn Код:
CMD:gps(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid))//Checks if player is in any vehicle
    {
    ShowPlayerDialog(playerid, GPS, DIALOG_STYLE_LIST, "GPS", "Los Santos\nLas Venturas\nSan Fierro", "Select", "Close"); // If player is in vehicle then shows dialog
    return 1;
    }
    GameTextForPlayer(playerid, "~r~You're not in a vehicle", 2000, 1);// Sends a GameText if player is not in the vehicle
    return 1;
}
use this:

Define
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
OnPlayerKeyStateChange
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(PRESSED(KEY_NO))
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                ShowPlayerDialog(playerid, GPS, DIALOG_STYLE_LIST, "GPS", "Los Santos\nLas Venturas\nSan Fierro", "Select", "Close");
            }
        }
    }
    return 1;
}
If you don't want to use it maybe it will be useful for someone else.
Reply
#7

Yeah would come in handy if you didn't want to type
Reply
#8

good one!
Reply
#9

Thanks Ryz
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)