Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <sscanf2>
- #include <dini>
- #include <zcmd>
- #include <dfile>
- #define MAX_GPS_LOCATIONS 100
- #define MAX_GPS_NAME_STRING 100
- #define GPS_DIALOG 5900
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_BLUE 0x0000BBAA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_LIME 0x10F441AA
- #define COLOR_MAGENTA 0xFF00FFFF
- #define COLOR_NAVY 0x000080AA
- #define COLOR_AQUA 0xF0F8FFAA
- #define COLOR_CRIMSON 0xDC143CAA
- #define COLOR_FLBLUE 0x6495EDAA
- #define COLOR_BISQUE 0xFFE4C4AA
- #define COLOR_BLACK 0x000000AA
- #define COLOR_CHARTREUSE 0x7FFF00AA
- #define COLOR_BROWN 0XA52A2AAA
- #define COLOR_CORAL 0xFF7F50AA
- #define COLOR_GOLD 0xB8860BAA
- #define COLOR_GREENYELLOW 0xADFF2FAA
- #define COLOR_INDIGO 0x4B00B0AA
- #define COLOR_IVORY 0xFFFF82AA
- #define COLOR_LAWNGREEN 0x7CFC00AA
- #define COLOR_SEAGREEN 0x20B2AAAA
- #define COLOR_LIMEGREEN 0x32CD32AA //<--- Dark lime
- #define COLOR_MIDNIGHTBLUE 0X191970AA
- #define COLOR_MAROON 0x800000AA
- #define COLOR_OLIVE 0x808000AA
- #define COLOR_ORANGERED 0xFF4500AA
- #define COLOR_PINK 0xFFC0CBAA // - Light pink
- #define COLOR_SPRINGGREEN 0x00FF7FAA
- #define COLOR_TOMATO 0xFF6347AA // - Tomato >:/ sounds wrong lol... well... :P
- #define COLOR_YELLOWGREEN 0x9ACD32AA //- like military green
- #define COLOR_MEDIUMAQUA 0x83BFBFAA
- #define COLOR_MEDIUMMAGENTA 0x8B008BAA // dark magenta ^^
- #define COLOR_GREY 0xAFAFAFAA
- new gpspos[MAX_PLAYERS][MAX_GPS_LOCATIONS][MAX_GPS_NAME_STRING];
- new indexgps[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Loaded GPS FilterScript by ELECTRUX!!");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i=0; i<=MAX_PLAYERS; i++)
- {
- indexgps[i] = -1;
- for(new j=0; j<=MAX_GPS_LOCATIONS; j++)
- {
- for(new k=0; k<=MAX_GPS_NAME_STRING; k++)
- gpspos[i][j][k] = -1;
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new pname[50],folder[100];
- GetPlayerName(playerid,pname,sizeof(pname));
- format(folder,sizeof(folder),"/gps/%s",pname);
- if(!dfile_DirectoryExists(folder))
- {
- dfile_CreateDirectory(folder);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- indexgps[playerid] = -1;
- for(new i=0; i<=MAX_GPS_LOCATIONS; i++)
- {
- for(new j=0; j<=MAX_GPS_NAME_STRING; j++)
- gpspos[playerid][i][j] = -1;
- }
- return 1;
- }
- CMD:newgpspos(playerid,params[])
- {
- new placename[50],pname[50],file[100],Float:x,Float:y,Float:z;
- indexgps[playerid] = GetPlayerGPSFileCount(playerid);
- if(sscanf(params,"s",placename)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /newgpspos [PLACE NAME]");
- GetPlayerName(playerid,pname,sizeof(pname));
- GetPlayerPos(playerid,x,y,z);
- format(file,sizeof(file),"/gps/%s/%d.gps",pname,indexgps[playerid]);
- dini_Create(file);
- dini_Set(file,"Name",placename);
- dini_FloatSet(file,"PosX",x);
- dini_FloatSet(file,"PosY",y);
- dini_FloatSet(file,"PosZ",z);
- SendClientMessage(playerid,COLOR_GREEN,"Place added to your GPS. Use /gps to see.");
- return 1;
- }
- CMD:gps(playerid,params[])
- {
- new pname[50],mstring[2000],str1[256],str2[260],file[100];
- GetPlayerName(playerid,pname,sizeof(pname));
- for(new i=0; i<=MAX_GPS_LOCATIONS; i++)
- {
- format(file,sizeof(file),"/gps/%s/%d.gps",pname,i);
- if(dini_Exists(file))
- {
- str1 = dini_Get(file,"Name");
- format(str2,sizeof(str2),"%s\n",str1);
- strcat(mstring,str2);
- }
- }
- ShowPlayerDialog(playerid,GPS_DIALOG,DIALOG_STYLE_LIST,"GPS Locations",mstring,"OK","Cancel");
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- DisablePlayerCheckpoint(playerid);
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == GPS_DIALOG)
- {
- if(response == 1)
- {
- new pname[50],file[200],Float:px,Float:py,Float:pz,send[100];
- GetPlayerName(playerid,pname,sizeof(pname));
- format(file,sizeof(file),"/gps/%s/%d.gps",pname,listitem);
- px = dini_Float(file,"PosX");
- py = dini_Float(file,"PosY");
- pz = dini_Float(file,"PosZ");
- SetPlayerCheckpoint(playerid,px,py,pz,3.0);
- format(send,sizeof(send),"Checkpoint made at %.2f %.2f %.2f",px,py,pz);
- SendClientMessage(playerid,COLOR_GREEN,send);
- return 1;
- }
- else
- {
- SendClientMessage(playerid,COLOR_RED,"You cancelled!");
- return 1;
- }
- }
- return 0;
- }
- stock GetPlayerGPSFileCount(playerid)
- {
- new file[100],pname[50];
- GetPlayerName(playerid,pname,sizeof(pname));
- for(new i=0; i<=MAX_GPS_LOCATIONS; i++)
- {
- format(file,sizeof(file),"/gps/%s/%d.gps",pname,i);
- if(!dini_Exists(file))
- {
- return i;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement