Guest User

Untitled

a guest
Nov 6th, 2010
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6. #include <zcmd>
  7. #include <a_mysql>
  8. #include <sscanf2>
  9.  
  10. new string[128];
  11. new line[128];
  12. new FALSE = false;
  13.  
  14. #define FILTERSCRIPT // for ZCMD
  15. #define SendFormattedMessage(%0,%1,%2) do{new _str[128]; format(_str,128,%2); SendClientMessage(%0,%1,_str);}while(FALSE) // i dont know by who
  16. #define COLOR_GREY 0xAFAFAFAA
  17. #define COLOR_YELLOW 0xFFFF0096
  18. #define COLOR_RED 0xFF000096
  19.  
  20. public OnFilterScriptInit()
  21. {
  22. print("\n--------------------------------------");
  23. print(" Easy GPS by ArmyOfTwo has been loaded!");
  24. print("--------------------------------------\n");
  25. return 1;
  26. }
  27.  
  28. COMMAND:creategps(playerid, params[])
  29. {
  30. new Location[24];
  31.  
  32. if(!IsPlayerAdmin(playerid)) return SendError(playerid, "You must be logged into RCON!");
  33. if(sscanf(params, "s[24]", Location)) return SendError(playerid, "USAGE: /creategps <Location> ");
  34.  
  35. format(string, sizeof(string), "SELECT * FROM gps WHERE Location = '%s'", Location);
  36. mysql_query(string);
  37. mysql_store_result();
  38.  
  39. if(mysql_num_rows() == 1) {
  40. SendClientMessage(playerid, COLOR_GREY, "Location already exists!");
  41. return 1;
  42. }
  43.  
  44. new Float:gX, Float:gY, Float:gZ;
  45.  
  46. GetPlayerPos(playerid, gX, gY, gZ);
  47.  
  48. format(string, sizeof(string), "INSERT INTO gps (Location, X, Y, Z) VALUES('%s', '%f', '%f', '%f')",
  49. Location, gX, gY, gZ );
  50. mysql_query(string);
  51. mysql_query("SELECT MAX(SQLID) FROM gps");
  52. mysql_store_result();
  53.  
  54. SendFormattedMessage(playerid, COLOR_YELLOW, "%s has been created!", Location);
  55. mysql_free_result();
  56. return 1;
  57. }
  58.  
  59. COMMAND:gps(playerid, params[])
  60. {
  61. new Location[24];
  62. if(sscanf(params, "s[24]", Location)) return SendError(playerid, "USAGE: /gps <Location> - /locations to see all locations!");
  63.  
  64. format(string, sizeof(string), "SELECT * FROM gps WHERE Location = '%s'", Location);
  65. mysql_query(string);
  66. //mysql_store_result();
  67.  
  68. if(mysql_num_rows() == 0) {
  69. SendClientMessage(playerid, COLOR_GREY, "Location doesn't exist!");
  70. return 1;
  71. }
  72.  
  73. new gpSQLID,
  74. Float:gX,
  75. Float:gY,
  76. Float:gZ;
  77.  
  78. mysql_fetch_row_format(line,"|");
  79. sscanf(line, "p<|>is[24]fff", gpSQLID, Location, Float:gX, Float:gY, Float:gZ );
  80.  
  81. SetPlayerCheckpoint(playerid, gX, gY, gZ, 4.0);
  82. SendFormattedMessage(playerid, COLOR_YELLOW, "An checkpoint to %s has been set!", Location);
  83.  
  84. mysql_free_result();
  85. return 1;
  86. }
  87.  
  88. stock SendError(playerid, const text[])
  89. {
  90. SendClientMessage(playerid, COLOR_RED, text);
  91. return 1;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment