Advertisement
Guest User

Dynamisches GPS + Tachosystem by Slash

a guest
Aug 23rd, 2014
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 23.68 KB | None | 0 0
  1. /*
  2. ================================================================================
  3. Dynamisches GPS System Inc. Tacho by Items4Landwirt aka. Slash
  4.  
  5. Um das Script zu nutzen werden 2 definierungen im Gamemode benötigt:
  6. #define MAX_GPS 20  -> definiert die maximale anzahl von den Wegpunkten
  7. #define GPSTacho    -> Aktiviert den Tacho, falls nicht benötigt einfach weglassen
  8.  
  9. Es ist verboten:
  10. - Das Script als seines auszugeben
  11. - Es erneut hochzuladen, außer der Verweiß zum Originalthread ist enthalten
  12. - Meinen Namen zu entfernen, es sieht ja eh keiner
  13. - Das Script zu verkaufen.
  14.  
  15. In Sofern wünsche ich viel Spaß damit.
  16. Freundliche Grüße:
  17. Slash ™
  18. ================================================================================
  19. */
  20. #include <a_samp>
  21. #include <ocmd>
  22.  
  23. enum gpsi
  24. {
  25.     bool:erstellt,
  26.     Name[40],
  27.     Float:GPSX,
  28.     Float:GPSY,
  29.     Float:GPSZ
  30. }
  31. new gps[MAX_GPS][gpsi];
  32.  
  33. enum
  34. {
  35.     DIALOG_CREATE=9000,
  36.     DIALOG_GPS
  37. }
  38.  
  39. new DB:data,dialog[MAX_PLAYERS],GPSName[MAX_PLAYERS][30],select[MAX_PLAYERS],NavActive[MAX_PLAYERS],NavActiveID[MAX_PLAYERS];
  40.  
  41. #if defined GPSTacho
  42. new PlayerText:GPSText[MAX_PLAYERS][11];
  43.  
  44. new VehicleNames[212][] = {
  45. {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
  46. {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
  47. {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
  48. {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
  49. {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
  50. {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
  51. {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
  52. {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
  53. {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
  54. {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
  55. {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
  56. {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
  57. {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
  58. {"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
  59. {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
  60. {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
  61. {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
  62. {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
  63. {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
  64. {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
  65. {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
  66. {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
  67. {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
  68. {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
  69. {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
  70. {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
  71. {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
  72. {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
  73. {"Utility Trailer"}
  74. };
  75. #endif
  76.  
  77. #if !defined _ALS_
  78.     forward public _ALS_();
  79.     _ALS_()<_ALS_:unhooked>{}
  80.     _ALS_()<_ALS_:hooked>{}
  81.     _ALS_()<>{}
  82. #endif
  83.  
  84. public OnGameModeInit()
  85. {
  86.     state _ALS_:hooked;
  87.     data = db_open("gps.db");
  88.     db_query(data,"CREATE TABLE IF NOT EXISTS gps (`id` int(11), `Name` varchar(30), `X` float, `Y` float, `Z` float)");
  89.     LoadGPS();
  90.     print("\n=================================");
  91.     print(" Dynamisches GPS System by Slash");
  92.     print("=================================\n");
  93.     return GPS_OnGameModeInit();
  94. }
  95. forward GPS_OnGameModeInit();
  96. #if defined _ALS_OnGameModeInit
  97.     #undef OnGameModeInit
  98. #else
  99.     #define _ALS_OnGameModeInit
  100. #endif
  101. public GPS_OnGameModeInit() <_ALS_:unhooked> return 1;
  102. public GPS_OnGameModeInit() <> return 1;
  103. #define OnGameModeInit(%0) GPS_OnGameModeInit(%0)<_ALS_:hooked>
  104.  
  105. public OnGameModeExit()
  106. {
  107.     state _ALS_:hooked;
  108.     db_close(data);
  109.     return GPSOnGameModeExit();
  110. }
  111. forward GPSOnGameModeExit();
  112. #if defined _ALS_OnGameModeExit
  113.     #undef OnGameModeExit
  114. #else
  115.     #define _ALS_OnGameModeExit
  116. #endif
  117. public GPSOnGameModeExit() <_ALS_:unhooked> return 1;
  118. public GPSOnGameModeExit() <> return 1;
  119. #define OnGameModeExit(%0) GPSOnGameModeExit(%0)<_ALS_:hooked>
  120.  
  121. public OnPlayerConnect(playerid)
  122. {
  123.     state _ALS_:hooked;
  124.     CreatePlayerText(playerid);
  125.     return GPS_OnPlayerConnect(playerid);
  126. }
  127.  
  128. forward GPS_OnPlayerConnect(playerid);
  129. #if defined _ALS_OnPlayerConnect
  130.     #undef OnPlayerConnect
  131. #else
  132.     #define _ALS_OnPlayerConnect
  133. #endif
  134. public GPS_OnPlayerConnect() <_ALS_:unhooked> return 1;
  135. public GPS_OnPlayerConnect() <> return 1;
  136. #define OnPlayerConnect(%0) GPS_OnPlayerConnect(%0)<_ALS_:hooked>
  137.  
  138. ocmd:gpscfg(playerid,params[])
  139. {
  140.     #pragma unused params
  141.     if(!IsPlayerAdmin(playerid))return 1;
  142.     return ShowPlayerDialog(playerid,DIALOG_CREATE,DIALOG_STYLE_LIST,"GPS Verwaltung","Neuen Wegpunkt hinzufügen\nWegpunkte bearbeiten","Weiter","Abbrechen"),dialog[playerid]=1;
  143. }
  144. ocmd:gps(playerid,params[])
  145. {
  146.     #pragma unused params
  147.     new string[1024],i=0;
  148.     format(string,1024,"GPS Ausschalten\n");
  149.     for(;i<MAX_GPS;i++)
  150.     {
  151.         if(gps[i][erstellt]==true)
  152.         {format(string,1024,"%s%s\n",string,gps[i][Name]);}
  153.     }
  154.     return ShowPlayerDialog(playerid,DIALOG_GPS,DIALOG_STYLE_LIST,"GPS",string,"Weiter","Abbrechen"),dialog[playerid]=1;
  155. }
  156.  
  157. public OnPlayerEnterCheckpoint(playerid)
  158. {
  159.     state _ALS_:hooked;
  160.     if(NavActive[playerid])
  161.     {
  162.         DisablePlayerCheckpoint(playerid);
  163.         NavActive[playerid]=-1;
  164.         NavActiveID[playerid]=-1;
  165.         SendClientMessage(playerid,-1,"Ziel Erreicht, GPS wird ausgeschalten..");
  166.         #if defined GPSTacho
  167.         for(new i;i<11;i++)
  168.         {
  169.             PlayerTextDrawHide(playerid,GPSText[playerid][i]);
  170.         }
  171.         #endif
  172.     }
  173.     return GPS_OnPlayerEnterCheckpoint(playerid);
  174. }
  175. forward GPS_OnPlayerEnterCheckpoint(playerid);
  176. #if defined _ALS_OnPlayerEnterCheckpoint
  177.     #undef OnPlayerEnterCheckpoint
  178. #else
  179.     #define _ALS_OnPlayerEnterCheckpoint
  180. #endif
  181. public GPS_OnPlayerEnterCheckpoint() <_ALS_:unhooked> return 1;
  182. public GPS_OnPlayerEnterCheckpoint() <> return 1;
  183. #define OnPlayerEnterCheckpoint(%0) GPS_OnPlayerEnterCheckpoint(%0)<_ALS_:hooked>
  184.  
  185. public OnPlayerStateChange(playerid, newstate, oldstate)
  186. {
  187.     state _ALS_:hooked;
  188.     #if defined GPSTacho
  189.     SetVehicleNameToTacho(playerid);
  190.     #endif
  191.     return GPS_OnPlayerStateChange(playerid,newstate,oldstate);
  192. }
  193. forward GPS_OnPlayerStateChange(playerid,newstate,oldstate);
  194. #if defined _ALS_OnPlayerStateChange
  195.     #undef OnPlayerStateChange
  196. #else
  197.     #define _ALS_OnPlayerStateChange
  198. #endif
  199. public GPS_OnPlayerStateChange(playerid,newstate,oldstate) <_ALS_:unhooked> return 1;
  200. public GPS_OnPlayerStateChange(playerid,newstate,oldstate) <> return 1;
  201. #define OnPlayerStateChange(%0,%1,%2) GPS_OnPlayerStateChange(%0,%1,%2)<_ALS_:hooked>
  202.  
  203. public OnPlayerUpdate(playerid)
  204. {
  205.     state _ALS_:hooked;
  206.     #if defined GPSTacho
  207.     if(NavActive[playerid])
  208.     {
  209.         new string[20],Float:health;
  210.         if(IsPlayerInAnyVehicle(playerid))
  211.         {
  212.             format(string,20,"%d KM/h",GetVehicleSpeed(GetPlayerVehicleID(playerid)));
  213.             PlayerTextDrawSetString(playerid,GPSText[playerid][5],string);
  214.  
  215.             GetVehicleHealth(GetPlayerVehicleID(playerid),health);
  216.             format(string,20,"%d %",floatround(health)/10);
  217.             PlayerTextDrawSetString(playerid,GPSText[playerid][10],string);
  218.  
  219.             format(string,20,"%0.0f Meter",GetPlayerDistanceFromPoint(playerid,gps[NavActiveID[playerid]][GPSX],gps[NavActiveID[playerid]][GPSY],gps[NavActiveID[playerid]][GPSZ]));
  220.             PlayerTextDrawSetString(playerid,GPSText[playerid][7],string);
  221.         }
  222.         format(string,20,"%0.0f Meter",GetPlayerDistanceFromPoint(playerid,gps[NavActiveID[playerid]][GPSX],gps[NavActiveID[playerid]][GPSY],gps[NavActiveID[playerid]][GPSZ]));
  223.         PlayerTextDrawSetString(playerid,GPSText[playerid][7],string);
  224.     }
  225.     #endif
  226.     return GPS_OnPlayerUpdate(playerid);
  227. }
  228. forward GPS_OnPlayerUpdate(playerid);
  229. #if defined _ALS_OnPlayerUpdate
  230.     #undef OnPlayerUpdate
  231. #else
  232.     #define _ALS_OnPlayerUpdate
  233. #endif
  234. public GPS_OnPlayerUpdate(playerid) <_ALS_:unhooked> return 1;
  235. public GPS_OnPlayerUpdate(playerid) <> return 1;
  236. #define OnPlayerUpdate(%0) GPS_OnPlayerUpdate(%0)<_ALS_:hooked>
  237.  
  238. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  239. {
  240.     state _ALS_:hooked;
  241.     switch(dialogid)
  242.     {
  243.         case DIALOG_CREATE:
  244.         {
  245.             if(response)
  246.             {
  247.                 switch(dialog[playerid])
  248.                 {
  249.                     case 1:
  250.                     {
  251.                         switch(listitem)
  252.                         {
  253.                             case 0:return ShowPlayerDialog(playerid,DIALOG_CREATE,DIALOG_STYLE_INPUT,"GPS Verwaltung","Gebe nun den Namen des neuen GPS - Wegpunktes an","Weiter","Abbrechen"),dialog[playerid]=2;
  254.                             case 1:
  255.                             {
  256.                                 new string[1024],i=0;
  257.                                 for(;i<MAX_GPS;i++)
  258.                                 {
  259.                                     if(gps[i][erstellt]==true)
  260.                                     {format(string,1024,"%s%s\n",string,gps[i][Name]);}
  261.                                 }
  262.                                 return ShowPlayerDialog(playerid,DIALOG_CREATE,DIALOG_STYLE_LIST,"GPS Verwaltung",string,"Auswählen","Abbrechen"),dialog[playerid]=5;
  263.                             }
  264.                         }
  265.                     }
  266.                     case 2:
  267.                     {
  268.                         new string[128];
  269.                         format(GPSName[playerid],30,"%s",inputtext);
  270.                         format(string,128,"{FFFFFF}Möchtest du den neuen Wegpunkt {0068C2}%s {FFFFFF}im GPS eintragen?",inputtext);
  271.                         return ShowPlayerDialog(playerid,DIALOG_CREATE,DIALOG_STYLE_MSGBOX,"GPS Verwaltung",string,"Weiter","Abbrechen"),dialog[playerid]=3;
  272.                     }
  273.                     case 3:return CreateGPS(playerid,GPSName[playerid]);
  274.                     case 4:return dialog[playerid]=0;
  275.                     case 5:
  276.                     {
  277.                         select[playerid] = listitem;
  278.                         new string[128];
  279.                         format(string,128,"Wegpunkt - %s editieren",gps[select[playerid]][Name]);
  280.                         return ShowPlayerDialog(playerid,DIALOG_CREATE,DIALOG_STYLE_LIST,string,"Namen ändern\nPosition ändern\nLöschen","Weiter","Abbrechen"),dialog[playerid]=6;
  281.                     }
  282.                     case 6:
  283.                     {
  284.                         switch(listitem)
  285.                         {
  286.                             case 0:
  287.                             {
  288.                                 new string[128];
  289.                                 format(string,128,"{FFFFFF}Gebe nun den neuen Namen für den Wegpunkt {0068C2}%s {FFFFFF}an",gps[select[playerid]][Name]);
  290.                                 return ShowPlayerDialog(playerid,DIALOG_CREATE,DIALOG_STYLE_INPUT,"GPS Verwaltung",string,"Weiter","Abbrechen"),dialog[playerid]=7;
  291.                             }
  292.                             case 1:
  293.                             {
  294.                                 new string[128];
  295.                                 format(string,128,"{FFFFFF}Stelle sicher das du am neuen punkt für den Wegpunkt {0068C2}%s {FFFFFF}bist",gps[select[playerid]][Name]);
  296.                                 return ShowPlayerDialog(playerid,DIALOG_CREATE,DIALOG_STYLE_MSGBOX,"GPS Verwaltung",string,"Weiter","Abbrechen"),dialog[playerid]=8;
  297.                             }
  298.                             case 2:
  299.                             {
  300.                                 new string[128];
  301.                                 format(string,128,"{FFFFFF}Bist du sicher das du den Wegpunkt {0068C2}%s {FFFFFF}entfernen möchtest?",gps[select[playerid]][Name]);
  302.                                 return ShowPlayerDialog(playerid,DIALOG_CREATE,DIALOG_STYLE_MSGBOX,"GPS Verwaltung",string,"Weiter","Abbrechen"),dialog[playerid]=9;
  303.                             }
  304.                         }
  305.                     }
  306.                     case 7:
  307.                     {
  308.                         new string[128];
  309.                         format(string,128,"UPDATE gps SET Name='%s' WHERE id='%i'",DB_Escape(inputtext),select[playerid]);
  310.                         db_query(data,string);
  311.                         format(gps[select[playerid]][Name],30,"%s",inputtext);
  312.                         SendClientMessage(playerid,-1,"Der Name des Wegpunktes wurde erfolgreich geändert");
  313.                     }
  314.                     case 8:
  315.                     {
  316.                         new string[128],Float:Pos[3];
  317.                         GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
  318.                         format(string,128,"UPDATE gps SET X='%f',Y='%f',Z='%f' WHERE id='%i'",Pos[0],Pos[1],Pos[2],select[playerid]);
  319.                         db_query(data,string);
  320.                         LoadGPS();
  321.                         SendClientMessage(playerid,-1,"Die Position des Wegpunktes wurde erfolgreich geändert");
  322.                     }
  323.                     case 9:
  324.                     {
  325.                         new string[128];
  326.                         format(string,128,"DELETE FROM gps WHERE id='%i'",select[playerid]);
  327.                         db_query(data,string);
  328.                         gps[select[playerid]][GPSX] = 0.0;
  329.                         gps[select[playerid]][GPSY] = 0.0;
  330.                         gps[select[playerid]][GPSZ] = 0.0;
  331.                         gps[select[playerid]][GPSZ] = 0;
  332.                         gps[select[playerid]][erstellt] = false;
  333.                         SendClientMessage(playerid,-1,"Der Wegpunkt wurde erfolgreich gelöscht");
  334.                     }
  335.                 }
  336.             }
  337.             else return dialog[playerid]=0;
  338.         }
  339.         case DIALOG_GPS:
  340.         {
  341.             if(response)
  342.             {
  343.                 if(listitem==0)
  344.                 {
  345.                     NavActive[playerid]=0;
  346.                     NavActiveID[playerid]=0;
  347.                     DisablePlayerCheckpoint(playerid);
  348.                     #if defined GPSTacho
  349.                     for(new i;i<11;i++)
  350.                     {
  351.                         PlayerTextDrawHide(playerid,GPSText[playerid][i]);
  352.                     }
  353.                     #endif
  354.                     return SendClientMessage(playerid,-1,"GPS Ausgeschalten");
  355.                 }
  356.                 NavActiveID[playerid] = listitem-1;
  357.                 NavActive[playerid]=1;
  358.                 SetPlayerCheckpoint(playerid,gps[NavActiveID[playerid]][GPSX],gps[NavActiveID[playerid]][GPSY],gps[NavActiveID[playerid]][GPSZ],3.0);
  359.                 #if defined GPSTacho
  360.                 for(new i;i<11;i++)
  361.                 {
  362.                     PlayerTextDrawShow(playerid,GPSText[playerid][i]);
  363.                 }
  364.                 SetVehicleNameToTacho(playerid);
  365.                 #endif
  366.                 return SendClientMessage(playerid,-1,"GPS Wegpunkt gesetzt");
  367.             }
  368.         }
  369.     }
  370.     return GPS_OnDialogResponse(playerid, dialogid, response, listitem, inputtext);
  371. }
  372. forward GPS_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
  373. #if defined _ALS_OnDialogResponse
  374.     #undef OnDialogResponse
  375. #else
  376.     #define _ALS_OnDialogResponse
  377. #endif
  378. public GPS_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) <_ALS_:unhooked> return 1;
  379. public GPS_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) <> return 1;
  380. #define OnDialogResponse(%0,%1,%2,%3,%4) GPS_OnDialogResponse(%0,%1,%2,%3,%4)<_ALS_:hooked>
  381.  
  382. stock CreateGPS(playerid,const GName[])
  383. {
  384.     new Float:gPos[3],id=GetFreeGPSID(),string[128];
  385.     GetPlayerPos(playerid,gPos[0],gPos[1],gPos[2]);
  386.     if(id == -1)return ShowPlayerDialog(playerid,DIALOG_CREATE,DIALOG_STYLE_MSGBOX,"GPS Verwaltung","Es wurde bereits die maximale anzahl an GPS - Wegpunkten erstellt.","Weiter",""),dialog[playerid]=4;
  387.     format(gps[id][Name],30,GName);
  388.     gps[id][GPSX] = gPos[0];
  389.     gps[id][GPSY] = gPos[1];
  390.     gps[id][GPSZ] = gPos[2];
  391.     gps[id][erstellt] = true;
  392.     format(string,128,"INSERT INTO gps (`id`,`Name`,`X`,`Y`,`Z`) VALUES ('%i','%s','%f','%f','%f')",id,DB_Escape(GName),gPos[0],gPos[1],gPos[2]),db_query(data,string);
  393.     return SendClientMessage(playerid,-1,"Der GPS  Wegpunkt wurde erfolgreich erstellt.");
  394. }
  395. stock GetFreeGPSID()
  396. {
  397.     new i=0;
  398.     for(;i<MAX_GPS;i++)
  399.     {
  400.         if(gps[i][erstellt]==true)continue;
  401.         return i;
  402.     }
  403.     return -1;
  404. }
  405. stock LoadGPS()
  406. {
  407.     new i=0,string[128],cache[30],DBResult:result;
  408.     for(;i<MAX_GPS;i++)
  409.     {
  410.         format(string,128,"SELECT * FROM gps WHERE id = '%d'",i),result = db_query(data,string);
  411.         if(db_num_rows(result)==1)
  412.         {
  413.             db_get_field_assoc(result,"Name",cache,30);
  414.             format(gps[i][Name],30,"%s",cache);
  415.             db_get_field_assoc(result,"X",cache,30);
  416.             gps[i][GPSX] = floatstr(cache);
  417.             db_get_field_assoc(result,"Y",cache,30);
  418.             gps[i][GPSY] = floatstr(cache);
  419.             db_get_field_assoc(result,"Z",cache,30);
  420.             gps[i][GPSZ] = floatstr(cache);
  421.             gps[i][erstellt] = true;
  422.         }
  423.         else {gps[i][erstellt] = false;}
  424.     }
  425.     db_free_result(result);
  426. }
  427. stock DB_Escape(const text[])
  428. {
  429.     #define MAX_INI_ENTRY_TEXT 80
  430.     new ret[MAX_INI_ENTRY_TEXT * 2],ch,i,j;
  431.     while ((ch = text[i++]) && j < sizeof (ret))
  432.     {
  433.         if (ch == '\'')
  434.         {
  435.             if (j < sizeof (ret) - 2)
  436.             {
  437.                 ret[j++] = '\'';
  438.                 ret[j++] = '\'';
  439.             }
  440.         }
  441.         else if (j < sizeof (ret))
  442.         {
  443.             ret[j++] = ch;
  444.         }
  445.         else
  446.         {
  447.             j++;
  448.         }
  449.     }
  450.     ret[sizeof (ret) - 1] = '\0';
  451.     return ret;
  452. }
  453. stock SetVehicleNameToTacho(playerid)
  454. {
  455.     if(IsPlayerInAnyVehicle(playerid))return PlayerTextDrawSetString(playerid,GPSText[playerid][4],VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
  456.     return PlayerTextDrawSetString(playerid,GPSText[playerid][4],"Zu Fuss");
  457. }
  458. stock GetVehicleSpeed(vehicleid)
  459. {
  460.     new Float:xPos[3];
  461.     GetVehicleVelocity(vehicleid, xPos[0], xPos[1], xPos[2]);
  462.     return floatround(floatsqroot(xPos[0] * xPos[0] + xPos[1] * xPos[1] + xPos[2] * xPos[2]) * 170.00);
  463. }
  464. stock CreatePlayerText(playerid)
  465. {
  466.     #if defined GPSTacho
  467.     GPSText[playerid][0] = CreatePlayerTextDraw(playerid, 653.875000, 336.916656, "usebox");
  468.     PlayerTextDrawLetterSize(playerid, GPSText[playerid][0], 0.000000, 14.472681);
  469.     PlayerTextDrawTextSize(playerid, GPSText[playerid][0], 519.250000, 0.000000);
  470.     PlayerTextDrawAlignment(playerid, GPSText[playerid][0], 1);
  471.     PlayerTextDrawColor(playerid, GPSText[playerid][0], 0);
  472.     PlayerTextDrawUseBox(playerid, GPSText[playerid][0], true);
  473.     PlayerTextDrawBoxColor(playerid, GPSText[playerid][0], 102);
  474.     PlayerTextDrawSetShadow(playerid, GPSText[playerid][0], 0);
  475.     PlayerTextDrawSetOutline(playerid, GPSText[playerid][0], 0);
  476.     PlayerTextDrawFont(playerid, GPSText[playerid][0], 0);
  477.  
  478.     GPSText[playerid][1] = CreatePlayerTextDraw(playerid, 534.375000, 338.333251, "GPS System");
  479.     PlayerTextDrawLetterSize(playerid, GPSText[playerid][1], 0.365622, 1.378332);
  480.     PlayerTextDrawAlignment(playerid, GPSText[playerid][1], 1);
  481.     PlayerTextDrawColor(playerid, GPSText[playerid][1], -1523963137);
  482.     PlayerTextDrawSetShadow(playerid, GPSText[playerid][1], 0);
  483.     PlayerTextDrawSetOutline(playerid, GPSText[playerid][1], 1);
  484.     PlayerTextDrawBackgroundColor(playerid, GPSText[playerid][1], 51);
  485.     PlayerTextDrawFont(playerid, GPSText[playerid][1], 2);
  486.     PlayerTextDrawSetProportional(playerid, GPSText[playerid][1], 1);
  487.  
  488.     GPSText[playerid][2] = CreatePlayerTextDraw(playerid, 524.375000, 367.499938, "Fahrzeug:");
  489.     PlayerTextDrawLetterSize(playerid, GPSText[playerid][2], 0.285623, 1.133332);
  490.     PlayerTextDrawTextSize(playerid, GPSText[playerid][2], -17.500000, -7.000000);
  491.     PlayerTextDrawAlignment(playerid, GPSText[playerid][2], 1);
  492.     PlayerTextDrawColor(playerid, GPSText[playerid][2], -1);
  493.     PlayerTextDrawSetShadow(playerid, GPSText[playerid][2], 0);
  494.     PlayerTextDrawSetOutline(playerid, GPSText[playerid][2], 1);
  495.     PlayerTextDrawBackgroundColor(playerid, GPSText[playerid][2], 51);
  496.     PlayerTextDrawFont(playerid, GPSText[playerid][2], 1);
  497.     PlayerTextDrawSetProportional(playerid, GPSText[playerid][2], 1);
  498.  
  499.     GPSText[playerid][3] = CreatePlayerTextDraw(playerid, 526.250000, 388.499755, "Geschwindigkeit:");
  500.     PlayerTextDrawLetterSize(playerid, GPSText[playerid][3], 0.217498, 1.174165);
  501.     PlayerTextDrawAlignment(playerid, GPSText[playerid][3], 1);
  502.     PlayerTextDrawColor(playerid, GPSText[playerid][3], -1);
  503.     PlayerTextDrawSetShadow(playerid, GPSText[playerid][3], 0);
  504.     PlayerTextDrawSetOutline(playerid, GPSText[playerid][3], 1);
  505.     PlayerTextDrawBackgroundColor(playerid, GPSText[playerid][3], 51);
  506.     PlayerTextDrawFont(playerid, GPSText[playerid][3], 1);
  507.     PlayerTextDrawSetProportional(playerid, GPSText[playerid][3], 1);
  508.  
  509.     GPSText[playerid][4] = CreatePlayerTextDraw(playerid, 575.000000, 368.083221, "Berkley's RC Van");
  510.     PlayerTextDrawLetterSize(playerid, GPSText[playerid][4], 0.213124, 1.238332);
  511.     PlayerTextDrawAlignment(playerid, GPSText[playerid][4], 1);
  512.     PlayerTextDrawColor(playerid, GPSText[playerid][4], -5963521);
  513.     PlayerTextDrawSetShadow(playerid, GPSText[playerid][4], 0);
  514.     PlayerTextDrawSetOutline(playerid, GPSText[playerid][4], 1);
  515.     PlayerTextDrawBackgroundColor(playerid, GPSText[playerid][4], 51);
  516.     PlayerTextDrawFont(playerid, GPSText[playerid][4], 1);
  517.     PlayerTextDrawSetProportional(playerid, GPSText[playerid][4], 1);
  518.  
  519.     GPSText[playerid][5] = CreatePlayerTextDraw(playerid, 590.625000, 389.666503, "0 Km/h");
  520.     PlayerTextDrawLetterSize(playerid, GPSText[playerid][5], 0.234999, 1.028331);
  521.     PlayerTextDrawAlignment(playerid, GPSText[playerid][5], 1);
  522.     PlayerTextDrawColor(playerid, GPSText[playerid][5], -5963521);
  523.     PlayerTextDrawSetShadow(playerid, GPSText[playerid][5], 0);
  524.     PlayerTextDrawSetOutline(playerid, GPSText[playerid][5], 1);
  525.     PlayerTextDrawBackgroundColor(playerid, GPSText[playerid][5], 51);
  526.     PlayerTextDrawFont(playerid, GPSText[playerid][5], 1);
  527.     PlayerTextDrawSetProportional(playerid, GPSText[playerid][5], 1);
  528.  
  529.     GPSText[playerid][6] = CreatePlayerTextDraw(playerid, 526.875000, 408.333343, "Strecke:");
  530.     PlayerTextDrawLetterSize(playerid, GPSText[playerid][6], 0.287497, 1.156664);
  531.     PlayerTextDrawAlignment(playerid, GPSText[playerid][6], 1);
  532.     PlayerTextDrawColor(playerid, GPSText[playerid][6], -1);
  533.     PlayerTextDrawSetShadow(playerid, GPSText[playerid][6], 0);
  534.     PlayerTextDrawSetOutline(playerid, GPSText[playerid][6], 1);
  535.     PlayerTextDrawBackgroundColor(playerid, GPSText[playerid][6], 51);
  536.     PlayerTextDrawFont(playerid, GPSText[playerid][6], 1);
  537.     PlayerTextDrawSetProportional(playerid, GPSText[playerid][6], 1);
  538.  
  539.     GPSText[playerid][7] = CreatePlayerTextDraw(playerid, 572.500000, 407.749938, "0 Meter");
  540.     PlayerTextDrawLetterSize(playerid, GPSText[playerid][7], 0.206248, 1.249999);
  541.     PlayerTextDrawAlignment(playerid, GPSText[playerid][7], 1);
  542.     PlayerTextDrawColor(playerid, GPSText[playerid][7], -5963521);
  543.     PlayerTextDrawSetShadow(playerid, GPSText[playerid][7], 0);
  544.     PlayerTextDrawSetOutline(playerid, GPSText[playerid][7], 1);
  545.     PlayerTextDrawBackgroundColor(playerid, GPSText[playerid][7], 51);
  546.     PlayerTextDrawFont(playerid, GPSText[playerid][7], 1);
  547.     PlayerTextDrawSetProportional(playerid, GPSText[playerid][7], 1);
  548.  
  549.     GPSText[playerid][8] = CreatePlayerTextDraw(playerid, 516.875000, 366.916595, ".");
  550.     PlayerTextDrawLetterSize(playerid, GPSText[playerid][8], 12.297508, -1.194165);
  551.     PlayerTextDrawAlignment(playerid, GPSText[playerid][8], 1);
  552.     PlayerTextDrawColor(playerid, GPSText[playerid][8], -1523963137);
  553.     PlayerTextDrawSetShadow(playerid, GPSText[playerid][8], 0);
  554.     PlayerTextDrawSetOutline(playerid, GPSText[playerid][8], 1);
  555.     PlayerTextDrawBackgroundColor(playerid, GPSText[playerid][8], 51);
  556.     PlayerTextDrawFont(playerid, GPSText[playerid][8], 1);
  557.     PlayerTextDrawSetProportional(playerid, GPSText[playerid][8], 1);
  558.  
  559.     GPSText[playerid][9] = CreatePlayerTextDraw(playerid, 528.125000, 427.583282, "Zustand:");
  560.     PlayerTextDrawLetterSize(playerid, GPSText[playerid][9], 0.272498, 1.197499);
  561.     PlayerTextDrawAlignment(playerid, GPSText[playerid][9], 1);
  562.     PlayerTextDrawColor(playerid, GPSText[playerid][9], -1);
  563.     PlayerTextDrawSetShadow(playerid, GPSText[playerid][9], 0);
  564.     PlayerTextDrawSetOutline(playerid, GPSText[playerid][9], 1);
  565.     PlayerTextDrawBackgroundColor(playerid, GPSText[playerid][9], 51);
  566.     PlayerTextDrawFont(playerid, GPSText[playerid][9], 1);
  567.     PlayerTextDrawSetProportional(playerid, GPSText[playerid][9], 1);
  568.  
  569.     GPSText[playerid][10] = CreatePlayerTextDraw(playerid, 573.750000, 426.999908, "0 %");
  570.     PlayerTextDrawLetterSize(playerid, GPSText[playerid][10], 0.220624, 1.279164);
  571.     PlayerTextDrawAlignment(playerid, GPSText[playerid][10], 1);
  572.     PlayerTextDrawColor(playerid, GPSText[playerid][10], -5963521);
  573.     PlayerTextDrawSetShadow(playerid, GPSText[playerid][10], 0);
  574.     PlayerTextDrawSetOutline(playerid, GPSText[playerid][10], 1);
  575.     PlayerTextDrawBackgroundColor(playerid, GPSText[playerid][10], 51);
  576.     PlayerTextDrawFont(playerid, GPSText[playerid][10], 1);
  577.     PlayerTextDrawSetProportional(playerid, GPSText[playerid][10], 1);
  578.     #else
  579.     #pragma unused playerid
  580.     #endif
  581.     return 1;
  582. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement