Advertisement
Guest User

db.obj.inc

a guest
Jun 24th, 2015
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 24.22 KB | None | 0 0
  1. #define MAX_DB_OBJS                 800            
  2. #define DIALOG_OBJS                 5450
  3. #define DIALOG_RAMP_OBJS            DIALOG_OBJS + 1
  4. #define DIALOG_ROAD_OBJS            DIALOG_OBJS + 2
  5. #define DIALOG_ARROW_OBJS           DIALOG_OBJS + 3
  6. #define DIALOG_SKYDIVE_OBJS         DIALOG_OBJS + 4
  7. #define DIALOG_TUBE_OBJS            DIALOG_OBJS + 5
  8. #define DIALOG_MISC_OBJS            DIALOG_OBJS + 6
  9. #define DIALOG_LIGHT_OBJS           DIALOG_OBJS + 7
  10. #define DIALOG_NEON_OBJS            DIALOG_OBJS + 8
  11. #define DIALOG_CREATE_OBJS          DIALOG_OBJS + 9
  12. #define DIALOG_MAP_OBJS             DIALOG_OBJS + 10
  13. #define DIALOG_BREAK_OBJS           DIALOG_OBJS + 11
  14.  
  15. enum E_DB_OBJ
  16. {
  17.     E_DB_OBJ_DB_ID,
  18.     E_DB_OBJ_MODEL,
  19.     Float:E_DB_OBJ_X,
  20.     Float:E_DB_OBJ_Y,
  21.     Float:E_DB_OBJ_Z,
  22.     Float:E_DB_OBJ_RX,
  23.     Float:E_DB_OBJ_RY,
  24.     Float:E_DB_OBJ_RZ
  25. }
  26.  
  27. new gDBObjs[MAX_DB_OBJS][E_DB_OBJ];
  28.  
  29. enum E_DB_OBJ_LIST
  30. {
  31.     E_DB_OBJ_LIST_MODEL_ID,
  32.     E_DB_OBJ_LIST_NAME[64]
  33. }
  34.  
  35. //ramps list //done
  36. new gRampObjsList[][E_DB_OBJ_LIST] =
  37. {
  38.     {18778, "Ramp T1"},
  39.     {18779, "Ramp T2"},
  40.     {18780, "Ramp T3"},
  41.     {19005, "Ramp T4"},
  42.     {18783, "Fun Box Top"},
  43.     {18784, "Fun Box Ramp 1"},
  44.     {18785, "Fun Box Ramp 2"},
  45.     {18786, "Fun Box Ramp 3"},
  46.     {18787, "Fun Box Ramp 4"},
  47.     {13593, "Kick Ramp"},
  48.     {13604, "Kick Ramp 2"},
  49.     {13641, "Kick Ramp 3 w/Loop"},
  50.     {13645, "Kick Ramp 4"},
  51.     {18781, "Big Mesh Ramp"},
  52.     {18782, "Cookie Ramp"},
  53.     {18862, "Garbage Pile Ramp"},
  54.     {13639, "Ramp Parse"},
  55.     {1245, "Wood w/Box Ramp"},
  56.     {1503, "Wood w/Box Ramp 2"},
  57.     {13646, "Ramp Landing Pad"},
  58.     {13649, "Ramp Landing Pad 2"},
  59.     {18847, "Huge Half Pipe 1"},
  60.     {18859, "Quarter Pipe 1"},
  61.     {19002, "Fire Hoop 1"},
  62.     {18858, "Foam Hoop 1"},
  63.     {19001, "VC Wide Loop 1"},
  64.     {18882, "Huge Bowl 1"},
  65.     {18883, "Huge Bowl 2"},
  66.     {18884, "Huge Bowl 3"},
  67.     {13666, "Loop Big"}
  68. };
  69.  
  70. //Tubes list //done
  71. new gTubeObjsList[][E_DB_OBJ_LIST] =
  72. {
  73.     {18997, "1m"},
  74.     {18995, "5m"},
  75.     {18996, "5m 45 Bend"},
  76.     {18992, "10m 45 Bend"},
  77.     {18993, "10m 90 Bend"},
  78.     {18994, "10m 180 Bend"},
  79.     {18987, "25m"},
  80.     {18988, "25m Cut End"},
  81.     {18989, "25m 45 Bend"},
  82.     {18990, "25m 90 Bend"},
  83.     {18991, "25m 180 Bend"},
  84.     {18808, "50m"},
  85.     {18809, "50m Glass"},
  86.     {18810, "50m Bulge"},
  87.     {18811, "50m Glass Bulge"},
  88.     {18813, "50m Glass Funnel"},
  89.     {18812, "50m Funnel 1"},
  90.     {18814, "50m Funnel 2"},
  91.     {18815, "50m Funnel 3"},
  92.     {18816, "50m Funnel 4"},
  93.     {18817, "50m TSection"},
  94.     {18818, "50m Glass"},
  95.     {18819, "50m Plus"},
  96.     {18820, "50m Glass Plus"},
  97.     {18821, "50m 45 Bend"},
  98.     {18822, "50m Glass 45 Bend"},
  99.     {18823, "50m 90 Bend 1"},
  100.     {18824, "50m Glass 90 Bend"},
  101.     {18825, "50m 180 Bend"},
  102.     {18826, "50m Glass 180 Bend"},
  103.     {18852, "100m "},
  104.     {18827, "100m 2"},
  105.     {18982, "100m 3"},
  106.     {18983, "100m 4"},
  107.     {18984, "100m 5"},
  108.     {18985, "100m 6"},
  109.     {18853, "100m 45 Bend"},
  110.     {18854, "100m 90 Bend"},
  111.     {18855, "100m 180 Bend"},
  112.     {18998, "200m"},
  113.     {18999, "200m Bendy"},
  114.     {19000, "200m Bulge"},
  115.     {18851, "Tube To Road"},
  116.     {18986, "Tube To Pipe"},
  117.     {18828, "Spiral"},
  118.     {18829, "R Texture"},
  119.     {18830, "R Texture bridge"},
  120.     {18831, "RT 25m Bend 90"},
  121.     {18832, "RT 25m Bend 180"},
  122.     {18833, "RT 50m Bend 45"},
  123.     {18834, "RT 50m Bend 180"},
  124.     {18835, "RB Funnel"},
  125.     {18836, "RB Halfpipe"},
  126.     {18837, "RB 25m Bend 90"},
  127.     {18838, "RB 25m Bend 180"},
  128.     {18839, "RB 50m Bend 45"},
  129.     {18840, "RB 50m Bend 90"},
  130.     {18841, "RB 50m Bend 180"},
  131.     {18842, "RB 50m"}
  132. };
  133.  
  134. //Skydiving list //done
  135. new gSkyDiveObjsList[][E_DB_OBJ_LIST] =
  136. {
  137.     {18768, "SkyDive Platform 1"},
  138.     {18769, "SkyDive Platform 1a"},
  139.     {18770, "SkyDive Platform 1b"},
  140.     {18881, "SkyDive Platform 2"},
  141.     {3108, "Base Jump Target"},
  142.     {18850, "Heli Pad "}
  143. };
  144.  
  145. //Arrow list //done
  146. new gArrowObjsList[][E_DB_OBJ_LIST] =
  147. {
  148.     {1318, "Arrow Type 0"},
  149.     {19130, "Arrow Type 1"},
  150.     {19131, "Arrow Type 2"},
  151.     {19132, "Arrow Type 3"},
  152.     {19133, "Arrow Type 4"},
  153.     {19134, "Arrow Type 5"},
  154.     {19135, "EnEx Marker 1"},
  155.     {19197, "EnEx Marker 2"},
  156.     {19198, "EnEx Marker 3"}
  157. };
  158.  
  159. //roadwork list //done
  160. new gRoadObjsList[][E_DB_OBJ_LIST] =
  161. {
  162.     {1237, "Oarnge Barral"},
  163.     {1238, "Traffic Cone"},
  164.     {1282, "Small Road Block"},
  165.     {1427, "Small Road Block 2"},
  166.     {1459, "Small Road Block 3"},
  167.     {1422, "Road Block"},
  168.     {1423, "Road Block 2"},
  169.     {1424, "Road Block 3"},
  170.     {1425, "Detour Sign"},
  171.     {19467, "vehicle barrier"}
  172. };
  173.  
  174. //Misc list //done
  175. new gMiscObjsList[][E_DB_OBJ_LIST] =
  176. {
  177.     {19086, "Chainsaw Dildo"},
  178.     {19128, "Dance Floor 1"},
  179.     {19129, "Dance Floor 2"},
  180.     {18771, "Spiral Stairs"},
  181.     {18850, "HeliPad 1"},
  182.     {19273, "Keypad Non Dynamic"},
  183.     {18861, "scaffoldlift"},
  184.     {18880, "SpeedCamera"},
  185.     {18885, "Gun Vending Machine"},
  186.     {19425, "Speed Bump"},
  187.     {19278,"LiftPlatform1"},
  188.     {2780, "Smoke Machine"},
  189.     {19470, "For Sale 1"},
  190.     {19471, "For Sale 2"}
  191. };
  192.  
  193. //Spotlight list //done
  194. new gLightObjsList[][E_DB_OBJ_LIST] =
  195. {
  196.     {19143, "Pin SpotLight 1"},
  197.     {19144, "Pin SpotLight 2"},
  198.     {19145, "Pin SpotLight 3"},
  199.     {19146, "Pin SpotLight 4"},
  200.     {19147, "Pin SpotLight 5"},
  201.     {19148, "Pin SpotLight 6"},
  202.     {19149, "Pin SpotLight 7"},
  203.     {19150, "Pin SpotLight 8"},
  204.     {19151, "Pin SpotLight 9"},
  205.     {19152, "Pin SpotLight 10"},
  206.     {19153, "Pin SpotLight 11"},
  207.     {19154, "Pin SpotLight 12"},
  208.     {19155, "Pin SpotLight 13"},
  209.     {19156, "Pin SpotLight 14"},
  210.     {18656, "Beam White"},
  211.     {18657, "Beam Red"},
  212.     {18658, "Beam Blue"},
  213.     {18643, "Laser Red"},
  214.     {19080, "Laser Blue"},
  215.     {19081, "Laser Purple"},
  216.     {19082, "Laser Orange"},
  217.     {19083, "Laser Green"},
  218.     {19084, "Laser Yellow"},
  219.     {19121, "Bollard White"},
  220.     {19122, "Bollard Blue"},
  221.     {19123, "Bollard Green"},
  222.     {19124, "Bollard Red"},
  223.     {19125, "Bollard Yellow"},
  224.     {19126, "Bollard Light Blue"},
  225.     {19127, "Bollard Pink"}
  226. };
  227.  
  228.  
  229. //Neon list //done
  230. new gNeonObjsList[][E_DB_OBJ_LIST] =
  231. {
  232.     {9123, "Tunnel"},
  233.     {18647, "Red Tube"},
  234.     {18648, "Blue Tube"},
  235.     {18649, "Green Tube"},
  236.     {18650, "Yellow Tube"},
  237.     {18651, "Pink Tube"},
  238.     {18652, "White Tube"},
  239.     {7097,  "vRock"},
  240.     {9125, "Lxor"},
  241.     {9129, "Pirate"}
  242. };
  243.  
  244. //Misc list //done
  245. new gMapObjsList[][E_DB_OBJ_LIST] =
  246. {
  247.     {19164, "Map 1"},
  248.     {19165, "Map 2"},
  249.     {19166, "Map 3"},
  250.     {19167, "Map 4"},
  251.     {19168, "Map 5"},
  252.     {19169, "Map 6"},
  253.     {19170, "Map 7"},
  254.     {19171, "Map 8"}
  255. };
  256.  
  257.  
  258. //glass list //done
  259. new gBreakableObjsList[][E_DB_OBJ_LIST] =
  260. {
  261.     {1517,  "Bar Bottle"},
  262.     {19818, "Wine Glass"},
  263.     {19819, "Martini Glass"},
  264.     {19820, "Glass Bottle"},
  265.     {19821, "Glass Bottle"},
  266.     {19822, "Glass Bottle"},
  267.     {19823, "Glass Bottle"},
  268.     {19824, "Glass Bottle"},
  269.     {19570, "Milk Jar"}
  270. };
  271. /*
  272. //glass list //done
  273. new gPoliceObjsList[][E_DB_OBJ_LIST] =
  274. {
  275.     {19797, "Police Light Visor"},
  276.     {19834, "Police Line Tape"},
  277.     {18646, "Police Light (Single Red)"},
  278.     {19419, "Police Light Bar (on)"},
  279.     {19420, "Police Light Bar (off)"},
  280.     {19620, "Police Light Bar"}
  281.     };
  282. */
  283.  
  284. stock ShowCreateBreakableDialog(playerid)
  285. {
  286.     new strDialog[1024];
  287.     for (new i=0,len = sizeof(gBreakableObjsList);i<len;i++){
  288.         if      (i==0) format(strDialog, sizeof (strDialog), "%s", gBreakableObjsList[i][E_DB_OBJ_LIST_NAME]);
  289.         else    format(strDialog, sizeof (strDialog), "%s\n%s", strDialog, gBreakableObjsList[i][E_DB_OBJ_LIST_NAME]); 
  290.     }
  291.     return ShowPlayerDialog(playerid,DIALOG_BREAK_OBJS,DIALOG_STYLE_LIST,"Select A Map Obj",strDialog,"Ok","Cancel");
  292. }
  293.  
  294. stock ShowCreateMapDialog(playerid)
  295. {
  296.     new strDialog[1024];
  297.     for (new i=0,len = sizeof(gMapObjsList);i<len;i++){
  298.         if      (i==0) format(strDialog, sizeof (strDialog), "%s", gMapObjsList[i][E_DB_OBJ_LIST_NAME]);
  299.         else    format(strDialog, sizeof (strDialog), "%s\n%s", strDialog, gMapObjsList[i][E_DB_OBJ_LIST_NAME]);   
  300.     }
  301.     return ShowPlayerDialog(playerid,DIALOG_MAP_OBJS,DIALOG_STYLE_LIST,"Select A Map Obj",strDialog,"Ok","Cancel");
  302. }
  303. stock ShowCreateLightDialog(playerid)
  304. {
  305.     new strDialog[1024];
  306.     for (new i=0,len = sizeof(gLightObjsList);i<len;i++){
  307.         if      (i==0) format(strDialog, sizeof (strDialog), "%s", gLightObjsList[i][E_DB_OBJ_LIST_NAME]);
  308.         else    format(strDialog, sizeof (strDialog), "%s\n%s", strDialog, gLightObjsList[i][E_DB_OBJ_LIST_NAME]); 
  309.     }
  310.     return ShowPlayerDialog(playerid,DIALOG_LIGHT_OBJS,DIALOG_STYLE_LIST,"Select A Light Obj",strDialog,"Ok","Cancel");
  311. }
  312.  
  313. stock ShowCreateMiscDialog(playerid)
  314. {
  315.     new strDialog[1024];
  316.    
  317.     for (new i=0,len = sizeof(gMiscObjsList);i<len;i++){
  318.         if      (i==0) format(strDialog, sizeof (strDialog), "%s", gMiscObjsList[i][E_DB_OBJ_LIST_NAME]);
  319.         else    format(strDialog, sizeof (strDialog), "%s\n%s", strDialog, gMiscObjsList[i][E_DB_OBJ_LIST_NAME]);  
  320.     }
  321.     return ShowPlayerDialog(playerid,DIALOG_MISC_OBJS,DIALOG_STYLE_LIST,"Select A Misc Obj",strDialog,"Ok","Cancel");
  322. }
  323.  
  324. stock ShowCreateArrowDialog(playerid)
  325. {
  326.     new strDialog[1024];
  327.     for (new i=0,len = sizeof(gArrowObjsList);i<len;i++){
  328.         if      (i==0) format(strDialog, sizeof (strDialog), "%s", gArrowObjsList[i][E_DB_OBJ_LIST_NAME]);
  329.         else    format(strDialog, sizeof (strDialog), "%s\n%s", strDialog, gArrowObjsList[i][E_DB_OBJ_LIST_NAME]); 
  330.     }
  331.     return ShowPlayerDialog(playerid,DIALOG_ARROW_OBJS,DIALOG_STYLE_LIST,"Select A Arrow Obj",strDialog,"Ok","Cancel");
  332. }
  333.  
  334. stock ShowCreateSkyDiveDialog(playerid)
  335. {
  336.     new strDialog[1024];
  337.     for (new i=0,len = sizeof(gSkyDiveObjsList);i<len;i++){
  338.         if      (i==0) format(strDialog, sizeof (strDialog), "%s", gSkyDiveObjsList[i][E_DB_OBJ_LIST_NAME]);
  339.         else    format(strDialog, sizeof (strDialog), "%s\n%s", strDialog, gSkyDiveObjsList[i][E_DB_OBJ_LIST_NAME]);   
  340.     }
  341.     return ShowPlayerDialog(playerid,DIALOG_SKYDIVE_OBJS,DIALOG_STYLE_LIST,"Select A SkyDive Obj",strDialog,"Ok","Cancel");
  342. }
  343.  
  344. stock ShowCreateTubeDialog(playerid)
  345. {
  346.     new strDialog[1024];
  347.     for (new i=0,len = sizeof(gTubeObjsList);i<len;i++){
  348.         if      (i==0) format(strDialog, sizeof (strDialog), "%s", gTubeObjsList[i][E_DB_OBJ_LIST_NAME]);
  349.         else    format(strDialog, sizeof (strDialog), "%s\n%s", strDialog, gTubeObjsList[i][E_DB_OBJ_LIST_NAME]);  
  350.     }
  351.     return ShowPlayerDialog(playerid,DIALOG_TUBE_OBJS,DIALOG_STYLE_LIST,"Select A Tube",strDialog,"Ok","Cancel");
  352. }
  353.  
  354. stock ShowCreateRampDialog(playerid)
  355. {
  356.     new strDialog[1024];
  357.     for (new i=0,len = sizeof(gRampObjsList);i<len;i++){
  358.         if      (i==0) format(strDialog, sizeof (strDialog), "%s", gRampObjsList[i][E_DB_OBJ_LIST_NAME]);
  359.         else    format(strDialog, sizeof (strDialog), "%s\n%s", strDialog, gRampObjsList[i][E_DB_OBJ_LIST_NAME]);  
  360.     }
  361.     return ShowPlayerDialog(playerid,DIALOG_RAMP_OBJS,DIALOG_STYLE_LIST,"Select A Ramp",strDialog,"Ok","Cancel");
  362. }
  363.  
  364. stock ShowCreateRoadWorkDialog(playerid)
  365. {
  366.     new strDialog[1024];
  367.    
  368.     for (new i=0,len = sizeof(gRoadObjsList);i<len;i++){
  369.         if      (i==0) format(strDialog, sizeof (strDialog), "%s", gRoadObjsList[i][E_DB_OBJ_LIST_NAME]);
  370.         else    format(strDialog, sizeof (strDialog), "%s\n%s", strDialog, gRoadObjsList[i][E_DB_OBJ_LIST_NAME]);  
  371.     }
  372.     return ShowPlayerDialog(playerid,DIALOG_ROAD_OBJS,DIALOG_STYLE_LIST,"Select A Road Object",strDialog,"Ok","Cancel");
  373. }
  374.  
  375. stock ShowCreateNeonDialog(playerid)
  376. {
  377.     new strDialog[1024];
  378.     for (new i=0,len = sizeof(gNeonObjsList);i<len;i++){
  379.         if      (i==0) format(strDialog, sizeof (strDialog), "%s", gNeonObjsList[i][E_DB_OBJ_LIST_NAME]);
  380.         else    format(strDialog, sizeof (strDialog), "%s\n%s", strDialog, gNeonObjsList[i][E_DB_OBJ_LIST_NAME]);  
  381.     }
  382.     return ShowPlayerDialog(playerid,DIALOG_NEON_OBJS,DIALOG_STYLE_LIST,"Select A Neon Obj",strDialog,"Ok","Cancel");
  383. }
  384.  
  385. new strCObjDialog[1024];
  386.  
  387. stock ShowCreateObjDialog(playerid)
  388. {
  389.     if(strCObjDialog[0]==EOS)
  390.     {
  391.         format
  392.         (
  393.             strCObjDialog,
  394.             sizeof(strCObjDialog),
  395.             "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
  396.             "RoadWork",
  397.             "Ramp",
  398.             "Tube",
  399.             "SkyDive",
  400.             "Arrow",
  401.             "Light",
  402.             "Neon",
  403.             "Misc",
  404.             "Maps",
  405.             "Glass' Bottles",
  406.             "Select Obj",
  407.             "Select Closest Obj"
  408.         );
  409.     }
  410.     return ShowPlayerDialog(playerid,DIALOG_CREATE_OBJS,DIALOG_STYLE_LIST,"Select A Object Type",strCObjDialog,"Ok","Cancel");
  411. }
  412.  
  413.  
  414. YCMD:cbreakable(playerid, params[], help)
  415. {
  416.     #pragma unused params
  417.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/cBreakable : create a Breakable object");}
  418.     else        {ShowCreateBreakableDialog(playerid);}
  419.     return 1;
  420. }
  421.  
  422.  
  423. YCMD:cmap(playerid, params[], help)
  424. {
  425.     #pragma unused params
  426.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/cMap : create a Map object");}
  427.     else        {ShowCreateMapDialog(playerid);}
  428.     return 1;
  429. }
  430. YCMD:cneon(playerid, params[], help)
  431. {
  432.     #pragma unused params
  433.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/cNeon : create a Neon object");}
  434.     else        {ShowCreateNeonDialog(playerid);}
  435.     return 1;
  436. }
  437.  
  438. YCMD:clight(playerid, params[], help)
  439. {
  440.     #pragma unused params
  441.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/cLight : create a Light object");}
  442.     else        {ShowCreateLightDialog(playerid);}
  443.     return 1;
  444. }
  445.  
  446. YCMD:cmisc(playerid, params[], help)
  447. {
  448.     #pragma unused params
  449.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/cMisc : create a Misc object");}
  450.     else        {ShowCreateMiscDialog(playerid);}
  451.     return 1;
  452. }
  453.  
  454. YCMD:carrow(playerid, params[], help)
  455. {
  456.     #pragma unused params
  457.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/cArrow : create a Arrow object");}
  458.     else        {ShowCreateArrowDialog(playerid);}
  459.     return 1;
  460. }
  461.  
  462. YCMD:cskydive(playerid, params[], help)
  463. {
  464.     #pragma unused params
  465.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/cSkyDive : create a SkyDive object");}
  466.     else        {ShowCreateSkyDiveDialog(playerid);}
  467.     return 1;
  468. }
  469.  
  470. YCMD:ctube(playerid, params[], help)
  471. {
  472.     #pragma unused params
  473.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/cTube : create a Tube object");}
  474.     else        {ShowCreateTubeDialog(playerid);}
  475.     return 1;
  476. }
  477.  
  478. YCMD:cramp(playerid, params[], help)
  479. {
  480.     #pragma unused params
  481.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/cRamp : create a ramp object");}
  482.     else        {ShowCreateRampDialog(playerid);}
  483.     return 1;
  484. }
  485.  
  486. YCMD:croadwork(playerid, params[], help)
  487. {
  488.     #pragma unused params
  489.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/cRoadWork : create a Road Work object");}
  490.     else        {ShowCreateRoadWorkDialog(playerid);}
  491.     return 1;
  492. }
  493.  
  494. YCMD:cobj(playerid, params[], help)
  495. {
  496.     #pragma unused params
  497.     /*
  498.     new strOut[128];
  499.     format
  500.     (
  501.         strOut,
  502.         sizeof(strOut),
  503.         "%s %s %s %s %s %s %s %s %s %s",
  504.         "/cRoadWork",
  505.         "/cRamp",
  506.         "/cTube",
  507.         "/cSkyDive",
  508.         "/cArrow",
  509.         "/cLight",
  510.         "/cNeon",
  511.         "/cMisc",
  512.         "/sobj",
  513.         "/scobj"
  514.     );
  515.     SendClientMessage(playerid, 0xFF9933FF, strOut);
  516.     */
  517.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/cobj : creates / edits an object");}
  518.     else        {ShowCreateObjDialog(playerid);}
  519.     return 1;
  520. }
  521.  
  522.  
  523. YCMD:sobj(playerid, params[], help)
  524. {
  525.     #pragma unused params
  526.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/sobj  :  select an object to edit");}
  527.     else       
  528.     {
  529.         SelectObject(playerid);
  530.         SendClientMessage(playerid, 0xFF9933FF, "SERVER: Please select the object you'd like to edit!");
  531.     }
  532.     return 1;
  533. }
  534.  
  535. YCMD:scloseobj(playerid, params[], help)
  536. {
  537.     #pragma unused params
  538.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/scloseobj  [range : default 25.0]:  selects an object close to you to edit");}
  539.     else       
  540.     {
  541.         new Float:selRange;
  542.         if (sscanf(params, "f",selRange)) selRange = 25.0;
  543.         new closeObj = GetClosestObject(playerid,selRange);
  544.         dprintf("Closest obj to edit %i",closeObj);
  545.         if (closeObj)
  546.         {
  547.             EditObject(playerid, closeObj);
  548.             SendClientMessage(playerid, 0xFF9933FF, "SERVER: You are now editing the  closest obj to you.");
  549.         }
  550.         else
  551.         {
  552.             SendClientMessage(playerid, 0xFF9933FF, "SERVER: No Object found close to you, try getting closer to the obj your trying to edit. or use the range param");
  553.             SendClientMessage(playerid, 0xFF9933FF, "/scloseobj  [range : default 25.0]:  selects an object close to you to edit");
  554.         }
  555.        
  556.     }
  557.     return 1;
  558. }
  559.  
  560. /*
  561. //objects!!!!!!
  562. YCMD:cobj(playerid, params[], help)
  563. {
  564.     //#pragma unused params
  565.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/cobj : create an obj");}
  566.     else       
  567.     {
  568.         ShowCreateRampDialog(playerid);
  569.     }
  570.     return 1;
  571. }
  572. */
  573.  
  574.  
  575.  
  576. stock GetClosestObject(playerid, Float:range = 25.0)
  577. {
  578.    
  579.     new Float:dist, Float:cdist=FLOAT_INFINITY, cobj=0;
  580.     for(new i=0; i < MAX_DB_OBJS; i++)
  581.     {
  582.         if(gDBObjs[i][E_DB_OBJ_MODEL])
  583.         {
  584.             dist =
  585.             GetPlayerDistanceFromPoint
  586.             (
  587.                 playerid,
  588.                 gDBObjs[i][E_DB_OBJ_X],
  589.                 gDBObjs[i][E_DB_OBJ_Y],
  590.                 gDBObjs[i][E_DB_OBJ_Z]
  591.             );
  592.             if(dist < cdist)
  593.             {
  594.                 cdist = dist;
  595.                 cobj = i;
  596.             }
  597.         }
  598.     }
  599.     if (cdist < range) return cobj;
  600.     return 0;
  601. }
  602.  
  603.  
  604. stock CreateObjDBTable(DB:db)
  605. {
  606.     CreateDbTable
  607.     (
  608.         db,         //database ref
  609.         "OBJS",     //table name
  610.         true,       //create an index field (ID)
  611.         //table fields
  612.         "MODEL",
  613.         "X",
  614.         "Y",
  615.         "Z",
  616.         "RX",
  617.         "RY",
  618.         "RZ"
  619.     );
  620.     return 1;
  621. }
  622.  
  623. stock DeleteObjFromDB (DB:db, objectid)
  624. {
  625.     new Query[256];
  626.  
  627.     format(Query, sizeof(Query), "DELETE FROM OBJS WHERE ID=%i", gDBObjs[objectid][E_DB_OBJ_DB_ID]);
  628.     db_query(db, Query);
  629.     dprint(Query);
  630.     gDBObjs[objectid][E_DB_OBJ_DB_ID]   = 0;
  631.     gDBObjs[objectid][E_DB_OBJ_MODEL]   = 0;
  632.     gDBObjs[objectid][E_DB_OBJ_X]       = 0.0;
  633.     gDBObjs[objectid][E_DB_OBJ_Y]       = 0.0;
  634.     gDBObjs[objectid][E_DB_OBJ_Z]       = 0.0;
  635.     gDBObjs[objectid][E_DB_OBJ_RX]      = 0.0;
  636.     gDBObjs[objectid][E_DB_OBJ_RY]      = 0.0;
  637.     gDBObjs[objectid][E_DB_OBJ_RZ]      = 0.0;
  638.     dprint("obj DELETED FROM db");
  639.     return 1;
  640. }
  641.  
  642. stock AddObjToDB (DB:db, objectid)
  643. {
  644.     new Query[256],
  645.         Query_Values[128],
  646.         DBResult:Result,
  647.         str[10];
  648.     format
  649.     (
  650.         Query_Values,
  651.         sizeof(Query_Values),
  652.         "'%i','%f','%f','%f','%f','%f','%f'",
  653.         gDBObjs[objectid][E_DB_OBJ_MODEL],
  654.         gDBObjs[objectid][E_DB_OBJ_X],
  655.         gDBObjs[objectid][E_DB_OBJ_Y],
  656.         gDBObjs[objectid][E_DB_OBJ_Z],
  657.         gDBObjs[objectid][E_DB_OBJ_RX],
  658.         gDBObjs[objectid][E_DB_OBJ_RY],
  659.         gDBObjs[objectid][E_DB_OBJ_RZ]
  660.     );
  661.     format(Query, sizeof(Query), "INSERT INTO OBJS (`MODEL`,`X`, `Y`, `Z`, `RX`, `RY`, `RZ`) VALUES(%s)", Query_Values);
  662.     dprint(Query);
  663.     db_query(db, Query);
  664.     Result = db_query(db, "SELECT `ID` FROM `OBJS` ORDER BY `ID` DESC LIMIT 1");
  665.     db_get_field_assoc(Result,"ID",str,sizeof(str));
  666.     db_free_result(Result);
  667.     gDBObjs[objectid][E_DB_OBJ_DB_ID] = strval(str);
  668.     dprint("obj added to db");
  669.     return 1;
  670. }
  671.  
  672.  
  673. stock UpdateObjToDB (DB:db, objectid)
  674. {
  675.     new str_Query[1024];
  676.     format(
  677.         str_Query, sizeof(str_Query),
  678.         "UPDATE `OBJS` SET `MODEL`='%i', `X`='%f', `Y`='%f', `Z`='%f', `RX`='%f', `RY`='%f', `RZ`='%f' WHERE `ID`=%i",
  679.         gDBObjs[objectid][E_DB_OBJ_MODEL],
  680.         gDBObjs[objectid][E_DB_OBJ_X],
  681.         gDBObjs[objectid][E_DB_OBJ_Y],
  682.         gDBObjs[objectid][E_DB_OBJ_Z],
  683.         gDBObjs[objectid][E_DB_OBJ_RX],
  684.         gDBObjs[objectid][E_DB_OBJ_RY],
  685.         gDBObjs[objectid][E_DB_OBJ_RZ],
  686.         gDBObjs[objectid][E_DB_OBJ_DB_ID]
  687.     );
  688.     db_query(db,str_Query);
  689.     dprint(str_Query);
  690.     return 1;
  691. }
  692.  
  693.  
  694.  
  695. forward LoadObjsDb(DB:db);
  696. public LoadObjsDb(DB:db)
  697. {
  698.     new
  699.         DBResult:Result,
  700.         mLoaded
  701.     ;
  702.     Result = db_query( db, "SELECT * FROM `OBJS`" );
  703.     for(new a,r=db_num_rows(Result);a<r;a++)
  704.     {
  705.         new str[256],str2[128];
  706.         db_get_field_assoc(Result,"ID",str2,sizeof(str2));
  707.         strcat(str,str2);
  708.         strcat(str," ");
  709.         db_get_field_assoc(Result,"MODEL",str2,sizeof(str2));
  710.         strcat(str,str2);
  711.         strcat(str," ");
  712.         db_get_field_assoc(Result,"X",str2,sizeof(str2));
  713.         strcat(str,str2);
  714.         strcat(str," ");
  715.         db_get_field_assoc(Result,"Y",str2,sizeof(str2));
  716.         strcat(str,str2);
  717.         strcat(str," ");
  718.         db_get_field_assoc(Result,"Z",str2,sizeof(str2));
  719.         strcat(str,str2);
  720.         strcat(str," ");
  721.         db_get_field_assoc(Result,"RX",str2,sizeof(str2));
  722.         strcat(str,str2);
  723.         strcat(str," ");
  724.         db_get_field_assoc(Result,"RY",str2,sizeof(str2));
  725.         strcat(str,str2);
  726.         strcat(str," ");
  727.         db_get_field_assoc(Result,"RZ",str2,sizeof(str2));
  728.         strcat(str,str2);
  729.        
  730.         if(!sscanf(
  731.                 str,
  732.                 "iiffffff",
  733.                 gDBObjs[0][E_DB_OBJ_DB_ID],
  734.                 gDBObjs[0][E_DB_OBJ_MODEL],
  735.                 gDBObjs[0][E_DB_OBJ_X],
  736.                 gDBObjs[0][E_DB_OBJ_Y],
  737.                 gDBObjs[0][E_DB_OBJ_Z],
  738.                 gDBObjs[0][E_DB_OBJ_RX],
  739.                 gDBObjs[0][E_DB_OBJ_RY],
  740.                 gDBObjs[0][E_DB_OBJ_RZ]
  741.         ))
  742.         {
  743.             mLoaded++;
  744.            
  745.             new objectid =
  746.             CreateObject
  747.             (
  748.                 gDBObjs[0][E_DB_OBJ_MODEL],
  749.                 gDBObjs[0][E_DB_OBJ_X],
  750.                 gDBObjs[0][E_DB_OBJ_Y],
  751.                 gDBObjs[0][E_DB_OBJ_Z],
  752.                 gDBObjs[0][E_DB_OBJ_RX],
  753.                 gDBObjs[0][E_DB_OBJ_RY],
  754.                 gDBObjs[0][E_DB_OBJ_RZ]
  755.             );
  756.            
  757.            
  758.             sscanf(
  759.                 str,
  760.                 "iiffffff",
  761.                 gDBObjs[objectid][E_DB_OBJ_DB_ID],
  762.                 gDBObjs[objectid][E_DB_OBJ_MODEL],
  763.                 gDBObjs[objectid][E_DB_OBJ_X],
  764.                 gDBObjs[objectid][E_DB_OBJ_Y],
  765.                 gDBObjs[objectid][E_DB_OBJ_Z],
  766.                 gDBObjs[objectid][E_DB_OBJ_RX],
  767.                 gDBObjs[objectid][E_DB_OBJ_RY],
  768.                 gDBObjs[objectid][E_DB_OBJ_RZ]
  769.             );
  770.         }
  771.         db_next_row(Result);
  772.     }
  773.     db_free_result(Result);
  774.     printf("Loaded %d Objects from: database",mLoaded);
  775.     return 1;
  776. }
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  /*
  804.  YCMD:mobj(playerid, params[], help)
  805. {
  806.     //#pragma unused params
  807.     if (help)   {SendClientMessage(playerid, 0xFF9933FF, "/mobj [objId][text] :  ");}
  808.     else       
  809.     {
  810.         new objectid,strIn[128];
  811.         if (sscanf(params,"is[128]",objectid,strIn)) return SendClientMessage(playerid, 0xFF9933FF, "/mobj [objId][text] :  ");
  812.         if (!IsValidObject(objectid)) return SendClientMessage(playerid, 0xFF9933FF, "/mobj [objId][text] :  Invalid objId");
  813.        
  814.         //new myobject = CreateObject(19353, 0, 0, 10, 0.0, 0.0, 90.0); //create the object
  815.         SetObjectMaterialText
  816.         (
  817.             objectid,
  818.             strIn,
  819.             0,
  820.             OBJECT_MATERIAL_SIZE_512x512  ,
  821.             "Arial",
  822.             28,
  823.             0,
  824.             0xFFFF8200,  //argb
  825.             0xFF000000,  //argb
  826.             OBJECT_MATERIAL_TEXT_ALIGN_CENTER
  827.         );
  828.        
  829.        
  830.         new strOut[128];
  831.         format(strOut,128,"ObjID (%i) mat updated",objectid);
  832.         SendClientMessage(playerid, 0xFF9933FF, strOut);
  833.     }
  834.     return 1;
  835. }
  836.  
  837. */
  838.  
  839.  
  840.  
  841.  
  842.  
  843. //-----------------------------------------------------------------------------------------------------
  844. /*
  845. native CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 200.0);
  846. native DestroyDynamicObject(objectid);
  847. native IsValidDynamicObject(objectid);
  848. native SetDynamicObjectPos(objectid, Float:x, Float:y, Float:z);
  849. native GetDynamicObjectPos(objectid, &Float:x, &Float:y, &Float:z);
  850. native SetDynamicObjectRot(objectid, Float:rx, Float:ry, Float:rz);
  851. native GetDynamicObjectRot(objectid, &Float:rx, &Float:ry, &Float:rz);
  852. native MoveDynamicObject(objectid, Float:x, Float:y, Float:z, Float:speed);
  853. native StopDynamicObject(objectid);
  854. native DestroyAllDynamicObjects();
  855. native CountDynamicObjects();
  856. */
  857. //For more info on ALS Hooking check
  858. //http://forum.sa-mp.com/showthread.php?t=85907
  859. /*
  860. static gOBJS_HasCB[1];
  861.  
  862. //--------------OnGameModeInit Hook-------------------
  863.  
  864. public OnGameModeInit()
  865. {
  866.     //your OnGameModeInit pre code here
  867.  
  868.     //function hook checks
  869.  
  870.     gOBJS_HasCB[0] = funcidx("OBJS_OnPlayerEditObject") != -1;
  871.     if (funcidx("OBJS_OnGameModeInit") != -1)
  872.     {
  873.         return CallLocalFunction("OBJS_OnGameModeInit", "");
  874.     }
  875.     //your OnGameModeInit post code here
  876.  
  877.     return 1;
  878. }
  879.  
  880. #if defined _ALS_OnGameModeInit
  881.     #undef OnGameModeInit
  882. #else
  883.     #define _ALS_OnGameModeInit
  884. #endif
  885. #define OnGameModeInit OBJS_OnGameModeInit
  886. forward OBJS_OnGameModeInit();
  887.  
  888.  
  889.  
  890. //--------------OnPlayerEditObject Hook-------------------
  891.  
  892. public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
  893. {
  894.     new strOut[128];
  895.     if(!IsValidObject(objectid)) return 0;
  896.     if(!playerobject) // If this is a global object, move it for other players
  897.     {
  898.         MoveObject(objectid, fX, fY, fZ, 100.0);
  899.     }
  900.  
  901.     if(response == EDIT_RESPONSE_FINAL)
  902.     {
  903.             // Do anything here to save (or revert) the updated object position
  904.         format
  905.         (
  906.             strOut,
  907.             128,
  908.             "Object Saved, objid(%i) x(%.02f) y(%.02f) z(%.02f) rx(%.02f) ry(%.02f) rz(%.02f)",
  909.             objectid,
  910.             fX,
  911.             fY,
  912.             fZ,
  913.             fRotX,
  914.             fRotY,
  915.             fRotZ
  916.         );
  917.         SendClientMessage(playerid,-1,strOut);
  918.         // (optional) put them back in selection mode after they click save
  919.         //SelectObject(playerid);
  920.     }
  921.     if (response == EDIT_RESPONSE_CANCEL)
  922.     {
  923.         DestroyObject(objectid);
  924.     }
  925.    
  926.    
  927.     //
  928.     if (gOBJS_HasCB[0])
  929.     {
  930.         return CallLocalFunction("OBJS_OnPlayerEditObject", "iiiiffffff",playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ);
  931.     }
  932.     return 1;
  933. }
  934. #if defined _ALS_OnPlayerEditObject
  935.     #undef OnPlayerEditObject
  936. #else
  937.     #define _ALS_OnPlayerEditObject
  938. #endif
  939. #define OnPlayerEditObject OBJS_OnPlayerEditObject
  940. forward OBJS_OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ);
  941.  
  942. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement