SHOW:
|
|
- or go back to the newest paste.
1 | //////////////////////////////////////////////////////////////////////////////// | |
2 | // ATTACHED OBJECT EDITOR // | |
3 | // by Robo_N1X // | |
4 | - | // -Version: 0.1 Beta- // |
4 | + | // -Version: 0.1a Beta- // |
5 | // ========================================================================== // | |
6 | - | // Note: This filterscript works in SA:MP 0.3e // |
6 | + | // Note: This filterscript works in SA:MP 0.3e and upper // |
7 | // License note: // | |
8 | // * You may not remove any credits that is written in the credits dialog in // | |
9 | // this script! // | |
10 | // * You may modify this script without removing any credits // | |
11 | // * You may copy the content(s) of this script without removing any credits // | |
12 | // * You may use this script for non-commercial // | |
13 | // Credits: SA-MP Team, h02, DracoBlue, whoever made some functions here // | |
14 | //////////////////////////////////////////////////////////////////////////////// | |
15 | ||
16 | #include <a_samp> // Credits to: SA-MP team | |
17 | #include <Dini> // Credits to: DracoBlue | |
18 | #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1 // Credits to: DracoBlue / Source: SA-MP Wiki | |
19 | #define MIN_ATTACHED_OBJECT_BONE 1 | |
20 | #define MAX_ATTACHED_OBJECT_BONE 18 | |
21 | #define MAX_ATTACHED_OBJECT_OFFSET 3000.00 | |
22 | #define MIN_ATTACHED_OBJECT_OFFSET -3000.00 | |
23 | #define MAX_ATTACHED_OBJECT_ROT 360.00 | |
24 | #define MIN_ATTACHED_OBJECT_ROT -360.00 | |
25 | #define MAX_ATTACHED_OBJECT_SIZE 1000.00 | |
26 | #define MIN_ATTACHED_OBJECT_SIZE -1000.00 | |
27 | - | #define AOE_VERSION "0.1 - Feb, 2013" // Version |
27 | + | #define AOE_VERSION "0.1a - Feb, 2013" // Version |
28 | #define AO_FILENAME "%s_pao.ini" // Player attached/holding object (%s = name) located in scriptfiles folder by default | |
29 | #define AOC_FILENAME "%s_exp.txt" // Converted attached/holding object (%s = name) located in scriptfiles folder by default | |
30 | // COLOR DEFINES | |
31 | #define COLOR_WHITE 0xFFFFFFFF | |
32 | #define COLOR_RED 0xFF0000FF | |
33 | #define COLOR_YELLOW 0xFFFF00FF | |
34 | #define COLOR_GREEN 0x00FF00FF | |
35 | #define COLOR_CYAN 0x00FFFFFF | |
36 | #define COLOR_BLUE 0x0000FFFF | |
37 | #define COLOR_MAGENTA 0xFF00FFFF | |
38 | ||
39 | // ============================================================================= | |
40 | ||
41 | new aoe_str[128], aoe_str2[256]; | |
42 | new PlayerName[MAX_PLAYER_NAME]; | |
43 | enum | |
44 | { | |
45 | AOED = 400, | |
46 | AOED_HELP, | |
47 | AOED_ABOUT, | |
48 | AOED_CREATE_MODEL, | |
49 | AOED_CREATE_BONE, | |
50 | AOED_CREATE_SLOT, | |
51 | AOED_CREATE_REPLACE, | |
52 | AOED_CREATE_EDIT, | |
53 | AOED_EDIT_SLOT, | |
54 | AOED_REMOVE_SLOT, | |
55 | AOED_REMOVE, | |
56 | AOED_REMOVEALL, | |
57 | AOED_STATS_SLOT, | |
58 | AOED_STATS, | |
59 | AOED_AO_LIST, | |
60 | AOED_DUPLICATE_SLOT1, | |
61 | AOED_DUPLICATE_SLOT2, | |
62 | AOED_DUPLICATE_REPLACE, | |
63 | AOED_SET_SLOT1, | |
64 | AOED_SET_SLOT2, | |
65 | AOED_SET_SLOT_REPLACE, | |
66 | AOED_SET_MODEL_SLOT, | |
67 | AOED_SET_MODEL, | |
68 | AOED_SET_BONE_SLOT, | |
69 | AOED_SET_BONE, | |
70 | AOED_SAVE, | |
71 | AOED_SAVE_SLOT, | |
72 | AOED_SAVE2, | |
73 | AOED_LOAD, | |
74 | AOED_LOAD_SLOT, | |
75 | AOED_LOAD_REPLACE, | |
76 | AOED_LOAD2, | |
77 | AOED_CONVERT | |
78 | } | |
79 | enum AttachedObjectOptions { | |
80 | aoValid = 0, | |
81 | aoModelID, aoBoneID, | |
82 | Float:aoX, Float:aoY, Float:aoZ, | |
83 | Float:aoRX, Float:aoRY, Float:aoRZ, | |
84 | Float:aoSX, Float:aoSY, Float:aoSZ, | |
85 | aoMC1, aoMC2 | |
86 | } | |
87 | new pao[MAX_PLAYERS][MAX_PLAYER_ATTACHED_OBJECTS][AttachedObjectOptions]; | |
88 | new AttachedObjectBones[MAX_ATTACHED_OBJECT_BONE][24] = { | |
89 | {"Spine"}, {"Head"}, {"Left upper arm"}, {"Right upper arm"}, {"Left hand"}, {"Right hand"}, | |
90 | {"Left thigh"}, {"Right thigh"}, {"Left foot"}, {"Right foot"}, {"Right calf"}, {"Left calf"}, | |
91 | {"Left forearm"}, {"Right forearm"}, {"Left clavicle"}, {"Right clavicle"}, {"Neck"}, {"Jaw"} | |
92 | }; | |
93 | ||
94 | // ============================================================================= | |
95 | ||
96 | public OnFilterScriptInit() | |
97 | { | |
98 | for(new i = 0; i < GetMaxPlayers(); i++) | |
99 | { | |
100 | for(new s = 0; s < MAX_PLAYER_ATTACHED_OBJECTS; s++) { | |
101 | if(IsPlayerAttachedObjectSlotUsed(i, s)) pao[i][s][aoValid] = 1; | |
102 | else AOE_UnsetValues(i, s); | |
103 | } | |
104 | - | print(" [FilterScript] Attached Object Editor for SA:MP 0.3e has been loaded!"); |
104 | + | |
105 | print(" [FilterScript] Attached Object Editor for SA:MP 0.3e+ has been loaded!"); | |
106 | printf(" Attached Objects Count: %d", GetAttachedObjectsCount()); | |
107 | return 1; | |
108 | } | |
109 | ||
110 | public OnFilterScriptExit() | |
111 | - | print(" [FilterScript] Attached Object Editor for SA:MP 0.3e has been unloaded!"); |
111 | + | |
112 | print(" [FilterScript] Attached Object Editor for SA:MP 0.3e+ has been unloaded!"); | |
113 | printf(" Attached Objects Count: %d", GetAttachedObjectsCount()); | |
114 | for(new x = 0; x < GetMaxPlayers(); x++) { | |
115 | if(IsPlayerConnected(x)) AOE_UnsetVars(x); | |
116 | } | |
117 | return 1; | |
118 | } | |
119 | ||
120 | public OnPlayerConnect(playerid) | |
121 | { | |
122 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) { | |
123 | if(IsPlayerAttachedObjectSlotUsed(playerid, i)) pao[playerid][i][aoValid] = 1; | |
124 | else RemovePlayerAttachedObject(playerid, i), AOE_UnsetValues(playerid, i); | |
125 | } | |
126 | return 1; | |
127 | } | |
128 | ||
129 | public OnPlayerSpawn(playerid) | |
130 | { | |
131 | new slots = 0; | |
132 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) { | |
133 | if(pao[playerid][i][aoValid]) RestorePlayerAttachedObject(playerid, i), slots++; | |
134 | } | |
135 | if(0 < slots <= MAX_PLAYER_ATTACHED_OBJECTS) { | |
136 | format(aoe_str2, sizeof(aoe_str2), "* Automatically restored your attached object(s) [Total: %d]!", slots); | |
137 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
138 | } | |
139 | return 1; | |
140 | } | |
141 | ||
142 | public OnPlayerCommandText(playerid, cmdtext[]) | |
143 | { | |
144 | if(!strcmp(cmdtext, "/attachedobjecteditor", true) || !strcmp(cmdtext, "/aoe", true)) | |
145 | { | |
146 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
146 | + | |
147 | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; | |
148 | else AOE_ShowPlayerDialog(playerid, 0, AOED, "Attached Object Editor", "Select", "Close"); | |
149 | return 1; | |
150 | } | |
151 | if(!strcmp(cmdtext, "/attachedobjecteditorhelp", true) || !strcmp(cmdtext, "/aoeh", true)) | |
152 | { | |
153 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
153 | + | |
154 | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; | |
155 | else AOE_ShowPlayerDialog(playerid, 1, AOED_HELP, "Attached Object Editor Help", "Close"); | |
156 | return 1; | |
157 | } | |
158 | if(!strcmp(cmdtext, "/removeattachedobjects", true) || !strcmp(cmdtext, "/raos", true)) | |
159 | { | |
160 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
160 | + | |
161 | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; | |
162 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
163 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
164 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
165 | return 1; | |
166 | - | else AOE_ShowPlayerDialog(playerid, 12, AOED_REMOVEALL, "Remove all attached object(s)", "Yes", "Cancel"); |
166 | + | |
167 | else AOE_ShowPlayerDialog(playerid, 12, AOED_REMOVEALL, "Remove All Attached Object(s)", "Yes", "Cancel"); | |
168 | return 1; | |
169 | } | |
170 | if(!strcmp(cmdtext, "/undodeleteattachedobject", true) || !strcmp(cmdtext, "/undeleteattachedobject", true) || !strcmp(cmdtext, "/udao", true)) | |
171 | { | |
172 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
172 | + | |
173 | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; | |
174 | else if(GetPlayerAttachedObjectsCount(playerid) >= MAX_PLAYER_ATTACHED_OBJECTS) { | |
175 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't have more attached object(s) [Limit exceed]!"); | |
176 | SendClientMessage(playerid, COLOR_YELLOW, "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached objects!"); | |
177 | GameTextForPlayer(playerid, "~r~~h~Too many attached objects!", 5000, 3); | |
178 | return 1; | |
179 | } | |
180 | else if(!GetPVarType(playerid, "LastAttachedObjectRemoved")) { | |
181 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object removed with /rao command!"); | |
182 | GameTextForPlayer(playerid, "~r~~h~No attached object can be restored!", 5000, 3); | |
183 | return 1; | |
184 | } | |
185 | else | |
186 | { | |
187 | new slot = GetPVarInt(playerid, "LastAttachedObjectRemoved"); | |
188 | if(!IsValidPlayerAttachedObject(playerid, slot)) { | |
189 | format(aoe_str, sizeof(aoe_str), "* Sorry, you can't restore your last attached object from slot/index number %i as it's not valid!", slot); | |
190 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str); | |
191 | GameTextForPlayer(playerid, "~r~~h~Cannot restore attached object!", 5000, 3); | |
192 | return 1; | |
193 | } | |
194 | else if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) { | |
195 | format(aoe_str, sizeof(aoe_str), "* Sorry, you can't restore your last attached object as you had an attached object in that slot already (%i)!", slot); | |
196 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str); | |
197 | GameTextForPlayer(playerid, "~r~~h~Cannot restore attached object!", 5000, 3); | |
198 | return 1; | |
199 | } | |
200 | RestorePlayerAttachedObject(playerid, slot); | |
201 | format(aoe_str2, sizeof(aoe_str2), "* You've restored your attaced object from slot/index number %i [Model: %d - Bone: %s (%i)]!", slot, pao[playerid][slot][aoModelID], | |
202 | GetAttachedObjectBoneName(pao[playerid][slot][aoBoneID]), pao[playerid][slot][aoBoneID]); | |
203 | format(aoe_str, sizeof(aoe_str), "~g~Restored your attached object~n~~w~index/number: %i~n~Model: %d - Bone: %i", slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID]); | |
204 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
205 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
206 | } | |
207 | return 1; | |
208 | } | |
209 | if(!strcmp(cmdtext, "/attachedobjectlist", true) || !strcmp(cmdtext, "/aol", true)) | |
210 | { | |
211 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
211 | + | |
212 | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; | |
213 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
214 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
215 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
216 | return 1; | |
217 | } | |
218 | else { | |
219 | AOE_ShowPlayerDialog(playerid, 7, AOED_AO_LIST, "Attached Object List", "Edit", "Cancel"); | |
220 | } | |
221 | return 1; | |
222 | } | |
223 | if(!strcmp(cmdtext, "/totalattachedobjects", true) || !strcmp(cmdtext, "/taos", true)) | |
224 | { | |
225 | SendClientMessage(playerid, COLOR_CYAN, "----------------------------------------------------------------------------------------------------"); | |
226 | format(aoe_str2, sizeof(aoe_str2), "-- Total attached object(s) attached on you: %d", GetPlayerAttachedObjectsCount(playerid)); | |
227 | SendClientMessage(playerid, 0x00DDDDFF, aoe_str2); | |
228 | format(aoe_str2, sizeof(aoe_str2), "-- Total of all attached object(s) in server: %d", GetAttachedObjectsCount()); | |
229 | SendClientMessage(playerid, 0x00DDDDFF, aoe_str2); | |
230 | SendClientMessage(playerid, COLOR_CYAN, "----------------------------------------------------------------------------------------------------"); | |
231 | return 1; | |
232 | } | |
233 | ||
234 | dcmd(createattachedobject, 20, cmdtext); | |
235 | dcmd(cao, 3, cmdtext); | |
236 | dcmd(editattachedobject, 18, cmdtext); | |
237 | dcmd(eao, 3, cmdtext); | |
238 | dcmd(removeattachedobject, 20, cmdtext); | |
239 | dcmd(rao, 3, cmdtext); | |
240 | dcmd(saveattachedobject, 18, cmdtext); | |
241 | dcmd(sao, 3, cmdtext); | |
242 | dcmd(saveattachedobjects, 19, cmdtext); | |
243 | dcmd(saos, 4, cmdtext); | |
244 | dcmd(loadattachedobject, 18, cmdtext); | |
245 | dcmd(lao, 3, cmdtext); | |
246 | dcmd(loadattachedobjects, 19, cmdtext); | |
247 | dcmd(laos, 4, cmdtext); | |
248 | dcmd(convertattachedobjectfile, 25, cmdtext); | |
249 | dcmd(convertattachedobject, 21, cmdtext); | |
250 | dcmd(caof, 4, cmdtext); | |
251 | dcmd(attachedobjectstats, 19, cmdtext); | |
252 | dcmd(aos, 3, cmdtext); | |
253 | dcmd(duplicateattachedobject, 23, cmdtext); | |
254 | dcmd(dao, 3, cmdtext); | |
255 | dcmd(setattachedobjectslot, 21, cmdtext); | |
256 | dcmd(setattachedobjectindex, 22, cmdtext); | |
257 | dcmd(saoi, 4, cmdtext); | |
258 | dcmd(setattachedobjectmodel, 22, cmdtext); | |
259 | dcmd(saom, 4, cmdtext); | |
260 | dcmd(setattachedobjectbone, 21, cmdtext); | |
261 | dcmd(saob, 4, cmdtext); | |
262 | dcmd(setattachedobjectoffsetx, 24, cmdtext); | |
263 | dcmd(saoox, 5, cmdtext); | |
264 | dcmd(setattachedobjectoffsety, 24, cmdtext); | |
265 | dcmd(saooy, 5, cmdtext); | |
266 | dcmd(setattachedobjectoffsetz, 24, cmdtext); | |
267 | dcmd(saooz, 5, cmdtext); | |
268 | dcmd(setattachedobjectrotx, 21, cmdtext); | |
269 | dcmd(saorx, 5, cmdtext); | |
270 | dcmd(setattachedobjectroty, 21, cmdtext); | |
271 | dcmd(saory, 5, cmdtext); | |
272 | dcmd(setattachedobjectrotz, 21, cmdtext); | |
273 | dcmd(saorz, 5, cmdtext); | |
274 | dcmd(setattachedobjectscalex, 23, cmdtext); | |
275 | dcmd(saosx, 5, cmdtext); | |
276 | dcmd(setattachedobjectscaley, 23, cmdtext); | |
277 | dcmd(saosy, 5, cmdtext); | |
278 | dcmd(setattachedobjectscalez, 23, cmdtext); | |
279 | dcmd(saosz, 5, cmdtext); | |
280 | dcmd(setattachedobjectmc1, 20, cmdtext); | |
281 | dcmd(saomc1, 6, cmdtext); | |
282 | dcmd(setattachedobjectmc2, 20, cmdtext); | |
283 | dcmd(saomc2, 6, cmdtext); | |
284 | return 0; | |
285 | } | |
286 | ||
287 | // ----------------------------------------------------------------------------- | |
288 | ||
289 | dcmd_createattachedobject(playerid, params[]) | |
290 | { | |
291 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
291 | + | |
292 | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; | |
293 | else if(GetPlayerAttachedObjectsCount(playerid) >= MAX_PLAYER_ATTACHED_OBJECTS) { | |
294 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't have more attached object(s) [Limit exceed]!"); | |
295 | SendClientMessage(playerid, COLOR_YELLOW, "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached objects!"); | |
296 | GameTextForPlayer(playerid, "~r~~h~Too many attached objects!", 5000, 3); | |
297 | return 1; | |
298 | } | |
299 | else | |
300 | { | |
301 | new idx, tmp[24], tmp2[24], tmp3[24], model, bone, slot; | |
302 | tmp = strtok(params, idx), model = strval(tmp), SetPVarInt(playerid, "CreateAttachedObjectModel", model); | |
303 | if(!strlen(tmp)) { | |
304 | AOE_ShowPlayerDialog(playerid, 4, AOED_CREATE_MODEL, "Create Attached Object", "Enter", "Cancel"); | |
305 | return 1; | |
306 | } | |
307 | else if(!IsValidObjectModel(model) || !IsNumeric(tmp)) { | |
308 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid object model number/id [%s]!", tmp); | |
309 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
310 | GameTextForPlayer(playerid, "~r~~h~Invalid object model!", 5000, 3); | |
311 | return 1; | |
312 | } | |
313 | else | |
314 | { | |
315 | tmp2 = strtok(params, idx), bone = strval(tmp2), SetPVarInt(playerid, "CreateAttachedObjectBone", bone); | |
316 | if(!strlen(tmp2)) { | |
317 | AOE_ShowPlayerDialog(playerid, 5, AOED_CREATE_BONE, "Create Attached Object", "Select", "Cancel"); | |
318 | return 1; | |
319 | } | |
320 | else if(!IsValidAttachedObjectBone(bone) || !IsNumeric(tmp2)) { | |
321 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object bone number/id [%s]!", tmp2); | |
322 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
323 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object bone!", 5000, 3); | |
324 | return 1; | |
325 | } | |
326 | else | |
327 | { | |
328 | tmp3 = strtok(params, idx), slot = strval(tmp3), SetPVarInt(playerid, "CreateAttachedObjectIndex", slot); | |
329 | if(!strlen(tmp3)) { | |
330 | AOE_ShowPlayerDialog(playerid, 6, AOED_CREATE_SLOT, "Create Attached Object", "Select", "Cancel"); | |
331 | return 1; | |
332 | } | |
333 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp3)) { | |
334 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp3); | |
335 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
336 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
337 | return 1; | |
338 | } | |
339 | else if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) { | |
340 | AOE_ShowPlayerDialog(playerid, 9, AOED_CREATE_REPLACE, "Create Attached Object (Replace)", "Yes", "Cancel"); | |
341 | return 1; | |
342 | } | |
343 | else | |
344 | { | |
345 | CreatePlayerAttachedObject(playerid, slot, model, bone); | |
346 | format(aoe_str2, sizeof(aoe_str2), "* Created attached object model %d at slot/index number %i [Bone: %s (%i)]!", model, slot, GetAttachedObjectBoneName(bone), bone); | |
347 | format(aoe_str, sizeof(aoe_str), "~b~Created attached object~n~~w~index/number: %i~n~Model: %d - Bone: %i", slot, model, bone); | |
348 | SendClientMessage(playerid, COLOR_BLUE, aoe_str2); | |
349 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
350 | AOE_ShowPlayerDialog(playerid, 10, AOED_CREATE_EDIT, "Create Attached Object (Edit)", "Edit", "Skip"); | |
351 | } | |
352 | } | |
353 | } | |
354 | } | |
355 | return 1; | |
356 | } | |
357 | ||
358 | dcmd_cao(playerid, params[]) return dcmd_createattachedobject(playerid, params); | |
359 | ||
360 | dcmd_editattachedobject(playerid, params[]) | |
361 | { | |
362 | if(GetPVarInt(playerid, "EditingAttachedObject") == 1) return CancelEdit(playerid); | |
363 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
363 | + | |
364 | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; | |
365 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
366 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
367 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
368 | return 1; | |
369 | } | |
370 | else if(!strlen(params)) { | |
371 | AOE_ShowPlayerDialog(playerid, 7, AOED_EDIT_SLOT, "Edit Attached Object", "Edit", "Cancel"); | |
372 | return 1; | |
373 | } | |
374 | else | |
375 | { | |
376 | new slot = strval(params); | |
377 | SetPVarInt(playerid, "EditAttachedObjectIndex", slot); | |
378 | if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(params)) { | |
379 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", params); | |
380 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
381 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
382 | return 1; | |
383 | } | |
384 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
385 | { | |
386 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
387 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
388 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
389 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
390 | return 1; | |
391 | } | |
392 | else | |
393 | { | |
394 | EditAttachedObject(playerid, slot); | |
395 | format(aoe_str2, sizeof(aoe_str2), "* You're now editing your attached object from slot/index number %i!", slot); | |
396 | format(aoe_str, sizeof(aoe_str), "~g~Editing your attached object~n~~w~index/number: %i", slot); | |
397 | SetPVarInt(playerid, "EditingAttachedObject", 1); | |
398 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
399 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
400 | if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "** Hint: Use {FFFFFF}~k~~VEHICLE_ACCELERATE~{FFFF00} key to look around"); | |
401 | else SendClientMessage(playerid, COLOR_YELLOW, "** Hint: Use {FFFFFF}~k~~PED_SPRINT~{FFFF00} key to look around"); | |
402 | } | |
403 | } | |
404 | return 1; | |
405 | } | |
406 | ||
407 | dcmd_eao(playerid, params[]) return dcmd_editattachedobject(playerid, params); | |
408 | ||
409 | dcmd_removeattachedobject(playerid, params[]) | |
410 | { | |
411 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
411 | + | |
412 | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; | |
413 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
414 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
415 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
416 | return 1; | |
417 | } | |
418 | else if(!strlen(params)) { | |
419 | AOE_ShowPlayerDialog(playerid, 7, AOED_REMOVE_SLOT, "Remove Attached Object", "Remove", "Cancel"); | |
420 | return 1; | |
421 | } | |
422 | else | |
423 | { | |
424 | new slot = strval(params); | |
425 | SetPVarInt(playerid, "RemoveAttachedObjectIndex", slot); | |
426 | if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(params)) { | |
427 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", params); | |
428 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
429 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
430 | return 1; | |
431 | } | |
432 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
433 | { | |
434 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
435 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
436 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
437 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
438 | return 1; | |
439 | } | |
440 | else | |
441 | { | |
442 | RemovePlayerAttachedObjectEx(playerid, slot); | |
443 | format(aoe_str2, sizeof(aoe_str2), "* You've removed your attached object from slot/index number %i!", slot); | |
444 | format(aoe_str, sizeof(aoe_str), "~r~Removed your attached object~n~~w~index/number: %i", slot); | |
445 | SendClientMessage(playerid, COLOR_RED, aoe_str2); | |
446 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
447 | } | |
448 | } | |
449 | return 1; | |
450 | } | |
451 | ||
452 | dcmd_rao(playerid, params[]) return dcmd_removeattachedobject(playerid, params); | |
453 | ||
454 | dcmd_saveattachedobject(playerid, params[]) | |
455 | { | |
456 | GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME); | |
457 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
457 | + | |
458 | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; | |
459 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
460 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
461 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
462 | return 1; | |
463 | } | |
464 | else | |
465 | { | |
466 | new idx, tmp[24], tmp2[32], slot, ao_file[64]; | |
467 | tmp = strtok(params, idx), slot = strval(tmp), SetPVarInt(playerid, "SaveAttachedObjectIndex", slot); | |
468 | if(!strlen(tmp)) { | |
469 | AOE_ShowPlayerDialog(playerid, 7, AOED_SAVE_SLOT, "Save Attached Object", "Select", "Cancel"); | |
470 | return 1; | |
471 | } | |
472 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
473 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
474 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
475 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
476 | return 1; | |
477 | } | |
478 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
479 | { | |
480 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
481 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
482 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
483 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
484 | return 1; | |
485 | } | |
486 | else | |
487 | { | |
488 | tmp2 = strtok(params, idx); | |
489 | if(!strlen(tmp2)) { | |
490 | AOE_ShowPlayerDialog(playerid, 15, AOED_SAVE, "Save Attached Object", "Save", "Cancel"); | |
491 | return 1; | |
492 | } | |
493 | else if(!IsValidFileName(tmp2)) { | |
494 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid file name [%s]!", tmp2); | |
495 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
496 | SendClientMessage(playerid, COLOR_YELLOW, "Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, ."); | |
497 | GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 5000, 3); | |
498 | return 1; | |
499 | } | |
500 | else | |
501 | { | |
502 | format(ao_file, sizeof(ao_file), AO_FILENAME, tmp2); | |
503 | if(dini_Exists(ao_file)) { | |
504 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, attached object file \"%s\" already exists!", tmp2); | |
505 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
506 | GameTextForPlayer(playerid, "~r~~h~File already exists!", 5000, 3); | |
507 | return 1; | |
508 | } | |
509 | else | |
510 | { | |
511 | if(IsValidPlayerAttachedObject(playerid, slot) != 1) { | |
512 | SendClientMessage(playerid, COLOR_RED, "* Error: Invalid attached object data, save canceled"); | |
513 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object data!", 5000, 3); | |
514 | return 1; | |
515 | } | |
516 | else | |
517 | { | |
518 | SendClientMessage(playerid, COLOR_WHITE, "* Saving attached object file, please wait..."); | |
519 | AOE_SavePlayerAttachedObject(playerid, slot, ao_file); | |
520 | format(aoe_str2, sizeof(aoe_str2), "** Your attached object from index %i has been saved as \"%s\" (Model: %d - Bone: %i)!", slot, tmp2, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID]); | |
521 | SendClientMessage(playerid, COLOR_BLUE, aoe_str2); | |
522 | } | |
523 | } | |
524 | } | |
525 | } | |
526 | } | |
527 | return 1; | |
528 | } | |
529 | ||
530 | dcmd_sao(playerid, params[]) return dcmd_saveattachedobject(playerid, params); | |
531 | ||
532 | dcmd_saveattachedobjects(playerid, params[]) | |
533 | { | |
534 | GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME); | |
535 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
535 | + | |
536 | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; | |
537 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
538 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
539 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
540 | return 1; | |
541 | } | |
542 | else | |
543 | { | |
544 | if(!strlen(params)) { | |
545 | AOE_ShowPlayerDialog(playerid, 15, AOED_SAVE2, "Save Attached Object(s) Set", "Save", "Cancel"); | |
546 | return 1; | |
547 | } | |
548 | else if(!IsValidFileName(params)) { | |
549 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid file name [%s]!", params); | |
550 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
551 | SendClientMessage(playerid, COLOR_YELLOW, "Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, ."); | |
552 | GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 5000, 3); | |
553 | return 1; | |
554 | } | |
555 | else | |
556 | { | |
557 | new ao_file[64], slots; | |
558 | format(ao_file, sizeof(ao_file), AO_FILENAME, params); | |
559 | if(dini_Exists(ao_file)) { | |
560 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, attached object(s) set file \"%s\" already exists!", params); | |
561 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
562 | GameTextForPlayer(playerid, "~r~~h~File already exists!", 5000, 3); | |
563 | return 1; | |
564 | } | |
565 | else | |
566 | { | |
567 | SendClientMessage(playerid, COLOR_WHITE, "* Saving attached object(s) set file, please wait..."); | |
568 | for(new slot = 0; slot < MAX_PLAYER_ATTACHED_OBJECTS; slot++) | |
569 | { | |
570 | if(IsValidPlayerAttachedObject(playerid, slot) != 1) continue; | |
571 | else { | |
572 | slots += AOE_SavePlayerAttachedObject(playerid, slot, ao_file); | |
573 | } | |
574 | } | |
575 | if(!slots && dini_Exists(ao_file)) { | |
576 | dini_Remove(ao_file); | |
577 | SendClientMessage(playerid, COLOR_RED, "** Error: file saving was canceled because there were no valid attached object!"); | |
578 | return 1; | |
579 | } | |
580 | else { | |
581 | format(aoe_str2, sizeof(aoe_str2), "** Your attached object set has been saved as \"%s\" (Total: %i)!", params, slots); | |
582 | SendClientMessage(playerid, COLOR_BLUE, aoe_str2); | |
583 | } | |
584 | } | |
585 | } | |
586 | } | |
587 | return 1; | |
588 | } | |
589 | ||
590 | dcmd_saos(playerid, params[]) return dcmd_saveattachedobjects(playerid, params); | |
591 | ||
592 | dcmd_loadattachedobject(playerid, params[]) | |
593 | { | |
594 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
594 | + | |
595 | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; | |
596 | else if(GetPlayerAttachedObjectsCount(playerid) >= MAX_PLAYER_ATTACHED_OBJECTS) { | |
597 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't have more attached object(s) [Limit exceed]!"); | |
598 | SendClientMessage(playerid, COLOR_YELLOW, "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached objects!"); | |
599 | GameTextForPlayer(playerid, "~r~~h~Too many attached objects!", 5000, 3); | |
600 | return 1; | |
601 | } | |
602 | else | |
603 | { | |
604 | new idx, tmp[32], tmp2[24], ao_file[64], slot; | |
605 | tmp = strtok(params, idx), SetPVarString(playerid, "LoadAttachedObjectName", tmp); | |
606 | if(!strlen(tmp)) { | |
607 | AOE_ShowPlayerDialog(playerid, 16, AOED_LOAD, "Load Attached Object", "Enter", "Cancel"); | |
608 | return 1; | |
609 | } | |
610 | else if(!IsValidFileName(tmp)) { | |
611 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid file name [%s]!", tmp); | |
612 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
613 | SendClientMessage(playerid, COLOR_YELLOW, "Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, ."); | |
614 | GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 5000, 3); | |
615 | return 1; | |
616 | } | |
617 | else | |
618 | { | |
619 | format(ao_file, sizeof(ao_file), AO_FILENAME, tmp); | |
620 | if(!dini_Exists(ao_file)) { | |
621 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, attached object file \"%s\" does not exist!", tmp); | |
622 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
623 | GameTextForPlayer(playerid, "~r~~h~File does not exist!", 5000, 3); | |
624 | return 1; | |
625 | } | |
626 | else | |
627 | - | tmp2 = strtok(params, idx), slot = strval(tmp2); |
627 | + | |
628 | tmp2 = strtok(params, idx), slot = strval(tmp2), SetPVarInt(playerid, "LoadAttachedObjectIndex", slot); | |
629 | if(!strlen(tmp2)) { | |
630 | SendClientMessage(playerid, COLOR_WHITE, "* Load Attached Object: Please specify attached object index..."); | |
631 | ShowPlayerDialog(playerid, AOED_LOAD_SLOT, DIALOG_STYLE_INPUT, "Load Attached Object", "Enter the index number of attached object in the file:", "Load", "Cancel"); | |
632 | return 1; | |
633 | } | |
634 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp2)) { | |
635 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp2); | |
636 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
637 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
638 | return 1; | |
639 | - | else if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) { |
639 | + | |
640 | - | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you already have attached object at slot/index number %i!", slot); |
640 | + | |
641 | { | |
642 | - | return 1; |
642 | + | if(!AOE_IsValidAttachedObjectInFile(slot, ao_file)) { |
643 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, there is no valid attached object from slot/index number %i!", slot); | |
644 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
645 | GameTextForPlayer(playerid, "~r~~h~Attached object slot not found!", 5000, 3); | |
646 | - | SendClientMessage(playerid, COLOR_WHITE, "* Loading attached object file, please wait..."); |
646 | + | |
647 | - | if(!AOE_IsValidAttachedObjectInFile(slot, ao_file)) { |
647 | + | |
648 | else if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) { | |
649 | AOE_ShowPlayerDialog(playerid, 17, AOED_LOAD_REPLACE, "Load & Replace Attached Object", "Yes", "Cancel"); | |
650 | return 1; | |
651 | } | |
652 | else if(!AOE_LoadPlayerAttachedObject(playerid, slot, ao_file)) { | |
653 | SendClientMessage(playerid, COLOR_RED, "* Error: Invalid attached object data, load canceled"); | |
654 | pao[playerid][slot][aoValid] = 0; | |
655 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object data!", 5000, 3); | |
656 | return 1; | |
657 | } | |
658 | else | |
659 | { | |
660 | SendClientMessage(playerid, COLOR_WHITE, "* Loading attached object file, please wait..."); | |
661 | format(aoe_str2, sizeof(aoe_str2), "** You've loaded attached object from file \"%s\" by %s from skin %i (Index: %i - Model: %d - Bone: %i)!", tmp, dini_Get(ao_file, "auth"), dini_Int(ao_file, "skin"), | |
662 | slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID]); | |
663 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
664 | } | |
665 | } | |
666 | } | |
667 | } | |
668 | } | |
669 | return 1; | |
670 | } | |
671 | ||
672 | dcmd_lao(playerid, params[]) return dcmd_loadattachedobject(playerid, params); | |
673 | ||
674 | dcmd_loadattachedobjects(playerid, params[]) | |
675 | { | |
676 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
677 | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command when editing an attached object!"); | |
678 | else if(GetPlayerAttachedObjectsCount(playerid) >= MAX_PLAYER_ATTACHED_OBJECTS) { | |
679 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't have more attached object(s) [Limit exceed]!"); | |
680 | SendClientMessage(playerid, COLOR_YELLOW, "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached objects!"); | |
681 | GameTextForPlayer(playerid, "~r~~h~Too many attached objects!", 5000, 3); | |
682 | return 1; | |
683 | } | |
684 | else | |
685 | { | |
686 | if(!strlen(params)) { | |
687 | AOE_ShowPlayerDialog(playerid, 16, AOED_LOAD2, "Load Attached Object(s) Set", "Load", "Cancel"); | |
688 | return 1; | |
689 | } | |
690 | else if(!IsValidFileName(params)) { | |
691 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid file name [%s]!", params); | |
692 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
693 | SendClientMessage(playerid, COLOR_YELLOW, "Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, ."); | |
694 | GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 5000, 3); | |
695 | return 1; | |
696 | } | |
697 | else | |
698 | { | |
699 | new ao_file[64], slots; | |
700 | format(ao_file, sizeof(ao_file), AO_FILENAME, params); | |
701 | if(!dini_Exists(ao_file)) { | |
702 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, attached object file \"%s\" does not exist!", params); | |
703 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
704 | GameTextForPlayer(playerid, "~r~~h~File does not exist!", 5000, 3); | |
705 | return 1; | |
706 | } | |
707 | else | |
708 | { | |
709 | SendClientMessage(playerid, COLOR_WHITE, "* Loading attached object(s) set file, please wait..."); | |
710 | for(new slot = 0; slot < MAX_PLAYER_ATTACHED_OBJECTS; slot++) | |
711 | { | |
712 | if(!AOE_IsValidAttachedObjectInFile(slot, ao_file)) continue; | |
713 | else if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) { | |
714 | format(aoe_str2, sizeof(aoe_str2), "** Attached object slot %i is used, load canceled", slot); | |
715 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
716 | return 1; | |
717 | } | |
718 | else slots += AOE_LoadPlayerAttachedObject(playerid, slot, ao_file); | |
719 | } | |
720 | format(aoe_str2, sizeof(aoe_str2), "** You've loaded attached object(s) set from file \"%s\" by %s from skin %i (Total: %i)!", params, dini_Get(ao_file, "auth"), dini_Int(ao_file, "skin"), slots); | |
721 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
722 | } | |
723 | } | |
724 | } | |
725 | return 1; | |
726 | } | |
727 | ||
728 | dcmd_laos(playerid, params[]) return dcmd_loadattachedobjects(playerid, params); | |
729 | ||
730 | dcmd_convertattachedobjectfile(playerid, params[]) | |
731 | { | |
732 | GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME); | |
733 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
734 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
734 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
735 | else | |
736 | { | |
737 | new ao_file[64], ao_filename[64], slots, ao_filelen; | |
738 | format(ao_file, sizeof(ao_file), AO_FILENAME, params); | |
739 | format(ao_filename, sizeof(ao_filename), AOC_FILENAME, params); | |
740 | if(!strlen(params)) { | |
741 | AOE_ShowPlayerDialog(playerid, 2, AOED_CONVERT, "Convert Attached Object(s) file", "Convert", "Cancel"); | |
742 | return 1; | |
743 | } | |
744 | else if(!IsValidFileName(ao_file)) { | |
745 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you've entered an invalid file name! Valid characters are:"); | |
746 | SendClientMessage(playerid, COLOR_YELLOW, "A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, ."); | |
747 | GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 5000, 3); | |
748 | return 1; | |
749 | } | |
750 | else | |
751 | { | |
752 | if(!fexist(ao_file)) { | |
753 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, attached object(s) file \"%s\" does not exist!", params); | |
754 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
755 | GameTextForPlayer(playerid, "~r~~h~File does not exist!", 5000, 3); | |
756 | return 1; | |
757 | } | |
758 | else | |
759 | { | |
760 | slots += AOE_ConvertAttachedObjectFile(playerid, ao_file, ao_filename, ao_filelen); | |
761 | SendClientMessage(playerid, COLOR_WHITE, "* Converting file, please wait..."); | |
762 | format(aoe_str2, sizeof(aoe_str2), "** Attached object(s) file \"%s\" has been converted to \"%s\" raw code (%i objects, %i bytes)", ao_file, ao_filename, slots, ao_filelen); | |
763 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
764 | } | |
765 | } | |
766 | } | |
767 | return 1; | |
768 | } | |
769 | ||
770 | dcmd_convertattachedobject(playerid, params[]) return dcmd_convertattachedobjectfile(playerid, params); | |
771 | dcmd_caof(playerid, params[]) return dcmd_convertattachedobjectfile(playerid, params); | |
772 | ||
773 | dcmd_attachedobjectstats(playerid, params[]) | |
774 | { | |
775 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
776 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
776 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
777 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
778 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
779 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
780 | return 1; | |
781 | } | |
782 | else if(!strlen(params)) { | |
783 | AOE_ShowPlayerDialog(playerid, 7, AOED_STATS_SLOT, "Attached Object Stats", "Select", "Cancel"); | |
784 | return 1; | |
785 | } | |
786 | else | |
787 | { | |
788 | new slot = strval(params); | |
789 | SetPVarInt(playerid, "AttachedObjectStatsIndex", slot); | |
790 | if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(params)) { | |
791 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", params); | |
792 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
793 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
794 | return 1; | |
795 | } | |
796 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
797 | { | |
798 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
799 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
800 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
801 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
802 | return 1; | |
803 | } | |
804 | else | |
805 | { | |
806 | format(aoe_str, sizeof(aoe_str), "Your Attached Object Stats (%i)", slot); | |
807 | AOE_ShowPlayerDialog(playerid, 8, AOED_STATS, aoe_str, "Print", "Close"); | |
808 | if(IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_WHITE, "* As you're an admin, you can print this attached object stats & usage to the console"); | |
809 | } | |
810 | } | |
811 | return 1; | |
812 | } | |
813 | ||
814 | dcmd_aos(playerid, params[]) return dcmd_attachedobjectstats(playerid, params); | |
815 | ||
816 | dcmd_duplicateattachedobject(playerid, params[]) | |
817 | { | |
818 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
819 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
819 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
820 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
821 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
822 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
823 | return 1; | |
824 | } | |
825 | else | |
826 | { | |
827 | new idx, tmp[24], tmp2[24], slot1, slot2; | |
828 | tmp = strtok(params, idx), slot1 = strval(tmp), SetPVarInt(playerid, "DuplicateAttachedObjectIndex1", slot1); | |
829 | if(!strlen(tmp)) { | |
830 | AOE_ShowPlayerDialog(playerid, 7, AOED_DUPLICATE_SLOT1, "Duplicate Attached Object Index (1)", "Select", "Cancel"); | |
831 | return 1; | |
832 | } | |
833 | else if(!IsValidAttachedObjectSlot(slot1) || !IsNumeric(tmp)) { | |
834 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
835 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
836 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
837 | return 1; | |
838 | } | |
839 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot1)) | |
840 | { | |
841 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot1); | |
842 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot1); | |
843 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
844 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
845 | return 1; | |
846 | } | |
847 | else | |
848 | { | |
849 | tmp2 = strtok(params, idx), slot2 = strval(tmp2), SetPVarInt(playerid, "DuplicateAttachedObjectIndex2", slot2); | |
850 | if(!strlen(tmp2)) { | |
851 | AOE_ShowPlayerDialog(playerid, 6, AOED_DUPLICATE_SLOT2, "Duplicate Attached Object Index (2)", "Select", "Cancel"); | |
852 | return 1; | |
853 | } | |
854 | if(!IsValidAttachedObjectSlot(slot2) || !IsNumeric(tmp2)) { | |
855 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp2); | |
856 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
857 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
858 | return 1; | |
859 | } | |
860 | else if(slot1 == slot2) { | |
861 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you can't duplicate attached object from slot/index number %i to the same slot (%i) as it's already there?!!", slot1, slot2); | |
862 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
863 | GameTextForPlayer(playerid, "~y~DOH!", 2500, 3); | |
864 | return 1; | |
865 | } | |
866 | else if(IsPlayerAttachedObjectSlotUsed(playerid, slot2)) { | |
867 | AOE_ShowPlayerDialog(playerid, 13, AOED_DUPLICATE_REPLACE, "Duplicate Attached Object (Replace)", "Yes", "Cancel"); | |
868 | } | |
869 | else | |
870 | { | |
871 | DuplicatePlayerAttachedObject(playerid, slot1, slot2); | |
872 | format(aoe_str2, sizeof(aoe_str2), "* Duplicated your attached object from slot/index number %i to %i!", slot1, slot2); | |
873 | format(aoe_str, sizeof(aoe_str), "~g~Attached object duplicated~n~~w~index/number:~n~%i to %i", slot1, slot2); | |
874 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
875 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
876 | } | |
877 | } | |
878 | } | |
879 | return 1; | |
880 | } | |
881 | ||
882 | dcmd_dao(playerid, params[]) return dcmd_duplicateattachedobject(playerid, params); | |
883 | ||
884 | dcmd_setattachedobjectindex(playerid, params[]) | |
885 | { | |
886 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
887 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
887 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
888 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
889 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
890 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
891 | return 1; | |
892 | } | |
893 | else | |
894 | { | |
895 | new idx, tmp[24], tmp2[24], slot, newslot; | |
896 | tmp = strtok(params, idx), slot = strval(tmp), SetPVarInt(playerid, "SetAttachedObjectIndex1", slot); | |
897 | if(!strlen(tmp)) { | |
898 | AOE_ShowPlayerDialog(playerid, 7, AOED_SET_SLOT1, "Set Attached Object Index (1)", "Select", "Cancel"); | |
899 | return 1; | |
900 | } | |
901 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
902 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
903 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
904 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
905 | return 1; | |
906 | } | |
907 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
908 | { | |
909 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
910 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
911 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
912 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
913 | return 1; | |
914 | } | |
915 | else | |
916 | { | |
917 | tmp2 = strtok(params, idx), newslot = strval(tmp2), SetPVarInt(playerid, "SetAttachedObjectIndex2", newslot); | |
918 | if(!strlen(tmp2)) { | |
919 | AOE_ShowPlayerDialog(playerid, 6, AOED_SET_SLOT2, "Set Attached Object Index (2)", "Select", "Cancel"); | |
920 | return 1; | |
921 | } | |
922 | else if(!IsValidAttachedObjectSlot(newslot) || !IsNumeric(tmp2)) { | |
923 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp2); | |
924 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
925 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
926 | return 1; | |
927 | } | |
928 | else if(slot == newslot) { | |
929 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you can't move attached object from slot/index number %i to the same slot (%i) as it's already there?!!", slot, newslot); | |
930 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
931 | GameTextForPlayer(playerid, "~y~DOH!", 2500, 3); | |
932 | return 1; | |
933 | } | |
934 | else if(IsPlayerAttachedObjectSlotUsed(playerid, newslot)) { | |
935 | AOE_ShowPlayerDialog(playerid, 14, AOED_SET_SLOT_REPLACE, "Set Attached Object Index (Replace)", "Yes", "Cancel"); | |
936 | } | |
937 | else | |
938 | { | |
939 | MovePlayerAttachedObjectIndex(playerid, slot, newslot); | |
940 | format(aoe_str2, sizeof(aoe_str2), "* Moved your attached object from slot/index number %i to %i!", slot, newslot); | |
941 | format(aoe_str, sizeof(aoe_str), "~g~Attached object moved~n~~w~index/number:~n~%i to %i", slot, newslot); | |
942 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
943 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
944 | } | |
945 | } | |
946 | } | |
947 | return 1; | |
948 | } | |
949 | ||
950 | dcmd_setattachedobjectslot(playerid, params[]) return dcmd_setattachedobjectindex(playerid, params); | |
951 | dcmd_saoi(playerid, params[]) return dcmd_setattachedobjectindex(playerid, params); | |
952 | ||
953 | dcmd_setattachedobjectmodel(playerid, params[]) | |
954 | { | |
955 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
956 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
956 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
957 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
958 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
959 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
960 | return 1; | |
961 | } | |
962 | else | |
963 | { | |
964 | new idx, tmp[24], tmp2[24], slot, newmodel; | |
965 | tmp = strtok(params, idx), slot = strval(tmp), SetPVarInt(playerid, "SetAttachedObjectModelIndex", slot); | |
966 | if(!strlen(tmp)) { | |
967 | AOE_ShowPlayerDialog(playerid, 7, AOED_SET_MODEL_SLOT, "Set Attached Object Model", "Select", "Cancel"); | |
968 | return 1; | |
969 | } | |
970 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
971 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
972 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
973 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
974 | return 1; | |
975 | } | |
976 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
977 | { | |
978 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
979 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
980 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
981 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
982 | return 1; | |
983 | } | |
984 | else | |
985 | { | |
986 | tmp2 = strtok(params, idx), newmodel = strval(tmp2), SetPVarInt(playerid, "SetAttachedObjectModel", newmodel); | |
987 | if(!strlen(tmp2)) { | |
988 | AOE_ShowPlayerDialog(playerid, 4, AOED_SET_MODEL, "Set Attached Object Model", "Enter", "Cancel"); | |
989 | return 1; | |
990 | } | |
991 | else if(!IsValidObjectModel(newmodel) || !IsNumeric(tmp2)) { | |
992 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid object model number/id [%s]!", tmp2); | |
993 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
994 | GameTextForPlayer(playerid, "~r~~h~Invalid object model!", 5000, 3); | |
995 | return 1; | |
996 | } | |
997 | else if(newmodel == pao[playerid][slot][aoModelID]) { | |
998 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you can't change this attached object (SID:%i) model from %d to the same model (%d)!!", slot, pao[playerid][slot][aoModelID], newmodel); | |
999 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1000 | GameTextForPlayer(playerid, "~y~DOH!", 2500, 3); | |
1001 | return 1; | |
1002 | } | |
1003 | else | |
1004 | { | |
1005 | UpdatePlayerAttachedObject(playerid, slot, newmodel, pao[playerid][slot][aoBoneID]); | |
1006 | format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object model to %d at slot/index number %i!", newmodel, slot); | |
1007 | format(aoe_str, sizeof(aoe_str), "~g~Attached object model updated~n~~w~%d (SID:%i)", newmodel, slot); | |
1008 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1009 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1010 | } | |
1011 | } | |
1012 | } | |
1013 | return 1; | |
1014 | } | |
1015 | ||
1016 | dcmd_saom(playerid, params[]) return dcmd_setattachedobjectmodel(playerid, params); | |
1017 | ||
1018 | dcmd_setattachedobjectbone(playerid, params[]) | |
1019 | { | |
1020 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
1021 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1021 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
1022 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
1023 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
1024 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
1025 | return 1; | |
1026 | } | |
1027 | else | |
1028 | { | |
1029 | new idx, tmp[24], tmp2[128], slot, newbone; | |
1030 | tmp = strtok(params, idx), slot = strval(tmp), SetPVarInt(playerid, "SetAttachedObjectBoneIndex", slot); | |
1031 | if(!strlen(tmp)) { | |
1032 | AOE_ShowPlayerDialog(playerid, 7, AOED_SET_BONE_SLOT, "Set Attached Object Bone", "Select", "Cancel"); | |
1033 | return 1; | |
1034 | } | |
1035 | if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
1036 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
1037 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1038 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
1039 | return 1; | |
1040 | } | |
1041 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
1042 | { | |
1043 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
1044 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
1045 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1046 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1047 | return 1; | |
1048 | } | |
1049 | else | |
1050 | { | |
1051 | tmp2 = strrest(params, idx), newbone = GetAttachedObjectBoneID(tmp2), SetPVarInt(playerid, "SetAttachedObjectBone", newbone); | |
1052 | if(!strlen(tmp2)) { | |
1053 | AOE_ShowPlayerDialog(playerid, 5, AOED_SET_BONE, "Set Attached Object", "Set", "Cancel"); | |
1054 | return 1; | |
1055 | } | |
1056 | if(!IsValidAttachedObjectBoneName(tmp2)) { | |
1057 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object bone [%s]!", tmp2); | |
1058 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1059 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object bone!", 5000, 3); | |
1060 | return 1; | |
1061 | } | |
1062 | else if(newbone == pao[playerid][slot][aoBoneID]) { | |
1063 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you can't change this attached object (SID:%i) bone from %s to the same bone (%i)!!", slot, tmp2, pao[playerid][slot][aoBoneID]); | |
1064 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1065 | GameTextForPlayer(playerid, "~y~DOH!", 2500, 3); | |
1066 | return 1; | |
1067 | } | |
1068 | else | |
1069 | { | |
1070 | UpdatePlayerAttachedObject(playerid, slot, pao[playerid][slot][aoModelID], newbone); | |
1071 | format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object bone to %i (%s) at slot/index number %i!", newbone, GetAttachedObjectBoneName(newbone), slot); | |
1072 | format(aoe_str, sizeof(aoe_str), "~g~Attached object bone updated~n~~w~%i (SID:%i)", newbone, slot); | |
1073 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1074 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1075 | } | |
1076 | } | |
1077 | } | |
1078 | return 1; | |
1079 | } | |
1080 | ||
1081 | dcmd_saob(playerid, params[]) return dcmd_setattachedobjectbone(playerid, params); | |
1082 | ||
1083 | dcmd_setattachedobjectoffsetx(playerid, params[]) | |
1084 | { | |
1085 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
1086 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1086 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
1087 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
1088 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
1089 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
1090 | return 1; | |
1091 | } | |
1092 | else | |
1093 | { | |
1094 | new idx, tmp[24], tmp2[24], slot, Float:newoffsetx; | |
1095 | tmp = strtok(params, idx), slot = strval(tmp); | |
1096 | tmp2 = strtok(params, idx), newoffsetx = floatstr(tmp2); | |
1097 | if(!strlen(tmp) || !strlen(tmp2)) { | |
1098 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectoffsetx <AttachedObjectSlot> <Float:OffsetX>"); | |
1099 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object position (OffsetX) with specified parameters"); | |
1100 | return 1; | |
1101 | } | |
1102 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
1103 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
1104 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1105 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
1106 | return 1; | |
1107 | } | |
1108 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
1109 | { | |
1110 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
1111 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
1112 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1113 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1114 | return 1; | |
1115 | } | |
1116 | else if(!IsNumeric2(tmp2) || (newoffsetx < MIN_ATTACHED_OBJECT_OFFSET || newoffsetx > MAX_ATTACHED_OBJECT_OFFSET)) { | |
1117 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object offset(X) value [%s]!", tmp2); | |
1118 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1119 | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (OffsetX) value are larger than "#MIN_ATTACHED_OBJECT_OFFSET" and less than "#MAX_ATTACHED_OBJECT_OFFSET""); | |
1120 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object offset value!", 5000, 3); | |
1121 | return 1; | |
1122 | } | |
1123 | else | |
1124 | { | |
1125 | UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], newoffsetx, pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], | |
1126 | pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]); | |
1127 | format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object position (OffsetX) to %.2f at slot/index number %i!", newoffsetx, slot); | |
1128 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1129 | GameTextForPlayer(playerid, "~g~Attached object position updated!", 5000, 3); | |
1130 | } | |
1131 | } | |
1132 | return 1; | |
1133 | } | |
1134 | ||
1135 | dcmd_saoox(playerid, params[]) return dcmd_setattachedobjectoffsetx(playerid, params); | |
1136 | ||
1137 | dcmd_setattachedobjectoffsety(playerid, params[]) | |
1138 | { | |
1139 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
1140 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1140 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
1141 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
1142 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
1143 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
1144 | return 1; | |
1145 | } | |
1146 | else | |
1147 | { | |
1148 | new idx, tmp[24], tmp2[24], slot, Float:newoffsety; | |
1149 | tmp = strtok(params, idx), slot = strval(tmp); | |
1150 | tmp2 = strtok(params, idx), newoffsety = floatstr(tmp2); | |
1151 | if(!strlen(tmp) || !strlen(tmp2)) { | |
1152 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectoffsety <AttachedObjectSlot> <Float:OffsetY>"); | |
1153 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object position (OffsetY) with specified parameters"); | |
1154 | return 1; | |
1155 | } | |
1156 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
1157 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
1158 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1159 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
1160 | return 1; | |
1161 | } | |
1162 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
1163 | { | |
1164 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
1165 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
1166 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1167 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1168 | return 1; | |
1169 | } | |
1170 | else if(!IsNumeric2(tmp2) || (newoffsety < MIN_ATTACHED_OBJECT_OFFSET || newoffsety > MAX_ATTACHED_OBJECT_OFFSET)) { | |
1171 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object offset(Y) value [%s]!", tmp2); | |
1172 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1173 | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (OffsetY) value are larger than "#MIN_ATTACHED_OBJECT_OFFSET" and less than "#MAX_ATTACHED_OBJECT_OFFSET""); | |
1174 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object offset value!", 5000, 3); | |
1175 | return 1; | |
1176 | } | |
1177 | else | |
1178 | { | |
1179 | UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], newoffsety, pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], | |
1180 | pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]); | |
1181 | format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object position (OffsetY) to %.2f at slot/index number %i!", newoffsety, slot); | |
1182 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1183 | GameTextForPlayer(playerid, "~g~Attached object position updated!", 5000, 3); | |
1184 | } | |
1185 | } | |
1186 | return 1; | |
1187 | } | |
1188 | ||
1189 | dcmd_saooy(playerid, params[]) return dcmd_setattachedobjectoffsety(playerid, params); | |
1190 | ||
1191 | dcmd_setattachedobjectoffsetz(playerid, params[]) | |
1192 | { | |
1193 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
1194 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1194 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
1195 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
1196 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
1197 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
1198 | return 1; | |
1199 | } | |
1200 | else | |
1201 | { | |
1202 | new idx, tmp[24], tmp2[24], slot, Float:newoffsetz; | |
1203 | tmp = strtok(params, idx), slot = strval(tmp); | |
1204 | tmp2 = strtok(params, idx), newoffsetz = floatstr(tmp2); | |
1205 | if(!strlen(tmp) || !strlen(tmp2)) { | |
1206 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectoffsetz <AttachedObjectSlot> <Float:OffsetZ>"); | |
1207 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object position (OffsetZ) with specified parameters"); | |
1208 | return 1; | |
1209 | } | |
1210 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
1211 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
1212 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1213 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
1214 | return 1; | |
1215 | } | |
1216 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
1217 | { | |
1218 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
1219 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
1220 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1221 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1222 | return 1; | |
1223 | } | |
1224 | else if(!IsNumeric2(tmp2) || (newoffsetz < MIN_ATTACHED_OBJECT_OFFSET || newoffsetz > MAX_ATTACHED_OBJECT_OFFSET)) { | |
1225 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object offset(Z) value [%s]!", tmp2); | |
1226 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1227 | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (OffsetZ) value are larger than "#MIN_ATTACHED_OBJECT_OFFSET" and less than "#MAX_ATTACHED_OBJECT_OFFSET""); | |
1228 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object offset value!", 5000, 3); | |
1229 | return 1; | |
1230 | } | |
1231 | else | |
1232 | { | |
1233 | UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], newoffsetz, pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], | |
1234 | pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]); | |
1235 | format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object position (OffsetZ) to %.2f at slot/index number %i!", newoffsetz, slot); | |
1236 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1237 | GameTextForPlayer(playerid, "~g~Attached object position updated!", 5000, 3); | |
1238 | } | |
1239 | } | |
1240 | return 1; | |
1241 | } | |
1242 | ||
1243 | dcmd_saooz(playerid, params[]) return dcmd_setattachedobjectoffsetz(playerid, params); | |
1244 | ||
1245 | dcmd_setattachedobjectrotx(playerid, params[]) | |
1246 | { | |
1247 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
1248 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1248 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
1249 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
1250 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
1251 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
1252 | return 1; | |
1253 | } | |
1254 | else | |
1255 | { | |
1256 | new idx, tmp[24], tmp2[24], slot, Float:newrotx; | |
1257 | tmp = strtok(params, idx), slot = strval(tmp); | |
1258 | tmp2 = strtok(params, idx), newrotx = floatstr(tmp2); | |
1259 | if(!strlen(tmp) || !strlen(tmp2)) { | |
1260 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectrotx <AttachedObjectSlot> <Float:RotX>"); | |
1261 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object rotation (RotX) with specified parameters"); | |
1262 | return 1; | |
1263 | } | |
1264 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
1265 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
1266 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1267 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
1268 | return 1; | |
1269 | } | |
1270 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
1271 | { | |
1272 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
1273 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
1274 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1275 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1276 | return 1; | |
1277 | } | |
1278 | else if(!IsNumeric2(tmp2) || (newrotx < MIN_ATTACHED_OBJECT_ROT || newrotx > MAX_ATTACHED_OBJECT_ROT)) { | |
1279 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object rotation(X) value [%s]!", tmp2); | |
1280 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1281 | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (RotX) value are larger than "#MIN_ATTACHED_OBJECT_ROT" and less than "#MAX_ATTACHED_OBJECT_ROT""); | |
1282 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object rotation value!", 5000, 3); | |
1283 | return 1; | |
1284 | } | |
1285 | else | |
1286 | { | |
1287 | UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], newrotx, pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], | |
1288 | pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]); | |
1289 | format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object rotation (RotX) to %.2f at slot/index number %i!", newrotx, slot); | |
1290 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1291 | GameTextForPlayer(playerid, "~g~Attached object rotation updated!", 5000, 3); | |
1292 | } | |
1293 | } | |
1294 | return 1; | |
1295 | } | |
1296 | ||
1297 | dcmd_saorx(playerid, params[]) return dcmd_setattachedobjectrotx(playerid, params); | |
1298 | ||
1299 | dcmd_setattachedobjectroty(playerid, params[]) | |
1300 | { | |
1301 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
1302 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1302 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
1303 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
1304 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
1305 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
1306 | return 1; | |
1307 | } | |
1308 | else | |
1309 | { | |
1310 | new idx, tmp[24], tmp2[24], slot, Float:newroty; | |
1311 | tmp = strtok(params, idx), slot = strval(tmp); | |
1312 | tmp2 = strtok(params, idx), newroty = floatstr(tmp2); | |
1313 | if(!strlen(tmp) || !strlen(tmp2)) { | |
1314 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectroty <AttachedObjectSlot> <Float:RotY>"); | |
1315 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object rotation (RotY) with specified parameters"); | |
1316 | return 1; | |
1317 | } | |
1318 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
1319 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
1320 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1321 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
1322 | return 1; | |
1323 | } | |
1324 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
1325 | { | |
1326 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
1327 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
1328 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1329 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1330 | return 1; | |
1331 | } | |
1332 | else if(!IsNumeric2(tmp2) || (newroty < MIN_ATTACHED_OBJECT_ROT || newroty > MAX_ATTACHED_OBJECT_ROT)) { | |
1333 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object rotation(Y) value [%s]!", tmp2); | |
1334 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1335 | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (RotY) value are larger than "#MIN_ATTACHED_OBJECT_ROT" and less than "#MAX_ATTACHED_OBJECT_ROT""); | |
1336 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object rotation value!", 5000, 3); | |
1337 | return 1; | |
1338 | } | |
1339 | else | |
1340 | { | |
1341 | UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], newroty, pao[playerid][slot][aoRZ], | |
1342 | pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]); | |
1343 | format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object rotation (RotY) to %.2f at slot/index number %i!", newroty, slot); | |
1344 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1345 | GameTextForPlayer(playerid, "~g~Attached object rotation updated!", 5000, 3); | |
1346 | } | |
1347 | } | |
1348 | return 1; | |
1349 | } | |
1350 | ||
1351 | dcmd_saory(playerid, params[]) return dcmd_setattachedobjectroty(playerid, params); | |
1352 | ||
1353 | dcmd_setattachedobjectrotz(playerid, params[]) | |
1354 | { | |
1355 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
1356 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1356 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
1357 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
1358 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
1359 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
1360 | return 1; | |
1361 | } | |
1362 | else | |
1363 | { | |
1364 | new idx, tmp[24], tmp2[24], slot, Float:newrotz; | |
1365 | tmp = strtok(params, idx), slot = strval(tmp); | |
1366 | tmp2 = strtok(params, idx), newrotz = floatstr(tmp2); | |
1367 | if(!strlen(tmp) || !strlen(tmp2)) { | |
1368 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectrotz <AttachedObjectSlot> <Float:RotZ>"); | |
1369 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object rotation (RotZ) with specified parameters"); | |
1370 | return 1; | |
1371 | } | |
1372 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
1373 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
1374 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1375 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
1376 | return 1; | |
1377 | } | |
1378 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
1379 | { | |
1380 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
1381 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
1382 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1383 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1384 | return 1; | |
1385 | } | |
1386 | else if(!IsNumeric2(tmp2) || (newrotz < MIN_ATTACHED_OBJECT_ROT || newrotz > MAX_ATTACHED_OBJECT_ROT)) { | |
1387 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object rotation(Z) value [%s]!", tmp2); | |
1388 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1389 | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (RotZ) value are larger than "#MIN_ATTACHED_OBJECT_ROT" and less than "#MAX_ATTACHED_OBJECT_ROT""); | |
1390 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object rotation value!", 5000, 3); | |
1391 | return 1; | |
1392 | } | |
1393 | else | |
1394 | { | |
1395 | UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], newrotz, | |
1396 | pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]); | |
1397 | format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object rotation (RotZ) to %.2f at slot/index number %i!", newrotz, slot); | |
1398 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1399 | GameTextForPlayer(playerid, "~g~Attached object rotation updated!", 5000, 3); | |
1400 | } | |
1401 | } | |
1402 | return 1; | |
1403 | } | |
1404 | ||
1405 | dcmd_saorz(playerid, params[]) return dcmd_setattachedobjectrotz(playerid, params); | |
1406 | ||
1407 | dcmd_setattachedobjectscalex(playerid, params[]) | |
1408 | { | |
1409 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
1410 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1410 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
1411 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
1412 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
1413 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
1414 | return 1; | |
1415 | } | |
1416 | else | |
1417 | { | |
1418 | new idx, tmp[24], tmp2[24], slot, Float:newscalex; | |
1419 | tmp = strtok(params, idx), slot = strval(tmp); | |
1420 | tmp2 = strtok(params, idx), newscalex = floatstr(tmp2); | |
1421 | if(!strlen(tmp) || !strlen(tmp2)) { | |
1422 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectscalex <AttachedObjectSlot> <Float:ScaleX>"); | |
1423 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object size (ScaleX) with specified parameters"); | |
1424 | return 1; | |
1425 | } | |
1426 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
1427 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
1428 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1429 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
1430 | return 1; | |
1431 | } | |
1432 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
1433 | { | |
1434 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
1435 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
1436 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1437 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1438 | return 1; | |
1439 | } | |
1440 | else if(!IsNumeric2(tmp2) || (newscalex < MIN_ATTACHED_OBJECT_SIZE || newscalex > MAX_ATTACHED_OBJECT_SIZE)) { | |
1441 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object scale(X) value [%s]!", tmp2); | |
1442 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1443 | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (ScaleX) value are larger than "#MIN_ATTACHED_OBJECT_SIZE" and less than "#MAX_ATTACHED_OBJECT_SIZE""); | |
1444 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object size value!", 5000, 3); | |
1445 | return 1; | |
1446 | } | |
1447 | else | |
1448 | { | |
1449 | UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], | |
1450 | newscalex, pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]); | |
1451 | format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object size (ScaleX) to %.2f at slot/index number %i!", newscalex, slot); | |
1452 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1453 | GameTextForPlayer(playerid, "~g~Attached object size updated!", 5000, 3); | |
1454 | } | |
1455 | } | |
1456 | return 1; | |
1457 | } | |
1458 | ||
1459 | dcmd_saosx(playerid, params[]) return dcmd_setattachedobjectscalex(playerid, params); | |
1460 | ||
1461 | dcmd_setattachedobjectscaley(playerid, params[]) | |
1462 | { | |
1463 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
1464 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1464 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
1465 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
1466 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
1467 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
1468 | return 1; | |
1469 | } | |
1470 | else | |
1471 | { | |
1472 | new idx, tmp[24], tmp2[24], slot, Float:newscaley; | |
1473 | tmp = strtok(params, idx), slot = strval(tmp); | |
1474 | tmp2 = strtok(params, idx), newscaley = floatstr(tmp2); | |
1475 | if(!strlen(tmp) || !strlen(tmp2)) { | |
1476 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectscaley <AttachedObjectSlot> <Float:ScaleY>"); | |
1477 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object size (ScaleY) with specified parameters"); | |
1478 | return 1; | |
1479 | } | |
1480 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
1481 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
1482 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1483 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
1484 | return 1; | |
1485 | } | |
1486 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
1487 | { | |
1488 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
1489 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
1490 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1491 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1492 | return 1; | |
1493 | } | |
1494 | else if(!IsNumeric2(tmp2) || (newscaley < MIN_ATTACHED_OBJECT_SIZE || newscaley > MAX_ATTACHED_OBJECT_SIZE)) { | |
1495 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object scale(Y) value [%s]!", tmp2); | |
1496 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1497 | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (ScaleY) value are larger than "#MIN_ATTACHED_OBJECT_SIZE" and less than "#MAX_ATTACHED_OBJECT_SIZE""); | |
1498 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object size value!", 5000, 3); | |
1499 | return 1; | |
1500 | } | |
1501 | else | |
1502 | { | |
1503 | UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], | |
1504 | pao[playerid][slot][aoSX], newscaley, pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]); | |
1505 | format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object size (ScaleY) to %.2f at slot/index number %i!", newscaley, slot); | |
1506 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1507 | GameTextForPlayer(playerid, "~g~Attached object size updated!", 5000, 3); | |
1508 | } | |
1509 | } | |
1510 | return 1; | |
1511 | } | |
1512 | ||
1513 | dcmd_saosy(playerid, params[]) return dcmd_setattachedobjectscaley(playerid, params); | |
1514 | ||
1515 | dcmd_setattachedobjectscalez(playerid, params[]) | |
1516 | { | |
1517 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
1518 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1518 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
1519 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
1520 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
1521 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
1522 | return 1; | |
1523 | } | |
1524 | else | |
1525 | { | |
1526 | new idx, tmp[24], tmp2[24], slot, Float:newscalez; | |
1527 | tmp = strtok(params, idx), slot = strval(tmp); | |
1528 | tmp2 = strtok(params, idx), newscalez = floatstr(tmp2); | |
1529 | if(!strlen(tmp) || !strlen(tmp2)) { | |
1530 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectscalez <AttachedObjectSlot> <Float:ScaleZ>"); | |
1531 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object size (ScaleZ) with specified parameters"); | |
1532 | return 1; | |
1533 | } | |
1534 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
1535 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
1536 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1537 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
1538 | return 1; | |
1539 | } | |
1540 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
1541 | { | |
1542 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
1543 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
1544 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1545 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1546 | return 1; | |
1547 | } | |
1548 | else if(!IsNumeric2(tmp2) || (newscalez < MIN_ATTACHED_OBJECT_SIZE || newscalez > MAX_ATTACHED_OBJECT_SIZE)) { | |
1549 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object scale(Z) value [%s]!", tmp2); | |
1550 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1551 | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (ScaleZ) value are larger than "#MIN_ATTACHED_OBJECT_SIZE" and less than "#MAX_ATTACHED_OBJECT_SIZE""); | |
1552 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object size value!", 5000, 3); | |
1553 | return 1; | |
1554 | } | |
1555 | else | |
1556 | { | |
1557 | UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], | |
1558 | pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], newscalez, pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]); | |
1559 | format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object size (ScaleZ) to %.2f at slot/index number %i!", newscalez, slot); | |
1560 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1561 | GameTextForPlayer(playerid, "~g~Attached object size updated!", 5000, 3); | |
1562 | } | |
1563 | } | |
1564 | return 1; | |
1565 | } | |
1566 | ||
1567 | dcmd_saosz(playerid, params[]) return dcmd_setattachedobjectscalez(playerid, params); | |
1568 | ||
1569 | dcmd_setattachedobjectmc1(playerid, params[]) | |
1570 | { | |
1571 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
1572 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1572 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
1573 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
1574 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
1575 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
1576 | return 1; | |
1577 | } | |
1578 | else | |
1579 | { | |
1580 | new idx, tmp[24], tmp2[24], slot, newmc1; | |
1581 | tmp = strtok(params, idx), slot = strval(tmp); | |
1582 | if(!strlen(tmp)) { | |
1583 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmc1 <AttachedObjectSlot> <MaterialColor>"); | |
1584 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object color (Material:1) with specified parameters"); | |
1585 | return 1; | |
1586 | } | |
1587 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
1588 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
1589 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1590 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
1591 | return 1; | |
1592 | } | |
1593 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
1594 | { | |
1595 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
1596 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
1597 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1598 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1599 | return 1; | |
1600 | } | |
1601 | else | |
1602 | { | |
1603 | new alpha[3], red[3], green[3], blue[3], colors[16]; | |
1604 | tmp2 = strtok(params, idx); | |
1605 | if(!strlen(tmp2)) { | |
1606 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmc1 <AttachedObjectSlot> <MaterialColor>"); | |
1607 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object color (Material:1) with specified parameters"); | |
1608 | return 1; | |
1609 | } | |
1610 | else | |
1611 | { | |
1612 | strins(colors, tmp2, 0); | |
1613 | if(IsNumeric2(tmp2)) newmc1 = strval(colors); // Integer | |
1614 | else if(strlen(tmp2) == 8) // AARRGGBB | |
1615 | { | |
1616 | SetColor: | |
1617 | if(IsValidHex(colors)) | |
1618 | { | |
1619 | format(alpha, sizeof(alpha), "%c%c", colors[0], colors[1]); | |
1620 | format(red, sizeof(red), "%c%c", colors[2], colors[3]); | |
1621 | format(green, sizeof(green), "%c%c", colors[4], colors[5]); | |
1622 | format(blue, sizeof(blue), "%c%c", colors[6], colors[7]); | |
1623 | newmc1 = RGBAtoARGB(RGB(HexToInt(red), HexToInt(green), HexToInt(blue), HexToInt(alpha))); | |
1624 | } | |
1625 | else goto Error; | |
1626 | } | |
1627 | else if(tmp2[0] == '#' && strlen(tmp2) == 9) { // #AARRGGBB | |
1628 | strdel(colors, 0, 1); | |
1629 | goto SetColor; | |
1630 | } | |
1631 | else if(tmp2[0] == '0' && tmp2[1] == 'x' && strlen(tmp2) == 10) { // 0xAARRGGBB | |
1632 | strdel(colors, 0, 2); | |
1633 | goto SetColor; | |
1634 | } | |
1635 | else { | |
1636 | Error: | |
1637 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object color(MC1) value [%s]!", tmp2); | |
1638 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1639 | SendClientMessage(playerid, COLOR_WHITE, "** Use hex color with ARGB (AARRGGBB) format (eg. 0xFFFF0000, #FF00FF00, FF0000FF) or integer value."); | |
1640 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object color value!", 5000, 3); | |
1641 | return 1; | |
1642 | } | |
1643 | } | |
1644 | UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], | |
1645 | pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], newmc1, pao[playerid][slot][aoMC2]); | |
1646 | format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object color (MC1) to %s at slot/index number %i!", tmp2, slot); | |
1647 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1648 | GameTextForPlayer(playerid, "~g~Attached object color updated!", 5000, 3); | |
1649 | } | |
1650 | } | |
1651 | return 1; | |
1652 | } | |
1653 | ||
1654 | dcmd_saomc1(playerid, params[]) return dcmd_setattachedobjectmc1(playerid, params); | |
1655 | ||
1656 | dcmd_setattachedobjectmc2(playerid, params[]) | |
1657 | { | |
1658 | if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) | |
1659 | - | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1659 | + | return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1; |
1660 | else if(!GetPlayerAttachedObjectsCount(playerid)) { | |
1661 | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); | |
1662 | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3); | |
1663 | return 1; | |
1664 | } | |
1665 | else | |
1666 | { | |
1667 | new idx, tmp[24], tmp2[24], slot, newmc2; | |
1668 | tmp = strtok(params, idx), slot = strval(tmp); | |
1669 | if(!strlen(tmp)) { | |
1670 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmc2 <AttachedObjectSlot> <MaterialColor>"); | |
1671 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object color (Material:2) with specified parameters"); | |
1672 | return 1; | |
1673 | } | |
1674 | else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) { | |
1675 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp); | |
1676 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1677 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3); | |
1678 | return 1; | |
1679 | } | |
1680 | else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot)) | |
1681 | { | |
1682 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot); | |
1683 | format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot); | |
1684 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1685 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1686 | return 1; | |
1687 | } | |
1688 | else | |
1689 | { | |
1690 | new alpha[3], red[3], green[3], blue[3], colors[10]; | |
1691 | tmp2 = strtok(params, idx); | |
1692 | if(!strlen(tmp)) { | |
1693 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmc2 <AttachedObjectSlot> <MaterialColor>"); | |
1694 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object color (Material:2) with specified parameters"); | |
1695 | return 1; | |
1696 | } | |
1697 | else | |
1698 | { | |
1699 | strins(colors, tmp2, 0); | |
1700 | if(IsNumeric2(tmp2)) newmc2 = strval(colors); // Integer | |
1701 | else if(strlen(tmp2) == 8) // AARRGGBB | |
1702 | { | |
1703 | SetColor: | |
1704 | if(IsValidHex(colors)) | |
1705 | { | |
1706 | format(alpha, sizeof(alpha), "%c%c", colors[0], colors[1]); | |
1707 | format(red, sizeof(red), "%c%c", colors[2], colors[3]); | |
1708 | format(green, sizeof(green), "%c%c", colors[4], colors[5]); | |
1709 | format(blue, sizeof(blue), "%c%c", colors[6], colors[7]); | |
1710 | newmc2 = RGBAtoARGB(RGB(HexToInt(red), HexToInt(green), HexToInt(blue), HexToInt(alpha))); | |
1711 | } | |
1712 | else goto Error; | |
1713 | } | |
1714 | else if(tmp2[0] == '#' && strlen(tmp2) == 9) { // #AARRGGBB | |
1715 | strdel(colors, 0, 1); | |
1716 | goto SetColor; | |
1717 | } | |
1718 | else if(tmp2[0] == '0' && tmp2[1] == 'x' && strlen(tmp2) == 10) { // 0xAARRGGBB | |
1719 | strdel(colors, 0, 2); | |
1720 | goto SetColor; | |
1721 | } | |
1722 | else { | |
1723 | Error: | |
1724 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object color(MC2) value [%s]!", tmp2); | |
1725 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1726 | SendClientMessage(playerid, COLOR_WHITE, "** Use hex color with ARGB (AARRGGBB) format (eg. 0xFFFF0000, #FF00FF00, FF0000FF) or integer value."); | |
1727 | GameTextForPlayer(playerid, "~r~~h~Invalid attached object color value!", 5000, 3); | |
1728 | return 1; | |
1729 | } | |
1730 | } | |
1731 | UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], | |
1732 | pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], newmc2); | |
1733 | format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object color (MC2) to %s at slot/index number %i!", tmp2, slot); | |
1734 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1735 | GameTextForPlayer(playerid, "~g~Attached object color updated!", 5000, 3); | |
1736 | } | |
1737 | } | |
1738 | return 1; | |
1739 | } | |
1740 | ||
1741 | dcmd_saomc2(playerid, params[]) return dcmd_setattachedobjectmc2(playerid, params); | |
1742 | ||
1743 | public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) | |
1744 | { | |
1745 | switch(dialogid) | |
1746 | { | |
1747 | case AOED: | |
1748 | { | |
1749 | if(response) | |
1750 | { | |
1751 | switch(listitem) | |
1752 | { | |
1753 | case 0: OnPlayerCommandText(playerid, "/createattachedobject"); | |
1754 | case 1: OnPlayerCommandText(playerid, "/duplicateattachedobject"); | |
1755 | case 2: OnPlayerCommandText(playerid, "/editattachedobject"); | |
1756 | case 3: OnPlayerCommandText(playerid, "/saveattachedobject"); | |
1757 | case 4: OnPlayerCommandText(playerid, "/saveattachedobjects"); | |
1758 | case 5: OnPlayerCommandText(playerid, "/loadattachedobject"); | |
1759 | case 6: OnPlayerCommandText(playerid, "/loadattachedobjects"); | |
1760 | case 7: OnPlayerCommandText(playerid, "/removeattachedobject"); | |
1761 | case 8: OnPlayerCommandText(playerid, "/removeattachedobjects"); | |
1762 | case 9: OnPlayerCommandText(playerid, "/undodeleteattachedobject"); | |
1763 | case 10: OnPlayerCommandText(playerid, "/convertattachedobjectfile"); | |
1764 | case 11: OnPlayerCommandText(playerid, "/attachedobjectlist"); | |
1765 | case 12: OnPlayerCommandText(playerid, "/attachedobjectstats"); | |
1766 | case 13: OnPlayerCommandText(playerid, "/totalattachedobjects"); | |
1767 | case 14: OnPlayerCommandText(playerid, "/attachedobjecteditorhelp"); | |
1768 | case 15: AOE_ShowPlayerDialog(playerid, 3, AOED_ABOUT, "About Attached Object Editor", "Close"); | |
1769 | } | |
1770 | } | |
1771 | else SendClientMessage(playerid, COLOR_WHITE, "* You've closed attached object editor dialog"); | |
1772 | } | |
1773 | case AOED_CREATE_MODEL: | |
1774 | { | |
1775 | if(response) { | |
1776 | format(aoe_str, sizeof(aoe_str), "%s", inputtext); | |
1777 | dcmd_createattachedobject(playerid, aoe_str); | |
1778 | } | |
1779 | else { | |
1780 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /createattachedobject <ObjectModelID> <AttachedObjectBone> <AttachedObjectSlot>"); | |
1781 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to create your attached object with specified parameters"); | |
1782 | } | |
1783 | } | |
1784 | case AOED_CREATE_BONE: | |
1785 | { | |
1786 | if(response) { | |
1787 | format(aoe_str, sizeof(aoe_str), "%d %i", GetPVarInt(playerid, "CreateAttachedObjectModel"), listitem + 1); | |
1788 | dcmd_createattachedobject(playerid, aoe_str); | |
1789 | } | |
1790 | else { | |
1791 | // AOE_ShowPlayerDialog(playerid, 4, AOED_CREATE_MODEL, "Create Attached Object", "Enter", "Cancel"); | |
1792 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /createattachedobject <ObjectModelID> <AttachedObjectBone> <AttachedObjectSlot>"); | |
1793 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to create your attached object with specified parameters"); | |
1794 | } | |
1795 | } | |
1796 | case AOED_CREATE_SLOT: | |
1797 | { | |
1798 | if(response) { | |
1799 | format(aoe_str, sizeof(aoe_str), "%d %i %i", GetPVarInt(playerid, "CreateAttachedObjectModel"), GetPVarInt(playerid, "CreateAttachedObjectBone"), listitem); | |
1800 | dcmd_createattachedobject(playerid, aoe_str); | |
1801 | } | |
1802 | else { | |
1803 | // AOE_ShowPlayerDialog(playerid, 5, AOED_CREATE_BONE, "Create Attached Object", "Select", "Cancel"); | |
1804 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /createattachedobject <ObjectModelID> <AttachedObjectBone> <AttachedObjectSlot>"); | |
1805 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to create your attached object with specified parameters"); | |
1806 | } | |
1807 | } | |
1808 | case AOED_CREATE_REPLACE: | |
1809 | { | |
1810 | if(response) | |
1811 | { | |
1812 | new slot = GetPVarInt(playerid, "CreateAttachedObjectIndex"), model = GetPVarInt(playerid, "CreateAttachedObjectModel"), bone = GetPVarInt(playerid, "CreateAttachedObjectBone"); | |
1813 | CreatePlayerAttachedObject(playerid, slot, model, bone); | |
1814 | format(aoe_str2, sizeof(aoe_str2), "* Created a new attached object model %d at slot/index number %i [Bone: %s (%i)]!", model, slot, GetAttachedObjectBoneName(bone), bone); | |
1815 | format(aoe_str, sizeof(aoe_str), "~b~Created attached object~n~~w~index/number: %i~n~Model: %d - Bone: %i", slot, model, bone); | |
1816 | SendClientMessage(playerid, COLOR_BLUE, aoe_str2); | |
1817 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1818 | AOE_ShowPlayerDialog(playerid, 10, AOED_CREATE_EDIT, "Edit attached object", "Edit", "Skip"); | |
1819 | } | |
1820 | else { | |
1821 | // AOE_ShowPlayerDialog(playerid, 6, AOED_CREATE_SLOT, "Create Attached Object", "Select", "Cancel"); | |
1822 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /createattachedobject <ObjectModelID> <AttachedObjectBone> <AttachedObjectSlot>"); | |
1823 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to create your attached object with specified parameters"); | |
1824 | } | |
1825 | } | |
1826 | case AOED_CREATE_EDIT: | |
1827 | { | |
1828 | if(response) { | |
1829 | format(aoe_str, sizeof(aoe_str), "%i", GetPVarInt(playerid, "CreateAttachedObjectIndex")); | |
1830 | dcmd_editattachedobject(playerid, aoe_str); | |
1831 | } | |
1832 | else { | |
1833 | SendClientMessage(playerid, COLOR_WHITE, "* You've skipped to edit your attached object"); | |
1834 | SendClientMessage(playerid, COLOR_WHITE, "** Note: use /editattachedobject command to edit your attached object"); | |
1835 | } | |
1836 | } | |
1837 | case AOED_EDIT_SLOT: | |
1838 | { | |
1839 | if(response) | |
1840 | { | |
1841 | if(IsPlayerAttachedObjectSlotUsed(playerid, listitem)) { | |
1842 | format(aoe_str, sizeof(aoe_str), "%i", listitem); | |
1843 | dcmd_editattachedobject(playerid, aoe_str); | |
1844 | } | |
1845 | else { | |
1846 | format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", listitem); | |
1847 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
1848 | AOE_ShowPlayerDialog(playerid, 7, AOED_EDIT_SLOT, "Edit Attached Object", "Edit", "Cancel"); | |
1849 | } | |
1850 | } | |
1851 | else { | |
1852 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /editattachedobject <AttachedObjectSlot>"); | |
1853 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to edit your attached object from specified slot/index number"); | |
1854 | } | |
1855 | SetPVarInt(playerid, "EditingAttachedObject", 0); | |
1856 | } | |
1857 | case AOED_REMOVE_SLOT: | |
1858 | { | |
1859 | if(response) { | |
1860 | format(aoe_str, sizeof(aoe_str), "%i", listitem); | |
1861 | dcmd_removeattachedobject(playerid, aoe_str); | |
1862 | } | |
1863 | else { | |
1864 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /removeattachedobject <AttachedObjectSlot>"); | |
1865 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to remove your attached object from specified attached object slot/index number"); | |
1866 | } | |
1867 | } | |
1868 | case AOED_REMOVE: | |
1869 | { | |
1870 | if(response) | |
1871 | { | |
1872 | new slot = GetPVarInt(playerid, "RemoveAttachedObjectIndex"); | |
1873 | RemovePlayerAttachedObjectEx(playerid, slot), SetPVarInt(playerid, "RemoveAttachedObjectIndex", slot); | |
1874 | format(aoe_str2, sizeof(aoe_str2), "* You've removed your attached object from slot/index number %i!", slot); | |
1875 | format(aoe_str, sizeof(aoe_str), "~r~Removed your attached object~n~~w~index/number: %i", slot); | |
1876 | SendClientMessage(playerid, COLOR_RED, aoe_str2); | |
1877 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1878 | } | |
1879 | else SendClientMessage(playerid, COLOR_WHITE, "* You've canceled removing your attached object"); | |
1880 | } | |
1881 | case AOED_REMOVEALL: | |
1882 | { | |
1883 | if(response) | |
1884 | { | |
1885 | new slots = RemovePlayerAttachedObjectEx(playerid, 0, true); | |
1886 | format(aoe_str2, sizeof(aoe_str2), "* You've removed all of your %d attached object(s)!", slots); | |
1887 | format(aoe_str, sizeof(aoe_str), "~r~Removed all your attached object(s)~n~~w~Total: %d", slots); | |
1888 | SendClientMessage(playerid, COLOR_RED, aoe_str2); | |
1889 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1890 | } | |
1891 | else SendClientMessage(playerid, COLOR_WHITE, "* You've canceled removing all your attached object(s)"); | |
1892 | } | |
1893 | case AOED_STATS_SLOT: | |
1894 | { | |
1895 | if(response) { | |
1896 | format(aoe_str, sizeof(aoe_str), "%i", listitem); | |
1897 | dcmd_attachedobjectstats(playerid, aoe_str); | |
1898 | } | |
1899 | else { | |
1900 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /attachedobjectstats <AttachedObjectSlot>"); | |
1901 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to view your attached stats object from specified slot"); | |
1902 | } | |
1903 | } | |
1904 | case AOED_STATS: | |
1905 | { | |
1906 | if(response && IsPlayerAdmin(playerid)) | |
1907 | { | |
1908 | new slot = GetPVarInt(playerid, "AttachedObjectStatsIndex"); | |
1909 | GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME); | |
1910 | printf(" >> %s (ID:%i) is requesting to print their attached object stats", PlayerName, playerid); | |
1911 | printf(" Attached object slot/index number: %i\n - Model ID/Number/Type: %d\n - Bone: %s (ID:%d)\n - Offsets:\n -- X: %.2f ~ Y: %.2f ~ Z: %.2f\n - Rotations:\n -- RX: %.2f ~ RY: %.2f ~ RZ: %.2f\ | |
1912 | \n - Scales:\n -- SX: %.2f ~ SY: %.2f ~ SZ: %.2f\n - Materials:\n -- Color 1: %i (%x) ~ Color 2: %i (%x)\n Total of %s (ID:%i)'s attached object(s): %d", slot, pao[playerid][slot][aoModelID], GetAttachedObjectBoneName(pao[playerid][slot][aoBoneID]), | |
1913 | pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], | |
1914 | pao[playerid][slot][aoMC1], IntToHex(pao[playerid][slot][aoMC1]), pao[playerid][slot][aoMC2], IntToHex(pao[playerid][slot][aoMC2]), PlayerName, playerid, GetPlayerAttachedObjectsCount(playerid)); | |
1915 | printf(" Skin: %i ~ Code usage (playerid = %i):\n SetPlayerAttachedObject(playerid, %i, %d, %i, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %i, %i);", GetPlayerSkin(playerid), playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], | |
1916 | pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], | |
1917 | pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]); | |
1918 | SendClientMessage(playerid, COLOR_WHITE, "SERVER: Your attached object stats has been printed!"); | |
1919 | } | |
1920 | else SendClientMessage(playerid, COLOR_WHITE, "* You've closed your attached object stats dialog"); | |
1921 | } | |
1922 | case AOED_AO_LIST: | |
1923 | { | |
1924 | if(response) { | |
1925 | format(aoe_str, sizeof(aoe_str), "%i", listitem); | |
1926 | dcmd_editattachedobject(playerid, aoe_str); | |
1927 | } | |
1928 | else SendClientMessage(playerid, COLOR_WHITE, "* You've closed your attached object list dialog"); | |
1929 | } | |
1930 | case AOED_DUPLICATE_SLOT1: | |
1931 | { | |
1932 | if(response) { | |
1933 | format(aoe_str, sizeof(aoe_str), "%i", listitem); | |
1934 | dcmd_duplicateattachedobject(playerid, aoe_str); | |
1935 | } | |
1936 | else { | |
1937 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /duplicateattachedobject <FromAttachedObjectSlot> <ToAttachedObjectSlot>"); | |
1938 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to duplicate your attached object from specified slot to another specified slot"); | |
1939 | } | |
1940 | } | |
1941 | case AOED_DUPLICATE_SLOT2: | |
1942 | { | |
1943 | if(response) { | |
1944 | format(aoe_str, sizeof(aoe_str), "%i %i", GetPVarInt(playerid, "DuplicateAttachedObjectIndex1"), listitem); | |
1945 | dcmd_duplicateattachedobject(playerid, aoe_str); | |
1946 | } | |
1947 | else { | |
1948 | // AOE_ShowPlayerDialog(playerid, 7, AOED_DUPLICATE_SLOT1, "Duplicate Attached Object Index (1)", "Select", "Cancel"); | |
1949 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /duplicateattachedobject <FromAttachedObjectSlot> <ToAttachedObjectSlot>"); | |
1950 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to duplicate your attached object from specified slot to another specified slot"); | |
1951 | } | |
1952 | } | |
1953 | case AOED_DUPLICATE_REPLACE: | |
1954 | { | |
1955 | if(response) | |
1956 | { | |
1957 | new slot1 = GetPVarInt(playerid, "DuplicateAttachedObjectIndex1"), slot2 = GetPVarInt(playerid, "DuplicateAttachedObjectIndex2"); | |
1958 | DuplicatePlayerAttachedObject(playerid, slot1, slot2); | |
1959 | format(aoe_str2, sizeof(aoe_str2), "* Duplicated your attached object from slot/index number %i to %i!", slot1, slot2); | |
1960 | format(aoe_str, sizeof(aoe_str), "~g~Attached object duplicated~n~~w~index/number:~n~%i to %i", slot1, slot2); | |
1961 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
1962 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
1963 | } | |
1964 | else { | |
1965 | // AOE_ShowPlayerDialog(playerid, 6, AOED_DUPLICATE_SLOT2, "Duplicate Attached Object Index (2)", "Select", "Cancel"); | |
1966 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /duplicateattachedobject <FromAttachedObjectSlot> <ToAttachedObjectSlot>"); | |
1967 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to duplicate your attached object from specified slot to another specified slot"); | |
1968 | } | |
1969 | } | |
1970 | case AOED_SET_SLOT1: | |
1971 | { | |
1972 | if(response) { | |
1973 | format(aoe_str, sizeof(aoe_str), "%i", listitem); | |
1974 | dcmd_setattachedobjectindex(playerid, aoe_str); | |
1975 | } | |
1976 | else { | |
1977 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectindex <FromAttachedObjectSlot> <ToAttachedObjectSlot>"); | |
1978 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to change your attached object slot to another specified slot"); | |
1979 | } | |
1980 | } | |
1981 | case AOED_SET_SLOT2: | |
1982 | { | |
1983 | if(response) { | |
1984 | format(aoe_str, sizeof(aoe_str), "%i %i", GetPVarInt(playerid, "SetAttachedObjectIndex1"), listitem); | |
1985 | dcmd_setattachedobjectindex(playerid, aoe_str); | |
1986 | } | |
1987 | else { | |
1988 | // AOE_ShowPlayerDialog(playerid, 7, AOED_SET_SLOT1, "Set Attached Object Index (1)", "Select", "Cancel"); | |
1989 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectindex <FromAttachedObjectSlot> <ToAttachedObjectSlot>"); | |
1990 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to change your attached object slot to another specified slot"); | |
1991 | } | |
1992 | } | |
1993 | case AOED_SET_SLOT_REPLACE: | |
1994 | { | |
1995 | if(response) | |
1996 | { | |
1997 | new slot = GetPVarInt(playerid, "SetAttachedObjectIndex1"), newslot = GetPVarInt(playerid, "SetAttachedObjectIndex2"); | |
1998 | MovePlayerAttachedObjectIndex(playerid, slot, newslot); | |
1999 | format(aoe_str2, sizeof(aoe_str2), "* Moved & replaced your attached object from slot/index number %i to %i!", slot, newslot); | |
2000 | format(aoe_str, sizeof(aoe_str), "~g~Attached object moved~n~~w~index/number:~n~%i to %i", slot, newslot); | |
2001 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
2002 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
2003 | } | |
2004 | else { | |
2005 | // AOE_ShowPlayerDialog(playerid, 6, AOED_SET_SLOT2, "Set Attached Object Index (2)", "Select", "Cancel"); | |
2006 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectindex <FromAttachedObjectSlot> <ToAttachedObjectSlot>"); | |
2007 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to change your attached object slot to another specified slot"); | |
2008 | } | |
2009 | } | |
2010 | case AOED_SET_MODEL_SLOT: | |
2011 | { | |
2012 | if(response) { | |
2013 | format(aoe_str, sizeof(aoe_str), "%i", listitem); | |
2014 | dcmd_setattachedobjectmodel(playerid, aoe_str); | |
2015 | } | |
2016 | else { | |
2017 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmodel <AttachedObjectSlot> <AttachedObjectModel>"); | |
2018 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object model from the specified parameters"); | |
2019 | } | |
2020 | } | |
2021 | case AOED_SET_MODEL: | |
2022 | { | |
2023 | if(response) { | |
2024 | format(aoe_str, sizeof(aoe_str), "%i %d", GetPVarInt(playerid, "SetAttachedObjectModelIndex"), strval(inputtext)); | |
2025 | dcmd_setattachedobjectmodel(playerid, aoe_str); | |
2026 | } | |
2027 | else { | |
2028 | // AOE_ShowPlayerDialog(playerid, 7, AOED_SET_MODEL_SLOT, "Set Attached Object Model", "Select", "Cancel"); | |
2029 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmodel <AttachedObjectSlot> <AttachedObjectModel>"); | |
2030 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object model from the specified parameters"); | |
2031 | } | |
2032 | } | |
2033 | case AOED_SET_BONE_SLOT: | |
2034 | { | |
2035 | if(response) { | |
2036 | format(aoe_str, sizeof(aoe_str), "%i", listitem); | |
2037 | dcmd_setattachedobjectbone(playerid, aoe_str); | |
2038 | } | |
2039 | else { | |
2040 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectbone <AttachedObjectSlot> <AttachedObjectBone>"); | |
2041 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object bone from the specified parameters"); | |
2042 | } | |
2043 | } | |
2044 | case AOED_SET_BONE: | |
2045 | { | |
2046 | if(response) { | |
2047 | format(aoe_str, sizeof(aoe_str), "%i %i", GetPVarInt(playerid, "SetAttachedObjectBoneIndex"), listitem+1); | |
2048 | dcmd_setattachedobjectbone(playerid, aoe_str); | |
2049 | } | |
2050 | else { | |
2051 | // AOE_ShowPlayerDialog(playerid, 7, AOED_SET_BONE_SLOT, "Set Attached Object Bone", "Select", "Cancel"); | |
2052 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectbone <AttachedObjectSlot> <AttachedObjectBone>"); | |
2053 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object bone from the specified parameters"); | |
2054 | } | |
2055 | } | |
2056 | case AOED_SAVE_SLOT: | |
2057 | { | |
2058 | if(response) { | |
2059 | format(aoe_str, sizeof(aoe_str), "%i", listitem); | |
2060 | dcmd_saveattachedobject(playerid, aoe_str); | |
2061 | } | |
2062 | else { | |
2063 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /saveattachedobject <AttachedObjectSlot> <FileName>"); | |
2064 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to save your attached object from the specified slot"); | |
2065 | } | |
2066 | } | |
2067 | case AOED_SAVE: | |
2068 | { | |
2069 | if(response) { | |
2070 | format(aoe_str, sizeof(aoe_str), "%i %s", GetPVarInt(playerid, "SaveAttachedObjectIndex"), inputtext); | |
2071 | dcmd_saveattachedobject(playerid, aoe_str); | |
2072 | } | |
2073 | else { | |
2074 | // AOE_ShowPlayerDialog(playerid, 15, AOED_SAVE_SLOT, "Save Attached Object", "Select", "Cancel"); | |
2075 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /saveattachedobject <AttachedObjectSlot> <FileName>"); | |
2076 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to save your attached object from the specified slot"); | |
2077 | } | |
2078 | } | |
2079 | case AOED_SAVE2: | |
2080 | { | |
2081 | if(response) dcmd_saveattachedobjects(playerid, inputtext); | |
2082 | else { | |
2083 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /saveattachedobjects <FileName>"); | |
2084 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to save all of your attached object(s) to a set file"); | |
2085 | } | |
2086 | } | |
2087 | case AOED_LOAD: | |
2088 | { | |
2089 | if(response) dcmd_loadattachedobject(playerid, inputtext); | |
2090 | else { | |
2091 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /loadattachedobject <FileName> <FromAttachedObjectSlot>"); | |
2092 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to load a saved attached object from the specified slot in the file"); | |
2093 | } | |
2094 | } | |
2095 | case AOED_LOAD_SLOT: | |
2096 | { | |
2097 | if(response) { | |
2098 | GetPVarString(playerid, "LoadAttachedObjectName", aoe_str, sizeof(aoe_str)); | |
2099 | format(aoe_str, sizeof(aoe_str), "%s %i", aoe_str, strval(inputtext)); | |
2100 | dcmd_loadattachedobject(playerid, aoe_str); | |
2101 | } | |
2102 | else { | |
2103 | // AOE_ShowPlayerDialog(playerid, 16, AOED_LOAD, "Load Attached Object", "Enter", "Cancel"); | |
2104 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /loadattachedobject <FileName> <FromAttachedObjectSlot>"); | |
2105 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to load a saved attached object from the specified slot in the file"); | |
2106 | } | |
2107 | } | |
2108 | case AOED_LOAD_REPLACE: | |
2109 | { | |
2110 | if(response) { | |
2111 | SendClientMessage(playerid, COLOR_WHITE, "* Loading attached object file, please wait..."); | |
2112 | new slot = GetPVarInt(playerid, "LoadAttachedObjectIndex"), ao_file[32]; | |
2113 | GetPVarString(playerid, "LoadAttachedObjectName", aoe_str, sizeof(aoe_str)); | |
2114 | format(ao_file, sizeof(ao_file), AO_FILENAME, aoe_str); | |
2115 | AOE_LoadPlayerAttachedObject(playerid, slot, ao_file); | |
2116 | format(aoe_str2, sizeof(aoe_str2), "** You've loaded & replaced your attached object from file \"%s\" by %s from skin %i (Index: %i - Model: %d - Bone: %i)!", aoe_str, | |
2117 | dini_Get(ao_file, "auth"), dini_Int(ao_file, "skin"), slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID]); | |
2118 | SendClientMessage(playerid, COLOR_GREEN, aoe_str2); | |
2119 | } | |
2120 | else { | |
2121 | // AOE_ShowPlayerDialog(playerid, 17, AOED_LOAD_REPLACE, "Load & Replace Attached Object", "Yes", "Cancel"); | |
2122 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /loadattachedobject <FileName> <FromAttachedObjectSlot>"); | |
2123 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to load a saved attached object from the specified slot in the file"); | |
2124 | } | |
2125 | } | |
2126 | case AOED_LOAD2: | |
2127 | { | |
2128 | if(response) dcmd_loadattachedobjects(playerid, inputtext); | |
2129 | else { | |
2130 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /loadattachedobjects <FileName>"); | |
2131 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to load a saved attached object(s) set file"); | |
2132 | } | |
2133 | } | |
2134 | case AOED_CONVERT: | |
2135 | { | |
2136 | if(response) dcmd_convertattachedobjectfile(playerid, inputtext); | |
2137 | else { | |
2138 | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /convertattachedobjectfile <FileName>"); | |
2139 | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to convert a saved attached object(s) file to raw code file"); | |
2140 | } | |
2141 | } | |
2142 | } | |
2143 | return 0; | |
2144 | } | |
2145 | ||
2146 | public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ) | |
2147 | { | |
2148 | if(response == EDIT_RESPONSE_FINAL) | |
2149 | { | |
2150 | if(IsPlayerAttachedObjectSlotUsed(playerid, index)) RemovePlayerAttachedObject(playerid, index); | |
2151 | UpdatePlayerAttachedObjectEx(playerid, index, modelid, boneid, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ); | |
2152 | SetPVarInt(playerid, "EditingAttachedObject", 0); | |
2153 | format(aoe_str2, sizeof(aoe_str2), "* You've edited your attached object from slot/index number %i", index); | |
2154 | format(aoe_str, sizeof(aoe_str), "~b~~h~Edited your attached object~n~~w~index/number: %i", index); | |
2155 | SendClientMessage(playerid, COLOR_CYAN, aoe_str2); | |
2156 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
2157 | } | |
2158 | if(response == EDIT_RESPONSE_CANCEL) | |
2159 | { | |
2160 | if(IsPlayerAttachedObjectSlotUsed(playerid, index)) RemovePlayerAttachedObject(playerid, index); | |
2161 | SetPlayerAttachedObject(playerid, index, pao[playerid][index][aoModelID], pao[playerid][index][aoBoneID], pao[playerid][index][aoX], pao[playerid][index][aoY], pao[playerid][index][aoZ], | |
2162 | pao[playerid][index][aoRX], pao[playerid][index][aoRY], pao[playerid][index][aoRZ], pao[playerid][index][aoSX], pao[playerid][index][aoSY], pao[playerid][index][aoSZ], pao[playerid][index][aoMC1], pao[playerid][index][aoMC2]); | |
2163 | pao[playerid][index][aoValid] = 1; | |
2164 | SetPVarInt(playerid, "EditingAttachedObject", 0); | |
2165 | format(aoe_str2, sizeof(aoe_str2), "* You've canceled editing your attached object from slot/index number %i", index); | |
2166 | format(aoe_str, sizeof(aoe_str), "~r~~h~Canceled editing your attached object~n~~w~index/number: %i", index); | |
2167 | SendClientMessage(playerid, COLOR_YELLOW, aoe_str2); | |
2168 | GameTextForPlayer(playerid, aoe_str, 5000, 3); | |
2169 | } | |
2170 | return 1; | |
2171 | } | |
2172 | ||
2173 | // ============================================================================= | |
2174 | ||
2175 | AOE_UnsetValues(playerid, index) | |
2176 | { | |
2177 | pao[playerid][index][aoValid] = 0; | |
2178 | pao[playerid][index][aoModelID] = 0, pao[playerid][index][aoBoneID] = 0; | |
2179 | pao[playerid][index][aoX] = 0.0, pao[playerid][index][aoY] = 0.0, pao[playerid][index][aoZ] = 0.0; | |
2180 | pao[playerid][index][aoRX] = 0.0, pao[playerid][index][aoRY] = 0.0, pao[playerid][index][aoRZ] = 0.0; | |
2181 | pao[playerid][index][aoSX] = 0.0, pao[playerid][index][aoSY] = 0.0, pao[playerid][index][aoSZ] = 0.0; | |
2182 | pao[playerid][index][aoMC1] = 0, pao[playerid][index][aoMC2] = 0; | |
2183 | } | |
2184 | ||
2185 | AOE_UnsetVars(playerid) | |
2186 | { | |
2187 | if(GetPVarInt(playerid, "EditingAttachedObject") == 1) CancelEdit(playerid); | |
2188 | DeletePVar(playerid, "CreateAttachedObjectModel"); | |
2189 | DeletePVar(playerid, "CreateAttachedObjectBone"); | |
2190 | DeletePVar(playerid, "CreateAttachedObjectIndex"); | |
2191 | DeletePVar(playerid, "EditAttachedObjectIndex"); | |
2192 | DeletePVar(playerid, "EditingAttachedObject"); | |
2193 | DeletePVar(playerid, "RemoveAttachedObjectIndex"); | |
2194 | DeletePVar(playerid, "AttachedObjectStatsIndex"); | |
2195 | DeletePVar(playerid, "DuplicateAttachedObjectIndex1"); | |
2196 | DeletePVar(playerid, "DuplicateAttachedObjectIndex2"); | |
2197 | - | strcat(aoe_str3, "Create your attached object\nDuplicate your attached object\nEdit your attached Object\nSave your attached object\nSave all of your attached(s) object\n"); |
2197 | + | |
2198 | - | strcat(aoe_str3, "Load attached object\nLoad attached object(s) set\nRemove attached object\nRemove all of your attached object(s)\n"); |
2198 | + | |
2199 | - | strcat(aoe_str3, "Restore your last deleted attached object\n"); |
2199 | + | |
2200 | - | strcat(aoe_str3, "Export attached object(s) file\nView your attached object list\nView your attached object status\nTotal attached object(s)\n"); |
2200 | + | |
2201 | - | strcat(aoe_str3, "Help\nAbout"); |
2201 | + | |
2202 | DeletePVar(playerid, "SetAttachedObjectBone"); | |
2203 | DeletePVar(playerid, "SaveAttachedObjectIndex"); | |
2204 | DeletePVar(playerid, "LoadAttachedObjectName"); | |
2205 | DeletePVar(playerid, "LoadAttachedObjectIndex"); | |
2206 | DeletePVar(playerid, "LastAttachedObjectRemoved"); | |
2207 | } | |
2208 | ||
2209 | AOE_ShowPlayerDialog(playerid, type, dialogid, caption[], button1[], button2[] = "") | |
2210 | { | |
2211 | new aoe_str1[128], aoe_str3[512], slot, slot2; | |
2212 | switch(type) | |
2213 | { | |
2214 | case 0: // AOE menu | |
2215 | { | |
2216 | new slots = GetPlayerAttachedObjectsCount(playerid), aoe_str4[1024]; | |
2217 | slot = GetPVarInt(playerid, "LastAttachedObjectRemoved"); | |
2218 | if(!GetPVarType(playerid, "LastAttachedObjectRemoved")) aoe_str1 = "{FF0000}Restore your last deleted attached object"; | |
2219 | else if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) format(aoe_str1, sizeof(aoe_str1), "{D1D1D1}Restore your last deleted attached object [Idx:%i]", slot); | |
2220 | else format(aoe_str1, sizeof(aoe_str1), "Restore your last deleted attached object [Idx:%i]", slot); | |
2221 | if(!slots) { | |
2222 | format(aoe_str4, sizeof(aoe_str4), "Create your attached object\n{FF0000}Duplicate your attached object\n{FF0000}Edit your attached object\n{FF0000}Save your attached object\n{FF0000}Save all of your attached object(s) [Total:%i]\n\ | |
2223 | Load attached object file\nLoad attached object(s) set", slots); | |
2224 | format(aoe_str4, sizeof(aoe_str4), "%s\n{FF0000}Remove your attached object\n{FF0000}Remove all of your attached object(s) [Total:%i]\n%s\n{FFFFFF}Export attached object(s) file\n{FF0000}View your attached object list\n\ | |
2225 | {FF0000}View your attached object stats\n{FFFFFF}Total attached object(s) [%i]", aoe_str4, slots, aoe_str1, slots); | |
2226 | } | |
2227 | else if(slots == MAX_PLAYER_ATTACHED_OBJECTS) { | |
2228 | format(aoe_str4, sizeof(aoe_str4), "{FF0000}Create your attached object\n{D1D1D1}Duplicate your attached object\nEdit your attached object\nSave your attached object\nSave all of your attached object(s) [Total:%i]\n\ | |
2229 | {FF0000}Load attached object file\n{FF0000}Load attached object(s) set", slots); | |
2230 | format(aoe_str4, sizeof(aoe_str4), "%s\nRemove your attached object\nRemove all of your attached object(s) [Total:%i]\n%s\nExport attached object(s) file\nView your attached object list\n\ | |
2231 | View your attached object stats\nTotal attached object(s) [%i]", aoe_str4, slots, aoe_str1, slots); | |
2232 | } | |
2233 | else { | |
2234 | format(aoe_str4, sizeof(aoe_str4), "Create your attached object\nDuplicate your attached object\nEdit your attached object\nSave your attached object\nSave all of your attached object(s) [Total:%i]\n\ | |
2235 | - | format(aoe_str3, sizeof(aoe_str3), "[FilterScript] Attached Object Editor for SA:MP 0.3e\nSimple editor/tool for attached object(s)\n\nVersion: %s\nCreated by: Robo_N1X\ |
2235 | + | Load attached object file\nLoad attached object(s) set", slots); |
2236 | format(aoe_str4, sizeof(aoe_str4), "%s\nRemove your attached object\nRemove all of your attached object(s) [Total:%i]\n%s\nExport attached object(s) file\n\ | |
2237 | View your attached object list\nView your attached object stats\nTotal attached object(s) [%i]", aoe_str4, slots, aoe_str1, slots); | |
2238 | } | |
2239 | strcat(aoe_str4, "\nHelp\nAbout"); | |
2240 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, aoe_str4, button1, button2); | |
2241 | } | |
2242 | case 1: // AOE help | |
2243 | { | |
2244 | new aoe_str4[2048]; | |
2245 | strcat(aoe_str4, "Command list & usage\nGeneral:\n"); | |
2246 | strcat(aoe_str4, " /attachedobjecteditor (/aoe): Shows attached object menu dialog\n /createattachedobject (/cao): Create your attached object\n"); | |
2247 | strcat(aoe_str4, " /editattachedobject (/eao): Edit your attached object\n /duplicateattachedobject (/dao): Duplicate your attached object\n"); | |
2248 | strcat(aoe_str4, " /removeattachedobject (/rao): Remove your attached object\n /removeattachedobjects (/raos): Remove all of your attached object(s)\n"); | |
2249 | strcat(aoe_str4, " /undeleteattachedobject (/udao): Restore your last deleted attached object\n /saveattachedobject (/sao): Save your attached object to a file\n"); | |
2250 | strcat(aoe_str4, " /saveattachedobjects (/saos): Save all of your attached object(s) to a set file\n /loadattachedobject (/lao): Load existing attached object file\n"); | |
2251 | strcat(aoe_str4, " /loadattachedobjects (/laos): Load existing attached object(s) set file\n /convertattachedobject (/caof): Convert saved file to raw code/script\n"); | |
2252 | strcat(aoe_str4, " /attachedobjectstats (/aos): Show your attached object stats\n /attachedobjectlist (/aol): Show your attached object list\n"); | |
2253 | strcat(aoe_str4, " /totalattachedobjects (/taos): Shows the number of attached object(s)\nChange/set value:\n"); | |
2254 | strcat(aoe_str4, " /setattachedobjectslot (/saoi): Set your attached object slot/index\n /setattachedobjectmodel (/saom): Set your attached object model\n"); | |
2255 | strcat(aoe_str4, " /setattachedobjectbone (/saob): Set your attached object bone\n /setattachedobjectoffsetx (/saoox): Set your attached object offset X\n"); | |
2256 | strcat(aoe_str4, " /setattachedobjectoffsety (/saooy): Set your attached object offset Y\n /setattachedobjectoffsetz (/saooz): Set your attached object offset Z\n"); | |
2257 | strcat(aoe_str4, " /setattachedobjectrotx (/saorx): Set your attached object rotation X\n /setattachedobjectrotx (/saory): Set your attached object rotation Y\n"); | |
2258 | strcat(aoe_str4, " /setattachedobjectrotx (/saorz): Set your attached object rotation Z\n /setattachedobjectscalex (/saosx): Set your attached object scale X\n"); | |
2259 | strcat(aoe_str4, " /setattachedobjectscalex (/saosy): Set your attached object scale Y\n /setattachedobjectscalex (/saosz): Set your attached object scale Z\n"); | |
2260 | strcat(aoe_str4, " /setattachedobjectmc1 (/saomc1): Set your attached object material color #1\n /setattachedobjectmc2 (/saomc2): Set your attached object material color #2\n"); | |
2261 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str4, button1, button2); | |
2262 | } | |
2263 | case 2: // AOE convert | |
2264 | { | |
2265 | format(aoe_str1, sizeof(aoe_str1), "* %s: Please enter an attached object file name...", caption); | |
2266 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, "Please enter an existing (saved) & valid attached object file name below to convert,\n\nPlease note that valid characters are:\n\ | |
2267 | A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, .", button1, button2); | |
2268 | SendClientMessage(playerid, COLOR_WHITE, aoe_str1); | |
2269 | } | |
2270 | case 3: // AOE about | |
2271 | { | |
2272 | GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME); | |
2273 | format(aoe_str3, sizeof(aoe_str3), "[FilterScript] Attached Object Editor for SA:MP 0.3e and upper\nSimple editor/tool for attached object(s)\n\nVersion: %s\nCreated by: Robo_N1X\ | |
2274 | \nCredits & Thanks to:\n> SA:MP Team (www.sa-mp.com)\n> h02 for the attachments editor idea\n> DracoBlue (DracoBlue.net)\n> SA:MP Wiki (wiki.sa-mp.com)\n> Whoever that made useful function for this script\nAnd you, %s (ID:%i) for using this filterscript!", | |
2275 | AOE_VERSION, PlayerName, playerid); | |
2276 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str3, button1, button2); | |
2277 | } | |
2278 | case 4: // AOE object model input | |
2279 | { | |
2280 | format(aoe_str1, sizeof(aoe_str1), "* %s: Please enter object model id/number...", caption); | |
2281 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, "Please enter a valid GTA:SA/SA:MP object model id/number below:", button1, button2); | |
2282 | SendClientMessage(playerid, COLOR_WHITE, aoe_str1); | |
2283 | } | |
2284 | case 5: // AOE bone list | |
2285 | { | |
2286 | for(new i = MIN_ATTACHED_OBJECT_BONE; i <= MAX_ATTACHED_OBJECT_BONE; i++) | |
2287 | { | |
2288 | format(aoe_str3, sizeof(aoe_str3), "%s%d. %s\n", aoe_str3, i, GetAttachedObjectBoneName(i)); | |
2289 | } | |
2290 | format(aoe_str1, sizeof(aoe_str1), "* %s: Please select attached object bone...", caption); | |
2291 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, aoe_str3, button1, button2); | |
2292 | SendClientMessage(playerid, COLOR_WHITE, aoe_str1); | |
2293 | } | |
2294 | case 6: // AOE slot/index list (free slot) | |
2295 | { | |
2296 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) | |
2297 | { | |
2298 | if(IsValidPlayerAttachedObject(playerid, i) == -1) format(aoe_str3, sizeof(aoe_str3), "%s{FFFFFF}%d. None - (Not Used)\n", aoe_str3, i); | |
2299 | else if(!IsValidPlayerAttachedObject(playerid, i)) format(aoe_str3, sizeof(aoe_str3), "%s{D1D1D1}%d. Unknown - Invalid attached object info\n", aoe_str3, i); | |
2300 | else format(aoe_str3, sizeof(aoe_str3), "%s{FF0000}%d. %d - %s (BID:%i) - (Used)\n", aoe_str3, i, pao[playerid][i][aoModelID], GetAttachedObjectBoneName(pao[playerid][i][aoBoneID]), pao[playerid][i][aoBoneID]); | |
2301 | } | |
2302 | if(!strcmp(button1, "Select", true)) format(aoe_str1, sizeof(aoe_str1), "* %s: Please select attached object slot/index number...", caption); | |
2303 | else format(aoe_str1, sizeof(aoe_str1), "* %s: Please select attached object slot/index number to %s...", caption, button1); | |
2304 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, aoe_str3, button1, button2); | |
2305 | SendClientMessage(playerid, COLOR_WHITE, aoe_str1); | |
2306 | } | |
2307 | case 7: // AOE slot/index list (used slot) | |
2308 | { | |
2309 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) | |
2310 | { | |
2311 | if(IsValidPlayerAttachedObject(playerid, i) == -1) format(aoe_str3, sizeof(aoe_str3), "%s{FF0000}%d. None - (Not Used)\n", aoe_str3, i); | |
2312 | else if(!IsValidPlayerAttachedObject(playerid, i)) format(aoe_str3, sizeof(aoe_str3), "%s{D1D1D1}%d. Unknown - Invalid attached object info\n", aoe_str3, i); | |
2313 | else format(aoe_str3, sizeof(aoe_str3), "%s{FFFFFF}%d. %d - %s (BID:%i) - (Used)\n", aoe_str3, i, pao[playerid][i][aoModelID], GetAttachedObjectBoneName(pao[playerid][i][aoBoneID]), pao[playerid][i][aoBoneID]); | |
2314 | } | |
2315 | if(!strcmp(button1, "Select", true)) format(aoe_str1, sizeof(aoe_str1), "* %s: Please select attached object slot/index number...", caption); | |
2316 | else format(aoe_str1, sizeof(aoe_str1), "* %s: Please select attached object slot/index number to %s...", caption, button1); | |
2317 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, aoe_str3, button1, button2); | |
2318 | SendClientMessage(playerid, COLOR_WHITE, aoe_str1); | |
2319 | - | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, "Yes", "Cancel"); |
2319 | + | |
2320 | case 8: // AOE stats | |
2321 | { | |
2322 | slot = GetPVarInt(playerid, "AttachedObjectStatsIndex"); | |
2323 | format(aoe_str3, sizeof(aoe_str3), "Attached object slot/index number %i stats...\n\nModel ID/Number/Type: %d\nBone: %s (%i)\n\nOffsets\nX Offset: %f\nY Offset: %f\nZ Offset: %f\n\nRotations\nX Rotation: %f\nY Rotation: %f\ | |
2324 | \nZ Rotation: %f\n\nScales\nX Scale: %f\nY Scale: %f\nZ Scale: %f\n\nMaterial\nColor 1: %i (%x)\nColor 2: %i (%x)\n\nYour skin: %i\nTotal of your attached object(s): %d", slot, pao[playerid][slot][aoModelID], | |
2325 | GetAttachedObjectBoneName(pao[playerid][slot][aoBoneID]), pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], | |
2326 | pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], | |
2327 | pao[playerid][slot][aoMC1], IntToHex(pao[playerid][slot][aoMC1]), pao[playerid][slot][aoMC2], IntToHex(pao[playerid][slot][aoMC2]), GetPlayerSkin(playerid), GetPlayerAttachedObjectsCount(playerid)); | |
2328 | format(aoe_str2, sizeof(aoe_str2), "* You're viewing your attached object stats from slot/index number %i", slot); | |
2329 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str3, (IsPlayerAdmin(playerid) ? button1 : button2), (IsPlayerAdmin(playerid) ? button2 : "")); // Only shows "Close" button for non-admin | |
2330 | SendClientMessage(playerid, COLOR_CYAN, aoe_str2); | |
2331 | } | |
2332 | case 9: // AOE create replace | |
2333 | { | |
2334 | format(aoe_str2, sizeof(aoe_str2), "Sorry, attached object slot/index number %i\nis already used, do you want to replace it?\n(This action cannot be undone)", GetPVarInt(playerid, "CreateAttachedObjectIndex")); | |
2335 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2); | |
2336 | } | |
2337 | case 10: // AOE create final | |
2338 | { | |
2339 | format(aoe_str2, sizeof(aoe_str2), "You've created your attached object\nat slot/index number: %i\nModel: %d\nBone: %s (BID:%i)\n\nDo you want to edit your attached object?", GetPVarInt(playerid, "CreateAttachedObjectIndex"), | |
2340 | GetPVarInt(playerid, "CreateAttachedObjectModel"), GetAttachedObjectBoneName(GetPVarInt(playerid, "CreateAttachedObjectBone")), GetPVarInt(playerid, "CreateAttachedObjectBone")); | |
2341 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2); | |
2342 | } | |
2343 | case 11: // AOE remove | |
2344 | { | |
2345 | format(aoe_str2, sizeof(aoe_str2), "You're about to remove attached object from slot/index number %i\nAre you sure you want to remove it?\n", GetPVarInt(playerid, "RemoveAttachedObjectIndex")); | |
2346 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2); | |
2347 | } | |
2348 | case 12: // AOE remove all | |
2349 | { | |
2350 | format(aoe_str2, sizeof(aoe_str2), "You're about to remove all of your attached object(s)\nTotal: %d\nAre you sure you want to remove them?\n(This action can't be undone)", GetPlayerAttachedObjectsCount(playerid)); | |
2351 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2); | |
2352 | } | |
2353 | case 13: // AOE duplicate replace | |
2354 | { | |
2355 | slot = GetPVarInt(playerid, "DuplicateAttachedObjectIndex1"), slot2 = GetPVarInt(playerid, "DuplicateAttachedObjectIndex2"); | |
2356 | format(aoe_str2, sizeof(aoe_str2), "You already have attached object at slot/index number %i!\nDo you want to replace it with attached object from slot %i?", slot, slot2); | |
2357 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2); | |
2358 | } | |
2359 | case 14: // AOE set index replace | |
2360 | { | |
2361 | slot = GetPVarInt(playerid, "SetAttachedObjectIndex1"), slot2 = GetPVarInt(playerid, "SetAttachedObjectIndex2"); | |
2362 | format(aoe_str2, sizeof(aoe_str2), "You already have attached object at slot/index number %i!\nDo you want to replace it with attached object from slot %i?", slot2, slot); | |
2363 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2); | |
2364 | } | |
2365 | case 15: // AOE save | |
2366 | { | |
2367 | format(aoe_str1, sizeof(aoe_str1), "* %s: Please enter attached object file name to save...", caption); | |
2368 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, "Please enter a valid file name to save this attached object below,\n\nPlease note that valid characters are:\n\ | |
2369 | A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, .", button1, button2); | |
2370 | SendClientMessage(playerid, COLOR_WHITE, aoe_str1); | |
2371 | } | |
2372 | case 16: // AOE load | |
2373 | { | |
2374 | format(aoe_str1, sizeof(aoe_str1), "* %s: Please enter attached object file name to load...", caption); | |
2375 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, "Please enter an valid and existing attached object file name below,\n\nPlease note that valid characters are:\n\ | |
2376 | A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, .", button1, button2); | |
2377 | SendClientMessage(playerid, COLOR_WHITE, aoe_str1); | |
2378 | } | |
2379 | case 17: // AOE load replace | |
2380 | { | |
2381 | format(aoe_str2, sizeof(aoe_str2), "You already have attached object at slot/index number %i!\nDo you want to continue loading and replace it?", GetPVarInt(playerid, "LoadAttachedObjectIndex")); | |
2382 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2); | |
2383 | } | |
2384 | } | |
2385 | return dialogid; | |
2386 | } | |
2387 | ||
2388 | AOE_SavePlayerAttachedObject(playerid, index, filename[]) | |
2389 | { | |
2390 | new aof_varname[32]; | |
2391 | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; | |
2392 | if(!IsValidAttachedObjectSlot(index) || !IsValidObjectModel(pao[playerid][index][aoModelID]) || !IsValidAttachedObjectBone(pao[playerid][index][aoBoneID])) return 0; | |
2393 | if(!dini_Exists(filename)) dini_Create(filename); | |
2394 | GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME); | |
2395 | dini_Set(filename, "auth", PlayerName); | |
2396 | dini_IntSet(filename, "skin", GetPlayerSkin(playerid)); | |
2397 | format(aof_varname, sizeof(aof_varname), "[%i]valid", index), dini_IntSet(filename, aof_varname, pao[playerid][index][aoValid]); | |
2398 | format(aof_varname, sizeof(aof_varname), "[%i]model", index), dini_IntSet(filename, aof_varname, pao[playerid][index][aoModelID]); | |
2399 | format(aof_varname, sizeof(aof_varname), "[%i]bone", index), dini_IntSet(filename, aof_varname, pao[playerid][index][aoBoneID]); | |
2400 | format(aof_varname, sizeof(aof_varname), "[%i]x", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoX]); | |
2401 | format(aof_varname, sizeof(aof_varname), "[%i]y", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoY]); | |
2402 | format(aof_varname, sizeof(aof_varname), "[%i]z", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoZ]); | |
2403 | format(aof_varname, sizeof(aof_varname), "[%i]rx", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoRX]); | |
2404 | format(aof_varname, sizeof(aof_varname), "[%i]ry", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoRY]); | |
2405 | format(aof_varname, sizeof(aof_varname), "[%i]rz", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoRZ]); | |
2406 | format(aof_varname, sizeof(aof_varname), "[%i]sx", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoSX]); | |
2407 | format(aof_varname, sizeof(aof_varname), "[%i]sy", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoSY]); | |
2408 | format(aof_varname, sizeof(aof_varname), "[%i]sz", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoSZ]); | |
2409 | format(aof_varname, sizeof(aof_varname), "[%i]mc1", index), dini_IntSet(filename, aof_varname, pao[playerid][index][aoMC1]); | |
2410 | format(aof_varname, sizeof(aof_varname), "[%i]mc2", index), dini_IntSet(filename, aof_varname, pao[playerid][index][aoMC2]); | |
2411 | return 1; | |
2412 | } | |
2413 | ||
2414 | AOE_LoadPlayerAttachedObject(playerid, index, filename[]) | |
2415 | { | |
2416 | new aof_varname[32]; | |
2417 | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; | |
2418 | if(!AOE_IsValidAttachedObjectInFile(index, filename)) return 0; | |
2419 | GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME); | |
2420 | format(aof_varname, sizeof(aof_varname), "[%i]valid", index), pao[playerid][index][aoValid] = dini_Int(filename, aof_varname); | |
2421 | format(aof_varname, sizeof(aof_varname), "[%i]model", index), pao[playerid][index][aoModelID] = dini_Int(filename, aof_varname); | |
2422 | format(aof_varname, sizeof(aof_varname), "[%i]bone", index), pao[playerid][index][aoBoneID] = dini_Int(filename, aof_varname); | |
2423 | format(aof_varname, sizeof(aof_varname), "[%i]x", index), pao[playerid][index][aoX] = dini_Float(filename, aof_varname); | |
2424 | format(aof_varname, sizeof(aof_varname), "[%i]y", index), pao[playerid][index][aoY] = dini_Float(filename, aof_varname); | |
2425 | format(aof_varname, sizeof(aof_varname), "[%i]z", index), pao[playerid][index][aoZ] = dini_Float(filename, aof_varname); | |
2426 | format(aof_varname, sizeof(aof_varname), "[%i]rx", index), pao[playerid][index][aoRX] = dini_Float(filename, aof_varname); | |
2427 | format(aof_varname, sizeof(aof_varname), "[%i]ry", index), pao[playerid][index][aoRY] = dini_Float(filename, aof_varname); | |
2428 | format(aof_varname, sizeof(aof_varname), "[%i]rz", index), pao[playerid][index][aoRZ] = dini_Float(filename, aof_varname); | |
2429 | format(aof_varname, sizeof(aof_varname), "[%i]sx", index), pao[playerid][index][aoSX] = dini_Float(filename, aof_varname); | |
2430 | format(aof_varname, sizeof(aof_varname), "[%i]sy", index), pao[playerid][index][aoSY] = dini_Float(filename, aof_varname); | |
2431 | format(aof_varname, sizeof(aof_varname), "[%i]sz", index), pao[playerid][index][aoSZ] = dini_Float(filename, aof_varname); | |
2432 | format(aof_varname, sizeof(aof_varname), "[%i]mc1", index), pao[playerid][index][aoMC1] = dini_Int(filename, aof_varname); | |
2433 | format(aof_varname, sizeof(aof_varname), "[%i]mc2", index), pao[playerid][index][aoMC2] = dini_Int(filename, aof_varname); | |
2434 | if(IsValidAttachedObjectSlot(index) && IsValidObjectModel(pao[playerid][index][aoModelID]) && IsValidAttachedObjectBone(pao[playerid][index][aoBoneID])) { | |
2435 | - | fwrite(ao_file, "Attached object raw code/exported file converted from [FS]Attached Object Editor (Version:"#AOE_VERSION") for SA:MP 0.3e\r\n"); |
2435 | + | |
2436 | pao[playerid][index][aoRX], pao[playerid][index][aoRY], pao[playerid][index][aoRZ], pao[playerid][index][aoSX], pao[playerid][index][aoSY], pao[playerid][index][aoSZ], | |
2437 | pao[playerid][index][aoMC1], pao[playerid][index][aoMC2]); | |
2438 | } | |
2439 | else { | |
2440 | AOE_UnsetValues(playerid, index); | |
2441 | return 0; | |
2442 | } | |
2443 | return 1; | |
2444 | } | |
2445 | ||
2446 | AOE_ConvertAttachedObjectFile(playerid, filename[], filename2[], &filelen = 0) | |
2447 | { | |
2448 | new aof_varname[32], pao_name[32], ao_temp[AttachedObjectOptions], slots, | |
2449 | Hour, Minute, Second, Year, Month, Day; | |
2450 | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; | |
2451 | GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME); | |
2452 | gettime(Hour, Minute, Second), getdate(Year, Month, Day); | |
2453 | strmid(pao_name, filename, 0, strlen(filename)-(strlen(AO_FILENAME)-2)); | |
2454 | format(aoe_str, sizeof(aoe_str), "\r\n-- \"%s\" converted by %s on %02d/%02d/%d - %02d:%02d:%02d --\r\n", filename, PlayerName, Day, Month, Year, Hour, Minute, Second); | |
2455 | for(new slot = 0; slot < MAX_PLAYER_ATTACHED_OBJECTS; slot++) | |
2456 | { | |
2457 | format(aof_varname, sizeof(aof_varname), "[%i]model", slot), ao_temp[aoModelID] = dini_Int(filename, aof_varname); | |
2458 | format(aof_varname, sizeof(aof_varname), "[%i]bone", slot), ao_temp[aoBoneID] = dini_Int(filename, aof_varname); | |
2459 | format(aof_varname, sizeof(aof_varname), "[%i]x", slot), ao_temp[aoX] = dini_Float(filename, aof_varname); | |
2460 | format(aof_varname, sizeof(aof_varname), "[%i]y", slot), ao_temp[aoY] = dini_Float(filename, aof_varname); | |
2461 | format(aof_varname, sizeof(aof_varname), "[%i]z", slot), ao_temp[aoZ] = dini_Float(filename, aof_varname); | |
2462 | format(aof_varname, sizeof(aof_varname), "[%i]rx", slot), ao_temp[aoRX] = dini_Float(filename, aof_varname); | |
2463 | format(aof_varname, sizeof(aof_varname), "[%i]ry", slot), ao_temp[aoRY] = dini_Float(filename, aof_varname); | |
2464 | format(aof_varname, sizeof(aof_varname), "[%i]rz", slot), ao_temp[aoRZ] = dini_Float(filename, aof_varname); | |
2465 | format(aof_varname, sizeof(aof_varname), "[%i]sx", slot), ao_temp[aoSX] = dini_Float(filename, aof_varname); | |
2466 | format(aof_varname, sizeof(aof_varname), "[%i]sy", slot), ao_temp[aoSY] = dini_Float(filename, aof_varname); | |
2467 | format(aof_varname, sizeof(aof_varname), "[%i]sz", slot), ao_temp[aoSZ] = dini_Float(filename, aof_varname); | |
2468 | format(aof_varname, sizeof(aof_varname), "[%i]mc1", slot), ao_temp[aoMC1] = dini_Int(filename, aof_varname); | |
2469 | format(aof_varname, sizeof(aof_varname), "[%i]mc2", slot), ao_temp[aoMC2] = dini_Int(filename, aof_varname); | |
2470 | if(!IsValidAttachedObjectSlot(slot) || !IsValidObjectModel(ao_temp[aoModelID]) || !IsValidAttachedObjectBone(ao_temp[aoBoneID])) continue; | |
2471 | else { | |
2472 | format(aoe_str2, sizeof(aoe_str2), "SetPlayerAttachedObject(playerid, %i, %d, %i, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %i, %i); // \"%s\" by %s (Skin:%i)\r\n", | |
2473 | slot, ao_temp[aoModelID], ao_temp[aoBoneID], ao_temp[aoX], ao_temp[aoY], ao_temp[aoZ], ao_temp[aoRX], ao_temp[aoRY], ao_temp[aoRZ], ao_temp[aoSX], ao_temp[aoSY], ao_temp[aoSZ], | |
2474 | ao_temp[aoMC1], ao_temp[aoMC2], pao_name, dini_Get(filename, "auth"), dini_Int(filename, "skin")); | |
2475 | if(!fexist(filename2)) | |
2476 | { | |
2477 | new File:ao_file = fopen(filename2, io_write); | |
2478 | fwrite(ao_file, "Attached object raw code/exported file converted from [FS]Attached Object Editor (Version:"#AOE_VERSION") for SA:MP 0.3e and upper\r\n"); | |
2479 | fwrite(ao_file, "Each attached object(s)/set file has the creation and information log above the code\r\n"); | |
2480 | fwrite(ao_file, "By default, the log shows the name of player who converted the file and time with format DD/MM/YYYY - HH:MM:SS\r\n"); | |
2481 | fwrite(ao_file, "Copy and paste the raw code(s) below, you can change the index parameter with valid slot number (0-9)!\r\n"); | |
2482 | fwrite(ao_file, aoe_str); | |
2483 | fwrite(ao_file, aoe_str2); | |
2484 | filelen = flength(ao_file); | |
2485 | fclose(ao_file); | |
2486 | } | |
2487 | else | |
2488 | { | |
2489 | new File:ao_file = fopen(filename2, io_append); | |
2490 | if(slots == 0) fwrite(ao_file, aoe_str); | |
2491 | fwrite(ao_file, aoe_str2); | |
2492 | filelen = flength(ao_file); | |
2493 | fclose(ao_file); | |
2494 | } | |
2495 | slots++; | |
2496 | } | |
2497 | } | |
2498 | return slots; | |
2499 | } | |
2500 | ||
2501 | AOE_IsValidAttachedObjectInFile(index, filename[]) | |
2502 | { | |
2503 | new aof_varname[32], ao_temp[AttachedObjectOptions]; | |
2504 | if(!fexist(filename)) return false; | |
2505 | if(IsValidAttachedObjectSlot(index)) | |
2506 | { | |
2507 | format(aof_varname, sizeof(aof_varname), "[%i]valid", index), ao_temp[aoValid] = dini_Int(filename, aof_varname); | |
2508 | format(aof_varname, sizeof(aof_varname), "[%i]model", index), ao_temp[aoModelID] = dini_Int(filename, aof_varname); | |
2509 | format(aof_varname, sizeof(aof_varname), "[%i]bone", index), ao_temp[aoBoneID] = dini_Int(filename, aof_varname); | |
2510 | if(ao_temp[aoValid] == 1 && IsValidObjectModel(ao_temp[aoModelID]) && IsValidAttachedObjectBone(ao_temp[aoBoneID])) return true; | |
2511 | } | |
2512 | return false; | |
2513 | } | |
2514 | ||
2515 | //------------------------------------------------------------------------------ | |
2516 | ||
2517 | stock CreatePlayerAttachedObject(playerid, index, modelid, bone) | |
2518 | { | |
2519 | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; | |
2520 | if(!IsValidAttachedObjectSlot(index) || !IsValidObjectModel(modelid) || !IsValidAttachedObjectBone(bone)) return 0; | |
2521 | if(IsPlayerAttachedObjectSlotUsed(playerid, index)) RemovePlayerAttachedObject(playerid, index); | |
2522 | SetPlayerAttachedObject(playerid, index, modelid, bone); | |
2523 | SetPVarInt(playerid, "CreateAttachedObjectIndex", index); | |
2524 | SetPVarInt(playerid, "CreateAttachedObjectModel", modelid); | |
2525 | SetPVarInt(playerid, "CreateAttachedObjectBone", bone); | |
2526 | pao[playerid][index][aoValid] = 1; | |
2527 | pao[playerid][index][aoModelID] = modelid; | |
2528 | pao[playerid][index][aoBoneID] = bone; | |
2529 | pao[playerid][index][aoX] = 0.0, pao[playerid][index][aoY] = 0.0, pao[playerid][index][aoZ] = 0.0; | |
2530 | pao[playerid][index][aoRX] = 0.0, pao[playerid][index][aoRY] = 0.0, pao[playerid][index][aoRZ] = 0.0; | |
2531 | pao[playerid][index][aoSX] = 1.0, pao[playerid][index][aoSY] = 1.0, pao[playerid][index][aoSZ] = 1.0; | |
2532 | pao[playerid][index][aoMC1] = 0, pao[playerid][index][aoMC2] = 0; | |
2533 | return 1; | |
2534 | } | |
2535 | ||
2536 | stock UpdatePlayerAttachedObject(playerid, index, modelid, bone) | |
2537 | return UpdatePlayerAttachedObjectEx(playerid, index, modelid, bone, pao[playerid][index][aoX], pao[playerid][index][aoY], pao[playerid][index][aoZ], pao[playerid][index][aoRX], pao[playerid][index][aoRY], pao[playerid][index][aoRZ], | |
2538 | pao[playerid][index][aoSX], pao[playerid][index][aoSY], pao[playerid][index][aoSZ], pao[playerid][index][aoMC1], pao[playerid][index][aoMC2]); | |
2539 | ||
2540 | stock UpdatePlayerAttachedObjectEx(playerid, index, modelid, bone, Float:fOffsetX = 0.0, Float:fOffsetY = 0.0, Float:fOffsetZ = 0.0, Float:fRotX = 0.0, Float:fRotY = 0.0, Float:fRotZ = 0.0, Float:fScaleX = 1.0, Float:fScaleY = 1.0, Float:fScaleZ = 1.0, materialcolor1 = 0, materialcolor2 = 0) | |
2541 | { | |
2542 | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; | |
2543 | if(!IsValidAttachedObjectSlot(index) || !IsValidObjectModel(modelid) || !IsValidAttachedObjectBone(bone)) return 0; | |
2544 | SetPlayerAttachedObject(playerid, index, modelid, bone, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ, materialcolor1, materialcolor2); | |
2545 | pao[playerid][index][aoValid] = 1; | |
2546 | pao[playerid][index][aoModelID] = modelid; | |
2547 | pao[playerid][index][aoBoneID] = bone; | |
2548 | pao[playerid][index][aoX] = fOffsetX, pao[playerid][index][aoY] = fOffsetY, pao[playerid][index][aoZ] = fOffsetZ; | |
2549 | pao[playerid][index][aoRX] = fRotX, pao[playerid][index][aoRY] = fRotY, pao[playerid][index][aoRZ] = fRotZ; | |
2550 | pao[playerid][index][aoSX] = fScaleX, pao[playerid][index][aoSY] = fScaleY, pao[playerid][index][aoSZ] = fScaleZ; | |
2551 | pao[playerid][index][aoMC1] = materialcolor1, pao[playerid][index][aoMC2] = materialcolor2; | |
2552 | return index; | |
2553 | } | |
2554 | ||
2555 | stock DuplicatePlayerAttachedObject(playerid, index1, index2) | |
2556 | { | |
2557 | if(IsValidPlayerAttachedObject(playerid, index1) && IsValidAttachedObjectSlot(index1) && IsValidAttachedObjectSlot(index2)) { | |
2558 | if(IsPlayerAttachedObjectSlotUsed(playerid, index2)) RemovePlayerAttachedObject(playerid, index2); | |
2559 | return UpdatePlayerAttachedObjectEx(playerid, index2, pao[playerid][index1][aoModelID], pao[playerid][index1][aoBoneID], pao[playerid][index1][aoX], pao[playerid][index1][aoY], pao[playerid][index1][aoZ], | |
2560 | pao[playerid][index1][aoRX], pao[playerid][index1][aoRY], pao[playerid][index1][aoRZ], pao[playerid][index1][aoSX], pao[playerid][index1][aoSY], pao[playerid][index1][aoSZ], pao[playerid][index1][aoMC1], pao[playerid][index1][aoMC2]); | |
2561 | } | |
2562 | return 0; | |
2563 | } | |
2564 | ||
2565 | stock MovePlayerAttachedObjectIndex(playerid, index1, index2) | |
2566 | { | |
2567 | if(IsValidPlayerAttachedObject(playerid, index1) && IsValidAttachedObjectSlot(index1) && IsValidAttachedObjectSlot(index2)) { | |
2568 | if(IsPlayerAttachedObjectSlotUsed(playerid, index1)) RemovePlayerAttachedObject(playerid, index1), pao[playerid][index1][aoValid] = 0; | |
2569 | if(IsPlayerAttachedObjectSlotUsed(playerid, index2)) RemovePlayerAttachedObject(playerid, index2), pao[playerid][index2][aoValid] = 0; | |
2570 | return UpdatePlayerAttachedObjectEx(playerid, index2, pao[playerid][index1][aoModelID], pao[playerid][index1][aoBoneID], pao[playerid][index1][aoX], pao[playerid][index1][aoY], pao[playerid][index1][aoZ], | |
2571 | pao[playerid][index1][aoRX], pao[playerid][index1][aoRY], pao[playerid][index1][aoRZ], pao[playerid][index1][aoSX], pao[playerid][index1][aoSY], pao[playerid][index1][aoSZ]); | |
2572 | } | |
2573 | return 0; | |
2574 | } | |
2575 | ||
2576 | stock RefreshPlayerAttachedObjects(playerid, forplayerid) | |
2577 | { | |
2578 | new slots = 0; | |
2579 | if(!IsPlayerConnected(playerid) || !IsPlayerConnected(forplayerid)) return INVALID_PLAYER_ID; | |
2580 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) | |
2581 | { | |
2582 | if(IsPlayerAttachedObjectSlotUsed(playerid, i) || IsValidPlayerAttachedObject(playerid, i)) | |
2583 | { | |
2584 | if(IsPlayerAttachedObjectSlotUsed(forplayerid, i)) RemovePlayerAttachedObject(forplayerid, i); | |
2585 | SetPlayerAttachedObject(forplayerid, i, pao[playerid][i][aoModelID], pao[playerid][i][aoBoneID], pao[playerid][i][aoX], pao[playerid][i][aoY], pao[playerid][i][aoZ], | |
2586 | pao[playerid][i][aoRX], pao[playerid][i][aoRY], pao[playerid][i][aoRZ], pao[playerid][i][aoSX], pao[playerid][i][aoSY], pao[playerid][i][aoSZ], pao[playerid][index][aoMC1], pao[playerid][index][aoMC2]); | |
2587 | pao[forplayerid][i][aoValid] = 1; | |
2588 | pao[forplayerid][i][aoModelID] = pao[playerid][i][aoModelID]; | |
2589 | pao[forplayerid][i][aoBoneID] = pao[playerid][i][aoBoneID]; | |
2590 | pao[forplayerid][i][aoX] = pao[playerid][i][aoX], pao[forplayerid][i][aoY] = pao[playerid][i][aoY], pao[forplayerid][i][aoZ] = pao[playerid][i][aoZ]; | |
2591 | pao[forplayerid][i][aoRX] = pao[playerid][i][aoRX], pao[forplayerid][i][aoRY] = pao[playerid][i][aoRY], pao[forplayerid][i][aoRZ] = pao[playerid][i][aoRZ]; | |
2592 | pao[forplayerid][i][aoSX] = pao[playerid][i][aoSX], pao[forplayerid][i][aoSY] = pao[playerid][i][aoSY], pao[forplayerid][i][aoSZ] = pao[playerid][i][aoSZ]; | |
2593 | pao[forplayerid][i][aoMC1] = pao[playerid][i][aoMC1], pao[forplayerid][i][aoMC2] = pao[playerid][i][aoMC2]; | |
2594 | slots++; | |
2595 | } | |
2596 | } | |
2597 | return slots; | |
2598 | } | |
2599 | ||
2600 | stock RestorePlayerAttachedObject(playerid, index) | |
2601 | { | |
2602 | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; | |
2603 | if(IsValidPlayerAttachedObject(playerid, index)) | |
2604 | { | |
2605 | SetPlayerAttachedObject(playerid, index, pao[playerid][index][aoModelID], pao[playerid][index][aoBoneID], pao[playerid][index][aoX], pao[playerid][index][aoY], pao[playerid][index][aoZ], | |
2606 | pao[playerid][index][aoRX], pao[playerid][index][aoRY], pao[playerid][index][aoRZ], pao[playerid][index][aoSX], pao[playerid][index][aoSY], pao[playerid][index][aoSZ], pao[playerid][index][aoMC1], pao[playerid][index][aoMC2]); | |
2607 | pao[playerid][index][aoValid] = 1; | |
2608 | return 1; | |
2609 | } | |
2610 | return 0; | |
2611 | } | |
2612 | ||
2613 | stock RemovePlayerAttachedObjectEx(playerid, index = 0, bool:RemoveAll = false) | |
2614 | { | |
2615 | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; | |
2616 | if(!GetPlayerAttachedObjectsCount(playerid) || !IsValidAttachedObjectSlot(index)) return 0; | |
2617 | new _TOTAL_ATTACHED_OBJECT_REMOVED_; | |
2618 | if(RemoveAll == true) | |
2619 | { | |
2620 | _TOTAL_ATTACHED_OBJECT_REMOVED_ = 0; | |
2621 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) | |
2622 | { | |
2623 | if(IsPlayerAttachedObjectSlotUsed(playerid, i)) { | |
2624 | RemovePlayerAttachedObject(playerid, i); | |
2625 | pao[playerid][i][aoValid] = 0; | |
2626 | SetPVarInt(playerid, "LastAttachedObjectRemoved", i); | |
2627 | _TOTAL_ATTACHED_OBJECT_REMOVED_++; | |
2628 | } | |
2629 | } | |
2630 | } | |
2631 | else | |
2632 | { | |
2633 | _TOTAL_ATTACHED_OBJECT_REMOVED_ = 0; | |
2634 | if(IsPlayerAttachedObjectSlotUsed(playerid, index)) { | |
2635 | RemovePlayerAttachedObject(playerid, index); | |
2636 | pao[playerid][index][aoValid] = 0; | |
2637 | SetPVarInt(playerid, "LastAttachedObjectRemoved", index); | |
2638 | _TOTAL_ATTACHED_OBJECT_REMOVED_++; | |
2639 | } | |
2640 | } | |
2641 | return _TOTAL_ATTACHED_OBJECT_REMOVED_; | |
2642 | } | |
2643 | ||
2644 | stock GetAttachedObjectBoneName(BoneID) | |
2645 | { | |
2646 | new GET_AO_BONE_NAME[24]; | |
2647 | if(!IsValidAttachedObjectBone(BoneID)) valstr(GET_AO_BONE_NAME, 0); | |
2648 | else strins(GET_AO_BONE_NAME, AttachedObjectBones[BoneID - MIN_ATTACHED_OBJECT_BONE], 0); | |
2649 | return GET_AO_BONE_NAME; | |
2650 | } | |
2651 | ||
2652 | stock GetAttachedObjectBoneID(const BoneName[]) | |
2653 | { | |
2654 | if(!IsValidAttachedObjectBoneName(BoneName)) return 0; | |
2655 | if(IsNumeric(BoneName) && IsValidAttachedObjectBoneName(BoneName)) return strval(BoneName); | |
2656 | for(new i = 0; i < sizeof(AttachedObjectBones); i++) | |
2657 | { | |
2658 | if(strfind(AttachedObjectBones[i], BoneName, true) != -1) return i + MIN_ATTACHED_OBJECT_BONE; | |
2659 | } | |
2660 | return 0; | |
2661 | } | |
2662 | ||
2663 | stock GetAttachedObjectsCount() | |
2664 | { | |
2665 | new _AttachedObjectsCount; | |
2666 | for(new x = 0; x < GetMaxPlayers(); x++) | |
2667 | { | |
2668 | if(IsPlayerConnected(x)) | |
2669 | { | |
2670 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) | |
2671 | { | |
2672 | if(IsPlayerAttachedObjectSlotUsed(x, i)) _AttachedObjectsCount++; | |
2673 | } | |
2674 | } | |
2675 | } | |
2676 | return _AttachedObjectsCount; | |
2677 | } | |
2678 | ||
2679 | stock GetPlayerAttachedObjectsCount(playerid) | |
2680 | { | |
2681 | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; | |
2682 | new _PlayerAttachedObjectsCount; | |
2683 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) | |
2684 | { | |
2685 | if(IsPlayerAttachedObjectSlotUsed(playerid, i)) _PlayerAttachedObjectsCount++; | |
2686 | } | |
2687 | return _PlayerAttachedObjectsCount; | |
2688 | } | |
2689 | ||
2690 | stock IsValidPlayerAttachedObject(playerid, index) | |
2691 | { | |
2692 | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; // Player is offline | |
2693 | if(!GetPlayerAttachedObjectsCount(playerid) || !IsPlayerAttachedObjectSlotUsed(playerid, index)) return -1; // Not used | |
2694 | if(!IsValidAttachedObjectSlot(index) || !IsValidObjectModel(pao[playerid][index][aoModelID]) || !IsValidAttachedObjectBone(pao[playerid][index][aoBoneID]) || !pao[playerid][index][aoValid]) return 0; // Invalid data | |
2695 | return 1; | |
2696 | } | |
2697 | ||
2698 | stock IsValidAttachedObjectSlot(SlotID) | |
2699 | { | |
2700 | if(0 <= SlotID < MAX_PLAYER_ATTACHED_OBJECTS) return true; | |
2701 | return false; | |
2702 | } | |
2703 | ||
2704 | stock IsValidAttachedObjectBone(BoneID) | |
2705 | { | |
2706 | if(MIN_ATTACHED_OBJECT_BONE <= BoneID <= MAX_ATTACHED_OBJECT_BONE) return true; | |
2707 | return false; | |
2708 | } | |
2709 | ||
2710 | stock IsValidAttachedObjectBoneName(const BoneName[]) | |
2711 | { | |
2712 | new length = strlen(BoneName); | |
2713 | if(!length || length > 24) return false; | |
2714 | for(new b = 0; b < sizeof(AttachedObjectBones); b++) | |
2715 | { | |
2716 | if(!strcmp(BoneName, AttachedObjectBones[b], true)) return true; | |
2717 | - | // Custom Object 19516-19999 (can be changed) |
2717 | + | |
2718 | if(IsNumeric(BoneName) && IsValidAttachedObjectBone(strval(BoneName))) return true; | |
2719 | return false; | |
2720 | } | |
2721 | ||
2722 | stock IsValidFileName(const filename[]) | |
2723 | { | |
2724 | new length = strlen(filename); | |
2725 | if(length < 1 || length > 24) return false; | |
2726 | for(new j = 0; j < length; j++) { | |
2727 | if((filename[j] < 'A' || filename[j] > 'Z') && (filename[j] < 'a' || filename[j] > 'z') && (filename[j] < '0' || filename[j] > '9') | |
2728 | && !(filename[j] == '@' || filename[j] == '$' || filename[j] == '(' || filename[j] == ')' | |
2729 | || filename[j] == '[' || filename[j] == ']' || filename[j] == '_' || filename[j] == '=' || filename[j] == '.')) return false; | |
2730 | } | |
2731 | return true; | |
2732 | } | |
2733 | ||
2734 | //------------------------------------------------------------------------------ | |
2735 | ||
2736 | stock IsValidObjectModel(ModelID) | |
2737 | { | |
2738 | if( | |
2739 | // Weapons Objects | |
2740 | (ModelID >= 321 && ModelID <= 326) | |
2741 | || (ModelID >= 330 && ModelID <= 331) | |
2742 | || (ModelID >= 333 && ModelID <= 339) | |
2743 | || (ModelID >= 341 && ModelID <= 344) | |
2744 | || (ModelID >= 346 && ModelID <= 363) | |
2745 | || (ModelID >= 365 && ModelID <= 372) | |
2746 | // Fun Objects | |
2747 | || (ModelID >= 1433 && ModelID <= 13594) | |
2748 | // Roads Objects | |
2749 | || (ModelID >= 5482 && ModelID <= 5512) | |
2750 | // Barriers Objects | |
2751 | || (ModelID >= 966 && ModelID <= 998) | |
2752 | // Misc Objects 1210-1325 | |
2753 | || (ModelID >= 1210 && ModelID <= 1325) | |
2754 | // Misc Objects 1420-1620 | |
2755 | || (ModelID >= 1420 && ModelID <= 1620) | |
2756 | // Misc Objects 1971-4522 | |
2757 | || (ModelID >= 1971 && ModelID <= 4522) | |
2758 | // SA:MP Object 18632-19515 (0.3e) | |
2759 | || (ModelID >= 18632 && ModelID <= 19515) | |
2760 | // Custom Object 19516-19999 (Including SA:MP 0.3x objects, can be changed) | |
2761 | || (ModelID >= 19516 && ModelID <= 19999)) | |
2762 | { | |
2763 | return true; | |
2764 | } | |
2765 | return false; | |
2766 | } | |
2767 | ||
2768 | stock strtok(const string[], &index) | |
2769 | { | |
2770 | new length = strlen(string); | |
2771 | while ((index < length) && (string[index] <= ' ')) | |
2772 | { | |
2773 | index++; | |
2774 | } | |
2775 | ||
2776 | new offset = index; | |
2777 | new result[20]; | |
2778 | while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) | |
2779 | { | |
2780 | result[index - offset] = string[index]; | |
2781 | index++; | |
2782 | } | |
2783 | result[index - offset] = EOS; | |
2784 | return result; | |
2785 | } | |
2786 | ||
2787 | stock strrest(const string[], &index) | |
2788 | { | |
2789 | new length = strlen(string); | |
2790 | while ((index < length) && (string[index] <= ' ')) | |
2791 | { | |
2792 | index++; | |
2793 | } | |
2794 | new offset = index; | |
2795 | new result[128]; | |
2796 | while ((index < length) && ((index - offset) < (sizeof(result) - 1))) | |
2797 | { | |
2798 | result[index - offset] = string[index]; | |
2799 | index++; | |
2800 | } | |
2801 | result[index - offset] = EOS; | |
2802 | return result; | |
2803 | } | |
2804 | ||
2805 | stock IsNumeric(const string[]) | |
2806 | { | |
2807 | new length=strlen(string); | |
2808 | if(length==0) return false; | |
2809 | for(new i = 0; i < length; i++) { | |
2810 | if(string[i] > '9' || string[i] <'0') return false; | |
2811 | } | |
2812 | return true; | |
2813 | } | |
2814 | ||
2815 | stock IsNumeric2(const string[]) | |
2816 | { | |
2817 | // Is Numeric Check 2 | |
2818 | // ------------------ | |
2819 | // By DracoBlue... handles negative numbers | |
2820 | new length=strlen(string); | |
2821 | if (length==0) return false; | |
2822 | for (new i = 0; i < length; i++) | |
2823 | { | |
2824 | if((string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+' && string[i]!='.') // Not a number,'+' or '-' or '.' | |
2825 | || (string[i]=='-' && i!=0) // A '-' but not first char. | |
2826 | || (string[i]=='+' && i!=0) // A '+' but not first char. | |
2827 | ) return false; | |
2828 | } | |
2829 | if (length==1 && (string[0]=='-' || string[0]=='+' || string[0]=='.')) return false; | |
2830 | return true; | |
2831 | } | |
2832 | ||
2833 | stock IsValidHex(string[]) | |
2834 | { | |
2835 | new length = strlen(string); | |
2836 | if(length < 6 || length > 8) return false; | |
2837 | for(new i = 0; i < length; i++) { | |
2838 | if((string[i] < 'A' || string[i] > 'F') && (string[i] < 'a' || string[i] > 'f') && (string[i] < '0' || string[i] > '9')) return false; | |
2839 | } | |
2840 | return true; | |
2841 | } | |
2842 | ||
2843 | stock RGB( red, green, blue, alpha ) | |
2844 | { | |
2845 | /* Combines a color and returns it, so it can be used in functions. | |
2846 | @red: Amount of red color. | |
2847 | @green: Amount of green color. | |
2848 | @blue: Amount of blue color. | |
2849 | @alpha: Amount of alpha transparency. | |
2850 | ||
2851 | -Returns: | |
2852 | A integer with the combined color. | |
2853 | */ | |
2854 | return (red * 16777216) + (green * 65536) + (blue * 256) + alpha; | |
2855 | } | |
2856 | ||
2857 | stock RGBAtoARGB(color) | |
2858 | return (color >>> 8)|(color << 24); | |
2859 | ||
2860 | stock HexToInt(string[]) | |
2861 | { | |
2862 | if (string[0] == 0) return 0; | |
2863 | new i; | |
2864 | new cur = 1; | |
2865 | new res = 0; | |
2866 | for (i = strlen(string); i > 0; i--) { | |
2867 | if (string[i-1] < 58) res = res + cur * (string[i-1] - 48); | |
2868 | else { | |
2869 | res = res + cur * (string[i-1] - 65 + 10); | |
2870 | cur = cur * 16; | |
2871 | } | |
2872 | } | |
2873 | return res; | |
2874 | } | |
2875 | ||
2876 | stock IntToHex(number) | |
2877 | { | |
2878 | new m=1; | |
2879 | new depth=0; | |
2880 | while (number>=m) { | |
2881 | m = m*16; | |
2882 | depth++; | |
2883 | } | |
2884 | depth--; | |
2885 | new str[256]; | |
2886 | for (new i = depth; i >= 0; i--) | |
2887 | { | |
2888 | str[i] = ( number & 0x0F) + 0x30; // + (tmp > 9 ? 0x07 : 0x00) | |
2889 | str[i] += (str[i] > '9') ? 0x07 : 0x00; | |
2890 | number >>= 4; | |
2891 | } | |
2892 | if(strlen(str) == 0)strins(str,"00",0); | |
2893 | else | |
2894 | if(strlen(str) == 1)strins(str,"0",0); | |
2895 | str[8] = '\0'; | |
2896 | return str; | |
2897 | } |