Advertisement
ZulRocky

Attachments

Jul 14th, 2015
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 17.14 KB | None | 0 0
  1. //Player Attachments system by Excel
  2. //==============================================================================
  3. #include <a_samp>
  4. #include <a_mysql>
  5. #include <mSelection>
  6. #include <sscanf2>
  7. #include <YSI\y_ini>
  8. #include <izcmd>
  9. //==============================================================================
  10. #define     SQL_HOST            "localhost"
  11. #define     SQL_USER            "root"
  12. #define     SQL_PASSWORD        ""
  13. #define     SQL_DBNAME          "sa-mp"
  14. //==============================================================================
  15. #define DIALOG_ATTACH_INDEX             13500
  16. #define DIALOG_ATTACH_INDEX_SELECTION   DIALOG_ATTACH_INDEX+1
  17. #define DIALOG_ATTACH_EDITREPLACE       DIALOG_ATTACH_INDEX+2
  18. #define DIALOG_ATTACH_MODEL_SELECTION   DIALOG_ATTACH_INDEX+3
  19. #define DIALOG_ATTACH_BONE_SELECTION    DIALOG_ATTACH_INDEX+4
  20. #define DIALOG_ATTACH_OBJECT_SELECTION  DIALOG_ATTACH_INDEX+5
  21. #define DIALOG_ATTACH_OBJECT2_SELECTION DIALOG_ATTACH_INDEX+6
  22. //==============================================================================
  23. #define MAX_OSLOTS  MAX_PLAYER_ATTACHED_OBJECTS
  24. //==============================================================================
  25. #define     COL_WHITE       "{FFFFFF}"
  26. #define     COL_BLACK       "{0E0101}"
  27. #define     COL_GREY        "{C3C3C3}"
  28. #define     COL_GREEN       "{6EF83C}"
  29. #define     COL_RED         "{F81414}"
  30. #define     COL_YELLOW      "{F3FF02}"
  31. #define     COL_ORANGE      "{FFAF00}"
  32. #define     COL_LIME        "{B7FF00}"
  33. #define     COL_CYAN        "{00FFEE}"
  34. #define     COL_BLUE        "{0049FF}"
  35. #define     COL_MAGENTA     "{F300FF}"
  36. #define     COL_VIOLET      "{B700FF}"
  37. #define     COL_PINK        "{FF00EA}"
  38. #define     COL_MARONE      "{A90202}"
  39. //==============================================================================
  40. new AttachmentObjectsList[] = {
  41. 18632,
  42. 18633,
  43. 18634,
  44. 18635,
  45. 18636,
  46. 18637,
  47. 18638,
  48. 18639,
  49. 18640,
  50. 18975,
  51. 19136,
  52. 19274,
  53. 18641,
  54. 18642,
  55. 18643,
  56. 18644,
  57. 18645,
  58. 18865,
  59. 18866,
  60. 18867,
  61. 18868,
  62. 18869,
  63. 18870,
  64. 18871,
  65. 18872,
  66. 18873,
  67. 18874,
  68. 18875,
  69. 18890,
  70. 18891,
  71. 18892,
  72. 18893,
  73. 18894,
  74. 18895,
  75. 18896,
  76. 18897,
  77. 18898,
  78. 18899,
  79. 18900,
  80. 18901,
  81. 18902,
  82. 18903,
  83. 18904,
  84. 18905,
  85. 18906,
  86. 18907,
  87. 18908,
  88. 18909,
  89. 18910,
  90. 18911,
  91. 18912,
  92. 18913,
  93. 18914,
  94. 18915,
  95. 18916,
  96. 18917,
  97. 18918,
  98. 18919,
  99. 18920,
  100. 18921,
  101. 18922,
  102. 18923,
  103. 18924,
  104. 18925,
  105. 18926,
  106. 18927,
  107. 18928,
  108. 18929,
  109. 18930,
  110. 18931,
  111. 18932,
  112. 18933,
  113. 18934,
  114. 18935,
  115. 18936,
  116. 18937,
  117. 18938,
  118. 18939,
  119. 18940,
  120. 18941,
  121. 18942,
  122. 18943,
  123. 18944,
  124. 18945,
  125. 18946,
  126. 18947,
  127. 18948,
  128. 18949,
  129. 18950,
  130. 18951,
  131. 18952,
  132. 18953,
  133. 18954,
  134. 18955,
  135. 18956,
  136. 18957,
  137. 18958,
  138. 18959,
  139. 18960,
  140. 18961,
  141. 18962,
  142. 18963,
  143. 18964,
  144. 18965,
  145. 18966,
  146. 18967,
  147. 18968,
  148. 18969,
  149. 18970,
  150. 18971,
  151. 18972,
  152. 18973,
  153. 18974,
  154. 18976,
  155. 18977,
  156. 18978,
  157. 18979,
  158. 19006,
  159. 19007,
  160. 19008,
  161. 19009,
  162. 19010,
  163. 19011,
  164. 19012,
  165. 19013,
  166. 19014,
  167. 19015,
  168. 19016,
  169. 19017,
  170. 19018,
  171. 19019,
  172. 19020,
  173. 19021,
  174. 19022,
  175. 19023,
  176. 19024,
  177. 19025,
  178. 19026,
  179. 19027,
  180. 19028,
  181. 19029,
  182. 19030,
  183. 19031,
  184. 19032,
  185. 19033,
  186. 19034,
  187. 19035,
  188. 19036,
  189. 19037,
  190. 19038,
  191. 19039,
  192. 19040,
  193. 19041,
  194. 19042,
  195. 19043,
  196. 19044,
  197. 19045,
  198. 19046,
  199. 19047,
  200. 19048,
  201. 19049,
  202. 19050,
  203. 19051,
  204. 19052,
  205. 19053,
  206. 19085,
  207. 19086,
  208. 19090,
  209. 19091,
  210. 19092,
  211. 19093,
  212. 19094,
  213. 19095,
  214. 19096,
  215. 19097,
  216. 19098,
  217. 19099,
  218. 19100,
  219. 19101,
  220. 19102,
  221. 19103,
  222. 19104,
  223. 19105,
  224. 19106,
  225. 19107,
  226. 19108,
  227. 19109,
  228. 19110,
  229. 19111,
  230. 19112,
  231. 19113,
  232. 19114,
  233. 19115,
  234. 19116,
  235. 19117,
  236. 19118,
  237. 19119,
  238. 19120,
  239. 19137,
  240. 19138,
  241. 19139,
  242. 19140,
  243. 19141,
  244. 19142,
  245. 19160,
  246. 19161,
  247. 19162,
  248. 19163,
  249. 19317,
  250. 19318,
  251. 19319,
  252. 19330,
  253. 19331,
  254. 19346,
  255. 19347,
  256. 19348,
  257. 19349,
  258. 19350,
  259. 19351,
  260. 19352,
  261. 19487,
  262. 19488,
  263. 19513,
  264. 19515,
  265. 331,
  266. 333,
  267. 334,
  268. 335,
  269. 336,
  270. 337,
  271. 338,
  272. 339,
  273. 341,
  274. 321,
  275. 322,
  276. 323,
  277. 324,
  278. 325,
  279. 326,
  280. 343,
  281. 346,
  282. 347,
  283. 348,
  284. 349,
  285. 350,
  286. 351,
  287. 352,
  288. 353,
  289. 355,
  290. 356,
  291. 372,
  292. 357,
  293. 358,
  294. 361,
  295. 363,
  296. 364,
  297. 365,
  298. 366,
  299. 367,
  300. 368,
  301. 369,
  302. 371
  303. };
  304. //==============================================================================
  305. new AttachmentBones[][24] = {
  306. {"Spine"},
  307. {"Head"},
  308. {"Left upper arm"},
  309. {"Right upper arm"},
  310. {"Left hand"},
  311. {"Right hand"},
  312. {"Left thigh"},
  313. {"Right thigh"},
  314. {"Left foot"},
  315. {"Right foot"},
  316. {"Right calf"},
  317. {"Left calf"},
  318. {"Left forearm"},
  319. {"Right forearm"},
  320. {"Left clavicle"},
  321. {"Right clavicle"},
  322. {"Neck"},
  323. {"Jaw"}
  324. };
  325.  
  326. enum attachmentInfo
  327. {
  328.     Amodel,
  329.     Abone,
  330.     Float:AfOffsetX,
  331.     Float:AfOffsetY,
  332.     Float:AfOffsetZ,
  333.     Float:AfRotX,
  334.     Float:AfRotY,
  335.     Float:AfRotZ,
  336.     Float:AfScaleX,
  337.     Float:AfScaleY,
  338.     Float:AfScaleZ
  339. }
  340. new aInfo[MAX_PLAYERS][MAX_OSLOTS][attachmentInfo];
  341. new SQLHandle;
  342. //==============================================================================
  343. CMD:o(playerid,params[])
  344. {
  345.     LoadAtt(playerid);
  346.     new string[128];
  347.     new dialog[500];
  348.     for(new x;x<MAX_OSLOTS;x++)
  349.     {
  350.         if(IsPlayerAttachedObjectSlotUsed(playerid, x))
  351.         {   format(string, sizeof(string), ""COL_WHITE"Slot:%d :: "COL_GREEN"Used Slot\n", x);    }
  352.         else format(string, sizeof(string), ""COL_WHITE"Slot:%d\n", x);
  353.         strcat(dialog,string);
  354.     }
  355.     ShowPlayerDialog(playerid, DIALOG_ATTACH_INDEX_SELECTION, DIALOG_STYLE_LIST,"Player Objects/Attachment: (Select Slot)", dialog, "Select", "Close(X)");
  356.     return 1;
  357. }
  358. CMD:att(playerid,params[])
  359. {
  360.     return cmd_o(playerid,params);
  361. }
  362. CMD:attachments(playerid,params[])
  363. {
  364.     return cmd_o(playerid,params);
  365. }
  366. CMD:hideatt(playerid,params[]){
  367.     for(new i; i<MAX_OSLOTS; i++)
  368.     {
  369.         if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
  370.     }
  371.     return 1;
  372. }
  373. CMD:showatt(playerid,params[]){
  374.     LoadAtt(playerid);
  375.     return 1;
  376. }
  377. //==============================================================================
  378. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  379. {
  380.     switch(dialogid)
  381.     {
  382.         case DIALOG_ATTACH_INDEX_SELECTION:
  383.         {
  384.             if(response)
  385.             {
  386.                 if(IsPlayerAttachedObjectSlotUsed(playerid, listitem))
  387.                 {
  388.                     ShowPlayerDialog(playerid, DIALOG_ATTACH_EDITREPLACE, DIALOG_STYLE_MSGBOX, \
  389.                     "Player Objects/Attachment: (Delete/Edit)", ""COL_WHITE"Do you wish to edit the attachment in that slot, or delete it?", "Edit(!)", "Delete(X)");
  390.                 }
  391.                 else
  392.                 {
  393.                     ShowPlayerDialog(playerid,DIALOG_ATTACH_OBJECT_SELECTION,DIALOG_STYLE_LIST,"Player Objects/Attachment: (Select Object Path)","Path:1 :: "COL_GREY"Server Objects Menu\n"COL_WHITE"Path:2 :: "COL_GREY"Custom Object","Next(>>)","Back(<<)");
  394.                 }
  395.                 SetPVarInt(playerid, "AttachmentIndexSel", listitem);
  396.             }
  397.             return 1;
  398.         }
  399.         case DIALOG_ATTACH_OBJECT_SELECTION:
  400.         {
  401.             if(!response)
  402.             {
  403.                 cmd_o(playerid,"");
  404.             }
  405.             if(response)
  406.             {
  407.                 if(listitem==0) ShowModelSelectionMenuEx(playerid, AttachmentObjectsList, 262, "Player Objects", DIALOG_ATTACH_MODEL_SELECTION, 0.0, 0.0, 0.0, 1.0, 0x00000099, 0x000000EE, 0xACCBF1FF);
  408.                 if(listitem==1) ShowPlayerDialog(playerid,DIALOG_ATTACH_OBJECT2_SELECTION,DIALOG_STYLE_INPUT,"Player Objects/Attachment: (Insert objectid)",""COL_WHITE"Put your custom objectid below, You can also take help from ''http://wiki.sa-mp.com''.","Edit","Back(<<)");
  409.             }
  410.         }
  411.         case DIALOG_ATTACH_OBJECT2_SELECTION:
  412.         {
  413.             if(!response)
  414.             {   ShowPlayerDialog(playerid,DIALOG_ATTACH_OBJECT_SELECTION,DIALOG_STYLE_LIST,"Player Objects/Attachment: (Select Object Path)","Path:1 :: "COL_GREY"Server Objects Menu\n"COL_WHITE"Path:2 :: "COL_GREY"Custom Object","Next(>>)","Back(<<)");    }
  415.             if(response)
  416.             {
  417.                 if(!strlen(inputtext))return SendClientMessage(playerid,-1,"PLAYER: You can't leave the coloumn blank."),ShowPlayerDialog(playerid,DIALOG_ATTACH_OBJECT2_SELECTION,DIALOG_STYLE_INPUT,"Player Objects/Attachment: (Insert objectid)",""COL_WHITE"Put your custom objectid below, You can also take help from ''http://wiki.sa-mp.com''.","Edit","Back(<<)");
  418.                 if(!IsNumeric(inputtext)) return SendClientMessage(playerid,-1,"PLAYER: You can't fill a object name, only object id's allowed."),ShowPlayerDialog(playerid,DIALOG_ATTACH_OBJECT2_SELECTION,DIALOG_STYLE_INPUT,"Player Objects/Attachment: (Insert objectid)",""COL_WHITE"Put your custom objectid below, You can also take help from ''http://wiki.sa-mp.com''.","Edit","Back(<<)");
  419.                 new obj;
  420.                 if(!sscanf(inputtext, "i", obj))
  421.                 {
  422.                     if(GetPVarInt(playerid, "AttachmentUsed") == 1) EditAttachedObject(playerid, obj);
  423.                     else
  424.                     {
  425.                         SetPVarInt(playerid, "AttachmentModelSel", obj);
  426.                         new string[256+1];
  427.                         new dialog[500];
  428.                         for(new x;x<sizeof(AttachmentBones);x++)
  429.                         {
  430.                             format(string, sizeof(string), "Bone:%s\n", AttachmentBones[x]);
  431.                             strcat(dialog,string);
  432.                         }
  433.                         ShowPlayerDialog(playerid, DIALOG_ATTACH_BONE_SELECTION, DIALOG_STYLE_LIST, \
  434.                         "{FF0000}Attachment Modification - Bone Selection", dialog, "Select", "Cancel");
  435.                     }
  436.                 }
  437.             }
  438.         }
  439.         case DIALOG_ATTACH_EDITREPLACE:
  440.         {
  441.             if(response) EditAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
  442.             else
  443.             {
  444.                 RemovePlayerAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
  445.                 new x=GetPVarInt(playerid, "AttachmentIndexSel"); //index id
  446.                 new query[129], name[MAX_PLAYER_NAME];
  447.                 GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  448.                 mysql_format(SQLHandle, query, sizeof(query), "DELETE FROM attachments WHERE name='%e' AND indx='%d'", name, x);
  449.                 mysql_tquery(SQLHandle, query, "", "");
  450.                 DeletePVar(playerid, "AttachmentIndexSel");
  451.             }
  452.             return 1;
  453.         }
  454.         case DIALOG_ATTACH_BONE_SELECTION:
  455.         {
  456.             if(response)
  457.             {
  458.                 SetPlayerAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"), GetPVarInt(playerid, "AttachmentModelSel"), listitem+1);
  459.                 EditAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
  460.                 SendClientMessage(playerid, 0xFFFFFFFF, "PLAYER: You can also hold SPAWN and use MOUSE to view from either sides.");
  461.             }
  462.             DeletePVar(playerid, "AttachmentIndexSel");
  463.             DeletePVar(playerid, "AttachmentModelSel");
  464.             return 1;
  465.         }
  466.     }
  467.     return 0;
  468. }
  469. //==============================================================================
  470. public OnFilterScriptInit()
  471. {
  472.     SQLHandle = mysql_connect(SQL_HOST, SQL_USER, SQL_DBNAME, SQL_PASSWORD);
  473.     mysql_log(LOG_ERROR | LOG_WARNING, LOG_TYPE_HTML);
  474.     if(mysql_errno() != 0) return print(" [Attachments] Can't connect to MySQL.");
  475.  
  476.     mysql_tquery(SQLHandle, "CREATE TABLE IF NOT EXISTS `attachments` (\
  477.       `ID` int(11) NOT NULL auto_increment,\
  478.       `name` varchar(30) NOT NULL,\
  479.       `indx` int(11) NOT NULL,\
  480.       `model` int(11) NOT NULL,\
  481.       `bone` int(11) NOT NULL,\
  482.       `setX` float NOT NULL,\
  483.       `setY` float NOT NULL,\
  484.       `setZ` float NOT NULL,\
  485.       `rotX` float NOT NULL,\
  486.       `rotY` float NOT NULL,\
  487.       `rotZ` float NOT NULL,\
  488.       `sclX` float NOT NULL,\
  489.       `sclY` float NOT NULL,\
  490.       `sclZ` float NOT NULL,\
  491.       PRIMARY KEY  (`ID`)\
  492.     ) ENGINE=MyISAM DEFAULT CHARSET=utf8;", "", "");
  493.  
  494.     return 1;
  495. }
  496. public OnFilterScriptExit()
  497. {
  498.     return 1;
  499. }
  500. //==============================================================================
  501. public OnPlayerEditAttachedObject( playerid, response, index, modelid, boneid,
  502.                                    Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ,
  503.                                    Float:fRotX, Float:fRotY, Float:fRotZ,
  504.                                    Float:fScaleX, Float:fScaleY, Float:fScaleZ )
  505. {
  506.     new debug_string[256+1];
  507.     format(debug_string,256,"SetPlayerAttachedObject(playerid,%d,%d,%d,%f,%f,%f,%f,%f,%f,%f,%f,%f)",
  508.         index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
  509.     SendClientMessage(playerid, -1, debug_string);
  510.  
  511.     SetPlayerAttachedObject(playerid,index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
  512.     SendClientMessage(playerid, 0xFFFFFFFF, "PLAYER: You have finished editing attachments, it has been saved to your database.");
  513.  
  514.     new name[MAX_PLAYER_NAME];
  515.     GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  516.     new query[130];
  517.     mysql_format(SQLHandle, query, sizeof(query), "SELECT * FROM attachments WHERE name='%e' AND indx='%d'", name, index);
  518.     mysql_tquery(SQLHandle, query, "", "");
  519.    
  520.     new rows, fields;
  521.     cache_get_data(rows, fields, SQLHandle);
  522.     new querys[500];
  523.     if(rows)
  524.     {
  525.         mysql_format(SQLHandle, querys, sizeof(querys), "UPDATE `attachments` SET model = %d, bone = %d, setX = %f, setY = %f, setZ = %f, rotX = %f, rotY = %f, rotZ = %f, sclX = %f, sclY = %f, sclZ = %f, WHERE `name` = '%e' AND `indx` = %d",
  526.         modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ,name,index);
  527.         //mysql_tquery(SQLHandle, querys, "", "");
  528.         mysql_function_query(SQLHandle,querys,false,"","");
  529.     }else{
  530.         mysql_format(SQLHandle, querys, sizeof(querys), "INSERT INTO `attachments`(`name`, `indx`, `model`, `bone`, `setX`, `setY`, `setZ`, `rotX`, `rotY`, `rotZ`, `sclX`, `sclY`, `sclZ`) VALUES ('%e',%d,%d,%d,%f,%f,%f,%f,%f,%f,%f,%f,%f)",
  531.         name,index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
  532.         //mysql_tquery(SQLHandle, querys2, "", "");
  533.         mysql_function_query(SQLHandle,querys,false,"","");
  534.     }
  535.     return 1;
  536. }
  537. //==============================================================================
  538. public OnPlayerConnect(playerid)
  539. {
  540.     return 0;
  541. }
  542. //==============================================================================
  543. public OnPlayerSpawn(playerid)
  544. {
  545.     LoadAtt(playerid);
  546.     return 1;
  547. }
  548. stock LoadAtt(playerid)
  549. {
  550.     new query[72], name[MAX_PLAYER_NAME];
  551.     GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  552.     mysql_format(SQLHandle, query, sizeof(query), "SELECT * FROM attachments WHERE name='%e'", name);
  553.     mysql_tquery(SQLHandle, query, "LoadPlayerAttachments", "i", playerid);
  554.     return 1;
  555. }
  556. forward LoadPlayerAttachments(playerid);
  557. public LoadPlayerAttachments(playerid)
  558. {
  559.     new id, loaded;
  560.     new rows = cache_num_rows();
  561.     if(rows)
  562.     {
  563.         while(loaded < rows)
  564.         {
  565.             id = cache_get_field_content_int(loaded, "indx");
  566.             aInfo[playerid][id][Amodel]          = cache_get_field_content_int(loaded, "model");
  567.             aInfo[playerid][id][Abone]           = cache_get_field_content_int(loaded, "bone");
  568.             aInfo[playerid][id][AfOffsetX]       = cache_get_field_content_int(loaded, "setX");
  569.             aInfo[playerid][id][AfOffsetY]       = cache_get_field_content_int(loaded, "setY");
  570.             aInfo[playerid][id][AfOffsetZ]       = cache_get_field_content_int(loaded, "setZ");
  571.             aInfo[playerid][id][AfRotX]          = cache_get_field_content_int(loaded, "rotX");
  572.             aInfo[playerid][id][AfRotY]          = cache_get_field_content_int(loaded, "rotY");
  573.             aInfo[playerid][id][AfRotZ]          = cache_get_field_content_int(loaded, "rotZ");
  574.             aInfo[playerid][id][AfScaleX]        = cache_get_field_content_int(loaded, "sclX");
  575.             aInfo[playerid][id][AfScaleY]        = cache_get_field_content_int(loaded, "sclY");
  576.             aInfo[playerid][id][AfScaleZ]        = cache_get_field_content_int(loaded, "sclZ");
  577.            
  578.             SetPlayerAttachedObject(playerid,id,
  579.             aInfo[playerid][id][Amodel],
  580.             aInfo[playerid][id][Abone],
  581.             aInfo[playerid][id][AfOffsetX],
  582.             aInfo[playerid][id][AfOffsetY],
  583.             aInfo[playerid][id][AfOffsetZ],
  584.             aInfo[playerid][id][AfRotX],
  585.             aInfo[playerid][id][AfRotY],
  586.             aInfo[playerid][id][AfRotZ],
  587.             aInfo[playerid][id][AfScaleX],
  588.             aInfo[playerid][id][AfScaleY],
  589.             aInfo[playerid][id][AfScaleZ]);
  590.             loaded++;
  591.         }
  592.         new attachmentload[130];
  593.         format(attachmentload, sizeof(attachmentload), "Attachment Load : %d",loaded);
  594.         SendClientMessage(playerid, -1, attachmentload);
  595.     }
  596.     return 1;
  597. }
  598. //==============================================================================
  599. public OnPlayerModelSelectionEx(playerid, response, extraid, modelid)
  600. {
  601.     if(extraid==DIALOG_ATTACH_MODEL_SELECTION)
  602.     {
  603.         if(!response)
  604.         {   ShowPlayerDialog(playerid,DIALOG_ATTACH_OBJECT_SELECTION,DIALOG_STYLE_LIST,"Player Objects/Attachment: (Select Object Path)","Path:1 :: "COL_GREY"Server Objects Menu\n"COL_WHITE"Path:2 :: "COL_GREY"Custom Object","Next(>>)","Back(<<)");    }
  605.         if(response)
  606.         {
  607.             if(GetPVarInt(playerid, "AttachmentUsed") == 1) EditAttachedObject(playerid, modelid);
  608.             else
  609.             {
  610.                 SetPVarInt(playerid, "AttachmentModelSel", modelid);
  611.                 new string[256+1];
  612.                 new dialog[500];
  613.                 for(new x;x<sizeof(AttachmentBones);x++)
  614.                 {
  615.                     format(string, sizeof(string), "Bone:%s\n", AttachmentBones[x]);
  616.                     strcat(dialog,string);
  617.                 }
  618.                 ShowPlayerDialog(playerid, DIALOG_ATTACH_BONE_SELECTION, DIALOG_STYLE_LIST, \
  619.                 "{FF0000}Attachment Modification - Bone Selection", dialog, "Select", "Cancel");
  620.             }//else DeletePVar(playerid, "AttachmentIndexSel");
  621.         }
  622.     }
  623.     return 1;
  624. }
  625. //==============================================================================
  626. stock IsNumeric(string[])
  627. {
  628.     for (new i = 0, j = strlen(string); i < j; i++)
  629.     {
  630.         if (string[i] > '9' || string[i] < '0') return 0;
  631.     }
  632.     return 1;
  633. }
  634. //==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement