#define GPS 10 //Main GPS Dialog #define GPSLS 11 // LS Dialog #define GPSLV 12// LV Dialog #define GPSSF 13// SF Dialog
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; }
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; }
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; }
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; }
public OnPlayerExitVehicle(playerid, vehicleid) { DisablePlayerCheckpoint(playerid);// Disables checkpoint return 1; }
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; }
Ehy, well done dude. |
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;
}
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
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;
}