Advertisement
Guest User

Show coords

a guest
May 28th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.50 KB | None | 0 0
  1. /*
  2.    THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK
  3.    http://dev-c.com
  4.    (C) Alexander Blade 2015
  5. */
  6.  
  7. /*
  8.    Script: Show coordinates X Y Z
  9.    Author: FunGt - http://www.gta-modding.com
  10. */
  11.  
  12. #include "script.h"
  13.  
  14. #include <string>
  15. #include <ctime>
  16.  
  17. #pragma warning(disable : 4244 4305) // double <-> float conversions
  18.  
  19. void draw_text(char *text, float x, float y, float scale) {
  20.         UI::SET_TEXT_FONT(0);
  21.         UI::SET_TEXT_SCALE(scale, scale);
  22.         UI::SET_TEXT_COLOUR(255, 255, 255, 245);
  23.         UI::SET_TEXT_WRAP(0.0, 1.0);
  24.         UI::SET_TEXT_CENTRE(0);
  25.         UI::SET_TEXT_DROPSHADOW(2, 2, 0, 0, 0);
  26.         UI::SET_TEXT_EDGE(1, 0, 0, 0, 205);
  27.         UI::_SET_TEXT_ENTRY("STRING");
  28.         UI::_ADD_TEXT_COMPONENT_STRING(text);
  29.         UI::_DRAW_TEXT(y, x);
  30. }
  31.  
  32. void main() {
  33.         Ped playerPed = PLAYER::PLAYER_PED_ID();
  34.         bool widescreen = GRAPHICS::GET_IS_WIDESCREEN();
  35.         Vector3 position;
  36.  
  37.         while(true) {
  38.                 playerPed = PLAYER::PLAYER_PED_ID();
  39.                 position = ENTITY::GET_ENTITY_COORDS(playerPed, 1);
  40.                 widescreen = GRAPHICS::GET_IS_WIDESCREEN();
  41.                 char coords[50];
  42.                 sprintf_s(coords, "X: %.3f Y: %.3f Z: %.3f", position.x, position.y, position.z);
  43.                 widescreen ? draw_text(coords, 0.978, 0.205 - 0.03, 0.3) : draw_text(coords, 0.978, 0.205, 0.3);
  44.  
  45.                 WAIT(0);
  46.         }
  47. }
  48.  
  49. void ScriptMain() {
  50.         srand(GetTickCount());
  51.         main();
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement