Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.40 KB | None | 0 0
  1.  
  2. #include "Main.h"
  3. #include "Player.h"
  4.  
  5. #include <vector>
  6. #include <string>
  7.  
  8. #define TELEPORT_TABLE "Teleport_table"
  9. #define TELEPORT_BUILD_CONTINUE "continue"
  10.  
  11. //Information for our teleport parsing
  12. enum E_TELE_PARSE
  13. {
  14.     E_CATEGORY,
  15.     E_NAME,
  16.     E_X,
  17.     E_Y,
  18.     E_Z,
  19.     E_A,
  20.     E_VW,
  21.     E_INT,
  22.     E_REAL_TELE,
  23.     E_VEHICLE,
  24.     E_DM_VEHICLE,
  25.     E_FREEZE,
  26.     E_REMOVE_ARMOUR,
  27.     E_REMOVE_WEAPS,
  28.     E_FILL_HEALTH,
  29.     E_GAME_TEXT
  30. };
  31.  
  32. enum E_TELE_CODES
  33. {
  34.     E_SUCCESSFUL_TELE
  35. };
  36.  
  37.  
  38. //Vehicles that can NOT teleport (Even if its a valid vehicle teleport).
  39. const int g_BadVehicles[] =
  40. {
  41.     403,406,407,408,414,417,427,428,433,435, //LineRunner,Dumper,Fire1,TrashMaster,Mule,Leviathan,Enforcer,Security,Barrakcs,Article
  42.     520,425,430,432,443,444,446,447,452,453,//Hydra,hunter,predator,Rhino,Packer,Monster,Squallo,SeaSparrow,Speeder,Reefer
  43.     454,455,456,460,469,472,473,476,484,486,//Tropic,Flatbed,Yankee,Skimmer,Sparrow,CoastGuard,Dinghy,Rustler,Marquis
  44.     487,488,493,497,498,499,508,511,512,513,//Maverick,NewsMav,Jetmax,PoliceMav,Boxville,Benson,Journey,Beagle,CropDuster,StuntPlane
  45.     514,515,519,524,531,532,537,538,544,548,//PetrolTanker,RoadTrain,Shamal,Cement,Tractor,Combine,Freight,BrownS,Fire,CargoBob
  46.     553,556,557,563,569,570,577,578,584,590, //Nevada,MonsterA,MonsterB,RainDance,FreightT,StreakT,At400,DFT,PetrolT,FreightB
  47.     591,592,593,595,606,607,608,609,610,611, //AtricleT,Andro,Dodo,Launch,Baggage,Baggage2,Tug,BoxBerg,Farm,Utility
  48.     449,450,441,464,465,501,564,594         //Tram,Article3,Bandit,Baron,Raider,Goblin,Tiger,Cam
  49. };
  50.  
  51.  
  52. const int g_DmVehicles[] =
  53. {
  54.     520,425,430,432,464,484 //Hydra,hunter,predator,Rhino,baron,rustler
  55. };
  56.  
  57. //function prototypes
  58. inline int ParseTeleData(char* str, const char* str2);
  59. inline int ParseTeleData(int* data, const char* str);
  60. inline int ParseTeleData(bool* data, const char* str);
  61. inline int ParseTeleData(float* data, const char* str);
  62.  
  63. struct CategoryData
  64. {
  65.     char* s_Name;
  66.     bool s_MapIcon;
  67.     int s_Icon;
  68.     int s_Color;
  69.  
  70.     CategoryData(char* name, bool mapicon, int icon, int color)
  71.     {
  72.         int size = NULL;
  73.  
  74.         if((size = strlen(name)))
  75.         {
  76.             s_Name = new char[ size + 1 ];
  77.             strcpy(s_Name, name);
  78.            
  79.             s_MapIcon = mapicon;
  80.             s_Icon = icon;
  81.             s_Color = color;
  82.         }
  83.     }
  84.  
  85.     ~CategoryData()
  86.     {
  87.         if(s_Name) delete[] s_Name;
  88.     }
  89. };
  90.  
  91. //Teleport is a frind of: Player
  92. class Teleport
  93. {
  94. private:
  95.     char
  96.         *m_Name,
  97.         *m_ClientMessage,
  98.         *m_GameText;
  99.     float
  100.         m_X,
  101.         m_Y,
  102.         m_Z,
  103.         m_Anlgle,
  104.         m_VX,
  105.         m_VY,
  106.         m_VZ,
  107.         m_VAnlgle;
  108.     bool
  109.         m_RealTele,
  110.         m_Vehicle,
  111.         m_DmVehicle,
  112.         m_Freeze,
  113.         m_RemoveArmour,
  114.         m_RemoveWeapons,
  115.         m_FillHealth;
  116.     int
  117.         m_VirtualWorld,
  118.         m_Interior,
  119.         m_MessageColor;
  120.  
  121.     CategoryData m_Category;
  122.    
  123.     static map<int, Player*> m_Builders;
  124.     static map<int, Teleport> m_BuildTeles;
  125.     static vector<CategoryData> m_Categories;
  126.  
  127. public:
  128.     Teleport();
  129.     ~Teleport();
  130.  
  131.     int TeleportPlayer(Player* player);
  132.     int ListTeleports(Player* player);
  133.     int AddTeleport(Teleport& teleport);
  134.     void SendTeleportMessage(Player* player,int code);
  135.    
  136.     static void BuildTeleport(Player* player);
  137.     static void RemoveTeleport(Teleport& teleport);
  138.     static int ParseTeleports(map<char*, Teleport>& TeleData);
  139.     static int CheckTeleportTable();
  140.  
  141.     //callbacks
  142.     static int OnDialogResponse(int playerid, int dialogid, int response, int listitem, char* inputtext);
  143.     static int OnPlayerText(int playerid, char* text);
  144. };
  145.  
  146. extern map<char*, Teleport> g_Teleport;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement