Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a comment
- // uncomment the line below if you want to write a filterscript
- //#define FILTERSCRIPT
- #include <a_samp>
- #include <zcmd>
- #include <a_mysql>
- #include <sscanf2>
- new string[128];
- new line[128];
- new FALSE = false;
- #define FILTERSCRIPT // for ZCMD
- #define SendFormattedMessage(%0,%1,%2) do{new _str[128]; format(_str,128,%2); SendClientMessage(%0,%1,_str);}while(FALSE) // i dont know by who
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_YELLOW 0xFFFF0096
- #define COLOR_RED 0xFF000096
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Easy GPS by ArmyOfTwo has been loaded!");
- print("--------------------------------------\n");
- return 1;
- }
- COMMAND:creategps(playerid, params[])
- {
- new Location[24];
- if(!IsPlayerAdmin(playerid)) return SendError(playerid, "You must be logged into RCON!");
- if(sscanf(params, "s[24]", Location)) return SendError(playerid, "USAGE: /creategps <Location> ");
- format(string, sizeof(string), "SELECT * FROM gps WHERE Location = '%s'", Location);
- mysql_query(string);
- mysql_store_result();
- if(mysql_num_rows() == 1) {
- SendClientMessage(playerid, COLOR_GREY, "Location already exists!");
- return 1;
- }
- new Float:gX, Float:gY, Float:gZ;
- GetPlayerPos(playerid, gX, gY, gZ);
- format(string, sizeof(string), "INSERT INTO gps (Location, X, Y, Z) VALUES('%s', '%f', '%f', '%f')",
- Location, gX, gY, gZ );
- mysql_query(string);
- mysql_query("SELECT MAX(SQLID) FROM gps");
- mysql_store_result();
- SendFormattedMessage(playerid, COLOR_YELLOW, "%s has been created!", Location);
- mysql_free_result();
- return 1;
- }
- COMMAND:gps(playerid, params[])
- {
- new Location[24];
- if(sscanf(params, "s[24]", Location)) return SendError(playerid, "USAGE: /gps <Location> - /locations to see all locations!");
- format(string, sizeof(string), "SELECT * FROM gps WHERE Location = '%s'", Location);
- mysql_query(string);
- //mysql_store_result();
- if(mysql_num_rows() == 0) {
- SendClientMessage(playerid, COLOR_GREY, "Location doesn't exist!");
- return 1;
- }
- new gpSQLID,
- Float:gX,
- Float:gY,
- Float:gZ;
- mysql_fetch_row_format(line,"|");
- sscanf(line, "p<|>is[24]fff", gpSQLID, Location, Float:gX, Float:gY, Float:gZ );
- SetPlayerCheckpoint(playerid, gX, gY, gZ, 4.0);
- SendFormattedMessage(playerid, COLOR_YELLOW, "An checkpoint to %s has been set!", Location);
- mysql_free_result();
- return 1;
- }
- stock SendError(playerid, const text[])
- {
- SendClientMessage(playerid, COLOR_RED, text);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment