Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define AGENCIADELS 1310.1472,-1369.6836,13.5656
- #define HOSPITALDELS 1184.3213,-1323.0328,13.1424
- #define PRAIADELS 322.7799,-1809.6986,4.4727
- #define MensagemGps "[GPS] Siga o checkpoint vermelho em seu mapa para chegar ao seu destino!"
- #define MensagemGpsErro "[GPS] Você precisa desativar seu destino atual primeiro!"
- #define MensagemGpsDesativado "[GPS] Você desligou o GPS!"
- #define MensagemGpsChegou "[GPS] Você chegou ao seu destino!"
- #define MensagemSemDestino "[GPS]Você não selecionou este destino!"
- #define D_GPS 10000
- new StringGps[128];
- new GpsLigado[MAX_PLAYERS];
- public OnGameModeInit()
- {
- return 1;
- }
- public OnGameModeExit()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(GpsLigado[i] == 1)
- {
- DisablePlayerCheckpoint(i);
- GpsLigado[i] = 0;
- }
- }
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(GpsLigado[i] == 1)
- {
- DisablePlayerCheckpoint(i);
- GpsLigado[i] = 0;
- }
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/gps", cmdtext, true, 10) == 0)
- {
- format(StringGps, sizeof(StringGps), "{FFFFFF}Praia de LS\nHospital de LS\nAgencia de Ls\nDesligar GPS");
- ShowPlayerDialog(playerid, D_GPS, DIALOG_STYLE_LIST, "{0080FF}GPS", StringGps, "Selecionar", "Cancelar");
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- if(GpsLigado[playerid] == 1)
- {
- DisablePlayerCheckpoint(playerid);
- SendClientMessage(playerid, -1, MensagemGpsChegou);
- GpsLigado[playerid] = 0;
- PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
- }
- else
- {
- SendClientMessage(playerid, -1, MensagemSemDestino);
- }
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == D_GPS)
- {
- if(response)
- {
- if(listitem == 0)
- {
- if(GpsLigado[playerid] == 0)
- {
- SetPlayerCheckpoint(playerid, PRAIADELS, 1.0);
- GpsLigado[playerid] = 1;
- SendClientMessage(playerid, 0x46A3FFFF, MensagemGps);
- }
- /*else if(IsPlayerAdmin(playerid)) coloque a variável de admin da sua gm aqui
- {
- SetPlayerPos(playerid, PRAIADELS);
- SendClientMessage(playerid, 0x46A3FFFF, MensagemGps);
- }*/
- else
- {
- SendClientMessage(playerid, -1, MensagemGpsErro);
- }
- }
- if(listitem == 1)
- {
- if(GpsLigado[playerid] == 0)
- {
- SetPlayerCheckpoint(playerid, HOSPITALDELS, 1.0);
- GpsLigado[playerid] = 1;
- SendClientMessage(playerid, 0x46A3FFFF, MensagemGps);
- }
- /*else if(IsPlayerAdmin(playerid)) coloque a variável de admin da sua gm aqui
- {
- SetPlayerPos(playerid, HOSPITALDELS);
- SendClientMessage(playerid, 0x46A3FFFF, MensagemGps);
- }*/
- else
- {
- SendClientMessage(playerid, -1, MensagemGpsErro);
- }
- }
- if(listitem == 2)
- {
- if(GpsLigado[playerid] == 0)
- {
- SetPlayerCheckpoint(playerid, AGENCIADELS, 1.0);
- GpsLigado[playerid] = 1;
- SendClientMessage(playerid, 0x46A3FFFF, MensagemGps);
- }
- /*else if(IsPlayerAdmin(playerid)) coloque a variável de admin da sua gm aqui
- {
- SetPlayerPos(playerid, AGENCIADELS);
- SendClientMessage(playerid, 0x46A3FFFF, MensagemGps);
- }*/
- else
- {
- SendClientMessage(playerid, -1, MensagemGpsErro);
- }
- }
- if(listitem == 3)
- {
- GpsLigado[playerid] = 0;
- DisablePlayerCheckpoint(playerid);
- SendClientMessage(playerid, -1, MensagemGpsDesativado);
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement