SHOW:
|
|
- or go back to the newest paste.
1 | - | //////////////////////////////////////////////////////////////////////////////// |
1 | + | /** PLAYER ATTACHED OBJECT EDITOR |
2 | - | // A Recommended Update to v0.4 is Available - http://pastebin.com/JvsDU2Uz // |
2 | + | * - Author: Robo_N1X |
3 | - | //////////////////////////////////////////////////////////////////////////////// |
3 | + | * - Version: 0.4 |
4 | - | // ATTACHED OBJECT EDITOR // |
4 | + | * - Date: November 2015 |
5 | - | // by Robo_N1X // |
5 | + | * - Forum Topic: http://forum.sa-mp.com/showthread.php?t=416138 |
6 | - | // -Version: 0.3- // |
6 | + | */ |
7 | - | // ========================================================================== // |
7 | + | /** This Source Code Form is subject to the terms of the Mozilla Public |
8 | - | // Note: This filterscript works in SA:MP 0.3e or upper // |
8 | + | * License, v. 2.0. If a copy of the MPL was not distributed with this |
9 | - | // License note: // |
9 | + | * file, You can obtain one at http://mozilla.org/MPL/2.0/ |
10 | - | // * You may not remove any credits that is written in the credits dialog or // |
10 | + | * |
11 | - | // other user interface element on this script! // |
11 | + | * Software distributed under the License is distributed on an "AS IS" basis, |
12 | - | // * You may modify this script without removing any credits // |
12 | + | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
13 | - | // * You may copy the content(s) of this script without removing any credits // |
13 | + | * for the specific language governing rights and limitations under the |
14 | - | // * You may use this script for non-commercial only // |
14 | + | * License. |
15 | - | // Credits & Thanks to: SA-MP Team, h02/Scott, Zeex, Y_Less, and whoever // |
15 | + | * |
16 | - | // helped or made some useful functions or codes used in this filter-script! // |
16 | + | * Credits & thanks to: SA-MP Team, Scott/h02, Zeex, Y_Less, |
17 | - | // Original thread: http://forum.sa-mp.com/showthread.php?t=416138 // |
17 | + | * and whoever helped or made some part of code used in this script. |
18 | - | //////////////////////////////////////////////////////////////////////////////// |
18 | + | */ |
19 | - | #define FILTERSCRIPT // This is a filterscript, don't remove! |
19 | + | #define FILTERSCRIPT // Mark this as a filterscript |
20 | - | #include <a_samp> // 0.3e+ - Credits to: SA-MP team |
20 | + | // Includes |
21 | - | #include <zcmd> // 0.3.1 - Credits to: Zeex |
21 | + | #include <a_samp> // v0.3e+ Credits to SA-MP team |
22 | - | #include <sscanf2> // 2.8.1 - Credits to: Y_Less |
22 | + | #include <sscanf2> // v2.8.1 Credits to Y_Less |
23 | - | #define MAX_ATTACHED_OBJECT_BONES 18 // Don't edit unless there is change on SA:MP feature with it. |
23 | + | #include <zcmd> // v0.3.1 Credits to Zeex |
24 | - | #define MAX_ATTACHED_OBJECT_OFFSET 300.0 // Max attached object offset, set around 0.0 to 3000.0 |
24 | + | // Script configurations (defines and macros) |
25 | - | #define MIN_ATTACHED_OBJECT_OFFSET -300.0 // Min attached object offset, set around 0.0 to -3000.0 |
25 | + | #define AOE_FILE_NAME "%s_pao.txt" // Player attached object file (%s = name) located in '\scriptfiles' folder by default |
26 | - | #define MAX_ATTACHED_OBJECT_ROTATION 360.0 // Max attached object rotation, 360.0 is default |
26 | + | #define AOE_VERSION "0.4 - November 2015" // Version string |
27 | - | #define MIN_ATTACHED_OBJECT_ROTATION -360.0 // Min attached object rotation, -360.0 default |
27 | + | #define AOE_SMALLER_SAVE true // Wheter the editor should skip writing default/zero value in the function argument |
28 | - | #define MAX_ATTACHED_OBJECT_SIZE 100.0 // Max attached object size, set around 0 to 1000.0 |
28 | + | #define MAX_ATTACHED_OBJECT_BONES (18) // Not necessary to change unless there is change in SA:MP. |
29 | - | #define MIN_ATTACHED_OBJECT_SIZE -100.0 // Min attached object size, set around 0 to -1000.0 |
29 | + | #define MAX_ATTACHED_OBJECT_BONE_NAME (16) // Max attached object bone name length |
30 | - | #define AOE_VERSION "0.3 - March, 2014" // Version, don't edit if not necessary! |
30 | + | #define MAX_ATTACHED_OBJECT_OFFSET 300.0 // Max (+) attached object offset limit |
31 | - | #define PAO_FILENAME "%s_pao.txt" // Player attached object file (%s = name) located in '\scriptfiles' folder by default |
31 | + | #define MIN_ATTACHED_OBJECT_OFFSET -300.0 // Min (-) attached object offset limit |
32 | - | #define AOE_CantEdit(%0) GetPVarInt(%0, "PAO_EAO") != 0 || GetPlayerState(%0) == PLAYER_STATE_WASTED || GetPlayerState(%0) == PLAYER_STATE_SPECTATING // Do not edit this! |
32 | + | #define MAX_ATTACHED_OBJECT_ROTATION 360.0 // Max (+) attached object rotation limit |
33 | - | #define AOE_HexFormat(%0) %0 >>> 16, %0 & 0xFFFF // printf %x fix for hex, format: 0x%04x%04x - Credits to: Y_Less |
33 | + | #define MIN_ATTACHED_OBJECT_ROTATION -360.0 // Min (-) attached object rotation limit |
34 | - | #define COLOR_WHITE (0xFFFFFFFF) |
34 | + | #define MAX_ATTACHED_OBJECT_SIZE 100.0 // Max (+) attached object scale limit |
35 | - | #define COLOR_RED (0xFF3333FF) |
35 | + | #define MIN_ATTACHED_OBJECT_SIZE -100.0 // Min (-) attached object scale limit |
36 | - | #define COLOR_MAGENTA (0xFF33CCFF) |
36 | + | #define HexPrintFormat(%0) %0 >>> 16, %0 & 0xFFFF // printf fix for hex (format: 0x%04x%04x) - credits to Y_Less |
37 | - | #define COLOR_BLUE (0x3366FFFF) |
37 | + | #define strupdate(%0,%1) %0[0] = EOS, strins(%0,%1,0) // To replace whole string |
38 | - | #define COLOR_CYAN (0x66FFCCFF) |
38 | + | // Color defines |
39 | - | #define COLOR_GREEN (0x00CC00FF) |
39 | + | #define AOE_COLOR0 (0xFFFFFFFF) // White |
40 | - | #define COLOR_YELLOW (0xFFFF33FF) |
40 | + | #define AOE_COLOR1 (0xCC0033FF) // Red |
41 | #define AOE_COLOR2 (0x00CC00FF) // Green | |
42 | #define AOE_COLOR3 (0x0066FFFF) // Blue | |
43 | - | new PlayerName[MAX_PLAYER_NAME+1]; |
43 | + | #define AOE_COLOR4 (0xFFFF33FF) // Yellow |
44 | - | enum // Dialog ID enumeration |
44 | + | #define AOE_COLOR5 (0x33FFFFFF) // Cyan |
45 | // Common non-format message defines | |
46 | - | E_AOED = 400, |
46 | + | #define AOE_M_ACCEPTABLE_OFFSET "** Offset (X/Y/Z) greater than or equal to "#MAX_ATTACHED_OBJECT_OFFSET" and less than or equal to "#MIN_ATTACHED_OBJECT_OFFSET";" |
47 | - | E_AOED_HELP, |
47 | + | #define AOE_M_ACCEPTABLE_ROTATION "** Rotation (RX/RY/RZ) greater than or equal to "#MAX_ATTACHED_OBJECT_OFFSET" and less than or equal to "#MIN_ATTACHED_OBJECT_OFFSET";" |
48 | - | E_AOED_ABOUT, |
48 | + | #define AOE_M_ACCEPTABLE_SCALE "** Scale (SX/SY/SZ) greater than or equal to "#MAX_ATTACHED_OBJECT_OFFSET" and less than or equal to "#MIN_ATTACHED_OBJECT_OFFSET";" |
49 | - | E_AOED_CREATE_MODEL, |
49 | + | #define AOE_M_CANT_EDIT "* Sorry, you can't use this command right now." |
50 | - | E_AOED_CREATE_BONE, |
50 | + | #define AOE_M_COMMENT_INFO "** Valid comment length is equal or less than 64 characters and only contains alphabet letter or number." |
51 | - | E_AOED_CREATE_SLOT, |
51 | + | #define AOE_M_COMMENT_INVALID "* Warning: Comment contains invalid character, ignoring anyway." |
52 | - | E_AOED_CREATE_REPLACE, |
52 | + | #define AOE_M_CREATE_CANCEL "* You've canceled creating attached object." |
53 | - | E_AOED_CREATE_EDIT, |
53 | + | #define AOE_M_CREATE_FAIL "* Failed to create attached object due to error." |
54 | - | E_AOED_EDIT_SLOT, |
54 | + | #define AOE_M_DELETE_ADMIN_ONLY "* Sorry, only Server Administrator can delete player attached object(s) file." |
55 | - | E_AOED_REMOVE_SLOT, |
55 | + | #define AOE_M_DELETE_CANCEL "* You've canceled deleting attached object file." |
56 | - | E_AOED_REMOVEALL, |
56 | + | #define AOE_M_DELETING "* Deleting attached object(s) file, please wait..." |
57 | - | E_AOED_STATS_SLOT, |
57 | + | #define AOE_M_DIALOG_CLOSE "* You've closed attached object editor dialog." |
58 | - | E_AOED_STATS, |
58 | + | #define AOE_M_DUPLICATE_FAIL "* Failed to duplicate attached object due to error." |
59 | - | E_AOED_DUPLICATE_SLOT1, |
59 | + | #define AOE_M_DUPLICATE_INFO "** Allows you to duplicate your existing attached object to another slot." |
60 | - | E_AOED_DUPLICATE_SLOT2, |
60 | + | #define AOE_M_DUPLICATE_USAGE "* Usage: /duplicateattachedobject <FromAttachedObjectIndex> <ToAttachedObjectIndex>" |
61 | - | E_AOED_DUPLICATE_REPLACE, |
61 | + | #define AOE_M_EDIT_CANCEL "* You've canceled editing attached object." |
62 | - | E_AOED_SET_SLOT1, |
62 | + | #define AOE_M_EDIT_HINT_ONFOOT "** Hint: Use {FFFFFF}~k~~PED_SPRINT~{FFFF33} key to look around." |
63 | - | E_AOED_SET_SLOT2, |
63 | + | #define AOE_M_EDIT_HINT_VEHICLE "** Hint: Use {FFFFFF}~k~~VEHICLE_ACCELERATE~{FFFF33} key to look around." |
64 | - | E_AOED_SET_SLOT_REPLACE, |
64 | + | #define AOE_M_EDIT_INFO "** Allows you to adjust your attached object from specified slot with your cursor." |
65 | - | E_AOED_SET_MODEL_SLOT, |
65 | + | #define AOE_M_EDIT_NOTHING "* Sorry, you don't have any attached object to edit!" |
66 | - | E_AOED_SET_MODEL, |
66 | + | #define AOE_M_EDIT_NOTICE "* Please finish (Save) or cancel (ESC) the edit first!" |
67 | - | E_AOED_SET_BONE_SLOT, |
67 | + | #define AOE_M_EDIT_SKIP "* You've skipped to edit your attached object." |
68 | - | E_AOED_SET_BONE, |
68 | + | #define AOE_M_EDIT_SKIP_INFO "** Note: use /editattachedobject command to edit your attached object." |
69 | - | E_AOED_SAVE, |
69 | + | #define AOE_M_EDIT_USAGE "* Usage: /editattachedobject <AttachedObjectIndex>" |
70 | - | E_AOED_SAVE_SLOT, |
70 | + | #define AOE_M_ERROR "* There was an error when performing this action." |
71 | - | E_AOED_SAVE_REPLACE, |
71 | + | #define AOE_M_FILE_CANCEL "* You've canceled managing attached object(s) file." |
72 | - | E_AOED_SAVE2, |
72 | + | #define AOE_M_INVALID_COLOR "* Sorry, you've entered invalid new color value." |
73 | - | E_AOED_SAVE2_REPLACE, |
73 | + | #define AOE_M_INVALID_XYZ "* Sorry, you've entered invalid new value." |
74 | - | E_AOED_LOAD, |
74 | + | #define AOE_M_LOADING "* Loading attached object file, please wait..." |
75 | - | E_AOED_LOAD_SLOT, |
75 | + | #define AOE_M_LOADING_SET "* Loading attached object(s) set file, please wait..." |
76 | - | E_AOED_LOAD_REPLACE, |
76 | + | #define AOE_M_MAX_SLOT_INFO "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached object(s) at one time, please remove some." |
77 | - | E_AOED_LOAD2, |
77 | + | #define AOE_M_NO_ATTACHED_OBJECT "* Sorry, you don't have any attached object." |
78 | #define AOE_M_NO_ENOUGH_SLOT "* Sorry, you can't have more attached object(s) (Limit exceeded)." | |
79 | #define AOE_M_OBJECT_DATA_PRINT "* As you're an admin, you can print this attached object properties & usage to the console." | |
80 | #define AOE_M_OBJECT_DATA_S_PRINT "SERVER: Attached object properties has been printed to server console!" | |
81 | - | AO_STATUS = 0, |
81 | + | #define AOE_M_OVERWRITE "* As you're an admin, you can replace an existed attached object file" |
82 | - | AO_MODEL_ID, AO_BONE_ID, |
82 | + | #define AOE_M_PROPERTIES_CLOSE "* You've closed your attached object properties dialog." |
83 | #define AOE_M_PROPERTIES_INFO "** Allows you to view your or another player's attached object properties." | |
84 | #define AOE_M_PROPERTIES_USAGE "* Usage: /attachedobjectproperties <AttachedObjectIndex> <Optional:Player>" | |
85 | #define AOE_M_REFRESH_INFO "** Allows you to load another player's attached object from specified slot." | |
86 | - | AO_MC1, AO_MC2 |
86 | + | #define AOE_M_REFRESH_OWN "* Sorry, you can't refresh your own attached object." |
87 | #define AOE_M_REFRESH_USAGE "* Usage: /refreshattachedobject <PlayerName/ID> <AttachedObjectIndex>" | |
88 | #define AOE_M_REFRESH_WARNING "* Warning: You are attempting to load another player's attached object on your existing attached object index." | |
89 | - | new AttachedObjectBones[MAX_ATTACHED_OBJECT_BONES][15+1] = |
89 | + | #define AOE_M_REMOVE_ALL_CANCEL "* You've canceled removing all your attached object(s)." |
90 | #define AOE_M_REMOVE_INFO "** Allows you to remove your attached object from specified slot." | |
91 | - | {"Spine"}, {"Head"}, {"Left upper arm"}, {"Right upper arm"}, {"Left hand"}, {"Right hand"}, |
91 | + | #define AOE_M_REMOVE_USAGE "* Usage: /removeattachedobject <AttachedObjectIndex>" |
92 | - | {"Left thigh"}, {"Right thigh"}, {"Left foot"}, {"Right foot"}, {"Right calf"}, {"Left calf"}, |
92 | + | #define AOE_M_RESET_ADMIN_ONLY "* Sorry, only Server Administrator can reset player's attached object editor variable." |
93 | - | {"Left forearm"}, {"Right forearm"}, {"Left clavicle"}, {"Right clavicle"}, {"Neck"}, {"Jaw"} |
93 | + | #define AOE_M_RESET_INFO "** Allows you to reset a player's attached object editor variable(s) to its first state. Only use when needed (in rare case)" |
94 | #define AOE_M_RESET_USAGE "* Usage: /resetattachedobjecteditor <PlayerName/ID> <Optional:AttachedObjectIndex>" | |
95 | #define AOE_M_SAVE_ERROR "* Error: Invalid attached object data, save canceled." | |
96 | #define AOE_M_SAVE_FAILED "* Error: Invalid attached object(s) data, save canceled." | |
97 | #define AOE_M_SAVE_OVERWRITE "** The attached object data on file has been overwritten (Re-Created)." | |
98 | - | print(" [FilterScript] Loading Attached Object Editor..."); |
98 | + | #define AOE_M_SAVE_SET_ERROR "** Error: file saving was canceled because there were no valid attached object!" |
99 | - | new j = GetMaxPlayers(); |
99 | + | #define AOE_M_SAVE_SET_OVERWRITE "** The attached object(s) data on file has been overwritten (Re-Created)." |
100 | - | if(j > MAX_PLAYERS) |
100 | + | #define AOE_M_SAVING "* Saving attached object file, please wait..." |
101 | #define AOE_M_SAVING_SET "* Saving attached object(s) set file, please wait..." | |
102 | - | printf(" [FS:AOE] \"maxplayers\" (%d) > \"MAX_PLAYERS\" (%d)\n >> Preferring \"MAX_PLAYERS\" for loop...", j, MAX_PLAYERS); |
102 | + | #define AOE_M_SET_BONE_INFO "** Allows you to change your attached object bone to another bone, valid bone numbers are 1 to "#MAX_ATTACHED_OBJECT_BONE"." |
103 | - | j = MAX_PLAYERS; |
103 | + | #define AOE_M_SET_BONE_USAGE "* Usage: /setattachedobjectbone <AttachedObjectIndex> <BoneName/ID>" |
104 | #define AOE_M_SET_COLOR1_INFO "** Allows you to set your attached object color (Material:1) with specified parameters." | |
105 | - | for(new i = 0; i < j; i++) |
105 | + | #define AOE_M_SET_COLOR1_USAGE "* Usage: /setattachedobjectmc1 <AttachedObjectIndex> <MaterialColor>" |
106 | #define AOE_M_SET_COLOR2_INFO "** Allows you to set your attached object color (Material:2) with specified parameters." | |
107 | - | for(new x = 0; x < MAX_PLAYER_ATTACHED_OBJECTS; x++) |
107 | + | #define AOE_M_SET_COLOR2_USAGE "* Usage: /setattachedobjectmc2 <AttachedObjectIndex> <MaterialColor>" |
108 | #define AOE_M_SET_COLOR_INFO "** Allows you to set your attached object material color(s) with specified parameters." | |
109 | - | if(IsPlayerAttachedObjectSlotUsed(i, x)) PAO[i][x][AO_STATUS] = 1; |
109 | + | #define AOE_M_SET_COLOR_USAGE "* Usage: /setattachedobjectmc <AttachedObjectIndex> <MaterialColor1> <MaterialColor2>" |
110 | - | else AOE_UnsetValues(i, x); |
110 | + | #define AOE_M_SET_MODEL_FAIL "* Failed to change attached object model due to error." |
111 | #define AOE_M_SET_MODEL_INFO "** Allows you to change your attached object model with another model (must be valid GTA:SA/SA-MP object model)." | |
112 | #define AOE_M_SET_MODEL_USAGE "* Usage: /setattachedobjectmodel <AttachedObjectIndex> <ObjectModel>" | |
113 | - | print(" [FilterScript] Attached Object Editor for SA:MP 0.3e+ has been loaded!\n * Current version: " #AOE_VERSION); |
113 | + | #define AOE_M_SET_OFFSET_INFO "** Allows you to set your attached object position/offset with specified parameters." |
114 | - | printf(" * Player attached objects count: %d", GetAttachedObjectsCount()); |
114 | + | #define AOE_M_SET_OFFSET_USAGE "* Usage: /setattachedobjectoffset <AttachedObjectIndex> <X/Y/Z> <Float:OffsetValue>" |
115 | #define AOE_M_SET_ROTATION_INFO "** Allows you to set your attached object rotation with specified parameters." | |
116 | #define AOE_M_SET_ROTATION_USAGE "* Usage: /setattachedobjectrot <AttachedObjectIndex> <X/Y/Z> <Float:RotationValue>" | |
117 | #define AOE_M_SET_SCALE_INFO "** Allows you to set your attached object scale/size with specified parameters." | |
118 | #define AOE_M_SET_SCALE_USAGE "* Usage: /setattachedobjectscale <AttachedObjectIndex> <X/Y/Z> <Float:ScaleValue>" | |
119 | #define AOE_M_SET_SLOT_FAIL "* Failed to change attached object slot due to error." | |
120 | - | printf(" [FilterScript] Unloading Attached Object Editor...\n * Player attached objects count: %d", GetAttachedObjectsCount()); |
120 | + | #define AOE_M_SET_SLOT_INFO "** Allows you to change your attached object slot to another slot, valid slot numbers are 0 to 9." |
121 | - | new j = GetMaxPlayers(); |
121 | + | #define AOE_M_SET_SLOT_USAGE "* Usage: /setattachedobjectindex <OldAttachedObjectIndex> <NewAttachedObjectIndex>" |
122 | - | if(j > MAX_PLAYERS) j = MAX_PLAYERS; |
122 | + | #define AOE_M_TARGET_NOT_ONLINE "* Sorry, the target player is not connected." |
123 | - | for(new i = 0; i < j; i++) if(IsPlayerConnected(i)) AOE_UnsetVars(i); |
123 | + | #define AOE_M_UNDELETE_HINT "** Hint: Leave the command parameter empty to restore last deleted object." |
124 | - | print(" [FilterScript] Attached Object Editor for SA:MP 0.3e+ has been unloaded!"); |
124 | + | #define AOE_M_UNDELETE_NOTHING "* Sorry, you don't have any attached object to restore." |
125 | - | return 1; |
125 | + | #define AOE_M_UNDELETE_NO_PARAM "* No parameter given, attempting to restore the last removed attached object..." |
126 | #define AOE_M_UNKNOWN_DATA "* Warning: This attached object has unknown data, please save it first to refresh the data!" | |
127 | #define AOE_M_VALID_NAME_INFO1 "** Valid length is greater than or equal to 1 and less than or equal to 24 characters." | |
128 | #define AOE_M_VALID_NAME_INFO2 "** Valid characters are: A to Z or a to z, 0 to 9 and @$()_=[] symbols for the next character." | |
129 | #define AOE_M_VALID_OFFSET "** Allowed float (Offset) value is larger than "#MIN_ATTACHED_OBJECT_OFFSET" and less than "#MAX_ATTACHED_OBJECT_OFFSET"." | |
130 | #define AOE_M_VALID_ROTATION "** Allowed float (Rotation) value is larger than "#MIN_ATTACHED_OBJECT_ROTATION" and less than "#MAX_ATTACHED_OBJECT_ROTATION"." | |
131 | #define AOE_M_VALID_SCALE "** Allowed float (Scale) value is larger than "#MIN_ATTACHED_OBJECT_SIZE" and less than "#MAX_ATTACHED_OBJECT_SIZE"." | |
132 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, i)) PAO[playerid][i][AO_STATUS] = 1; |
132 | + | // Common non-format gametext defines |
133 | - | else RemovePlayerAttachedObject(playerid, i), AOE_UnsetValues(playerid, i); |
133 | + | #define AOE_G_COLOR_UPDATED "~g~Attached object color updated!" |
134 | #define AOE_G_OFFSET_UPDATED "~g~Attached object position updated!" | |
135 | #define AOE_G_ROTATION_UPDATED "~g~Attached object rotation updated!" | |
136 | #define AOE_G_SCALE_UPDATED "~g~Attached object size updated!" | |
137 | #define AOE_G_DOH "~y~DOH!" | |
138 | #define AOE_G_CANT_RESTORE "~r~~h~Can't restore attached object!" | |
139 | #define AOE_G_FILE_DELETED "~r~~h~Attached object file deleted!" | |
140 | - | new slots = 0; |
140 | + | #define AOE_G_FILE_EXISTED "~r~~h~File already exists!" |
141 | - | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) |
141 | + | #define AOE_G_FILE_NOT_EXIST "~r~~h~File does not exist!" |
142 | #define AOE_G_INVALID_BONE "~r~~h~Invalid attached object bone!" | |
143 | #define AOE_G_INVALID_DATA "~r~~h~Invalid attached object data!" | |
144 | #define AOE_G_INVALID_FILE_NAME "~r~~h~Invalid file name!" | |
145 | - | RestorePlayerAttachedObject(playerid, i); |
145 | + | #define AOE_G_INVALID_MODEL "~r~~h~Invalid object model!" |
146 | - | slots++; |
146 | + | #define AOE_G_INVALID_OFFSET "~r~~h~Invalid attached object offset value!" |
147 | #define AOE_G_INVALID_ROTATION "~r~~h~Invalid attached object rotation value!" | |
148 | #define AOE_G_INVALID_SCALE "~r~~h~Invalid attached object size value!" | |
149 | - | if(0 < slots <= MAX_PLAYER_ATTACHED_OBJECTS) |
149 | + | #define AOE_G_INVALID_SLOT "~r~~h~Invalid attached object slot!" |
150 | #define AOE_G_NO_ATTACHED_OBJECT "~r~~h~Found no attached object!" | |
151 | - | format(AOE_STR, sizeof(AOE_STR), "* Automatically restored your attached object(s) [Total: %d]!", slots); |
151 | + | #define AOE_G_NO_ENOUGH_SLOT "~r~~h~Too many attached objects!" |
152 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
152 | + | #define AOE_G_NO_RESTORE "~r~~h~No attached object can be restored!" |
153 | // Dialog ID defines | |
154 | - | return 1; |
154 | + | #define AOE_D 400 // Main Menu ID |
155 | #define AOE_D_CREATE_SLOT (AOE_D+1) | |
156 | #define AOE_D_CREATE_MODEL (AOE_D+2) | |
157 | #define AOE_D_CREATE_BONE (AOE_D+3) | |
158 | #define AOE_D_CREATE_REPLACE (AOE_D+4) | |
159 | #define AOE_D_CREATE_EDIT (AOE_D+5) | |
160 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
160 | + | #define AOE_D_FILE (AOE_D+6) |
161 | - | else AOE_ShowPlayerDialog(playerid, 0, E_AOED, "Attached Object Editor", "Select", "Close"); |
161 | + | #define AOE_D_LOAD (AOE_D+7) |
162 | #define AOE_D_LOAD_SLOT (AOE_D+8) | |
163 | #define AOE_D_LOAD_REPLACE (AOE_D+9) | |
164 | #define AOE_D_LOAD2 (AOE_D+10) | |
165 | #define AOE_D_SAVE_SLOT (AOE_D+11) | |
166 | #define AOE_D_SAVE (AOE_D+12) | |
167 | #define AOE_D_SAVE_REPLACE (AOE_D+13) | |
168 | #define AOE_D_SAVE2 (AOE_D+14) | |
169 | #define AOE_D_SAVE2_REPLACE (AOE_D+15) | |
170 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
170 | + | #define AOE_D_DELETE (AOE_D+16) |
171 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
171 | + | #define AOE_D_EDIT_SLOT (AOE_D+17) |
172 | #define AOE_D_EDIT (AOE_D+18) | |
173 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
173 | + | #define AOE_D_EDIT_PROPERTIES (AOE_D+19) |
174 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
174 | + | #define AOE_D_SET_SLOT (AOE_D+20) |
175 | #define AOE_D_SET_SLOT_REPLACE (AOE_D+21) | |
176 | - | else AOE_ShowPlayerDialog(playerid, 10, E_AOED_REMOVEALL, "Remove All Attached Object(s)", "Yes", "Cancel"); |
176 | + | #define AOE_D_SET_MODEL (AOE_D+22) |
177 | #define AOE_D_SET_BONE (AOE_D+23) | |
178 | #define AOE_D_EDIT_XYZ (AOE_D+24) | |
179 | #define AOE_D_EDIT_COLOR (AOE_D+25) | |
180 | #define AOE_D_PROPERTIES (AOE_D+26) | |
181 | #define AOE_D_DUPLICATE_SLOT (AOE_D+27) | |
182 | #define AOE_D_DUPLICATE_REPLACE (AOE_D+28) | |
183 | #define AOE_D_REMOVE_ALL (AOE_D+29) | |
184 | #define AOE_D_REFRESH (AOE_D+30) | |
185 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
185 | + | #define AOE_D_REFRESH_REPLACE (AOE_D+31) |
186 | - | else if(GetPlayerAttachedObjectsCount(playerid) == MAX_PLAYER_ATTACHED_OBJECTS) |
186 | + | // Dialog class defines |
187 | #define AOE_C (0) | |
188 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't have more attached objects [Limit exceeded]!"); |
188 | + | #define AOE_C_FILE (1) |
189 | - | SendClientMessage(playerid, COLOR_YELLOW, "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached object(s) at a time!"); |
189 | + | #define AOE_C_EDIT (2) |
190 | - | GameTextForPlayer(playerid, "~r~~h~Too many attached objects!", 3000, 3); |
190 | + | #define AOE_C_HELP (3) |
191 | #define AOE_C_ABOUT (4) | |
192 | #define AOE_C_SLOT_EMPTY (5) | |
193 | #define AOE_C_SLOT_USED (6) | |
194 | - | if(GetPVarType(playerid, "PAO_LAOR")) |
194 | + | #define AOE_C_SLOT_ALL (7) |
195 | #define AOE_C_REFRESH (8) | |
196 | - | new slot = GetPVarInt(playerid, "PAO_LAOR"); |
196 | + | #define AOE_C_MODEL (9) |
197 | - | if(IsValidPlayerAttachedObject(playerid, slot)) |
197 | + | #define AOE_C_BONE (10) |
198 | #define AOE_C_CREATE_FINAL (11) | |
199 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
199 | + | #define AOE_C_REMOVE_ALL (12) |
200 | #define AOE_C_PROPERTIES (13) | |
201 | - | 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 (%d)!", slot); |
201 | + | #define AOE_C_EDIT_PROPERTIES (14) |
202 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
202 | + | #define AOE_C_EDIT_XYZ (15) |
203 | - | GameTextForPlayer(playerid, "~r~~h~Cannot restore attached object!", 3000, 3); |
203 | + | #define AOE_C_EDIT_COLOR (16) |
204 | #define AOE_C_DUPLICATE_REPLACE (17) | |
205 | #define AOE_C_CREATE_REPLACE (18) | |
206 | #define AOE_C_SET_INDEX_REPLACE (19) | |
207 | - | RestorePlayerAttachedObject(playerid, slot); |
207 | + | #define AOE_C_REFRESH_REPLACE (20) |
208 | - | format(AOE_STR, sizeof(AOE_STR), "* You've restored your attaced object from slot/index number %d [Model: %d - Bone: %s (%d)]!", slot, PAO[playerid][slot][AO_MODEL_ID], |
208 | + | #define AOE_C_LOAD_REPLACE (21) |
209 | - | GetAttachedObjectBoneName(PAO[playerid][slot][AO_BONE_ID]), PAO[playerid][slot][AO_BONE_ID]); |
209 | + | #define AOE_C_SAVE_REPLACE (22) |
210 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
210 | + | #define AOE_C_SAVE (23) |
211 | - | format(AOE_STR, sizeof(AOE_STR), "~g~Restored your attached object~n~~w~index/number: %d~n~Model: %d - Bone: %d", slot, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID]); |
211 | + | #define AOE_C_LOAD (24) |
212 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
212 | + | #define AOE_C_DELETE (25) |
213 | // Common non-format dialog title defines | |
214 | #define AOE_T "Attached Object Editor" | |
215 | #define AOE_T_ABOUT "About Attached Object Editor" | |
216 | #define AOE_T_CREATE "Create Attached Object" | |
217 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you can't restore your last attached object from slot/index number %d as it's not valid!", slot); |
217 | + | #define AOE_T_CREATE_EDIT "Create Attached Object (Edit)" |
218 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
218 | + | #define AOE_T_DELETE "Delete Attached Object(s) File" |
219 | - | GameTextForPlayer(playerid, "~r~~h~Cannot restore attached object!", 3000, 3); |
219 | + | #define AOE_T_DUPLICATE "Duplicate Attached Object" |
220 | #define AOE_T_EDIT "Edit Attached Object" | |
221 | #define AOE_T_FILE "Manage Attached Object File" | |
222 | #define AOE_T_HELP "Attached Object Editor Help" | |
223 | #define AOE_T_LOAD "Load Attached Object" | |
224 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object to restore!"); |
224 | + | #define AOE_T_LOAD_SET "Load Attached Object(s) Set" |
225 | - | GameTextForPlayer(playerid, "~r~~h~No attached object can be restored!", 3000, 3); |
225 | + | #define AOE_T_REFRESH "Refresh Attached Object" |
226 | #define AOE_T_REMOVE_ALL "Clear All Attached Object(s)" | |
227 | #define AOE_T_SAVE "Save Attached Object" | |
228 | #define AOE_T_SAVE_SET "Save Attached Object(s) Set" | |
229 | #define AOE_T_SET_BONE "Set Attached Object Bone" | |
230 | #define AOE_T_SET_INDEX "Set Attached Object Index" | |
231 | #define AOE_T_SET_MODEL "Set Attached Object Model" | |
232 | #define AOE_T_REPLACE " (Replace)" | |
233 | - | CMD:totalattachedobjects(playerid, params[]) |
233 | + | // Common non-format dialog info text defines |
234 | #define AOE_I_ENTER_MODEL \ | |
235 | "Please enter a valid GTA:SA/SA:MP object model id/number below:" | |
236 | - | SendClientMessage(playerid, COLOR_MAGENTA, "----------------------------------------------------------------------------------------------------"); |
236 | + | #define AOE_I_LOAD_NAME \ |
237 | - | format(AOE_STR, sizeof(AOE_STR), "-- Total attached object(s) attached on you: %d", GetPlayerAttachedObjectsCount(playerid)); |
237 | + | "Please enter an valid and existing attached object file name below,\n\n"#AOE_I_VALID_NAME |
238 | - | SendClientMessage(playerid, COLOR_CYAN, AOE_STR); |
238 | + | #define AOE_I_SAVE_NAME \ |
239 | - | format(AOE_STR, sizeof(AOE_STR), "-- Total of all attached object(s) in server: %d", GetAttachedObjectsCount()); |
239 | + | "Please enter a valid file name to save this attached object below,\n\n"#AOE_I_VALID_NAME |
240 | - | SendClientMessage(playerid, COLOR_CYAN, AOE_STR); |
240 | + | #define AOE_I_VALID_NAME \ |
241 | - | SendClientMessage(playerid, COLOR_MAGENTA, "----------------------------------------------------------------------------------------------------"); |
241 | + | "Please note that valid characters are:\nA to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =\nand the length must be 1-24 characters long" |
242 | - | return 1; |
242 | + | // Common non-format dialog button defines |
243 | #define AOE_B_BACK "Back" | |
244 | #define AOE_B_CANCEL "Cancel" | |
245 | - | CMD:taos(playerid, params[]) return cmd_totalattachedobjects(playerid, params); |
245 | + | #define AOE_B_CLOSE "Close" |
246 | #define AOE_B_DELETE "Delete" | |
247 | #define AOE_B_DUPLICATE "Duplicate" | |
248 | #define AOE_B_EDIT "Edit" | |
249 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
249 | + | #define AOE_B_EDIT_CREATE "Edit/Create" |
250 | - | else if(GetPlayerAttachedObjectsCount(playerid) == MAX_PLAYER_ATTACHED_OBJECTS) |
250 | + | #define AOE_B_ENTER "Enter" |
251 | #define AOE_B_LOAD "Load" | |
252 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't have more attached object(s) [Limit exceeded]!"); |
252 | + | #define AOE_B_PRINT "Print" |
253 | - | SendClientMessage(playerid, COLOR_YELLOW, "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached object(s) at a time!"); |
253 | + | #define AOE_B_SAVE "Save" |
254 | - | GameTextForPlayer(playerid, "~r~~h~Too many attached objects!", 3000, 3); |
254 | + | #define AOE_B_SELECT "Select" |
255 | #define AOE_B_SELECT_INDEX "Sel. Index" | |
256 | #define AOE_B_SELECT_MODEL "Sel. Model" | |
257 | #define AOE_B_SET "Set" | |
258 | - | new slot, model = -1, bone[15+1]; |
258 | + | #define AOE_B_SKIP "Skip" |
259 | - | if(sscanf(params, "dD(-1)S()[16]", slot, model, bone)) AOE_ShowPlayerDialog(playerid, 5, E_AOED_CREATE_SLOT, "Create Attached Object", "Select", "Cancel"); |
259 | + | #define AOE_B_YES "Yes" |
260 | // ============================================================================= | |
261 | new AOE_STR[128]; | |
262 | - | if(IsValidAttachedObjectSlot(slot)) |
262 | + | |
263 | - | { |
263 | + | |
264 | - | SetPVarInt(playerid, "PAO_CAOI", slot); |
264 | + | AO_STATUS, AO_MODEL_ID, AO_BONE_ID, |
265 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) AOE_ShowPlayerDialog(playerid, 8, E_AOED_CREATE_REPLACE, "Create Attached Object (Replace)", "Yes", "Back"); |
265 | + | |
266 | Float:AO_RX, Float:AO_RY, Float:AO_RZ, | |
267 | Float:AO_SX, Float:AO_SY, Float:AO_SZ, | |
268 | - | if(model == -1) AOE_ShowPlayerDialog(playerid, 3, E_AOED_CREATE_MODEL, "Create Attached Object", "Enter", "Sel Index"); |
268 | + | hex:AO_MC1, hex:AO_MC2 |
269 | } | |
270 | new PAO[MAX_PLAYERS][MAX_PLAYER_ATTACHED_OBJECTS][E_ATTACHED_OBJECT]; | |
271 | - | if(IsValidObjectModel(model)) |
271 | + | enum E_EDITOR_PVAR |
272 | - | { |
272 | + | |
273 | - | SetPVarInt(playerid, "PAO_CAOM", model); |
273 | + | PAO_INDEX1, PAO_INDEX2, PAO_MODEL_ID, PAO_BONE_ID, PAO_LAST_REMOVED, |
274 | - | if(strlen(bone)) |
274 | + | PAO_NAME[24], PAO_EDITING, PAO_TARGET |
275 | - | { |
275 | + | |
276 | - | if(IsValidAttachedObjectBoneName(bone)) |
276 | + | new EPV[MAX_PLAYERS][E_EDITOR_PVAR]; |
277 | - | { |
277 | + | new const AttachedObjectBones[MAX_ATTACHED_OBJECT_BONES][MAX_ATTACHED_OBJECT_BONE_NAME] = |
278 | - | new boneid = GetAttachedObjectBone(bone); |
278 | + | |
279 | - | SetPVarInt(playerid, "PAO_CAOB", boneid); |
279 | + | {"Spine"}, |
280 | - | CreatePlayerAttachedObject(playerid, slot, model, boneid); |
280 | + | {"Head"}, |
281 | - | format(AOE_STR, sizeof(AOE_STR), "* Created attached object model %d at slot/index number %d [Bone: %s (%d)]!", model, slot, GetAttachedObjectBoneName(boneid), boneid); |
281 | + | {"Left upper arm"}, {"Right upper arm"}, |
282 | - | SendClientMessage(playerid, COLOR_BLUE, AOE_STR); |
282 | + | {"Left hand"}, {"Right hand"}, |
283 | - | format(AOE_STR, sizeof(AOE_STR), "~b~Created attached object~n~~w~index/number: %d~n~Model: %d - Bone: %d", slot, model, boneid); |
283 | + | {"Left thigh"}, {"Right thigh"}, |
284 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
284 | + | {"Left foot"}, {"Right foot"}, |
285 | - | AOE_ShowPlayerDialog(playerid, 9, E_AOED_CREATE_EDIT, "Create Attached Object (Edit)", "Edit", "Skip"); |
285 | + | {"Right calf"}, {"Left calf"}, |
286 | - | } |
286 | + | {"Left forearm"}, {"Right forearm"}, |
287 | - | else |
287 | + | {"Left clavicle"}, {"Right clavicle"}, |
288 | - | { |
288 | + | {"Neck"}, |
289 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object bone number/id [%s]!", bone); |
289 | + | {"Jaw"} |
290 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
290 | + | |
291 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object bone!", 3000, 3); |
291 | + | new AOSelection, AOSlot, AOModel, AOBone, Float:AOAxis, hex:AOMC, |
292 | - | } |
292 | + | AOTarget, pName[MAX_PLAYER_NAME], AOFileName[32+1], Float:AOFileLen, AOComment[64]; |
293 | - | } |
293 | + | forward AOE_GetPVar(playerid, varname[]); |
294 | - | else AOE_ShowPlayerDialog(playerid, 4, E_AOED_CREATE_BONE, "Create Attached Object", "Select", "Sel Model"); |
294 | + | |
295 | - | } |
295 | + | |
296 | - | else |
296 | + | |
297 | - | { |
297 | + | print(" Attached Object Editor by Robo_N1X\n -------------loading--------------\n >> Version: "#AOE_VERSION" for SA:MP 0.3e+"); |
298 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid object model number/id [%d]!", model); |
298 | + | new totalAttachedObjects; |
299 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
299 | + | for(new i = 0; i < MAX_PLAYERS; i++) |
300 | - | GameTextForPlayer(playerid, "~r~~h~Invalid object model!", 3000, 3); |
300 | + | |
301 | - | } |
301 | + | if(IsPlayerConnected(i)) |
302 | { | |
303 | for(new x = 0; x < MAX_PLAYER_ATTACHED_OBJECTS; x++) | |
304 | - | } |
304 | + | |
305 | - | else |
305 | + | if(IsPlayerAttachedObjectSlotUsed(i, x)) |
306 | - | { |
306 | + | |
307 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
307 | + | PAO[i][x][AO_STATUS] = 0; |
308 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
308 | + | totalAttachedObjects++; |
309 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
309 | + | |
310 | else AOE_UnsetValues(i, x); | |
311 | } | |
312 | EPV[i][PAO_LAST_REMOVED] = MAX_PLAYER_ATTACHED_OBJECTS; | |
313 | } | |
314 | } | |
315 | printf(" >> Player attached objects count: %d", totalAttachedObjects); | |
316 | return 1; | |
317 | } | |
318 | ||
319 | public OnFilterScriptExit() | |
320 | - | if(GetPVarInt(playerid, "PAO_EAO") == 1) CancelEdit(playerid); |
320 | + | |
321 | - | else if(GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) |
321 | + | print(" Attached Object Editor by Robo_N1X\n -------------unloading------------\n >> Version: "#AOE_VERSION" for SA:MP 0.3e+"); |
322 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
322 | + | new totalAttachedObjects; |
323 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
323 | + | for(new i = 0; i < MAX_PLAYERS; i++) |
324 | { | |
325 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
325 | + | if(IsPlayerConnected(i)) |
326 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
326 | + | |
327 | for(new x = 0; x < MAX_PLAYER_ATTACHED_OBJECTS; x++) | |
328 | { | |
329 | totalAttachedObjects += IsPlayerAttachedObjectSlotUsed(i, x); | |
330 | - | new slot; |
330 | + | if(PAO[i][x][AO_STATUS] == 1 && !IsPlayerAdmin(i)) |
331 | - | if(sscanf(params, "d", slot)) AOE_ShowPlayerDialog(playerid, 6, E_AOED_EDIT_SLOT, "Edit Attached Object", "Edit/Create", "Cancel"); |
331 | + | RemovePlayerAttachedObjectEx(i, x); |
332 | } | |
333 | AOE_UnsetVars(i); | |
334 | - | if(IsValidAttachedObjectSlot(slot)) |
334 | + | |
335 | - | { |
335 | + | |
336 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
336 | + | printf(" >> Player attached objects count: %d", totalAttachedObjects); |
337 | return 1; | |
338 | - | EditAttachedObject(playerid, slot); |
338 | + | |
339 | - | SetPVarInt(playerid, "PAO_EAO", 1); |
339 | + | |
340 | - | PAO[playerid][slot][AO_STATUS] = 2; |
340 | + | |
341 | - | format(AOE_STR, sizeof(AOE_STR), "* You're now editing your attached object from slot/index number %d!", slot); |
341 | + | |
342 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
342 | + | |
343 | - | format(AOE_STR, sizeof(AOE_STR), "~g~Editing your attached object~n~~w~index/number: %d", slot); |
343 | + | |
344 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
344 | + | if(IsPlayerAttachedObjectSlotUsed(playerid, i)) PAO[playerid][i][AO_STATUS] = 1; |
345 | - | if(IsValidPlayerAttachedObject(playerid, slot) != 1) SendClientMessage(playerid, COLOR_RED, "Warning: This attached object has unknown data, please save it first to refresh the data!"); |
345 | + | |
346 | - | if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "** Hint: Use {FFFFFF}~k~~VEHICLE_ACCELERATE~{FFFF33} key to look around"); |
346 | + | |
347 | - | else SendClientMessage(playerid, COLOR_YELLOW, "** Hint: Use {FFFFFF}~k~~PED_SPRINT~{FFFF33} key to look around"); |
347 | + | RemovePlayerAttachedObject(playerid, i); |
348 | - | if(PAO[playerid][slot][AO_BONE_ID] == 2) SendClientMessage(playerid, COLOR_YELLOW, "** Hint: Type {FFFFFF}/HEADMOVE{FFFF33} to toggle player head movement"); |
348 | + | EPV[playerid][PAO_LAST_REMOVED] = MAX_PLAYER_ATTACHED_OBJECTS; |
349 | } | |
350 | } | |
351 | return 1; | |
352 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
352 | + | |
353 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
353 | + | |
354 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
354 | + | public OnPlayerDisconnect(playerid, reason) |
355 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
355 | + | |
356 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) | |
357 | - | } |
357 | + | |
358 | - | else |
358 | + | AOE_UnsetValues(playerid, i); |
359 | - | { |
359 | + | |
360 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
360 | + | AOE_UnsetVars(playerid); |
361 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
361 | + | |
362 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
362 | + | |
363 | - | } |
363 | + | |
364 | - | } |
364 | + | |
365 | { | |
366 | new slots; | |
367 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) | |
368 | { | |
369 | if(PAO[playerid][i][AO_STATUS] == 1) | |
370 | slots += RestorePlayerAttachedObject(playerid, i); | |
371 | } | |
372 | if(slots > 0) | |
373 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
373 | + | |
374 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
374 | + | format(AOE_STR, sizeof AOE_STR, "* Automatically restored your attached object(s) ({FFFFFF}Total: %d{%06x}).", slots, AOE_COLOR2 >>> 8); |
375 | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); | |
376 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
376 | + | |
377 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
377 | + | |
378 | } | |
379 | // ----------------------------------------------------------------------------- | |
380 | CMD:attachedobjecteditor(playerid, params[]) | |
381 | - | new slot; |
381 | + | |
382 | - | if(sscanf(params, "d", slot)) AOE_ShowPlayerDialog(playerid, 6, E_AOED_REMOVE_SLOT, "Remove Attached Object", "Remove", "Cancel"); |
382 | + | |
383 | if(AOE_CanEdit(playerid)) AOE_ShowPlayerDialog(playerid, AOE_C, AOE_D, AOE_T, AOE_B_SELECT, AOE_B_CLOSE); | |
384 | return 1; | |
385 | - | if(IsValidAttachedObjectSlot(slot)) |
385 | + | |
386 | CMD:aoe(playerid, params[]) return cmd_attachedobjecteditor(playerid, params); | |
387 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
387 | + | |
388 | - | { |
388 | + | |
389 | - | if(IsValidPlayerAttachedObject(playerid, slot)) format(AOE_STR, sizeof(AOE_STR), "* You've removed your attached object from slot/index number %d! (/udao to undelete)", slot); |
389 | + | |
390 | - | else format(AOE_STR, sizeof(AOE_STR), "* You've removed your attached object from slot/index number %d", slot); |
390 | + | |
391 | - | RemovePlayerAttachedObjectEx(playerid, slot); |
391 | + | if(AOE_CanEdit(playerid)) |
392 | - | SendClientMessage(playerid, COLOR_RED, AOE_STR); |
392 | + | |
393 | - | format(AOE_STR, sizeof(AOE_STR), "~r~Removed your attached object~n~~w~index/number: %d", slot); |
393 | + | if(AOE_HasAttachedObject(playerid)) AOE_ShowPlayerDialog(playerid, AOE_C_REMOVE_ALL, AOE_D_REMOVE_ALL, AOE_T_REMOVE_ALL, AOE_B_YES, AOE_B_CANCEL); |
394 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
394 | + | |
395 | - | } |
395 | + | |
396 | - | else |
396 | + | |
397 | - | { |
397 | + | |
398 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
398 | + | |
399 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
399 | + | |
400 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
400 | + | |
401 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
401 | + | if(AOE_CanEdit(playerid)) |
402 | - | } |
402 | + | |
403 | - | } |
403 | + | if(AOE_HasFreeSlot(playerid)) |
404 | - | else |
404 | + | |
405 | - | { |
405 | + | new bonename[MAX_ATTACHED_OBJECT_BONE_NAME]; |
406 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
406 | + | if(sscanf(params, "dD(-1)S()[16]", AOSlot, AOModel, bonename)) AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_EMPTY, AOE_D_CREATE_SLOT, AOE_T_CREATE, AOE_B_SELECT, AOE_B_CANCEL); |
407 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
407 | + | |
408 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
408 | + | |
409 | - | } |
409 | + | if(AOE_EnteredValidSlot(playerid, AOSlot)) |
410 | { | |
411 | EPV[playerid][PAO_INDEX1] = AOSlot; | |
412 | if(IsPlayerAttachedObjectSlotUsed(playerid, AOSlot)) AOE_ShowPlayerDialog(playerid, AOE_C_CREATE_REPLACE, AOE_D_CREATE_REPLACE, AOE_T_CREATE#AOE_T_REPLACE, AOE_B_YES,AOE_B_BACK); | |
413 | else | |
414 | { | |
415 | if(AOModel == -1) AOE_ShowPlayerDialog(playerid, AOE_C_MODEL, AOE_D_CREATE_MODEL, AOE_T_CREATE, AOE_B_ENTER, AOE_B_SELECT_INDEX); | |
416 | else | |
417 | { | |
418 | if(AOE_EnteredValidModel(playerid, AOModel)) | |
419 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
419 | + | |
420 | - | else if(GetPlayerAttachedObjectsCount(playerid) == MAX_PLAYER_ATTACHED_OBJECTS) |
420 | + | EPV[playerid][PAO_MODEL_ID] = AOModel; |
421 | if(isnull(bonename)) AOE_ShowPlayerDialog(playerid, AOE_C_BONE, AOE_D_CREATE_BONE, AOE_T_CREATE, AOE_B_SELECT, AOE_B_SELECT_MODEL); | |
422 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't have more attached object(s) [Limit exceeded]!"); |
422 | + | |
423 | - | SendClientMessage(playerid, COLOR_YELLOW, "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached object(s) at a time!"); |
423 | + | |
424 | - | GameTextForPlayer(playerid, "~r~~h~Too many attached objects!", 3000, 3); |
424 | + | if(AOE_EnteredValidBone(playerid, bonename)) |
425 | { | |
426 | AOBone = GetAttachedObjectBone(bonename); | |
427 | EPV[playerid][PAO_BONE_ID] = AOBone; | |
428 | - | new targetid, slot; |
428 | + | if(UpdatePlayerAttachedObjectEx(playerid, AOSlot, AOModel, AOBone)) |
429 | - | if(sscanf(params, "ud", targetid, slot)) |
429 | + | { |
430 | format(AOE_STR, sizeof AOE_STR, "* Created attached object model %d at bone %s (%d) in slot number {FFFFFF}%d{%06x}.", AOModel, GetAttachedObjectBoneName(AOBone), AOBone, AOSlot, AOE_COLOR3 >>> 8); | |
431 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /refreshattachedobject <PlayerName/ID> <AttachedObjectSlot>"); |
431 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
432 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to load another player's attached object from specified slot"); |
432 | + | format(AOE_STR, sizeof AOE_STR, "~b~Created attached object~n~~w~index number: %d~n~Model: %d ~ Bone: %d.", AOSlot, AOModel, AOBone); |
433 | - | SendClientMessage(playerid, COLOR_WHITE, "** Note: if you have an attached object on specified slot already, it will be replaced!"); |
433 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
434 | AOE_ShowPlayerDialog(playerid, AOE_C_CREATE_FINAL, AOE_D_CREATE_EDIT, AOE_T_CREATE_EDIT, AOE_B_EDIT, AOE_B_SKIP); | |
435 | } | |
436 | else SendClientMessage(playerid, AOE_COLOR1, AOE_M_CREATE_FAIL); | |
437 | - | if(targetid == playerid) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't refresh your own attached object!"); |
437 | + | } |
438 | - | else |
438 | + | |
439 | - | { |
439 | + | |
440 | - | if(IsPlayerConnected(targetid)) |
440 | + | |
441 | - | { |
441 | + | |
442 | - | if(IsPlayerAttachedObjectSlotUsed(targetid, slot)) |
442 | + | |
443 | - | { |
443 | + | |
444 | - | RefreshPlayerAttachedObject(targetid, playerid, slot); |
444 | + | |
445 | - | GetPlayerName(targetid, PlayerName, sizeof(PlayerName)); |
445 | + | |
446 | - | format(AOE_STR, sizeof(AOE_STR), "* You've refershed %s (ID:%d)'s attached object from slot/index number %d [Model: %d - Bone: %s (%d)]!", |
446 | + | |
447 | - | PlayerName, targetid, slot, PAO[targetid][slot][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[targetid][slot][AO_BONE_ID]), PAO[targetid][slot][AO_BONE_ID]); |
447 | + | |
448 | - | SendClientMessage(playerid, COLOR_BLUE, AOE_STR); |
448 | + | |
449 | - | format(AOE_STR, sizeof(AOE_STR), "~p~~h~Refreshed %s's attached object", PlayerName); |
449 | + | |
450 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
450 | + | |
451 | - | GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); |
451 | + | |
452 | - | format(AOE_STR, sizeof(AOE_STR), "* %s (ID:%d) has refreshed your attached object from slot/index number %d [Model: %d - Bone: %s (%d)]!", |
452 | + | |
453 | - | PlayerName, playerid, slot, PAO[targetid][slot][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[targetid][slot][AO_BONE_ID]), PAO[targetid][slot][AO_BONE_ID]); |
453 | + | new playerState = GetPlayerState(playerid); |
454 | - | SendClientMessage(targetid, COLOR_BLUE, AOE_STR); |
454 | + | if(EPV[playerid][PAO_EDITING] >= 1) CancelEdit(playerid); |
455 | - | format(AOE_STR, sizeof(AOE_STR), "~p~~h~%s has refreshed your attached object", PlayerName); |
455 | + | else if(playerState == PLAYER_STATE_WASTED || playerState == PLAYER_STATE_SPECTATING) |
456 | - | GameTextForPlayer(targetid, AOE_STR, 5000, 3); |
456 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_CANT_EDIT); |
457 | else | |
458 | { | |
459 | if(AOE_HasAttachedObject(playerid)) | |
460 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, %s (ID:%d) has no attached object in slot/index number %d!", PlayerName, targetid, slot); |
460 | + | |
461 | - | SendClientMessage(playerid, COLOR_WHITE, AOE_STR); |
461 | + | if(sscanf(params, "d", AOSlot)) |
462 | { | |
463 | - | } |
463 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_EDIT_USAGE); |
464 | - | else |
464 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_EDIT_INFO); |
465 | - | { |
465 | + | |
466 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, player %d is not connected!", targetid); |
466 | + | |
467 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
467 | + | |
468 | - | } |
468 | + | if(AOE_EnteredValidSlot(playerid, AOSlot)) |
469 | { | |
470 | if(AOE_HasSlot(playerid, AOSlot)) | |
471 | { | |
472 | EPV[playerid][PAO_INDEX1] = AOSlot; | |
473 | EditAttachedObject(playerid, AOSlot); | |
474 | PAO[playerid][AOSlot][AO_STATUS] = 2; | |
475 | format(AOE_STR, sizeof AOE_STR, "* You're now editing your attached object at index number {FFFFFF}%d{%06x}.", AOSlot, AOE_COLOR5 >>> 8); | |
476 | SendClientMessage(playerid, AOE_COLOR5, AOE_STR); | |
477 | format(AOE_STR, sizeof AOE_STR, "~b~~h~Editing your attached object~n~~w~index number: %d", AOSlot); | |
478 | AOE_GameTextForPlayer(playerid, AOE_STR); | |
479 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
479 | + | if(IsValidPlayerAttachedObject(playerid, AOSlot) != 1) |
480 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
480 | + | |
481 | SendClientMessage(playerid, AOE_COLOR1, AOE_M_UNKNOWN_DATA); | |
482 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
482 | + | EPV[playerid][PAO_EDITING] = 2; |
483 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
483 | + | |
484 | else EPV[playerid][PAO_EDITING] = 1; | |
485 | if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, AOE_COLOR4, AOE_M_EDIT_HINT_VEHICLE); | |
486 | else SendClientMessage(playerid, AOE_COLOR4, AOE_M_EDIT_HINT_ONFOOT); | |
487 | - | new slot, filename[32+1], comment[64+1]; |
487 | + | |
488 | - | if(sscanf(params,"dS()[25]S()[65]", slot, filename, comment)) AOE_ShowPlayerDialog(playerid, 6, E_AOED_SAVE_SLOT, "Save Attached Object", "Select", "Cancel"); |
488 | + | |
489 | - | else |
489 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_USED, AOE_D_EDIT_SLOT, AOE_T_EDIT, AOE_B_EDIT_CREATE, AOE_B_CANCEL); |
490 | } | |
491 | - | if(IsValidAttachedObjectSlot(slot)) |
491 | + | |
492 | - | { |
492 | + | |
493 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
493 | + | |
494 | - | { |
494 | + | |
495 | - | SetPVarInt(playerid, "PAO_SAOI", slot); |
495 | + | |
496 | - | if(strlen(filename)) |
496 | + | |
497 | - | { |
497 | + | |
498 | - | if(IsValidFileName(filename)) |
498 | + | |
499 | - | { |
499 | + | |
500 | - | SetPVarString(playerid, "PAO_SAON", filename); |
500 | + | if(AOE_CanEdit(playerid)) |
501 | - | format(filename, sizeof(filename), PAO_FILENAME, filename); |
501 | + | |
502 | - | if(fexist(filename)) |
502 | + | if(AOE_HasAttachedObject(playerid)) |
503 | - | { |
503 | + | |
504 | - | if(IsPlayerAdmin(playerid)) AOE_ShowPlayerDialog(playerid, 16, E_AOED_SAVE_REPLACE, "Save Attached Object", "Yes", "Cancel"); |
504 | + | if(sscanf(params, "d", AOSlot)) |
505 | { | |
506 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_REMOVE_USAGE); | |
507 | - | strdel(filename, strlen(filename) - (strlen(PAO_FILENAME) -2), sizeof(filename)); |
507 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_REMOVE_INFO); |
508 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, attached object file \"%s\" already exists!", filename); |
508 | + | |
509 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
509 | + | |
510 | - | GameTextForPlayer(playerid, "~r~~h~File already exists!", 3000, 3); |
510 | + | |
511 | if(AOSlot == MAX_PLAYER_ATTACHED_OBJECTS) cmd_removeattachedobjects(playerid, ""); | |
512 | else | |
513 | { | |
514 | if(AOE_EnteredValidSlot(playerid, AOSlot)) | |
515 | - | new filelen; |
515 | + | |
516 | - | SendClientMessage(playerid, COLOR_WHITE, "* Saving attached object file, please wait..."); |
516 | + | if(AOE_HasSlot(playerid, AOSlot)) |
517 | - | if(AOE_SavePlayerAttachedObject(playerid, filename, slot, comment, filelen)) |
517 | + | |
518 | - | { |
518 | + | EPV[playerid][PAO_INDEX1] = AOSlot; |
519 | - | format(AOE_STR, sizeof(AOE_STR), "** Your attached object from index %d has been saved as \"%s\" (Model: %d - Bone: %d - %d bytes)!", |
519 | + | if(IsValidPlayerAttachedObject(playerid, AOSlot)) format(AOE_STR, sizeof AOE_STR, "* You've removed your attached object from index number {FFFFFF}%d{%06x} (/udao to undelete last).", AOSlot, AOE_COLOR2 >>> 8); |
520 | - | slot, filename, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID], filelen); |
520 | + | else format(AOE_STR, sizeof AOE_STR, "* You've removed your attached object from index number {FFFFFF}%d{%06x}.", AOSlot, AOE_COLOR2 >>> 8); |
521 | - | SendClientMessage(playerid, COLOR_BLUE, AOE_STR); |
521 | + | RemovePlayerAttachedObjectEx(playerid, AOSlot); |
522 | - | } |
522 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
523 | - | else |
523 | + | format(AOE_STR, sizeof AOE_STR, "~b~~h~Removed your attached object~n~~w~index number: %d", AOSlot); |
524 | - | { |
524 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
525 | - | SendClientMessage(playerid, COLOR_RED, "* Error: Invalid attached object data, save canceled"); |
525 | + | |
526 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object data!", 3000, 3); |
526 | + | |
527 | } | |
528 | } | |
529 | - | } |
529 | + | |
530 | - | else |
530 | + | |
531 | return 1; | |
532 | - | strdel(filename, strlen(filename) - (strlen(PAO_FILENAME) -2), sizeof(filename)); |
532 | + | |
533 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid file name [%s]!", filename); |
533 | + | |
534 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
534 | + | |
535 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Valid length is greater than or equal to 1 and less than or equal to 24 characters."); |
535 | + | |
536 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, ."); |
536 | + | |
537 | - | GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 3000, 3); |
537 | + | |
538 | if(AOE_CanEdit(playerid)) | |
539 | { | |
540 | - | else AOE_ShowPlayerDialog(playerid, 13, E_AOED_SAVE, "Save Attached Object", "Save", "Sel Idx"); |
540 | + | if(AOE_HasFreeSlot(playerid)) |
541 | - | } |
541 | + | |
542 | - | else |
542 | + | if(sscanf(params, "D(-1)", AOSlot)) |
543 | - | { |
543 | + | |
544 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
544 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you've entered invalid attached object index number ({FFFFFF}%s{%06x}).", params, AOE_COLOR4 >>> 8); |
545 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
545 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
546 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
546 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_SLOT); |
547 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
547 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_UNDELETE_HINT); |
548 | - | } |
548 | + | |
549 | - | } |
549 | + | |
550 | - | else |
550 | + | |
551 | - | { |
551 | + | if(0 <= EPV[playerid][PAO_LAST_REMOVED] < MAX_PLAYER_ATTACHED_OBJECTS) |
552 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
552 | + | |
553 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
553 | + | if(AOSlot == -1) |
554 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
554 | + | |
555 | AOSlot = EPV[playerid][PAO_LAST_REMOVED]; | |
556 | valstr(AOE_STR, AOSlot); | |
557 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_UNDELETE_NO_PARAM); | |
558 | cmd_undeleteattachedobject(playerid, AOE_STR); | |
559 | } | |
560 | else if(IsValidAttachedObjectSlot(AOSlot)) | |
561 | { | |
562 | if(IsPlayerAttachedObjectSlotUsed(playerid, AOSlot)) | |
563 | - | CMD:saveattachedobjects(playerid, params[]) |
563 | + | |
564 | format(AOE_STR, sizeof AOE_STR, "* Sorry, you can't restore your removed attached object as it was replaced with another object in that slot already (%d).", AOSlot); | |
565 | - | new PAON = GetPlayerAttachedObjectsCount(playerid); |
565 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
566 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
566 | + | AOE_GameTextForPlayer(playerid, AOE_G_CANT_RESTORE); |
567 | - | else if(!PAON) |
567 | + | |
568 | else | |
569 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
569 | + | |
570 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
570 | + | EPV[playerid][PAO_INDEX1] = AOSlot; |
571 | if(RestorePlayerAttachedObject(playerid, AOSlot)) | |
572 | - | else if(PAON == 1) |
572 | + | |
573 | format(AOE_STR, sizeof AOE_STR, "* You've restored your attached object from index number {FFFFFF}%d{%06x} [Model: %d|Bone: %s (%d)]", AOSlot, AOE_COLOR3 >>> 8, | |
574 | - | SendClientMessage(playerid, COLOR_CYAN, "* You only have one attached object, redirecting you to use single save command instead..."); |
574 | + | PAO[playerid][AOSlot][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[playerid][AOSlot][AO_BONE_ID]), PAO[playerid][AOSlot][AO_BONE_ID]); |
575 | - | cmd_saveattachedobject(playerid, ""); |
575 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
576 | format(AOE_STR, sizeof AOE_STR, "~b~Restored your attached object~n~~w~index number: %d~n~Model: %d ~ Bone: %d", AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], PAO[playerid][AOSlot][AO_BONE_ID]); | |
577 | AOE_GameTextForPlayer(playerid, AOE_STR); | |
578 | } | |
579 | - | new filename[32+1], comment[64+1]; |
579 | + | |
580 | - | if(sscanf(params, "s[25]S()[65]", filename)) AOE_ShowPlayerDialog(playerid, 13, E_AOED_SAVE2, "Save Attached Object(s) Set", "Save", "Cancel"); |
580 | + | |
581 | format(AOE_STR, sizeof AOE_STR, "* Sorry, you can't restore your removed attached object from index number %d as it's not valid.", AOSlot); | |
582 | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); | |
583 | - | if(IsValidFileName(filename)) |
583 | + | AOE_GameTextForPlayer(playerid, AOE_G_CANT_RESTORE); |
584 | } | |
585 | - | SetPVarString(playerid, "PAO_SAON", filename); |
585 | + | |
586 | - | format(filename, sizeof(filename), PAO_FILENAME, filename); |
586 | + | |
587 | - | if(fexist(filename)) |
587 | + | |
588 | { | |
589 | - | if(IsPlayerAdmin(playerid)) AOE_ShowPlayerDialog(playerid, 16, E_AOED_SAVE2_REPLACE, "Save Attached Object(s) Set", "Save", "Cancel"); |
589 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you've entered invalid attached object index number ({FFFFFF}%d{%06x}).", AOSlot, AOE_COLOR4 >>> 8); |
590 | - | else |
590 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
591 | - | { |
591 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_SLOT); |
592 | - | strdel(filename, strlen(filename) - (strlen(PAO_FILENAME) -2), sizeof(filename)); |
592 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_UNDELETE_HINT); |
593 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, attached object(s) set file \"%s\" already exists!", filename); |
593 | + | |
594 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
594 | + | |
595 | - | GameTextForPlayer(playerid, "~r~~h~File already exists!", 3000, 3); |
595 | + | |
596 | { | |
597 | SendClientMessage(playerid, AOE_COLOR1, AOE_M_UNDELETE_NOTHING); | |
598 | AOE_GameTextForPlayer(playerid, AOE_G_NO_RESTORE); | |
599 | } | |
600 | - | new slots, filelen; |
600 | + | |
601 | - | SendClientMessage(playerid, COLOR_WHITE, "* Saving attached object(s) set file, please wait..."); |
601 | + | |
602 | - | slots = AOE_SavePlayerAttachedObject(playerid, filename, MAX_PLAYER_ATTACHED_OBJECTS, comment, filelen); |
602 | + | |
603 | - | if(slots) |
603 | + | |
604 | } | |
605 | - | format(AOE_STR, sizeof(AOE_STR), "** Your attached object set has been saved as \"%s\" (Total: %d - %d bytes)!", filename, slots, filelen); |
605 | + | |
606 | - | SendClientMessage(playerid, COLOR_BLUE, AOE_STR); |
606 | + | |
607 | ||
608 | - | else SendClientMessage(playerid, COLOR_RED, "** Error: file saving was canceled because there were no valid attached object!"); |
608 | + | |
609 | - | } |
609 | + | |
610 | if(AOE_CanEdit(playerid)) | |
611 | { | |
612 | if(AOE_HasFreeSlot(playerid)) | |
613 | - | strdel(filename, strlen(filename) - (strlen(PAO_FILENAME) -2), sizeof(filename)); |
613 | + | |
614 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid file name [%s]!", filename); |
614 | + | if(sscanf(params, "uD(-1)", AOTarget, AOSlot)) |
615 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
615 | + | |
616 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Valid length is greater than or equal to 1 and less than or equal to 24 characters."); |
616 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_REFRESH_USAGE); |
617 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, ."); |
617 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_REFRESH_INFO); |
618 | - | GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 3000, 3); |
618 | + | |
619 | else | |
620 | - | } |
620 | + | |
621 | if(AOTarget == playerid) SendClientMessage(playerid, AOE_COLOR4, AOE_M_REFRESH_OWN); | |
622 | else | |
623 | { | |
624 | if(AOTarget == INVALID_PLAYER_ID) SendClientMessage(playerid, AOE_COLOR4, AOE_M_TARGET_NOT_ONLINE); | |
625 | - | CMD:saos(playerid, params[]) return cmd_saveattachedobjects(playerid, params); |
625 | + | |
626 | { | |
627 | EPV[playerid][PAO_TARGET] = AOTarget; | |
628 | GetPlayerName(AOTarget, pName, sizeof pName); | |
629 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
629 | + | if(GetPlayerAttachedObjectsCount(AOTarget)) |
630 | - | else if(GetPlayerAttachedObjectsCount(playerid) == MAX_PLAYER_ATTACHED_OBJECTS) |
630 | + | |
631 | if(AOSlot == -1) AOE_ShowPlayerDialog(playerid, AOE_C_REFRESH, AOE_D_REFRESH, AOE_T_REFRESH, AOE_B_SELECT, AOE_B_CANCEL); | |
632 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't have more attached object(s) [Limit exceeded]!"); |
632 | + | |
633 | - | SendClientMessage(playerid, COLOR_YELLOW, "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached objects at a time!"); |
633 | + | |
634 | - | GameTextForPlayer(playerid, "~r~~h~Too many attached objects!", 3000, 3); |
634 | + | if(AOE_TargetHasSlot(playerid, AOTarget, AOSlot)) |
635 | { | |
636 | EPV[playerid][PAO_INDEX1] = AOSlot; | |
637 | if(IsPlayerAttachedObjectSlotUsed(playerid, AOSlot)) AOE_ShowPlayerDialog(playerid, AOE_C_REFRESH_REPLACE, AOE_D_REFRESH_REPLACE, AOE_T_REFRESH#AOE_T_REPLACE, AOE_B_YES, AOE_B_BACK); | |
638 | - | new filename[32+1], slot = -1; |
638 | + | else |
639 | - | if(sscanf(params, "s[25]D(-1)", filename, slot)) AOE_ShowPlayerDialog(playerid, 14, E_AOED_LOAD, "Load Attached Object", "Enter", "Cancel"); |
639 | + | { |
640 | if(RefreshPlayerAttachedObject(AOTarget, playerid, AOSlot)) | |
641 | { | |
642 | - | if(IsValidFileName(filename)) |
642 | + | format(AOE_STR, sizeof AOE_STR, "* You've refershed %s (ID:%d)'s attached object from index number %d [Model: %d|Bone: %s (%d)].", |
643 | pName, AOTarget, AOSlot, PAO[AOTarget][AOSlot][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[AOTarget][AOSlot][AO_BONE_ID]), PAO[AOTarget][AOSlot][AO_BONE_ID]); | |
644 | - | SetPVarString(playerid, "PAO_LAON", filename); |
644 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
645 | - | format(filename, sizeof(filename), PAO_FILENAME, filename); |
645 | + | format(AOE_STR, sizeof AOE_STR, "~b~~h~Refreshed ~w~%s~b~~h~'s~n~attached object from slot ~w~%d", pName, AOSlot); |
646 | - | if(fexist(filename)) |
646 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
647 | - | { |
647 | + | GetPlayerName(playerid, pName, sizeof pName); |
648 | - | if(slot == -1) |
648 | + | format(AOE_STR, sizeof AOE_STR, "* %s (ID:%d) has refreshed your attached object from index number %d [Model: %d|Bone: %s (%d)].", |
649 | - | { |
649 | + | pName, playerid, AOSlot, PAO[AOTarget][AOSlot][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[AOTarget][AOSlot][AO_BONE_ID]), PAO[AOTarget][AOSlot][AO_BONE_ID]); |
650 | - | SendClientMessage(playerid, COLOR_WHITE, "* Load Attached Object: Please specify attached object index..."); |
650 | + | SendClientMessage(AOTarget, AOE_COLOR2, AOE_STR); |
651 | - | ShowPlayerDialog(playerid, E_AOED_LOAD_SLOT, DIALOG_STYLE_INPUT, "Load Attached Object", "Enter the index number of attached object in the file:", "Load", "Sel File"); |
651 | + | format(AOE_STR, sizeof AOE_STR, "~w~%s~b~~h~ has refreshed~n~your attached object at slot ~w~%d", pName, AOSlot); |
652 | - | } |
652 | + | AOE_GameTextForPlayer(AOTarget, AOE_STR); |
653 | - | else |
653 | + | } |
654 | - | { |
654 | + | else SendClientMessage(playerid, AOE_COLOR1, AOE_M_ERROR); |
655 | - | if(IsValidAttachedObjectSlot(slot)) |
655 | + | } |
656 | - | { |
656 | + | |
657 | - | SetPVarInt(playerid, "PAO_LAOI", slot); |
657 | + | |
658 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) AOE_ShowPlayerDialog(playerid, 15, E_AOED_LOAD_REPLACE, "Load & Replace Attached Object", "Yes", "Cancel"); |
658 | + | |
659 | - | else |
659 | + | |
660 | - | { |
660 | + | |
661 | - | new comment[64+1]; |
661 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, %s (ID:%d) has no attached object.", pName, AOTarget); |
662 | - | SendClientMessage(playerid, COLOR_WHITE, "* Loading attached object file, please wait..."); |
662 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
663 | - | if(AOE_LoadPlayerAttachedObject(playerid, filename, slot, comment, sizeof(comment))) |
663 | + | AOE_GameTextForPlayer(playerid, AOE_G_NO_ATTACHED_OBJECT); |
664 | - | { |
664 | + | |
665 | - | format(AOE_STR, sizeof(AOE_STR), "** You've loaded attached object from file \"%s\" from slot index/number %d!", filename, slot); |
665 | + | |
666 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
666 | + | |
667 | - | format(AOE_STR, sizeof(AOE_STR), "** Comment: %s", comment); |
667 | + | |
668 | - | SendClientMessage(playerid, COLOR_WHITE, AOE_STR); |
668 | + | |
669 | - | } |
669 | + | |
670 | - | else |
670 | + | |
671 | - | { |
671 | + | |
672 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, there is no valid attached object data found in the file \"%s\" from slot %d!", filename, slot); |
672 | + | |
673 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
673 | + | |
674 | - | PAO[playerid][slot][AO_STATUS] = 0; |
674 | + | |
675 | - | GameTextForPlayer(playerid, "~r~~h~Attached object data not found!", 3000, 3); |
675 | + | |
676 | - | } |
676 | + | |
677 | if(AOE_CanEdit(playerid)) | |
678 | { | |
679 | - | else |
679 | + | if(AOE_HasAttachedObject(playerid)) |
680 | - | { |
680 | + | |
681 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
681 | + | if(sscanf(params,"dS()[25]S()[64]", AOSlot, AOFileName, AOComment)) AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_ALL, AOE_D_SAVE_SLOT, AOE_T_SAVE, AOE_B_SELECT, AOE_B_BACK); |
682 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
682 | + | |
683 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
683 | + | |
684 | if(AOSlot == MAX_PLAYER_ATTACHED_OBJECTS) | |
685 | - | } |
685 | + | |
686 | - | } |
686 | + | format(params, sizeof AOE_STR, "%s %s", AOFileName, AOComment); |
687 | - | else |
687 | + | cmd_saveallattachedobjects(playerid, params); |
688 | } | |
689 | - | strdel(filename, strlen(filename) - (strlen(PAO_FILENAME) -2), sizeof(filename)); |
689 | + | |
690 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, attached object file \"%s\" does not exist!", filename); |
690 | + | |
691 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
691 | + | if(AOE_EnteredValidSlot(playerid, AOSlot)) |
692 | - | GameTextForPlayer(playerid, "~r~~h~File does not exist!", 3000, 3); |
692 | + | |
693 | if(AOE_HasSlot(playerid, AOSlot)) | |
694 | { | |
695 | EPV[playerid][PAO_INDEX1] = AOSlot; | |
696 | if(isnull(AOFileName)) AOE_ShowPlayerDialog(playerid, AOE_C_SAVE, AOE_D_SAVE, AOE_T_SAVE, AOE_B_SAVE, AOE_B_SELECT_INDEX); | |
697 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid file name [%s]!", filename); |
697 | + | |
698 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
698 | + | |
699 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Valid length is greater than or equal to 1 and less than or equal to 24 characters."); |
699 | + | if(AOE_EnteredValidFileName(playerid, AOFileName)) |
700 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, ."); |
700 | + | |
701 | - | GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 3000, 3); |
701 | + | strupdate(EPV[playerid][PAO_NAME], AOFileName); |
702 | format(AOFileName, sizeof AOFileName, AOE_FILE_NAME, AOFileName); | |
703 | if(AOE_EnteredNonExistFileName(playerid, AOFileName)) | |
704 | { | |
705 | SendClientMessage(playerid, AOE_COLOR5, AOE_M_SAVING); | |
706 | if(!IsValidComment(AOComment) && !isnull(AOComment)) | |
707 | { | |
708 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_COMMENT_INVALID); | |
709 | AOComment[0] = EOS; | |
710 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_COMMENT_INFO); | |
711 | } | |
712 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command when editing an attached object!"); |
712 | + | if(AOE_SavePlayerAttachedObject(playerid, AOFileName, AOSlot, AOComment, AOFileLen)) |
713 | - | else if(GetPlayerAttachedObjectsCount(playerid) == MAX_PLAYER_ATTACHED_OBJECTS) |
713 | + | { |
714 | format(AOE_STR, sizeof AOE_STR, "* Your attached object from index %d has been saved as \"{FFFFFF}%s{%06x}\".", AOSlot, EPV[playerid][PAO_NAME], AOE_COLOR2 >>> 8); | |
715 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't have more attached object(s) [Limit exceeded]!"); |
715 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
716 | - | SendClientMessage(playerid, COLOR_YELLOW, "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached objects at a time!"); |
716 | + | format(AOE_STR, sizeof AOE_STR, "** Model: %d ~ Bone: %s (%d) ~ For skin: %d ~ File size: %.2f KB.", |
717 | - | GameTextForPlayer(playerid, "~r~~h~Too many attached objects!", 3000, 3); |
717 | + | PAO[playerid][AOSlot][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[playerid][AOSlot][AO_BONE_ID]), PAO[playerid][AOSlot][AO_BONE_ID], GetPlayerSkin(playerid), AOFileLen); |
718 | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); | |
719 | if(!isnull(AOComment)) | |
720 | { | |
721 | - | new filename[32+1]; |
721 | + | format(AOE_STR, sizeof AOE_STR, "** Comment: %s.", AOComment); |
722 | - | if(sscanf(params, "s[25]", filename)) AOE_ShowPlayerDialog(playerid, 14, E_AOED_LOAD2, "Load Attached Object(s) Set", "Load", "Cancel"); |
722 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); |
723 | } | |
724 | format(AOE_STR, sizeof AOE_STR, "~b~~h~Attached object file saved~n~%s", EPV[playerid][PAO_NAME]); | |
725 | - | if(IsValidFileName(filename)) |
725 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
726 | } | |
727 | - | format(filename, sizeof(filename), PAO_FILENAME, filename); |
727 | + | else |
728 | - | if(fexist(filename)) |
728 | + | { |
729 | - | { |
729 | + | SendClientMessage(playerid, AOE_COLOR1, AOE_M_SAVE_FAILED); |
730 | - | new slots = 0, comment[64+1]; |
730 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_DATA); |
731 | - | SendClientMessage(playerid, COLOR_WHITE, "* Loading attached object(s) set file, please wait..."); |
731 | + | } |
732 | - | slots = AOE_LoadPlayerAttachedObject(playerid, filename, MAX_PLAYER_ATTACHED_OBJECTS, comment, sizeof(comment)); |
732 | + | } |
733 | - | if(slots) |
733 | + | |
734 | - | { |
734 | + | |
735 | - | format(AOE_STR, sizeof(AOE_STR), "** You've loaded attached object(s) set from file \"%s\" (Total: %d)!", filename, slots); |
735 | + | |
736 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
736 | + | |
737 | - | format(AOE_STR, sizeof(AOE_STR), "** Comment: %s", comment); |
737 | + | |
738 | - | SendClientMessage(playerid, COLOR_WHITE, AOE_STR); |
738 | + | |
739 | - | } |
739 | + | |
740 | - | else |
740 | + | |
741 | - | { |
741 | + | |
742 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, there is no valid attached object data found in the file \"%s\"!", filename); |
742 | + | |
743 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
743 | + | |
744 | - | GameTextForPlayer(playerid, "~r~~h~Attached object data not found!", 3000, 3); |
744 | + | |
745 | ||
746 | - | } |
746 | + | CMD:saveallattachedobjects(playerid, params[]) |
747 | - | else |
747 | + | |
748 | if(AOE_CanEdit(playerid)) | |
749 | - | strdel(filename, strlen(filename) - (strlen(PAO_FILENAME) -2), sizeof(filename)); |
749 | + | |
750 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, attached object file \"%s\" does not exist!", filename); |
750 | + | if(AOE_HasAttachedObject(playerid)) |
751 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
751 | + | |
752 | - | GameTextForPlayer(playerid, "~r~~h~File does not exist!", 3000, 3); |
752 | + | if(sscanf(params, "s[25]S()[64]", AOFileName, AOComment)) AOE_ShowPlayerDialog(playerid, AOE_C_SAVE, AOE_D_SAVE2, AOE_T_SAVE_SET, AOE_B_SAVE, AOE_B_BACK); |
753 | else | |
754 | { | |
755 | if(AOE_EnteredValidFileName(playerid, AOFileName)) | |
756 | { | |
757 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid file name [%s]!", filename); |
757 | + | strupdate(EPV[playerid][PAO_NAME], AOFileName); |
758 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
758 | + | format(AOFileName, sizeof AOFileName, AOE_FILE_NAME, AOFileName); |
759 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Valid length is greater than or equal to 1 and less than or equal to 24 characters."); |
759 | + | if(AOE_EnteredNonExistFileName2(playerid, AOFileName)) |
760 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, ."); |
760 | + | |
761 | - | GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 3000, 3); |
761 | + | SendClientMessage(playerid, AOE_COLOR5, AOE_M_SAVING_SET); |
762 | if(!IsValidComment(AOComment) && !isnull(AOComment)) | |
763 | { | |
764 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_COMMENT_INVALID); | |
765 | AOComment[0] = EOS; | |
766 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_COMMENT_INFO); | |
767 | } | |
768 | new slots = AOE_SavePlayerAttachedObject(playerid, AOFileName, MAX_PLAYER_ATTACHED_OBJECTS, AOComment, AOFileLen); | |
769 | if(slots) | |
770 | { | |
771 | format(AOE_STR, sizeof AOE_STR, "* Your attached object set has been saved as \"{FFFFFF}%s{%06x}\".", EPV[playerid][PAO_NAME], AOE_COLOR2 >>> 8); | |
772 | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); | |
773 | format(AOE_STR, sizeof AOE_STR, "** Slots saved: %d ~ For skin: %d ~ File size: %.2f KB.", slots, GetPlayerSkin(playerid), AOFileLen); | |
774 | - | new filename[32+1]; |
774 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); |
775 | - | if(sscanf(params, "s[25]", filename)) |
775 | + | if(!isnull(AOComment)) |
776 | { | |
777 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /deleteattachedobjectfile <AttachedObjectFile>"); |
777 | + | format(AOE_STR, sizeof AOE_STR, "** Comment: %s.", AOComment); |
778 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows an admin to DELETE an existing attached object file PERMANENTLY"); |
778 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); |
779 | - | SendClientMessage(playerid, COLOR_WHITE, "** This command doesn't require you to type the format of the file"); |
779 | + | |
780 | format(AOE_STR, sizeof AOE_STR, "~g~~h~Attached object(s) file saved~n~%s", EPV[playerid][PAO_NAME]); | |
781 | AOE_GameTextForPlayer(playerid, AOE_STR); | |
782 | } | |
783 | - | if(IsValidFileName(filename)) |
783 | + | else SendClientMessage(playerid, AOE_COLOR1, AOE_M_SAVE_FAILED); |
784 | } | |
785 | - | format(filename, sizeof(filename), PAO_FILENAME, filename); |
785 | + | |
786 | - | if(fexist(filename)) |
786 | + | |
787 | - | { |
787 | + | |
788 | - | if(fremove(filename)) format(AOE_STR, sizeof(AOE_STR), "* You've deleted attached object file \"{CCFFFF}%s{%06x}\"!", filename, COLOR_RED >>> 8); |
788 | + | |
789 | - | else format(AOE_STR, sizeof(AOE_STR), "* Failed to delete attached object file \"{CCFFFF}%s{%06x}\"", filename, COLOR_RED >>> 8); |
789 | + | |
790 | - | SendClientMessage(playerid, COLOR_RED, AOE_STR); |
790 | + | |
791 | ||
792 | CMD:saao(playerid, params[]) return cmd_saveallattachedobjects(playerid, params); | |
793 | ||
794 | - | strdel(filename, strlen(filename) - (strlen(PAO_FILENAME) -2), sizeof(filename)); |
794 | + | |
795 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, attached object file \"%s\" does not exist!", filename); |
795 | + | |
796 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
796 | + | if(AOE_CanEdit(playerid)) |
797 | - | GameTextForPlayer(playerid, "~r~~h~File does not exist!", 3000, 3); |
797 | + | |
798 | if(AOE_HasFreeSlot(playerid)) | |
799 | { | |
800 | if(sscanf(params, "s[25]D(-1)", AOFileName, AOSlot)) AOE_ShowPlayerDialog(playerid, AOE_C_LOAD, AOE_D_LOAD, AOE_T_LOAD, AOE_B_ENTER, AOE_B_BACK); | |
801 | else | |
802 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid file name [%s]!", filename); |
802 | + | |
803 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
803 | + | if(AOE_EnteredValidFileName(playerid, AOFileName)) |
804 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Valid length is greater than or equal to 1 and less than or equal to 24 characters."); |
804 | + | |
805 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, ."); |
805 | + | strupdate(EPV[playerid][PAO_NAME], AOFileName); |
806 | - | GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 3000, 3); |
806 | + | format(AOFileName, sizeof AOFileName, AOE_FILE_NAME, EPV[playerid][PAO_NAME]); |
807 | if(AOE_EnteredExistedFileName(playerid, AOFileName)) | |
808 | { | |
809 | if(AOSlot == -1) AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_EMPTY, AOE_D_LOAD_SLOT, AOE_T_LOAD, AOE_B_LOAD, AOE_B_BACK); | |
810 | - | else SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, only Admin can delete player attached object file!"); |
810 | + | |
811 | { | |
812 | if(AOE_EnteredValidSlot(playerid, AOSlot)) | |
813 | { | |
814 | EPV[playerid][PAO_INDEX1] = AOSlot; | |
815 | if(IsPlayerAttachedObjectSlotUsed(playerid, AOSlot)) AOE_ShowPlayerDialog(playerid, AOE_C_LOAD_REPLACE, AOE_D_LOAD_REPLACE, AOE_T_LOAD#AOE_T_REPLACE, AOE_B_YES, AOE_B_BACK); | |
816 | - | CMD:attachedobjectstats(playerid, params[]) |
816 | + | |
817 | { | |
818 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
818 | + | SendClientMessage(playerid, AOE_COLOR5, AOE_M_LOADING); |
819 | - | else { |
819 | + | if(AOE_LoadPlayerAttachedObject(playerid, AOFileName, AOSlot, AOComment)) |
820 | - | new slot, targetid = -1; |
820 | + | { |
821 | - | if(sscanf(params, "dU(-1)", slot, targetid)) |
821 | + | format(AOE_STR, sizeof AOE_STR, "* You've loaded attached object from file \"{FFFFFF}%s{%06x}\" at index number %d.", EPV[playerid][PAO_NAME], AOE_COLOR2 >>> 8, AOSlot); |
822 | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); | |
823 | - | if(targetid == -1 && GetPlayerAttachedObjectsCount(playerid) >= 1) |
823 | + | if(!isnull(AOComment)) |
824 | - | AOE_ShowPlayerDialog(playerid, 6, E_AOED_STATS_SLOT, "Attached Object Stats", "Select", "Cancel"); |
824 | + | { |
825 | format(AOE_STR, sizeof AOE_STR, "** Comment: %s.", AOComment); | |
826 | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); | |
827 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /attachedobjectstats <AttachedObjectSlot> <Optional:Player>"); |
827 | + | } |
828 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to view a player's attached object's stats"); |
828 | + | format(AOE_STR, sizeof AOE_STR, "~g~~h~Attached object file loaded~n~%s", EPV[playerid][PAO_NAME]); |
829 | - | SendClientMessage(playerid, COLOR_WHITE, "** If you don't specify the player, then it will show yours."); |
829 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
830 | } | |
831 | else | |
832 | { | |
833 | format(AOE_STR, sizeof AOE_STR, "* Sorry, there is no valid attached object data found from file \"%s\" at index number %d.", EPV[playerid][PAO_NAME], AOSlot); | |
834 | - | SetPVarInt(playerid, "PAO_AOSI", slot); |
834 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
835 | - | if(IsValidAttachedObjectSlot(slot)) |
835 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_DATA); |
836 | - | { |
836 | + | AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_EMPTY, AOE_D_LOAD_SLOT, AOE_T_LOAD, AOE_B_LOAD, AOE_B_BACK); |
837 | - | if(targetid == -1) targetid = playerid; |
837 | + | } |
838 | - | if(IsPlayerConnected(targetid)) |
838 | + | |
839 | - | { |
839 | + | |
840 | - | SetPVarInt(playerid, "PAO_AOSU", targetid); |
840 | + | |
841 | - | GetPlayerName(targetid, PlayerName, sizeof(PlayerName)); |
841 | + | |
842 | - | if(GetPlayerAttachedObjectsCount(targetid)) |
842 | + | |
843 | } | |
844 | - | if(IsPlayerAttachedObjectSlotUsed(targetid, slot)) |
844 | + | |
845 | - | { |
845 | + | |
846 | - | if(targetid == playerid) format(AOE_STR, sizeof(AOE_STR), "Your Attached Object Stats (%d)", slot); |
846 | + | |
847 | - | else format(AOE_STR, sizeof(AOE_STR), "%s's Attached Object Stats (%d)", PlayerName, slot); |
847 | + | |
848 | - | AOE_ShowPlayerDialog(playerid, 7, E_AOED_STATS, AOE_STR, "Print", "Close"); |
848 | + | |
849 | CMD:lao(playerid, params[]) return cmd_loadattachedobject(playerid, params); | |
850 | ||
851 | - | { |
851 | + | |
852 | - | if(targetid == playerid) format(AOE_STR, sizeof(AOE_STR), "* Sorry, you have no attached object at slot/index number %d!", slot); |
852 | + | |
853 | - | else format(AOE_STR, sizeof(AOE_STR), "* Sorry, %s has no attached object at slot/index number %d!", PlayerName, slot); |
853 | + | if(AOE_CanEdit(playerid)) |
854 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
854 | + | |
855 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~Unknown attached object~n~~w~index/number: %d", slot); |
855 | + | if(AOE_HasFreeSlot(playerid)) |
856 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
856 | + | |
857 | if(sscanf(params, "s[25]", AOFileName)) AOE_ShowPlayerDialog(playerid, AOE_C_LOAD, AOE_D_LOAD2, AOE_T_LOAD_SET, AOE_B_LOAD, AOE_B_BACK); | |
858 | else | |
859 | { | |
860 | if(AOE_EnteredValidFileName(playerid, AOFileName)) | |
861 | - | if(targetid == playerid) |
861 | + | |
862 | - | { |
862 | + | strupdate(EPV[playerid][PAO_NAME], AOFileName); |
863 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you have no attached object!"); |
863 | + | format(AOFileName, sizeof AOFileName, AOE_FILE_NAME, AOFileName); |
864 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
864 | + | if(AOE_EnteredExistedFileName(playerid, AOFileName)) |
865 | - | } |
865 | + | |
866 | SendClientMessage(playerid, AOE_COLOR3, AOE_M_LOADING_SET); | |
867 | new slots = AOE_LoadPlayerAttachedObject(playerid, AOFileName, MAX_PLAYER_ATTACHED_OBJECTS, AOComment); | |
868 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, %s has no attached object!", PlayerName); |
868 | + | if(slots) |
869 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
869 | + | |
870 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~%s has no attached object", PlayerName); |
870 | + | format(AOE_STR, sizeof AOE_STR, "* You've loaded %d attached object(s) from file \"{FFFFFF}%s{%06x}\".", slots, EPV[playerid][PAO_NAME], AOE_COLOR2 >>> 8); |
871 | - | GameTextForPlayer(playerid, AOE_STR, 3000, 3); |
871 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
872 | if(!isnull(AOComment)) | |
873 | { | |
874 | format(AOE_STR, sizeof AOE_STR, "** Comment: %s.", AOComment); | |
875 | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); | |
876 | } | |
877 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, player %d is not connected!", targetid); |
877 | + | format(AOE_STR, sizeof AOE_STR, "~g~~h~Attached object(s) file loaded~n~%s", EPV[playerid][PAO_NAME]); |
878 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
878 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
879 | } | |
880 | - | } |
880 | + | |
881 | - | else |
881 | + | |
882 | format(AOE_STR, sizeof AOE_STR, "* Sorry, there is no valid attached object data found from file \"%s\".", EPV[playerid][PAO_NAME]); | |
883 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
883 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
884 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
884 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_DATA); |
885 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
885 | + | |
886 | - | } |
886 | + | |
887 | } | |
888 | } | |
889 | } | |
890 | } | |
891 | return 1; | |
892 | - | CMD:aos(playerid, params[]) return cmd_attachedobjectstats(playerid, params); |
892 | + | |
893 | ||
894 | CMD:laos(playerid, params[]) return cmd_loadattachedobjects(playerid, params); | |
895 | ||
896 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
896 | + | |
897 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
897 | + | |
898 | if(IsPlayerAdmin(playerid)) | |
899 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
899 | + | |
900 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
900 | + | if(sscanf(params, "s[25]", AOFileName)) AOE_ShowPlayerDialog(playerid, AOE_C_DELETE, AOE_D_DELETE, AOE_T_DELETE, AOE_B_DELETE, AOE_B_CANCEL); |
901 | else | |
902 | - | else |
902 | + | |
903 | - | { |
903 | + | if(AOE_EnteredValidFileName(playerid, AOFileName)) |
904 | - | new fromslot, asslot = -1; // This is "as slot" |
904 | + | |
905 | - | if(sscanf(params, "dD(-1)", fromslot, asslot)) AOE_ShowPlayerDialog(playerid, 6, E_AOED_DUPLICATE_SLOT1, "Duplicate Attached Object Index (1)", "Select", "Cancel"); |
905 | + | format(AOFileName, sizeof AOFileName, AOE_FILE_NAME, AOFileName); |
906 | - | else |
906 | + | if(fexist(AOFileName)) |
907 | { | |
908 | - | if(IsValidAttachedObjectSlot(fromslot)) |
908 | + | SendClientMessage(playerid, AOE_COLOR1, AOE_M_DELETING); |
909 | if(fremove(AOFileName)) | |
910 | - | SetPVarInt(playerid, "PAO_DAOI1", fromslot); |
910 | + | |
911 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, fromslot)) |
911 | + | format(AOE_STR, sizeof AOE_STR, "* You've deleted attached object(s) file \"{CCFFFF}%s{%06x}\".", AOFileName, AOE_COLOR1 >>> 8); |
912 | - | { |
912 | + | AOE_GameTextForPlayer(playerid, AOE_G_FILE_DELETED); |
913 | - | if(asslot == -1) AOE_ShowPlayerDialog(playerid, 5, E_AOED_DUPLICATE_SLOT2, "Duplicate Attached Object Index (2)", "Select", "Sel Idx1"); |
913 | + | |
914 | else format(AOE_STR, sizeof AOE_STR, "* Failed to delete attached object(s) file \"{CCFFFF}%s{%06x}\"", AOFileName, AOE_COLOR1 >>> 8); | |
915 | SendClientMessage(playerid, AOE_COLOR1, AOE_STR); | |
916 | - | if(IsValidAttachedObjectSlot(asslot)) |
916 | + | |
917 | else | |
918 | - | SetPVarInt(playerid, "PAO_DAOI2", asslot); |
918 | + | |
919 | - | if(fromslot == asslot) |
919 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, attached object(s) file \"{FFFFFF}%s{%06x}\" does not exist.", AOFileName, AOE_COLOR4 >>> 8); |
920 | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); | |
921 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you can't duplicate your attached object from slot/index number %d to the same slot (%d) as it's already there?!!", fromslot, asslot); |
921 | + | AOE_GameTextForPlayer(playerid, AOE_G_FILE_NOT_EXIST); |
922 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
922 | + | |
923 | - | GameTextForPlayer(playerid, "~y~DOH!", 2500, 3); |
923 | + | |
924 | } | |
925 | } | |
926 | else SendClientMessage(playerid, AOE_COLOR4, AOE_M_DELETE_ADMIN_ONLY); | |
927 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, asslot)) AOE_ShowPlayerDialog(playerid, 11, E_AOED_DUPLICATE_REPLACE, "Duplicate Attached Object (Replace)", "Yes", "Sel Idx2"); |
927 | + | |
928 | } | |
929 | ||
930 | - | DuplicatePlayerAttachedObject(playerid, fromslot, asslot); |
930 | + | |
931 | - | format(AOE_STR, sizeof(AOE_STR), "* Duplicated your attached object from slot/index number %d to %d!", fromslot, asslot); |
931 | + | |
932 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
932 | + | CMD:resetattachedobjecteditor(playerid, params[]) |
933 | - | format(AOE_STR, sizeof(AOE_STR), "~g~Attached object duplicated~n~~w~index/number:~n~%d to %d", fromslot, asslot); |
933 | + | |
934 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
934 | + | |
935 | { | |
936 | if(sscanf(params, "uD(-1)", AOTarget, AOSlot)) | |
937 | { | |
938 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_RESET_USAGE); | |
939 | SendClientMessage(playerid, AOE_COLOR0, AOE_M_RESET_INFO); | |
940 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index (2) number [%d]!", asslot); |
940 | + | |
941 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
941 | + | |
942 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
942 | + | |
943 | if(AOTarget == INVALID_PLAYER_ID) SendClientMessage(playerid, AOE_COLOR4, AOE_M_TARGET_NOT_ONLINE); | |
944 | else | |
945 | { | |
946 | - | else |
946 | + | if(0 <= AOSlot <= MAX_PLAYER_ATTACHED_OBJECTS) |
947 | - | { |
947 | + | |
948 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", fromslot); |
948 | + | RemovePlayerAttachedObjectEx(AOTarget, AOSlot); |
949 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
949 | + | if(AOSlot == MAX_PLAYER_ATTACHED_OBJECTS) |
950 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", fromslot); |
950 | + | |
951 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
951 | + | for(new x = 0; x < MAX_PLAYER_ATTACHED_OBJECTS; x++) |
952 | - | } |
952 | + | AOE_UnsetValues(AOTarget, x); |
953 | } | |
954 | else AOE_UnsetValues(AOTarget, AOSlot); | |
955 | } | |
956 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index (1) number [%d]!", fromslot); |
956 | + | ShowPlayerDialog(AOTarget, -1, DIALOG_STYLE_MSGBOX, "", "", "", ""); |
957 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
957 | + | AOE_UnsetVars(AOTarget); |
958 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
958 | + | format(AOE_STR, sizeof AOE_STR, "* Player's (ID:%d) attached object editor variable(s) has been reset!", AOTarget); |
959 | - | } |
959 | + | SendClientMessage(playerid, AOE_COLOR1, AOE_STR); |
960 | } | |
961 | } | |
962 | } | |
963 | else SendClientMessage(playerid, AOE_COLOR4, AOE_M_RESET_ADMIN_ONLY); | |
964 | return 1; | |
965 | } | |
966 | CMD:raoepv(playerid, params[]) return cmd_resetattachedobjecteditor(playerid, params); | |
967 | ||
968 | CMD:attachedobjectproperties(playerid, params[]) | |
969 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
969 | + | |
970 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
970 | + | if(AOE_CanEdit(playerid)) |
971 | { | |
972 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
972 | + | if(sscanf(params, "dU(-1)", AOSlot, AOTarget)) |
973 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
973 | + | |
974 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_PROPERTIES_USAGE); | |
975 | SendClientMessage(playerid, AOE_COLOR0, AOE_M_PROPERTIES_INFO); | |
976 | } | |
977 | - | new slot, newslot = -1; |
977 | + | |
978 | - | if(sscanf(params, "dD(-1)", slot, newslot)) AOE_ShowPlayerDialog(playerid, 6, E_AOED_SET_SLOT1, "Set Attached Object Index (1)", "Select", "Cancel"); |
978 | + | |
979 | if(AOE_EnteredValidSlot(playerid, AOSlot)) | |
980 | { | |
981 | - | if(IsValidAttachedObjectSlot(slot)) |
981 | + | if(AOTarget == -1) AOTarget = playerid; |
982 | if(AOTarget == INVALID_PLAYER_ID) SendClientMessage(playerid, AOE_COLOR4, AOE_M_TARGET_NOT_ONLINE); | |
983 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
983 | + | |
984 | - | { |
984 | + | |
985 | - | SetPVarInt(playerid, "PAO_SAOI1", slot); |
985 | + | EPV[playerid][PAO_TARGET] = AOTarget; |
986 | - | if(newslot == -1) AOE_ShowPlayerDialog(playerid, 5, E_AOED_SET_SLOT2, "Set Attached Object Index (2)", "Select", "Sel Idx1"); |
986 | + | GetPlayerName(AOTarget, pName, sizeof pName); |
987 | if(0 < GetPlayerAttachedObjectsCount(AOTarget) <= MAX_PLAYER_ATTACHED_OBJECTS) | |
988 | { | |
989 | - | if(IsValidAttachedObjectSlot(newslot)) |
989 | + | if(IsPlayerAttachedObjectSlotUsed(AOTarget, AOSlot)) |
990 | { | |
991 | - | if(slot == newslot) |
991 | + | EPV[playerid][PAO_INDEX1] = AOSlot; |
992 | if(AOTarget == playerid) format(AOE_STR, sizeof AOE_STR, "Your Attached Object Properties (%d)", AOSlot); | |
993 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you can't move your attached object from slot/index number %d to the same slot (%d) as it's already there?!!", slot, newslot); |
993 | + | else format(AOE_STR, sizeof AOE_STR, "%s's Attached Object Properties (%d)", pName, AOSlot); |
994 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
994 | + | AOE_ShowPlayerDialog(playerid, AOE_C_PROPERTIES, AOE_D_PROPERTIES, AOE_STR, AOE_B_PRINT, AOE_B_CLOSE); |
995 | - | GameTextForPlayer(playerid, "~y~DOH!", 2500, 3); |
995 | + | |
996 | else | |
997 | { | |
998 | if(AOTarget == playerid) format(AOE_STR, sizeof AOE_STR, "* Sorry, you have no attached object at index number %d.", AOSlot); | |
999 | - | SetPVarInt(playerid, "PAO_SAOI2", newslot); |
999 | + | else format(AOE_STR, sizeof AOE_STR, "* Sorry, %s has no attached object at index number %d.", pName, AOSlot); |
1000 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, newslot)) AOE_ShowPlayerDialog(playerid, 12, E_AOED_SET_SLOT_REPLACE, "Set Attached Object Index (Replace)", "Yes", "Sel Idx2"); |
1000 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
1001 | format(AOE_STR, sizeof AOE_STR, "~r~~h~Unknown attached object~n~~w~index number: %d.", AOSlot); | |
1002 | AOE_GameTextForPlayer(playerid, AOE_STR); | |
1003 | - | MovePlayerAttachedObjectIndex(playerid, slot, newslot); |
1003 | + | |
1004 | - | format(AOE_STR, sizeof(AOE_STR), "* Moved your attached object from slot/index number %d to %d!", slot, newslot); |
1004 | + | |
1005 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1005 | + | |
1006 | - | format(AOE_STR, sizeof(AOE_STR), "~g~Attached object moved~n~~w~index/number:~n~%d to %d", slot, newslot); |
1006 | + | |
1007 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1007 | + | if(AOTarget == playerid) |
1008 | - | } |
1008 | + | |
1009 | - | } |
1009 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_NO_ATTACHED_OBJECT); |
1010 | AOE_GameTextForPlayer(playerid, AOE_G_NO_ATTACHED_OBJECT); | |
1011 | } | |
1012 | else | |
1013 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", newslot); |
1013 | + | |
1014 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1014 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, %s has no attached object.", pName); |
1015 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1015 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
1016 | format(AOE_STR, sizeof AOE_STR, "~r~~h~%s has no attached object", pName); | |
1017 | AOE_GameTextForPlayer(playerid, AOE_STR); | |
1018 | - | } |
1018 | + | |
1019 | - | else |
1019 | + | |
1020 | - | { |
1020 | + | |
1021 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1021 | + | |
1022 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1022 | + | |
1023 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1023 | + | |
1024 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1024 | + | |
1025 | - | } |
1025 | + | |
1026 | ||
1027 | CMD:aop(playerid, params[]) return cmd_attachedobjectproperties(playerid, params); | |
1028 | CMD:attachedobjectstatus(playerid, params[]) return cmd_attachedobjectproperties(playerid, params); | |
1029 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1029 | + | CMD:aos(playerid, params[]) return cmd_attachedobjectproperties(playerid, params); |
1030 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1030 | + | |
1031 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1031 | + | |
1032 | { | |
1033 | if(AOE_CanEdit(playerid)) | |
1034 | { | |
1035 | if(AOE_HasAttachedObject(playerid)) | |
1036 | { | |
1037 | new slot2; | |
1038 | if(sscanf(params, "dD(-1)", AOSlot, slot2)) | |
1039 | { | |
1040 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_DUPLICATE_USAGE); | |
1041 | SendClientMessage(playerid, AOE_COLOR0, AOE_M_DUPLICATE_INFO); | |
1042 | } | |
1043 | else | |
1044 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1044 | + | |
1045 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
1045 | + | if(IsValidAttachedObjectSlot(AOSlot)) |
1046 | { | |
1047 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
1047 | + | if(AOE_HasSlot(playerid, AOSlot)) |
1048 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
1048 | + | |
1049 | EPV[playerid][PAO_INDEX1] = AOSlot; | |
1050 | if(slot2 == -1) AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_EMPTY, AOE_D_DUPLICATE_SLOT, AOE_T_DUPLICATE, AOE_B_DUPLICATE, AOE_B_BACK); | |
1051 | else | |
1052 | - | new slot, newmodel = -1; |
1052 | + | |
1053 | - | if(sscanf(params, "dD(-1)", slot, newmodel)) AOE_ShowPlayerDialog(playerid, 6, E_AOED_SET_MODEL_SLOT, "Set Attached Object Model", "Select", "Cancel"); |
1053 | + | if(IsValidAttachedObjectSlot(slot2)) |
1054 | - | else |
1054 | + | |
1055 | - | { |
1055 | + | EPV[playerid][PAO_INDEX2] = slot2; |
1056 | - | if(IsValidAttachedObjectSlot(slot)) |
1056 | + | if(slot2 == AOSlot) |
1057 | - | { |
1057 | + | |
1058 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
1058 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you cannot duplicate your attached object from slot %d to the same slot (%d) as it's already there?!", AOSlot, slot2); |
1059 | - | { |
1059 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
1060 | - | SetPVarInt(playerid, "PAO_SAOMI", slot); |
1060 | + | AOE_GameTextForPlayer(playerid, AOE_G_DOH); |
1061 | - | if(newmodel == -1) AOE_ShowPlayerDialog(playerid, 3, E_AOED_SET_MODEL, "Set Attached Object Model", "Enter", "Sel Idx"); |
1061 | + | |
1062 | else | |
1063 | { | |
1064 | - | if(IsValidObjectModel(newmodel)) |
1064 | + | if(IsPlayerAttachedObjectSlotUsed(playerid, slot2)) AOE_ShowPlayerDialog(playerid, AOE_C_DUPLICATE_REPLACE, AOE_D_DUPLICATE_REPLACE, AOE_T_DUPLICATE#AOE_T_REPLACE, AOE_B_DUPLICATE, AOE_B_SELECT_INDEX); |
1065 | else | |
1066 | - | if(newmodel == PAO[playerid][slot][AO_MODEL_ID]) |
1066 | + | { |
1067 | if(DuplicatePlayerAttachedObject(playerid, AOSlot, slot2)) | |
1068 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you can't change this attached object (SID:%d) model from %d to the same model (%d)!!", slot, PAO[playerid][slot][AO_MODEL_ID], newmodel); |
1068 | + | { |
1069 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1069 | + | format(AOE_STR, sizeof AOE_STR, "* Duplicated your attached object from slot %d to %d.", AOSlot, slot2); |
1070 | - | GameTextForPlayer(playerid, "~y~DOH!", 2500, 3); |
1070 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
1071 | format(AOE_STR, sizeof AOE_STR, "~g~Attached object duplicated~n~~w~index number:~n~%d to %d", AOSlot, slot2); | |
1072 | AOE_GameTextForPlayer(playerid, AOE_STR); | |
1073 | } | |
1074 | - | UpdatePlayerAttachedObject(playerid, slot, newmodel, PAO[playerid][slot][AO_BONE_ID]); |
1074 | + | else SendClientMessage(playerid, AOE_COLOR1, AOE_M_DUPLICATE_FAIL); |
1075 | - | format(AOE_STR, sizeof(AOE_STR), "* Updated your attached object model to %d at slot/index number %d!", newmodel, slot); |
1075 | + | } |
1076 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1076 | + | |
1077 | - | format(AOE_STR, sizeof(AOE_STR), "~g~Attached object model updated~n~~w~%d (SID:%d)", newmodel, slot); |
1077 | + | |
1078 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1078 | + | |
1079 | { | |
1080 | format(AOE_STR, sizeof AOE_STR, "* Sorry, you've entered invalid attached object index #2 number (%d).", slot2); | |
1081 | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); | |
1082 | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_SLOT); | |
1083 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid object model number/id [%d]!", newmodel); |
1083 | + | |
1084 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1084 | + | |
1085 | - | GameTextForPlayer(playerid, "~r~~h~Invalid object model!", 3000, 3); |
1085 | + | |
1086 | } | |
1087 | else | |
1088 | - | } |
1088 | + | |
1089 | - | else |
1089 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you've entered invalid attached object index #1 number (%d).", AOSlot); |
1090 | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); | |
1091 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1091 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_SLOT); |
1092 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1092 | + | |
1093 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1093 | + | |
1094 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1094 | + | |
1095 | - | } |
1095 | + | |
1096 | - | |
1096 | + | |
1097 | - | } |
1097 | + | |
1098 | - | else |
1098 | + | |
1099 | - | { |
1099 | + | |
1100 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1100 | + | |
1101 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1101 | + | |
1102 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1102 | + | |
1103 | - | } |
1103 | + | if(AOE_CanEdit(playerid)) |
1104 | { | |
1105 | if(AOE_HasAttachedObject(playerid)) | |
1106 | { | |
1107 | new AOSlot2; | |
1108 | if(sscanf(params, "dD(-1)", AOSlot, AOSlot2)) | |
1109 | { | |
1110 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_SET_SLOT_USAGE); | |
1111 | SendClientMessage(playerid, AOE_COLOR0, AOE_M_SET_SLOT_INFO); | |
1112 | } | |
1113 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1113 | + | |
1114 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
1114 | + | |
1115 | if(IsValidAttachedObjectSlot(AOSlot)) | |
1116 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
1116 | + | |
1117 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
1117 | + | if(AOE_HasSlot(playerid, AOSlot)) |
1118 | { | |
1119 | EPV[playerid][PAO_INDEX1] = AOSlot; | |
1120 | if(AOSlot2 == -1) AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_EMPTY, AOE_D_SET_SLOT, AOE_T_SET_INDEX, AOE_B_SET, AOE_B_BACK); | |
1121 | - | new slot, newbone[15+1]; |
1121 | + | |
1122 | - | if(sscanf(params, "dS()[16]", slot, newbone)) AOE_ShowPlayerDialog(playerid, 6, E_AOED_SET_BONE_SLOT, "Set Attached Object Bone", "Select", "Cancel"); |
1122 | + | |
1123 | - | else |
1123 | + | if(IsValidAttachedObjectSlot(AOSlot2)) |
1124 | { | |
1125 | - | if(IsValidAttachedObjectSlot(slot)) |
1125 | + | if(AOSlot2 == AOSlot) |
1126 | { | |
1127 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
1127 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you can't move your attached object from slot %d to the same slot (%d) as it's already there?!", AOSlot, AOSlot2); |
1128 | - | { |
1128 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
1129 | - | SetPVarInt(playerid, "PAO_SAOBI", slot); |
1129 | + | AOE_GameTextForPlayer(playerid, AOE_G_DOH); |
1130 | - | if(strlen(newbone)) |
1130 | + | |
1131 | - | { |
1131 | + | |
1132 | - | if(IsValidAttachedObjectBoneName(newbone)) |
1132 | + | |
1133 | - | { |
1133 | + | EPV[playerid][PAO_INDEX2] = AOSlot2; |
1134 | - | new newboneid = GetAttachedObjectBone(newbone); |
1134 | + | if(IsPlayerAttachedObjectSlotUsed(playerid, AOSlot2)) AOE_ShowPlayerDialog(playerid, AOE_C_SET_INDEX_REPLACE, AOE_D_SET_SLOT_REPLACE, AOE_T_SET_INDEX#AOE_T_REPLACE, AOE_B_YES, AOE_B_SELECT_INDEX); |
1135 | - | if(newboneid == PAO[playerid][slot][AO_BONE_ID]) |
1135 | + | else |
1136 | - | { |
1136 | + | { |
1137 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you can't change this attached object (SID:%d) bone from %s to the same bone (%d)!!", slot, newbone, PAO[playerid][slot][AO_BONE_ID]); |
1137 | + | if(ChangePlayerAttachedObjectIndex(playerid, AOSlot, AOSlot2)) |
1138 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1138 | + | { |
1139 | - | GameTextForPlayer(playerid, "~y~DOH!", 2500, 3); |
1139 | + | format(AOE_STR, sizeof AOE_STR, "* Moved your attached object from slot %d to {FFFFFF}%d{%06x}.", AOSlot, AOSlot2, AOE_COLOR2 >>> 8); |
1140 | - | } |
1140 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
1141 | - | else |
1141 | + | format(AOE_STR, sizeof AOE_STR, "~g~Attached object moved~n~~w~index number:~n~%d to %d", AOSlot, AOSlot2); |
1142 | - | { |
1142 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
1143 | - | UpdatePlayerAttachedObject(playerid, slot, PAO[playerid][slot][AO_MODEL_ID], newboneid); |
1143 | + | } |
1144 | - | format(AOE_STR, sizeof(AOE_STR), "* Updated your attached object bone to %d (%s) at slot/index number %d!", newboneid, newbone, slot); |
1144 | + | else SendClientMessage(playerid, AOE_COLOR1, AOE_M_SET_SLOT_FAIL); |
1145 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1145 | + | } |
1146 | - | format(AOE_STR, sizeof(AOE_STR), "~g~Attached object bone updated~n~~w~%d (SID:%d)", newboneid, slot); |
1146 | + | |
1147 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1147 | + | |
1148 | - | } |
1148 | + | |
1149 | { | |
1150 | - | else |
1150 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you've entered invalid attached object new index number ({FFFFFF}%d{%06x}).", AOSlot2, AOE_COLOR4 >>> 8); |
1151 | - | { |
1151 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
1152 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object bone [%s]!", newbone); |
1152 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_SLOT); |
1153 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1153 | + | |
1154 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object bone!", 3000, 3); |
1154 | + | |
1155 | - | } |
1155 | + | |
1156 | - | } |
1156 | + | |
1157 | - | else AOE_ShowPlayerDialog(playerid, 4, E_AOED_SET_BONE, "Set Attached Object", "Set", "Sel Idx"); |
1157 | + | |
1158 | { | |
1159 | - | else |
1159 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you've entered invalid attached object old index number ({FFFFFF}%d{%06x}).", AOSlot, AOE_COLOR4 >>> 8); |
1160 | - | { |
1160 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
1161 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1161 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_SLOT); |
1162 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1162 | + | |
1163 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1163 | + | |
1164 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1164 | + | |
1165 | - | } |
1165 | + | |
1166 | return 1; | |
1167 | } | |
1168 | ||
1169 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1169 | + | |
1170 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1170 | + | |
1171 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1171 | + | |
1172 | - | } |
1172 | + | |
1173 | CMD:setattachedobjectmodel(playerid, params[]) | |
1174 | { | |
1175 | if(AOE_CanEdit(playerid)) | |
1176 | { | |
1177 | if(AOE_HasAttachedObject(playerid)) | |
1178 | { | |
1179 | if(sscanf(params, "dD(-1)", AOSlot, AOModel)) | |
1180 | - | CMD:setattachedobjectoffsetx(playerid, params[]) |
1180 | + | |
1181 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_SET_MODEL_USAGE); | |
1182 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1182 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_SET_MODEL_INFO); |
1183 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
1183 | + | |
1184 | else | |
1185 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
1185 | + | |
1186 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
1186 | + | if(AOE_EnteredValidSlot(playerid, AOSlot)) |
1187 | { | |
1188 | if(AOE_HasSlot(playerid, AOSlot)) | |
1189 | { | |
1190 | - | new slot, Float:newoffsetx; |
1190 | + | EPV[playerid][PAO_INDEX1] = AOSlot; |
1191 | - | if(sscanf(params, "df", slot, newoffsetx)) |
1191 | + | if(AOModel == -1) AOE_ShowPlayerDialog(playerid, AOE_C_MODEL, AOE_D_SET_MODEL, AOE_T_SET_MODEL, AOE_B_SET, AOE_B_BACK); |
1192 | - | { |
1192 | + | |
1193 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectoffsetx <AttachedObjectSlot> <Float:OffsetX>"); |
1193 | + | |
1194 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object position (OffsetX) with specified parameters"); |
1194 | + | if(AOE_EnteredValidModel(playerid, AOModel)) |
1195 | - | } |
1195 | + | |
1196 | - | else |
1196 | + | EPV[playerid][PAO_MODEL_ID] = AOModel; |
1197 | - | { |
1197 | + | if(AOModel == PAO[playerid][AOSlot][AO_MODEL_ID]) |
1198 | - | if(IsValidAttachedObjectSlot(slot)) |
1198 | + | |
1199 | - | { |
1199 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you cannot change this attached object index %d model from %d to the same model (%d)!!", AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], AOModel); |
1200 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
1200 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
1201 | - | { |
1201 | + | AOE_GameTextForPlayer(playerid, AOE_G_DOH); |
1202 | - | if(MIN_ATTACHED_OBJECT_OFFSET <= newoffsetx <= MAX_ATTACHED_OBJECT_OFFSET) |
1202 | + | |
1203 | - | { |
1203 | + | |
1204 | - | UpdatePlayerAttachedObjectEx(playerid, slot, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID], newoffsetx, PAO[playerid][slot][AO_Y], PAO[playerid][slot][AO_Z], |
1204 | + | |
1205 | - | PAO[playerid][slot][AO_RX], PAO[playerid][slot][AO_RY], PAO[playerid][slot][AO_RZ], PAO[playerid][slot][AO_SX], PAO[playerid][slot][AO_SY], PAO[playerid][slot][AO_SZ], PAO[playerid][slot][AO_MC1], PAO[playerid][slot][AO_MC2]); |
1205 | + | if(UpdatePlayerAttachedObject(playerid, AOSlot, AOModel, PAO[playerid][AOSlot][AO_BONE_ID])) |
1206 | - | format(AOE_STR, sizeof(AOE_STR), "* Updated your attached object position (OffsetX) to %.2f at slot/index number %d!", newoffsetx, slot); |
1206 | + | { |
1207 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1207 | + | format(AOE_STR, sizeof AOE_STR, "* Updated your attached object index %d model to {FFFFFF}%d{%06x}.", AOSlot, AOModel, AOE_COLOR2 >>> 8); |
1208 | - | GameTextForPlayer(playerid, "~g~Attached object position updated!", 3000, 3); |
1208 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
1209 | - | } |
1209 | + | format(AOE_STR, sizeof AOE_STR, "~g~Attached object model updated~n~~w~%d (ID:%d)", AOModel, AOSlot); |
1210 | - | else |
1210 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
1211 | - | { |
1211 | + | } |
1212 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object offset(X) value [%.f]!", newoffsetx); |
1212 | + | else SendClientMessage(playerid, AOE_COLOR1, AOE_M_SET_MODEL_FAIL); |
1213 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1213 | + | |
1214 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (OffsetX) value is larger than "#MIN_ATTACHED_OBJECT_OFFSET" and less than "#MAX_ATTACHED_OBJECT_OFFSET); |
1214 | + | |
1215 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object offset value!", 3000, 3); |
1215 | + | |
1216 | - | } |
1216 | + | |
1217 | } | |
1218 | - | else |
1218 | + | |
1219 | - | { |
1219 | + | |
1220 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1220 | + | |
1221 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1221 | + | |
1222 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1222 | + | |
1223 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1223 | + | |
1224 | CMD:saom(playerid, params[]) return cmd_setattachedobjectmodel(playerid, params); | |
1225 | - | } |
1225 | + | |
1226 | - | else |
1226 | + | |
1227 | - | { |
1227 | + | |
1228 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1228 | + | if(AOE_CanEdit(playerid)) |
1229 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1229 | + | |
1230 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1230 | + | if(AOE_HasAttachedObject(playerid)) |
1231 | - | } |
1231 | + | |
1232 | new bonename[MAX_ATTACHED_OBJECT_BONE_NAME]; | |
1233 | if(sscanf(params, "dS()[16]", AOSlot, bonename)) | |
1234 | { | |
1235 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_SET_BONE_USAGE); | |
1236 | SendClientMessage(playerid, AOE_COLOR0, AOE_M_SET_BONE_INFO); | |
1237 | - | CMD:saoox(playerid, params[]) return cmd_setattachedobjectoffsetx(playerid, params); |
1237 | + | |
1238 | else | |
1239 | - | CMD:setattachedobjectoffsety(playerid, params[]) |
1239 | + | |
1240 | if(AOE_EnteredValidSlot(playerid, AOSlot)) | |
1241 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1241 | + | |
1242 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
1242 | + | if(AOE_HasSlot(playerid, AOSlot)) |
1243 | { | |
1244 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
1244 | + | EPV[playerid][PAO_INDEX1] = AOSlot; |
1245 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
1245 | + | if(isnull(bonename)) AOE_ShowPlayerDialog(playerid, AOE_C_BONE, AOE_D_SET_BONE, AOE_T_SET_BONE, AOE_B_SET, AOE_B_BACK); |
1246 | else | |
1247 | { | |
1248 | if(AOE_EnteredValidBone(playerid, bonename)) | |
1249 | - | new slot, Float:newoffsety; |
1249 | + | |
1250 | - | if(sscanf(params, "df", slot, newoffsety)) |
1250 | + | AOBone = GetAttachedObjectBone(bonename); |
1251 | - | { |
1251 | + | EPV[playerid][PAO_BONE_ID] = AOBone; |
1252 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectoffsety <AttachedObjectSlot> <Float:OffsetY>"); |
1252 | + | if(AOBone == PAO[playerid][AOSlot][AO_BONE_ID]) |
1253 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object position (OffsetY) with specified parameters"); |
1253 | + | |
1254 | - | } |
1254 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you cannot change this attached object index %d bone from %s to the same bone (%d)!!", AOSlot, bonename, PAO[playerid][AOSlot][AO_BONE_ID]); |
1255 | - | else |
1255 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
1256 | - | { |
1256 | + | AOE_GameTextForPlayer(playerid, AOE_G_DOH); |
1257 | - | if(IsValidAttachedObjectSlot(slot)) |
1257 | + | |
1258 | - | { |
1258 | + | |
1259 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
1259 | + | |
1260 | - | { |
1260 | + | if(UpdatePlayerAttachedObject(playerid, AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], AOBone)) |
1261 | - | if(MIN_ATTACHED_OBJECT_OFFSET <= newoffsety <= MAX_ATTACHED_OBJECT_OFFSET) |
1261 | + | { |
1262 | - | { |
1262 | + | if(IsNumeric(bonename)) bonename = GetAttachedObjectBoneName(AOBone); |
1263 | - | UpdatePlayerAttachedObjectEx(playerid, slot, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID], PAO[playerid][slot][AO_X], newoffsety, PAO[playerid][slot][AO_Z], |
1263 | + | format(AOE_STR, sizeof AOE_STR, "* Updated your attached object index %d bone to {FFFFFF}%d{%06x} (%s).", AOSlot, AOBone, AOE_COLOR2 >>> 8, bonename); |
1264 | - | PAO[playerid][slot][AO_RX], PAO[playerid][slot][AO_RY], PAO[playerid][slot][AO_RZ], PAO[playerid][slot][AO_SX], PAO[playerid][slot][AO_SY], PAO[playerid][slot][AO_SZ], PAO[playerid][slot][AO_MC1], PAO[playerid][slot][AO_MC2]); |
1264 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
1265 | - | format(AOE_STR, sizeof(AOE_STR), "* Updated your attached object position (OffsetY) to %.2f at slot/index number %d!", newoffsety, slot); |
1265 | + | format(AOE_STR, sizeof AOE_STR, "~g~Attached object bone updated~n~~w~%d (ID:%d)", AOBone, AOSlot); |
1266 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1266 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
1267 | - | GameTextForPlayer(playerid, "~g~Attached object position updated!", 3000, 3); |
1267 | + | } |
1268 | - | } |
1268 | + | else SendClientMessage(playerid, AOE_COLOR1, AOE_M_ERROR); |
1269 | - | else |
1269 | + | |
1270 | - | { |
1270 | + | |
1271 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object offset(Y) value [%.f]!", newoffsety); |
1271 | + | |
1272 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1272 | + | |
1273 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (OffsetY) value is larger than "#MIN_ATTACHED_OBJECT_OFFSET" and less than "#MAX_ATTACHED_OBJECT_OFFSET); |
1273 | + | |
1274 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object offset value!", 3000, 3); |
1274 | + | |
1275 | - | } |
1275 | + | |
1276 | } | |
1277 | - | else |
1277 | + | |
1278 | - | { |
1278 | + | |
1279 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1279 | + | |
1280 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1280 | + | |
1281 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1281 | + | |
1282 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1282 | + | CMD:setattachedobjectoffset(playerid, params[]) |
1283 | { | |
1284 | - | } |
1284 | + | if(AOE_CanEdit(playerid)) |
1285 | - | else |
1285 | + | |
1286 | - | { |
1286 | + | if(AOE_HasAttachedObject(playerid)) |
1287 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1287 | + | |
1288 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1288 | + | if(sscanf(params, "dcf", AOSlot, AOSelection, AOAxis)) |
1289 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1289 | + | |
1290 | - | } |
1290 | + | ErrorMessage: |
1291 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_SET_OFFSET_USAGE); | |
1292 | SendClientMessage(playerid, AOE_COLOR0, AOE_M_SET_OFFSET_INFO); | |
1293 | } | |
1294 | else | |
1295 | { | |
1296 | - | CMD:saooy(playerid, params[]) return cmd_setattachedobjectoffsety(playerid, params); |
1296 | + | if(AOE_EnteredValidSlot(playerid, AOSlot)) |
1297 | { | |
1298 | - | CMD:setattachedobjectoffsetz(playerid, params[]) |
1298 | + | if(AOE_HasSlot(playerid, AOSlot)) |
1299 | { | |
1300 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1300 | + | EPV[playerid][PAO_INDEX1] = AOSlot; |
1301 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
1301 | + | if(IsPlayerAdmin(playerid) || MIN_ATTACHED_OBJECT_OFFSET <= AOAxis <= MAX_ATTACHED_OBJECT_OFFSET) |
1302 | { | |
1303 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
1303 | + | switch(AOSelection) |
1304 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
1304 | + | |
1305 | case 'x', 'X': UpdatePlayerAttachedObjectEx(playerid, AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], PAO[playerid][AOSlot][AO_BONE_ID], AOAxis, PAO[playerid][AOSlot][AO_Y], PAO[playerid][AOSlot][AO_Z], | |
1306 | PAO[playerid][AOSlot][AO_RX], PAO[playerid][AOSlot][AO_RY], PAO[playerid][AOSlot][AO_RZ], PAO[playerid][AOSlot][AO_SX], PAO[playerid][AOSlot][AO_SY], PAO[playerid][AOSlot][AO_SZ], | |
1307 | PAO[playerid][AOSlot][AO_MC1], PAO[playerid][AOSlot][AO_MC2]); | |
1308 | - | new slot, Float:newoffsetz; |
1308 | + | case 'y', 'Y': UpdatePlayerAttachedObjectEx(playerid, AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], PAO[playerid][AOSlot][AO_BONE_ID], PAO[playerid][AOSlot][AO_X], AOAxis, PAO[playerid][AOSlot][AO_Z], |
1309 | - | if(sscanf(params, "df", slot, newoffsetz)) |
1309 | + | PAO[playerid][AOSlot][AO_RX], PAO[playerid][AOSlot][AO_RY], PAO[playerid][AOSlot][AO_RZ], PAO[playerid][AOSlot][AO_SX], PAO[playerid][AOSlot][AO_SY], PAO[playerid][AOSlot][AO_SZ], |
1310 | - | { |
1310 | + | PAO[playerid][AOSlot][AO_MC1], PAO[playerid][AOSlot][AO_MC2]); |
1311 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectoffsetz <AttachedObjectSlot> <Float:OffsetZ>"); |
1311 | + | case 'z', 'Z': UpdatePlayerAttachedObjectEx(playerid, AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], PAO[playerid][AOSlot][AO_BONE_ID], PAO[playerid][AOSlot][AO_X], PAO[playerid][AOSlot][AO_Y], AOAxis, |
1312 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object position (OffsetZ) with specified parameters"); |
1312 | + | PAO[playerid][AOSlot][AO_RX], PAO[playerid][AOSlot][AO_RY], PAO[playerid][AOSlot][AO_RZ], PAO[playerid][AOSlot][AO_SX], PAO[playerid][AOSlot][AO_SY], PAO[playerid][AOSlot][AO_SZ], |
1313 | - | } |
1313 | + | PAO[playerid][AOSlot][AO_MC1], PAO[playerid][AOSlot][AO_MC2]); |
1314 | - | else |
1314 | + | default: goto ErrorMessage; |
1315 | - | { |
1315 | + | |
1316 | - | if(IsValidAttachedObjectSlot(slot)) |
1316 | + | format(AOE_STR, sizeof AOE_STR, "* Updated your attached object index %d position (Offset%c) to {FFFFFF}%.4f{%06x}.", AOSlot, toupper(AOSelection), AOAxis, AOE_COLOR2 >>> 8); |
1317 | - | { |
1317 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
1318 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
1318 | + | AOE_GameTextForPlayer(playerid, AOE_G_OFFSET_UPDATED); |
1319 | - | { |
1319 | + | |
1320 | - | if(MIN_ATTACHED_OBJECT_OFFSET <= newoffsetz <= MAX_ATTACHED_OBJECT_OFFSET) |
1320 | + | |
1321 | - | { |
1321 | + | |
1322 | - | UpdatePlayerAttachedObjectEx(playerid, slot, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID], PAO[playerid][slot][AO_X], PAO[playerid][slot][AO_Y], newoffsetz, |
1322 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you've entered invalid attached object offset(%c) value ({FFFFFF}%f{%06x}).", toupper(AOSelection), AOAxis, AOE_COLOR4 >>> 8); |
1323 | - | PAO[playerid][slot][AO_RX], PAO[playerid][slot][AO_RY], PAO[playerid][slot][AO_RZ], PAO[playerid][slot][AO_SX], PAO[playerid][slot][AO_SY], PAO[playerid][slot][AO_SZ], PAO[playerid][slot][AO_MC1], PAO[playerid][slot][AO_MC2]); |
1323 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
1324 | - | format(AOE_STR, sizeof(AOE_STR), "* Updated your attached object position (OffsetZ) to %.2f at slot/index number %d!", newoffsetz, slot); |
1324 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_VALID_OFFSET); |
1325 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1325 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_OFFSET); |
1326 | - | GameTextForPlayer(playerid, "~g~Attached object position updated!", 3000, 3); |
1326 | + | |
1327 | - | } |
1327 | + | |
1328 | - | else |
1328 | + | |
1329 | - | { |
1329 | + | |
1330 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object offset(Z) value [%.f]!", newoffsetz); |
1330 | + | |
1331 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1331 | + | |
1332 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (OffsetZ) value is larger than "#MIN_ATTACHED_OBJECT_OFFSET" and less than "#MAX_ATTACHED_OBJECT_OFFSET); |
1332 | + | |
1333 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object offset value!", 3000, 3); |
1333 | + | |
1334 | - | } |
1334 | + | |
1335 | CMD:saoo(playerid, params[]) return cmd_setattachedobjectoffset(playerid, params); | |
1336 | - | else |
1336 | + | |
1337 | - | { |
1337 | + | CMD:setattachedobjectrot(playerid, params[]) |
1338 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1338 | + | |
1339 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1339 | + | if(AOE_CanEdit(playerid)) |
1340 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1340 | + | |
1341 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1341 | + | if(AOE_HasAttachedObject(playerid)) |
1342 | { | |
1343 | - | } |
1343 | + | if(sscanf(params, "dcf", AOSlot, AOSelection, AOAxis)) |
1344 | - | else |
1344 | + | |
1345 | - | { |
1345 | + | ErrorMessage: |
1346 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1346 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_SET_ROTATION_USAGE); |
1347 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1347 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_SET_ROTATION_INFO); |
1348 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1348 | + | |
1349 | - | } |
1349 | + | |
1350 | { | |
1351 | if(AOE_EnteredValidSlot(playerid, AOSlot)) | |
1352 | { | |
1353 | if(AOE_HasSlot(playerid, AOSlot)) | |
1354 | { | |
1355 | - | CMD:saooz(playerid, params[]) return cmd_setattachedobjectoffsetz(playerid, params); |
1355 | + | EPV[playerid][PAO_INDEX1] = AOSlot; |
1356 | if(IsPlayerAdmin(playerid) || MIN_ATTACHED_OBJECT_ROTATION <= AOAxis <= MAX_ATTACHED_OBJECT_ROTATION) | |
1357 | - | CMD:setattachedobjectrotx(playerid, params[]) |
1357 | + | |
1358 | switch(AOSelection) | |
1359 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1359 | + | |
1360 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
1360 | + | case 'x', 'X': UpdatePlayerAttachedObjectEx(playerid, AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], PAO[playerid][AOSlot][AO_BONE_ID], PAO[playerid][AOSlot][AO_X], PAO[playerid][AOSlot][AO_Y], PAO[playerid][AOSlot][AO_Z], |
1361 | AOAxis, PAO[playerid][AOSlot][AO_RY], PAO[playerid][AOSlot][AO_RZ], PAO[playerid][AOSlot][AO_SX], PAO[playerid][AOSlot][AO_SY], PAO[playerid][AOSlot][AO_SZ], | |
1362 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
1362 | + | PAO[playerid][AOSlot][AO_MC1], PAO[playerid][AOSlot][AO_MC2]); |
1363 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
1363 | + | case 'y', 'Y': UpdatePlayerAttachedObjectEx(playerid, AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], PAO[playerid][AOSlot][AO_BONE_ID], PAO[playerid][AOSlot][AO_X], PAO[playerid][AOSlot][AO_Y], PAO[playerid][AOSlot][AO_Z], |
1364 | PAO[playerid][AOSlot][AO_RX], AOAxis, PAO[playerid][AOSlot][AO_RZ], PAO[playerid][AOSlot][AO_SX], PAO[playerid][AOSlot][AO_SY], PAO[playerid][AOSlot][AO_SZ], | |
1365 | PAO[playerid][AOSlot][AO_MC1], PAO[playerid][AOSlot][AO_MC2]); | |
1366 | case 'z', 'Z': UpdatePlayerAttachedObjectEx(playerid, AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], PAO[playerid][AOSlot][AO_BONE_ID], PAO[playerid][AOSlot][AO_X], PAO[playerid][AOSlot][AO_Y], PAO[playerid][AOSlot][AO_Z], | |
1367 | - | new slot, Float:newrotx; |
1367 | + | PAO[playerid][AOSlot][AO_RX], PAO[playerid][AOSlot][AO_RY], AOAxis, PAO[playerid][AOSlot][AO_SX], PAO[playerid][AOSlot][AO_SY],PAO[playerid][AOSlot][AO_SZ], |
1368 | - | if(sscanf(params, "df", slot, newrotx)) |
1368 | + | PAO[playerid][AOSlot][AO_MC1], PAO[playerid][AOSlot][AO_MC2]); |
1369 | - | { |
1369 | + | default: goto ErrorMessage; |
1370 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectrotx <AttachedObjectSlot> <Float:RotX>"); |
1370 | + | |
1371 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object rotation (RotX) with specified parameters"); |
1371 | + | format(AOE_STR, sizeof AOE_STR, "* Updated your attached object index %d rotation (Rot%c) to {FFFFFF}%.4f{%06x}.", AOSlot, toupper(AOSelection), AOAxis, AOE_COLOR2 >>> 8); |
1372 | - | } |
1372 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
1373 | - | else |
1373 | + | AOE_GameTextForPlayer(playerid, AOE_G_ROTATION_UPDATED); |
1374 | - | { |
1374 | + | |
1375 | - | if(IsValidAttachedObjectSlot(slot)) |
1375 | + | |
1376 | - | { |
1376 | + | |
1377 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
1377 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you've entered an invalid attached object rotation(%c) value ({FFFFFF}%f{%06x}).", toupper(AOSelection), AOAxis, AOE_COLOR4 >>> 8); |
1378 | - | { |
1378 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
1379 | - | if(MIN_ATTACHED_OBJECT_ROTATION <= newrotx <= MAX_ATTACHED_OBJECT_ROTATION) |
1379 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_VALID_ROTATION); |
1380 | - | { |
1380 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_ROTATION); |
1381 | - | UpdatePlayerAttachedObjectEx(playerid, slot, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID], PAO[playerid][slot][AO_X], PAO[playerid][slot][AO_Y], PAO[playerid][slot][AO_Z], |
1381 | + | |
1382 | - | newrotx, PAO[playerid][slot][AO_RY], PAO[playerid][slot][AO_RZ], PAO[playerid][slot][AO_SX], PAO[playerid][slot][AO_SY], PAO[playerid][slot][AO_SZ], PAO[playerid][slot][AO_MC1], PAO[playerid][slot][AO_MC2]); |
1382 | + | |
1383 | - | format(AOE_STR, sizeof(AOE_STR), "* Updated your attached object rotation (RotX) to %.2f at slot/index number %d!", newrotx, slot); |
1383 | + | |
1384 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1384 | + | |
1385 | - | GameTextForPlayer(playerid, "~g~Attached object rotation updated!", 3000, 3); |
1385 | + | |
1386 | - | } |
1386 | + | |
1387 | - | else |
1387 | + | |
1388 | - | { |
1388 | + | |
1389 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object rotation(X) value [%.f]!", newrotx); |
1389 | + | |
1390 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1390 | + | CMD:saor(playerid, params[]) return cmd_setattachedobjectrot(playerid, params); |
1391 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (RotX) value is larger than "#MIN_ATTACHED_OBJECT_ROTATION" and less than "#MAX_ATTACHED_OBJECT_ROTATION); |
1391 | + | |
1392 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object rotation value!", 3000, 3); |
1392 | + | CMD:setattachedobjectscale(playerid, params[]) |
1393 | - | } |
1393 | + | |
1394 | if(AOE_CanEdit(playerid)) | |
1395 | - | else |
1395 | + | |
1396 | - | { |
1396 | + | if(AOE_HasAttachedObject(playerid)) |
1397 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1397 | + | |
1398 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1398 | + | if(sscanf(params, "dcf", AOSlot, AOSelection, AOAxis)) |
1399 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1399 | + | |
1400 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1400 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_SET_SCALE_USAGE); |
1401 | SendClientMessage(playerid, AOE_COLOR0, AOE_M_SET_SCALE_INFO); | |
1402 | - | } |
1402 | + | |
1403 | - | else |
1403 | + | |
1404 | - | { |
1404 | + | |
1405 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1405 | + | if(AOE_EnteredValidSlot(playerid, AOSlot)) |
1406 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1406 | + | |
1407 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1407 | + | if(AOE_HasSlot(playerid, AOSlot)) |
1408 | - | } |
1408 | + | |
1409 | EPV[playerid][PAO_INDEX1] = AOSlot; | |
1410 | if(IsPlayerAdmin(playerid) || MIN_ATTACHED_OBJECT_SIZE <= AOAxis <= MAX_ATTACHED_OBJECT_SIZE) | |
1411 | { | |
1412 | switch(AOSelection) | |
1413 | { | |
1414 | - | CMD:saorx(playerid, params[]) return cmd_setattachedobjectrotx(playerid, params); |
1414 | + | case 'x', 'X': UpdatePlayerAttachedObjectEx(playerid, AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], PAO[playerid][AOSlot][AO_BONE_ID], PAO[playerid][AOSlot][AO_X], PAO[playerid][AOSlot][AO_Y], PAO[playerid][AOSlot][AO_Z], |
1415 | PAO[playerid][AOSlot][AO_RX], PAO[playerid][AOSlot][AO_RY], PAO[playerid][AOSlot][AO_RZ], AOAxis, PAO[playerid][AOSlot][AO_SY], PAO[playerid][AOSlot][AO_SZ], | |
1416 | - | CMD:setattachedobjectroty(playerid, params[]) |
1416 | + | PAO[playerid][AOSlot][AO_MC1], PAO[playerid][AOSlot][AO_MC2]); |
1417 | case 'y', 'Y': UpdatePlayerAttachedObjectEx(playerid, AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], PAO[playerid][AOSlot][AO_BONE_ID], PAO[playerid][AOSlot][AO_X], PAO[playerid][AOSlot][AO_Y], PAO[playerid][AOSlot][AO_Z], | |
1418 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1418 | + | PAO[playerid][AOSlot][AO_RX], PAO[playerid][AOSlot][AO_RY], PAO[playerid][AOSlot][AO_RZ], PAO[playerid][AOSlot][AO_SX], AOAxis, PAO[playerid][AOSlot][AO_SZ], |
1419 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
1419 | + | PAO[playerid][AOSlot][AO_MC1], PAO[playerid][AOSlot][AO_MC2]); |
1420 | case 'z', 'Z': UpdatePlayerAttachedObjectEx(playerid, AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], PAO[playerid][AOSlot][AO_BONE_ID], PAO[playerid][AOSlot][AO_X], PAO[playerid][AOSlot][AO_Y], PAO[playerid][AOSlot][AO_Z], | |
1421 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
1421 | + | PAO[playerid][AOSlot][AO_RX], PAO[playerid][AOSlot][AO_RY], PAO[playerid][AOSlot][AO_RZ], PAO[playerid][AOSlot][AO_SX], PAO[playerid][AOSlot][AO_SY], AOAxis, |
1422 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
1422 | + | PAO[playerid][AOSlot][AO_MC1], PAO[playerid][AOSlot][AO_MC2]); |
1423 | } | |
1424 | format(AOE_STR, sizeof AOE_STR, "* Updated your attached object index %d size (Scale%c) to {FFFFFF}%.4f{%06x}.", AOSlot, toupper(AOSelection), AOAxis, AOE_COLOR2 >>> 8); | |
1425 | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); | |
1426 | - | new slot, Float:newroty; |
1426 | + | AOE_GameTextForPlayer(playerid, AOE_G_SCALE_UPDATED); |
1427 | - | if(sscanf(params, "df", slot, newroty)) |
1427 | + | |
1428 | - | { |
1428 | + | |
1429 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectroty <AttachedObjectSlot> <Float:RotY>"); |
1429 | + | |
1430 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object rotation (RotY) with specified parameters"); |
1430 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you've entered invalid attached object scale(%c) value ({FFFFFF}%f{%06x}).", toupper(AOSelection), AOAxis, AOE_COLOR4 >>> 8); |
1431 | - | } |
1431 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
1432 | - | else |
1432 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_VALID_SCALE); |
1433 | - | { |
1433 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_SCALE); |
1434 | - | if(IsValidAttachedObjectSlot(slot)) |
1434 | + | |
1435 | - | { |
1435 | + | |
1436 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
1436 | + | |
1437 | - | { |
1437 | + | |
1438 | - | if(MIN_ATTACHED_OBJECT_ROTATION <= newroty <= MAX_ATTACHED_OBJECT_ROTATION) |
1438 | + | |
1439 | - | { |
1439 | + | |
1440 | - | UpdatePlayerAttachedObjectEx(playerid, slot, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID], PAO[playerid][slot][AO_X], PAO[playerid][slot][AO_Y], PAO[playerid][slot][AO_Z], |
1440 | + | |
1441 | - | PAO[playerid][slot][AO_RX], newroty, PAO[playerid][slot][AO_RZ], PAO[playerid][slot][AO_SX], PAO[playerid][slot][AO_SY], PAO[playerid][slot][AO_SZ], PAO[playerid][slot][AO_MC1], PAO[playerid][slot][AO_MC2]); |
1441 | + | |
1442 | - | format(AOE_STR, sizeof(AOE_STR), "* Updated your attached object rotation (RotY) to %.2f at slot/index number %d!", newroty, slot); |
1442 | + | |
1443 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1443 | + | CMD:saos(playerid, params[]) return cmd_setattachedobjectscale(playerid, params); |
1444 | - | GameTextForPlayer(playerid, "~g~Attached object rotation updated!", 3000, 3); |
1444 | + | |
1445 | - | } |
1445 | + | CMD:setattachedobjectmc(playerid, params[]) |
1446 | - | else |
1446 | + | |
1447 | - | { |
1447 | + | if(AOE_CanEdit(playerid)) |
1448 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object rotation(Y) value [%.f]!", newroty); |
1448 | + | |
1449 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1449 | + | if(AOE_HasAttachedObject(playerid)) |
1450 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (RotY) value is larger than "#MIN_ATTACHED_OBJECT_ROTATION" and less than "#MAX_ATTACHED_OBJECT_ROTATION); |
1450 | + | |
1451 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object rotation value!", 3000, 3); |
1451 | + | new hex:MC2; |
1452 | - | } |
1452 | + | if(sscanf(params, "dxx", AOSlot, AOMC, MC2)) |
1453 | { | |
1454 | - | else |
1454 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_SET_COLOR_USAGE); |
1455 | - | { |
1455 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_SET_COLOR_INFO); |
1456 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1456 | + | |
1457 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1457 | + | |
1458 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1458 | + | |
1459 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1459 | + | if(AOE_EnteredValidSlot(playerid, AOSlot)) |
1460 | { | |
1461 | - | } |
1461 | + | if(AOE_HasSlot(playerid, AOSlot)) |
1462 | - | else |
1462 | + | |
1463 | - | { |
1463 | + | EPV[playerid][PAO_INDEX1] = AOSlot; |
1464 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1464 | + | if(AOMC != PAO[playerid][AOSlot][AO_MC1]) |
1465 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1465 | + | |
1466 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1466 | + | format(AOE_STR, sizeof AOE_STR, "* Updated your attached object index %d color #1 to {%06x}0x%x{%06x} (%i).", AOSlot, AOMC & 0xFFFFFF, AOMC, AOE_COLOR2 >>> 8, AOMC); |
1467 | - | } |
1467 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
1468 | } | |
1469 | if(MC2 != PAO[playerid][AOSlot][AO_MC2]) | |
1470 | { | |
1471 | format(AOE_STR, sizeof AOE_STR, "* Updated your attached object index %d color #2 to {%06x}0x%x{%06x} (%i).", AOSlot, MC2 & 0xFFFFFF, MC2, AOE_COLOR2 >>> 8, MC2); | |
1472 | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); | |
1473 | - | CMD:saory(playerid, params[]) return cmd_setattachedobjectroty(playerid, params); |
1473 | + | |
1474 | if(UpdatePlayerAttachedObjectEx(playerid, AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], PAO[playerid][AOSlot][AO_BONE_ID], PAO[playerid][AOSlot][AO_X], PAO[playerid][AOSlot][AO_Y], PAO[playerid][AOSlot][AO_Z], | |
1475 | - | CMD:setattachedobjectrotz(playerid, params[]) |
1475 | + | PAO[playerid][AOSlot][AO_RX], PAO[playerid][AOSlot][AO_RY], PAO[playerid][AOSlot][AO_RZ], PAO[playerid][AOSlot][AO_SX], PAO[playerid][AOSlot][AO_SY], PAO[playerid][AOSlot][AO_SZ], AOMC, MC2)) |
1476 | { | |
1477 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1477 | + | AOE_GameTextForPlayer(playerid, AOE_G_COLOR_UPDATED); |
1478 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
1478 | + | |
1479 | else SendClientMessage(playerid, AOE_COLOR1, AOE_M_ERROR); | |
1480 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
1480 | + | |
1481 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
1481 | + | |
1482 | } | |
1483 | } | |
1484 | } | |
1485 | - | new slot, Float:newrotz; |
1485 | + | |
1486 | - | if(sscanf(params, "df", slot, newrotz)) |
1486 | + | |
1487 | - | { |
1487 | + | |
1488 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectrotz <AttachedObjectSlot> <Float:RotZ>"); |
1488 | + | CMD:saomc(playerid, params[]) return cmd_setattachedobjectmc(playerid, params); |
1489 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object rotation (RotZ) with specified parameters"); |
1489 | + | |
1490 | - | } |
1490 | + | |
1491 | - | else |
1491 | + | |
1492 | - | { |
1492 | + | if(sscanf(params, "dx", AOSlot, AOMC)) |
1493 | - | if(IsValidAttachedObjectSlot(slot)) |
1493 | + | |
1494 | - | { |
1494 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_SET_COLOR1_USAGE); |
1495 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
1495 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_SET_COLOR1_INFO); |
1496 | - | { |
1496 | + | return 1; |
1497 | - | if(MIN_ATTACHED_OBJECT_ROTATION <= newrotz <= MAX_ATTACHED_OBJECT_ROTATION) |
1497 | + | |
1498 | - | { |
1498 | + | format(params, sizeof AOE_STR, "%d %x %x", AOSlot, AOMC, PAO[playerid][AOSlot][AO_MC2]); |
1499 | - | UpdatePlayerAttachedObjectEx(playerid, slot, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID], PAO[playerid][slot][AO_X], PAO[playerid][slot][AO_Y], PAO[playerid][slot][AO_Z], |
1499 | + | return cmd_setattachedobjectmc(playerid, params); |
1500 | - | PAO[playerid][slot][AO_RX], PAO[playerid][slot][AO_RY], newrotz, PAO[playerid][slot][AO_SX], PAO[playerid][slot][AO_SY], PAO[playerid][slot][AO_SZ], PAO[playerid][slot][AO_MC1], PAO[playerid][slot][AO_MC2]); |
1500 | + | |
1501 | - | format(AOE_STR, sizeof(AOE_STR), "* Updated your attached object rotation (RotZ) to %.2f at slot/index number %d!", newrotz, slot); |
1501 | + | |
1502 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1502 | + | |
1503 | - | GameTextForPlayer(playerid, "~g~Attached object rotation updated!", 3000, 3); |
1503 | + | |
1504 | - | } |
1504 | + | |
1505 | - | else |
1505 | + | |
1506 | - | { |
1506 | + | if(sscanf(params, "dx", AOSlot, AOMC)) |
1507 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object rotation(Z) value [%.f]!", newrotz); |
1507 | + | |
1508 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1508 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_SET_COLOR2_USAGE); |
1509 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (RotZ) value is larger than "#MIN_ATTACHED_OBJECT_ROTATION" and less than "#MAX_ATTACHED_OBJECT_ROTATION); |
1509 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_SET_COLOR2_INFO); |
1510 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object rotation value!", 3000, 3); |
1510 | + | return 1; |
1511 | - | } |
1511 | + | |
1512 | format(params, sizeof AOE_STR, "%d %x %x", AOSlot, PAO[playerid][AOSlot][AO_MC1], AOMC); | |
1513 | - | else |
1513 | + | return cmd_setattachedobjectmc(playerid, params); |
1514 | - | { |
1514 | + | |
1515 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1515 | + | |
1516 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1516 | + | |
1517 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1517 | + | |
1518 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1518 | + | |
1519 | { | |
1520 | - | } |
1520 | + | new slots; |
1521 | - | else |
1521 | + | switch(dialogid) |
1522 | - | { |
1522 | + | |
1523 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1523 | + | case AOE_D: |
1524 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1524 | + | |
1525 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1525 | + | if(response) |
1526 | - | } |
1526 | + | |
1527 | switch(listitem) | |
1528 | { | |
1529 | case 0: cmd_createattachedobject(playerid, ""); | |
1530 | case 1: AOE_ShowPlayerDialog(playerid, AOE_C_FILE, AOE_D_FILE, AOE_T_FILE, AOE_B_SELECT, AOE_B_CANCEL); | |
1531 | case 2: | |
1532 | - | CMD:saorz(playerid, params[]) return cmd_setattachedobjectrotz(playerid, params); |
1532 | + | |
1533 | if(GetPlayerAttachedObjectsCount(playerid) == 0) | |
1534 | - | CMD:setattachedobjectscalex(playerid, params[]) |
1534 | + | |
1535 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_EDIT_NOTHING); | |
1536 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1536 | + | AOE_GameTextForPlayer(playerid, AOE_G_NO_ATTACHED_OBJECT); |
1537 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
1537 | + | |
1538 | else AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_USED, AOE_D_EDIT_SLOT, AOE_T_EDIT, AOE_B_EDIT_CREATE, AOE_B_CANCEL); | |
1539 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
1539 | + | |
1540 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
1540 | + | case 3: cmd_removeattachedobjects(playerid, ""); |
1541 | case 4: cmd_undeleteattachedobject(playerid, ""); | |
1542 | case 5: | |
1543 | { | |
1544 | - | new slot, Float:newscalex; |
1544 | + | if(IsPlayerAdmin(playerid)) |
1545 | - | if(sscanf(params, "df", slot, newscalex)) |
1545 | + | |
1546 | - | { |
1546 | + | SendClientMessage(playerid, AOE_COLOR5, "-- Statistics & Debug ----------------------------------------------------"); |
1547 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectscalex <AttachedObjectSlot> <Float:ScaleX>"); |
1547 | + | SendClientMessage(playerid, AOE_COLOR3, "- Offset value limit: "#MIN_ATTACHED_OBJECT_OFFSET" to "#MAX_ATTACHED_OBJECT_OFFSET); |
1548 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object size (ScaleX) with specified parameters"); |
1548 | + | SendClientMessage(playerid, AOE_COLOR3, "- Rotation value limit: "#MIN_ATTACHED_OBJECT_ROTATION" to "#MAX_ATTACHED_OBJECT_ROTATION); |
1549 | - | } |
1549 | + | SendClientMessage(playerid, AOE_COLOR3, "- Scale value limit: "#MIN_ATTACHED_OBJECT_SIZE" to "#MAX_ATTACHED_OBJECT_SIZE); |
1550 | - | else |
1550 | + | strupdate(AOE_STR, AOE_FILE_NAME); |
1551 | - | { |
1551 | + | strdel(AOE_STR, 0, 2); |
1552 | - | if(IsValidAttachedObjectSlot(slot)) |
1552 | + | format(AOE_STR, sizeof AOE_STR, "- File format: %s", AOE_STR); |
1553 | - | { |
1553 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
1554 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
1554 | + | SendClientMessage(playerid, AOE_COLOR3, "- Smaller save size: "#AOE_SMALLER_SAVE); |
1555 | - | { |
1555 | + | format(AOE_STR, sizeof AOE_STR, "- Last attached object file name: %s", AOFileName); |
1556 | - | if(MIN_ATTACHED_OBJECT_SIZE <= newscalex <= MAX_ATTACHED_OBJECT_SIZE) |
1556 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
1557 | - | { |
1557 | + | format(AOE_STR, sizeof AOE_STR, "- Last saved attached object file length: %f", AOFileLen); |
1558 | - | UpdatePlayerAttachedObjectEx(playerid, slot, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID], PAO[playerid][slot][AO_X], PAO[playerid][slot][AO_Y], PAO[playerid][slot][AO_Z], |
1558 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
1559 | - | PAO[playerid][slot][AO_RX], PAO[playerid][slot][AO_RY], PAO[playerid][slot][AO_RZ], newscalex, PAO[playerid][slot][AO_SY], PAO[playerid][slot][AO_SZ], PAO[playerid][slot][AO_MC1], PAO[playerid][slot][AO_MC2]); |
1559 | + | format(AOE_STR, sizeof AOE_STR, "- Last attached object file comment: %s", AOComment); |
1560 | - | format(AOE_STR, sizeof(AOE_STR), "* Updated your attached object size (ScaleX) to %.2f at slot/index number %d!", newscalex, slot); |
1560 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
1561 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1561 | + | format(AOE_STR, sizeof AOE_STR, "- Last editor player name: %s", pName); |
1562 | - | GameTextForPlayer(playerid, "~g~Attached object size updated!", 3000, 3); |
1562 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
1563 | - | } |
1563 | + | format(AOE_STR, sizeof AOE_STR, "- Last editor target id: %d", AOTarget); |
1564 | - | else |
1564 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
1565 | format(AOE_STR, sizeof AOE_STR, "- Last selection edit: %d", AOSelection); | |
1566 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object scale(X) value [%f]!", newscalex); |
1566 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
1567 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1567 | + | format(AOE_STR, sizeof AOE_STR, "- Last attached object slot: %d", AOSlot); |
1568 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (ScaleX) value is larger than "#MIN_ATTACHED_OBJECT_SIZE" and less than "#MAX_ATTACHED_OBJECT_SIZE); |
1568 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
1569 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object size value!", 3000, 3); |
1569 | + | format(AOE_STR, sizeof AOE_STR, "- Last attached object model: %d", AOModel); |
1570 | - | } |
1570 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
1571 | format(AOE_STR, sizeof AOE_STR, "- Last attached object bone: %d", AOBone); | |
1572 | - | else |
1572 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
1573 | - | { |
1573 | + | format(AOE_STR, sizeof AOE_STR, "- Last attached object xyz axis value: %f", AOAxis); |
1574 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1574 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
1575 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1575 | + | format(AOE_STR, sizeof AOE_STR, "- Last attached object material color: %x (%i)", AOMC, AOMC); |
1576 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1576 | + | SendClientMessage(playerid, AOE_COLOR3, AOE_STR); |
1577 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1577 | + | |
1578 | else | |
1579 | { | |
1580 | - | else |
1580 | + | SendClientMessage(playerid, AOE_COLOR5, "-- Statistics --------------------------------------------------------------"); |
1581 | - | { |
1581 | + | |
1582 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1582 | + | new maxplayers = GetMaxPlayers(), attachedobjectscount, attachedobjectscount2; |
1583 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1583 | + | if(maxplayers > MAX_PLAYERS) maxplayers = MAX_PLAYERS; |
1584 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1584 | + | for(new i = 0; i < maxplayers; i++) |
1585 | { | |
1586 | if(IsPlayerConnected(i)) | |
1587 | { | |
1588 | for(new x = 0; x < MAX_PLAYER_ATTACHED_OBJECTS; x++) | |
1589 | { | |
1590 | attachedobjectscount += IsPlayerAttachedObjectSlotUsed(i, x); | |
1591 | - | CMD:saosx(playerid, params[]) return cmd_setattachedobjectscalex(playerid, params); |
1591 | + | if(PAO[i][x][AO_STATUS] == 1) attachedobjectscount2++; |
1592 | } | |
1593 | - | CMD:setattachedobjectscaley(playerid, params[]) |
1593 | + | |
1594 | } | |
1595 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1595 | + | format(AOE_STR, sizeof AOE_STR, "- Total attached object(s) in the server: %d (%d by editor)", attachedobjectscount, attachedobjectscount2); |
1596 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
1596 | + | SendClientMessage(playerid, AOE_COLOR5, AOE_STR); |
1597 | format(AOE_STR, sizeof AOE_STR, "- Total attached object(s) attached on you: %d", GetPlayerAttachedObjectsCount(playerid)); | |
1598 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
1598 | + | SendClientMessage(playerid, AOE_COLOR5, AOE_STR); |
1599 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
1599 | + | SendClientMessage(playerid, AOE_COLOR5, "--------------------------------------------------------------------------------"); |
1600 | } | |
1601 | case 6: AOE_ShowPlayerDialog(playerid, AOE_C_HELP, AOE_D, AOE_T_HELP, AOE_B_CLOSE); | |
1602 | case 7: AOE_ShowPlayerDialog(playerid, AOE_C_ABOUT, AOE_D, AOE_T_ABOUT, AOE_B_CLOSE); | |
1603 | - | new slot, Float:newscaley; |
1603 | + | |
1604 | - | if(sscanf(params, "df", slot, newscaley)) |
1604 | + | |
1605 | - | { |
1605 | + | else SendClientMessage(playerid, AOE_COLOR0, AOE_M_DIALOG_CLOSE); |
1606 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectscaley <AttachedObjectSlot> <Float:ScaleY>"); |
1606 | + | |
1607 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object size (ScaleY) with specified parameters"); |
1607 | + | case AOE_D_CREATE_SLOT: |
1608 | - | } |
1608 | + | |
1609 | - | else |
1609 | + | if(response) |
1610 | - | { |
1610 | + | |
1611 | - | if(IsValidAttachedObjectSlot(slot)) |
1611 | + | |
1612 | - | { |
1612 | + | cmd_createattachedobject(playerid, AOE_STR); |
1613 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
1613 | + | |
1614 | - | { |
1614 | + | else SendClientMessage(playerid, AOE_COLOR0, AOE_M_CREATE_CANCEL); |
1615 | - | if(MIN_ATTACHED_OBJECT_SIZE <= newscaley <= MAX_ATTACHED_OBJECT_SIZE) |
1615 | + | |
1616 | - | { |
1616 | + | case AOE_D_CREATE_MODEL: |
1617 | - | UpdatePlayerAttachedObjectEx(playerid, slot, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID], PAO[playerid][slot][AO_X], PAO[playerid][slot][AO_Y], PAO[playerid][slot][AO_Z], |
1617 | + | |
1618 | - | PAO[playerid][slot][AO_RX], PAO[playerid][slot][AO_RY], PAO[playerid][slot][AO_RZ], PAO[playerid][slot][AO_SX], newscaley, PAO[playerid][slot][AO_SZ], PAO[playerid][slot][AO_MC1], PAO[playerid][slot][AO_MC2]); |
1618 | + | if(response) |
1619 | - | format(AOE_STR, sizeof(AOE_STR), "* Updated your attached object size (ScaleY) to %.2f at slot/index number %d!", newscaley, slot); |
1619 | + | |
1620 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1620 | + | AOModel = strval(inputtext), EPV[playerid][PAO_MODEL_ID] = AOModel; |
1621 | - | GameTextForPlayer(playerid, "~g~Attached object size updated!", 3000, 3); |
1621 | + | if(AOE_EnteredValidModel(playerid, AOModel)) AOE_ShowPlayerDialog(playerid, AOE_C_BONE, AOE_D_CREATE_BONE, AOE_T_CREATE, AOE_B_SELECT, AOE_B_SELECT_MODEL); |
1622 | - | } |
1622 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_MODEL, AOE_D_CREATE_MODEL, AOE_T_CREATE, AOE_B_ENTER, AOE_B_SELECT_INDEX); |
1623 | - | else |
1623 | + | |
1624 | else AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_EMPTY, AOE_D_CREATE_SLOT, AOE_T_CREATE, AOE_B_SELECT, AOE_B_CANCEL); | |
1625 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object scale(Y) value [%f]!", newscaley); |
1625 | + | |
1626 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1626 | + | case AOE_D_CREATE_BONE: |
1627 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (ScaleY) value is larger than "#MIN_ATTACHED_OBJECT_SIZE" and less than "#MAX_ATTACHED_OBJECT_SIZE); |
1627 | + | |
1628 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object size value!", 3000, 3); |
1628 | + | if(response) |
1629 | - | } |
1629 | + | |
1630 | EPV[playerid][PAO_BONE_ID] = listitem+1; | |
1631 | - | else |
1631 | + | if(UpdatePlayerAttachedObjectEx(playerid, EPV[playerid][PAO_INDEX1], EPV[playerid][PAO_MODEL_ID], EPV[playerid][PAO_BONE_ID])) |
1632 | - | { |
1632 | + | |
1633 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1633 | + | format(AOE_STR, sizeof AOE_STR, "* Created attached object model %d at index number %d [Bone: %s (%d)]!", EPV[playerid][PAO_MODEL_ID], EPV[playerid][PAO_INDEX1], GetAttachedObjectBoneName(EPV[playerid][PAO_BONE_ID]), EPV[playerid][PAO_BONE_ID]); |
1634 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1634 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
1635 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1635 | + | format(AOE_STR, sizeof AOE_STR, "~b~Created attached object~n~~w~index/number: %d~n~Model: %d - Bone: %d", EPV[playerid][PAO_INDEX1], EPV[playerid][PAO_MODEL_ID], EPV[playerid][PAO_BONE_ID]); |
1636 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1636 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
1637 | AOE_ShowPlayerDialog(playerid, AOE_C_CREATE_FINAL, AOE_D_CREATE_EDIT, AOE_T_CREATE_EDIT, AOE_B_EDIT, AOE_B_SKIP); | |
1638 | } | |
1639 | - | else |
1639 | + | else SendClientMessage(playerid, AOE_COLOR1, AOE_M_CREATE_FAIL); |
1640 | - | { |
1640 | + | |
1641 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1641 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_MODEL, AOE_D_CREATE_MODEL, AOE_T_CREATE, AOE_B_ENTER, AOE_B_SELECT_INDEX); |
1642 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1642 | + | |
1643 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1643 | + | case AOE_D_CREATE_REPLACE: |
1644 | { | |
1645 | if(response) AOE_ShowPlayerDialog(playerid, AOE_C_MODEL, AOE_D_CREATE_MODEL, AOE_T_CREATE#AOE_T_REPLACE, AOE_B_ENTER, AOE_B_SELECT_INDEX); | |
1646 | else AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_EMPTY, AOE_D_CREATE_SLOT, AOE_T_CREATE, AOE_B_SELECT, AOE_B_CANCEL); | |
1647 | } | |
1648 | case AOE_D_CREATE_EDIT: | |
1649 | { | |
1650 | - | CMD:saosy(playerid, params[]) return cmd_setattachedobjectscaley(playerid, params); |
1650 | + | if(response) |
1651 | { | |
1652 | - | CMD:setattachedobjectscalez(playerid, params[]) |
1652 | + | valstr(AOE_STR, EPV[playerid][PAO_INDEX1]); |
1653 | cmd_editattachedobject(playerid, AOE_STR); | |
1654 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1654 | + | |
1655 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
1655 | + | |
1656 | { | |
1657 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
1657 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_EDIT_SKIP); |
1658 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
1658 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_EDIT_SKIP_INFO); |
1659 | } | |
1660 | } | |
1661 | case AOE_D_FILE: | |
1662 | - | new slot, Float:newscalez; |
1662 | + | |
1663 | - | if(sscanf(params, "df", slot, newscalez)) |
1663 | + | if(response) |
1664 | - | { |
1664 | + | |
1665 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectscalez <AttachedObjectSlot> <Float:ScaleZ>"); |
1665 | + | |
1666 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object size (ScaleZ) with specified parameters"); |
1666 | + | |
1667 | - | } |
1667 | + | case 0: cmd_loadattachedobject(playerid, ""); |
1668 | - | else |
1668 | + | case 1: cmd_loadattachedobjects(playerid, ""); |
1669 | - | { |
1669 | + | case 2: cmd_saveattachedobject(playerid, ""); |
1670 | - | if(IsValidAttachedObjectSlot(slot)) |
1670 | + | case 3: cmd_deleteattachedobjectfile(playerid, ""); |
1671 | - | { |
1671 | + | |
1672 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
1672 | + | |
1673 | - | { |
1673 | + | else SendClientMessage(playerid, AOE_COLOR0, AOE_M_FILE_CANCEL); |
1674 | - | if(MIN_ATTACHED_OBJECT_SIZE <= newscalez <= MAX_ATTACHED_OBJECT_SIZE) |
1674 | + | |
1675 | - | { |
1675 | + | case AOE_D_LOAD: |
1676 | - | UpdatePlayerAttachedObjectEx(playerid, slot, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID], PAO[playerid][slot][AO_X], PAO[playerid][slot][AO_Y], PAO[playerid][slot][AO_Z], |
1676 | + | |
1677 | - | PAO[playerid][slot][AO_RX], PAO[playerid][slot][AO_RY], PAO[playerid][slot][AO_RZ], PAO[playerid][slot][AO_SX], PAO[playerid][slot][AO_SY], newscalez, PAO[playerid][slot][AO_MC1], PAO[playerid][slot][AO_MC2]); |
1677 | + | if(response) |
1678 | - | format(AOE_STR, sizeof(AOE_STR), "* Updated your attached object size (ScaleZ) to %.2f at slot/index number %d!", newscalez, slot); |
1678 | + | |
1679 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1679 | + | if(AOE_EnteredValidFileName(playerid, inputtext)) |
1680 | - | GameTextForPlayer(playerid, "~g~Attached object size updated!", 3000, 3); |
1680 | + | |
1681 | strupdate(EPV[playerid][PAO_NAME], inputtext); | |
1682 | format(AOFileName, sizeof AOFileName, AOE_FILE_NAME, inputtext); | |
1683 | - | { |
1683 | + | if(AOE_EnteredExistedFileName(playerid, AOFileName)) AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_EMPTY, AOE_D_LOAD_SLOT, AOE_T_LOAD, AOE_B_LOAD, AOE_B_BACK); |
1684 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object scale(Z) value [%f]!", newscalez); |
1684 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_LOAD, AOE_D_LOAD, AOE_T_LOAD, AOE_B_ENTER, AOE_B_BACK); |
1685 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1685 | + | |
1686 | - | SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (ScaleZ) value is larger than "#MIN_ATTACHED_OBJECT_SIZE" and less than "#MAX_ATTACHED_OBJECT_SIZE); |
1686 | + | else if(isnull(inputtext)) AOE_ShowPlayerDialog(playerid, AOE_C_LOAD, AOE_D_LOAD, AOE_T_LOAD, AOE_B_ENTER, AOE_B_BACK); |
1687 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object size value!", 3000, 3); |
1687 | + | |
1688 | - | } |
1688 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_FILE, AOE_D_FILE, AOE_T_FILE, AOE_B_SELECT, AOE_B_CANCEL); |
1689 | - | } |
1689 | + | |
1690 | - | else |
1690 | + | case AOE_D_LOAD_SLOT: |
1691 | - | { |
1691 | + | |
1692 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1692 | + | if(response) |
1693 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1693 | + | |
1694 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1694 | + | format(AOE_STR, sizeof AOE_STR, "%s %d", EPV[playerid][PAO_NAME], strval(inputtext)); |
1695 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1695 | + | cmd_loadattachedobject(playerid, AOE_STR); |
1696 | } | |
1697 | else AOE_ShowPlayerDialog(playerid, AOE_C_LOAD, AOE_D_LOAD, AOE_T_LOAD, AOE_B_ENTER, AOE_B_BACK); | |
1698 | - | else |
1698 | + | |
1699 | - | { |
1699 | + | case AOE_D_LOAD_REPLACE: |
1700 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1700 | + | |
1701 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1701 | + | if(response) |
1702 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1702 | + | |
1703 | SendClientMessage(playerid, AOE_COLOR0, AOE_M_LOADING); | |
1704 | - | } |
1704 | + | format(AOFileName, sizeof AOFileName, AOE_FILE_NAME, EPV[playerid][PAO_NAME]); |
1705 | if(AOE_LoadPlayerAttachedObject(playerid, AOFileName, EPV[playerid][PAO_INDEX1], AOComment)) | |
1706 | { | |
1707 | format(AOE_STR, sizeof AOE_STR, "* You've loaded & replaced your attached object from file \"{FFFFFF}%s{%06x}\" [Index: %d|Model: %d|Bone: %d]!", | |
1708 | EPV[playerid][PAO_NAME], AOE_COLOR2 >>> 8, EPV[playerid][PAO_INDEX1], PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_MODEL_ID], PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_BONE_ID]); | |
1709 | - | CMD:saosz(playerid, params[]) return cmd_setattachedobjectscalez(playerid, params); |
1709 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
1710 | if(!isnull(AOComment)) | |
1711 | { | |
1712 | format(AOE_STR, sizeof AOE_STR, "** Comment: %s.", AOComment); | |
1713 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1713 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); |
1714 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
1714 | + | |
1715 | format(AOE_STR, sizeof AOE_STR, "~g~~h~Attached object file loaded~n~%s", EPV[playerid][PAO_NAME]); | |
1716 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
1716 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
1717 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
1717 | + | |
1718 | else SendClientMessage(playerid, AOE_COLOR1, AOE_M_ERROR); | |
1719 | } | |
1720 | else AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_EMPTY, AOE_D_LOAD_SLOT, AOE_T_LOAD, AOE_B_LOAD, AOE_B_BACK); | |
1721 | - | new slot, hex:newmc1; |
1721 | + | |
1722 | - | if(sscanf(params, "dx", slot, newmc1)) |
1722 | + | case AOE_D_LOAD2: |
1723 | - | { |
1723 | + | |
1724 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmc1 <AttachedObjectSlot> <MaterialColor>"); |
1724 | + | if(response) |
1725 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object color (Material:1) with specified parameters"); |
1725 | + | |
1726 | - | } |
1726 | + | if(AOE_EnteredValidFileName(playerid, inputtext)) |
1727 | - | else |
1727 | + | |
1728 | - | { |
1728 | + | strupdate(EPV[playerid][PAO_NAME], inputtext); |
1729 | - | if(IsValidAttachedObjectSlot(slot)) |
1729 | + | format(AOFileName, sizeof AOFileName, AOE_FILE_NAME, inputtext); |
1730 | - | { |
1730 | + | if(AOE_EnteredExistedFileName(playerid, AOFileName)) cmd_loadattachedobjects(playerid, inputtext); |
1731 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
1731 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_LOAD, AOE_D_LOAD2, AOE_T_LOAD_SET, AOE_B_LOAD, AOE_B_BACK); |
1732 | - | { |
1732 | + | |
1733 | - | UpdatePlayerAttachedObjectEx(playerid, slot, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID], PAO[playerid][slot][AO_X], PAO[playerid][slot][AO_Y], PAO[playerid][slot][AO_Z], |
1733 | + | else if(isnull(inputtext)) AOE_ShowPlayerDialog(playerid, AOE_C_LOAD, AOE_D_LOAD2, AOE_T_LOAD_SET, AOE_B_LOAD, AOE_B_BACK); |
1734 | - | PAO[playerid][slot][AO_RX], PAO[playerid][slot][AO_RY], PAO[playerid][slot][AO_RZ], PAO[playerid][slot][AO_SX], PAO[playerid][slot][AO_SY], PAO[playerid][slot][AO_SZ], newmc1, PAO[playerid][slot][AO_MC2]); |
1734 | + | |
1735 | - | format(AOE_STR, sizeof(AOE_STR), "* Updated your attached object color (MC1) to 0x{%06x}%x{%06x} (%i) at slot/index number %d!", newmc1 & 0xFFFFFF, newmc1, COLOR_GREEN >>> 8, newmc1, slot); |
1735 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_FILE, AOE_D_FILE, AOE_T_FILE, AOE_B_SELECT, AOE_B_CANCEL); |
1736 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1736 | + | |
1737 | - | GameTextForPlayer(playerid, "~g~Attached object color updated!", 3000, 3); |
1737 | + | case AOE_D_SAVE_SLOT: |
1738 | - | } |
1738 | + | |
1739 | - | else |
1739 | + | if(response) |
1740 | - | { |
1740 | + | |
1741 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1741 | + | if(listitem == 10) cmd_saveallattachedobjects(playerid, ""); |
1742 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1742 | + | |
1743 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1743 | + | |
1744 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1744 | + | if(AOE_HasSlot(playerid, listitem)) |
1745 | { | |
1746 | - | } |
1746 | + | valstr(AOE_STR, listitem); |
1747 | - | else |
1747 | + | cmd_saveattachedobject(playerid, AOE_STR); |
1748 | - | { |
1748 | + | |
1749 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1749 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_ALL, AOE_D_SAVE_SLOT, AOE_T_SAVE, AOE_B_SELECT, AOE_B_BACK); |
1750 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1750 | + | |
1751 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1751 | + | |
1752 | - | } |
1752 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_FILE, AOE_D_FILE, AOE_T_FILE, AOE_B_SELECT, AOE_B_CANCEL); |
1753 | } | |
1754 | case AOE_D_SAVE: | |
1755 | { | |
1756 | if(response) | |
1757 | { | |
1758 | if(AOE_EnteredValidFileName(playerid, inputtext)) | |
1759 | { | |
1760 | strupdate(EPV[playerid][PAO_NAME], inputtext); | |
1761 | format(AOFileName, sizeof AOFileName, AOE_FILE_NAME, inputtext); | |
1762 | - | if(AOE_CantEdit(playerid)) SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"); |
1762 | + | if(AOE_EnteredNonExistFileName(playerid, AOFileName)) |
1763 | - | else if(!GetPlayerAttachedObjectsCount(playerid)) |
1763 | + | |
1764 | format(AOE_STR, sizeof AOE_STR, "%d %s", EPV[playerid][PAO_INDEX1], inputtext); | |
1765 | - | SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!"); |
1765 | + | cmd_saveattachedobject(playerid, AOE_STR); |
1766 | - | GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 3000, 3); |
1766 | + | |
1767 | } | |
1768 | else AOE_ShowPlayerDialog(playerid, AOE_C_SAVE, AOE_D_SAVE, AOE_T_SAVE, AOE_B_SAVE, AOE_B_BACK); | |
1769 | } | |
1770 | - | new slot, newmc2; |
1770 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_ALL, AOE_D_SAVE_SLOT, AOE_T_SAVE, AOE_B_SELECT, AOE_B_SELECT_INDEX); |
1771 | - | if(sscanf(params, "dx", slot, newmc2)) |
1771 | + | |
1772 | - | { |
1772 | + | case AOE_D_SAVE_REPLACE: |
1773 | - | SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmc2 <AttachedObjectSlot> <MaterialColor>"); |
1773 | + | |
1774 | - | SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object color (Material:2) with specified parameters"); |
1774 | + | if(response) |
1775 | - | } |
1775 | + | |
1776 | - | else |
1776 | + | format(AOFileName, sizeof AOFileName, AOE_FILE_NAME, EPV[playerid][PAO_NAME]); |
1777 | - | { |
1777 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_SAVING); |
1778 | - | if(IsValidAttachedObjectSlot(slot)) |
1778 | + | if(AOE_SavePlayerAttachedObject(playerid, AOFileName, EPV[playerid][PAO_INDEX1], "", AOFileLen)) |
1779 | - | { |
1779 | + | |
1780 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) |
1780 | + | format(AOE_STR, sizeof AOE_STR, "* Your attached object from index %d has been saved as \"{FFFFFF}%s{%06x}\" [Model: %d|Bone: %d|%.2f KB]!", |
1781 | - | { |
1781 | + | EPV[playerid][PAO_INDEX1], EPV[playerid][PAO_NAME], AOE_COLOR2 >>> 8, PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_MODEL_ID], PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_BONE_ID], AOFileLen); |
1782 | - | UpdatePlayerAttachedObjectEx(playerid, slot, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID], PAO[playerid][slot][AO_X], PAO[playerid][slot][AO_Y], PAO[playerid][slot][AO_Z], |
1782 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
1783 | - | PAO[playerid][slot][AO_RX], PAO[playerid][slot][AO_RY], PAO[playerid][slot][AO_RZ], PAO[playerid][slot][AO_SX], PAO[playerid][slot][AO_SY], PAO[playerid][slot][AO_SZ], PAO[playerid][slot][AO_MC1], newmc2); |
1783 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_M_SAVE_OVERWRITE); |
1784 | - | format(AOE_STR, sizeof(AOE_STR), "* Updated your attached object color (MC2) to 0x{%06x}%x{%06x} (%i) at slot/index number %d!", newmc2 & 0xFFFFFF, newmc2, COLOR_GREEN >>> 8, newmc2, slot); |
1784 | + | format(AOE_STR, sizeof AOE_STR, "~g~~h~Attached object file saved~n~%s", EPV[playerid][PAO_NAME]); |
1785 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1785 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
1786 | - | GameTextForPlayer(playerid, "~g~Attached object color updated!", 3000, 3); |
1786 | + | |
1787 | else | |
1788 | - | else |
1788 | + | |
1789 | - | { |
1789 | + | SendClientMessage(playerid, AOE_COLOR1, AOE_M_SAVE_ERROR); |
1790 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you don't have attached object at slot/index number %d!", slot); |
1790 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_DATA); |
1791 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1791 | + | |
1792 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~You have no attached object~n~~w~index/number: %d", slot); |
1792 | + | |
1793 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1793 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_SAVE, AOE_D_SAVE, AOE_T_SAVE, AOE_B_SAVE, AOE_B_BACK); |
1794 | } | |
1795 | - | } |
1795 | + | case AOE_D_SAVE2: |
1796 | - | else |
1796 | + | |
1797 | - | { |
1797 | + | if(response) |
1798 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid attached object slot/index number [%d]!", slot); |
1798 | + | |
1799 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1799 | + | if(AOE_EnteredValidFileName(playerid, inputtext)) |
1800 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 3000, 3); |
1800 | + | |
1801 | - | } |
1801 | + | strupdate(EPV[playerid][PAO_NAME], inputtext); |
1802 | format(AOFileName, sizeof AOFileName, AOE_FILE_NAME, inputtext); | |
1803 | if(AOE_EnteredNonExistFileName2(playerid, AOFileName)) cmd_saveallattachedobjects(playerid, inputtext); | |
1804 | } | |
1805 | else AOE_ShowPlayerDialog(playerid, AOE_C_SAVE, AOE_D_SAVE2, AOE_T_SAVE_SET, AOE_B_SAVE, AOE_B_BACK); | |
1806 | } | |
1807 | else AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_ALL, AOE_D_SAVE_SLOT, AOE_T_SAVE_SET, AOE_B_SELECT, AOE_B_SELECT_INDEX); | |
1808 | } | |
1809 | case AOE_D_SAVE2_REPLACE: | |
1810 | { | |
1811 | - | switch(dialogid) |
1811 | + | if(response) |
1812 | { | |
1813 | - | case E_AOED: |
1813 | + | format(AOFileName, sizeof AOFileName, AOE_FILE_NAME, EPV[playerid][PAO_NAME]); |
1814 | - | { |
1814 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_SAVING_SET); |
1815 | - | if(response) |
1815 | + | slots = AOE_SavePlayerAttachedObject(playerid, AOFileName, MAX_PLAYER_ATTACHED_OBJECTS, "", AOFileLen); |
1816 | - | { |
1816 | + | |
1817 | { | |
1818 | format(AOE_STR, sizeof AOE_STR, "* Your attached object set has been saved as \"{FFFFFF}%s{%06x}\" (Total: %d|Size: %.2f KB)!", EPV[playerid][PAO_NAME], AOE_COLOR2 >>> 8, slots, AOFileLen); | |
1819 | - | case 0: cmd_createattachedobject(playerid, ""); |
1819 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
1820 | - | case 1: cmd_duplicateattachedobject(playerid, ""); |
1820 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_M_SAVE_SET_OVERWRITE); |
1821 | - | case 2: cmd_editattachedobject(playerid, ""); |
1821 | + | format(AOE_STR, sizeof AOE_STR, "~g~~h~Attached object(s) file saved~n~%s", EPV[playerid][PAO_NAME]); |
1822 | - | case 3: cmd_setattachedobjectindex(playerid, ""); |
1822 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
1823 | - | case 4: cmd_setattachedobjectmodel(playerid, ""); |
1823 | + | |
1824 | - | case 5: cmd_setattachedobjectbone(playerid, ""); |
1824 | + | else SendClientMessage(playerid, AOE_COLOR1, AOE_M_SAVE_SET_ERROR); |
1825 | - | case 6: cmd_saveattachedobject(playerid, ""); |
1825 | + | |
1826 | - | case 7: cmd_saveattachedobjects(playerid, ""); |
1826 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_SAVE, AOE_D_SAVE2, AOE_T_SAVE_SET, AOE_B_SAVE, AOE_B_BACK); |
1827 | - | case 8: cmd_loadattachedobject(playerid, ""); |
1827 | + | |
1828 | - | case 9: cmd_loadattachedobjects(playerid, ""); |
1828 | + | case AOE_D_DELETE: |
1829 | - | case 10: cmd_removeattachedobject(playerid, ""); |
1829 | + | |
1830 | - | case 11: cmd_removeattachedobjects(playerid, ""); |
1830 | + | if(response) |
1831 | - | case 12: cmd_undeleteattachedobject(playerid, ""); |
1831 | + | |
1832 | - | case 13: cmd_attachedobjectstats(playerid, ""); |
1832 | + | if(AOE_EnteredValidFileName(playerid, inputtext)) |
1833 | - | case 14: cmd_totalattachedobjects(playerid, ""); |
1833 | + | |
1834 | - | case 15: AOE_ShowPlayerDialog(playerid, 1, E_AOED_HELP, "Attached Object Editor Help", "Close"); |
1834 | + | format(AOFileName, sizeof AOFileName, AOE_FILE_NAME, inputtext); |
1835 | - | case 16: AOE_ShowPlayerDialog(playerid, 2, E_AOED_ABOUT, "About Attached Object Editor", "Close"); |
1835 | + | if(AOE_EnteredExistedFileName(playerid, AOFileName)) |
1836 | { | |
1837 | - | } |
1837 | + | cmd_deleteattachedobjectfile(playerid, inputtext); |
1838 | - | else SendClientMessage(playerid, COLOR_WHITE, "* You've closed attached object editor dialog"); |
1838 | + | |
1839 | - | } |
1839 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_DELETE, AOE_D_DELETE, AOE_T_DELETE, AOE_B_DELETE, AOE_B_CANCEL); |
1840 | - | case E_AOED_CREATE_SLOT: |
1840 | + | |
1841 | else if(isnull(inputtext)) AOE_ShowPlayerDialog(playerid, AOE_C_DELETE, AOE_D_DELETE, AOE_T_DELETE, AOE_B_DELETE, AOE_B_CANCEL); | |
1842 | - | if(response) |
1842 | + | |
1843 | else SendClientMessage(playerid, AOE_COLOR4, AOE_M_DELETE_CANCEL); | |
1844 | - | valstr(AOE_STR, listitem); |
1844 | + | |
1845 | - | cmd_createattachedobject(playerid, AOE_STR); |
1845 | + | case AOE_D_EDIT_SLOT: |
1846 | - | } |
1846 | + | |
1847 | - | } |
1847 | + | if(response) |
1848 | - | case E_AOED_CREATE_MODEL: |
1848 | + | |
1849 | - | { |
1849 | + | if(IsPlayerAttachedObjectSlotUsed(playerid, listitem)) |
1850 | - | if(response) |
1850 | + | |
1851 | EPV[playerid][PAO_INDEX1] = listitem; | |
1852 | - | new model; |
1852 | + | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object (%d)", listitem); |
1853 | - | model = strval(inputtext), SetPVarInt(playerid, "PAO_CAOM", model); |
1853 | + | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT, AOE_D_EDIT, AOE_STR, AOE_B_SELECT, AOE_B_CANCEL); |
1854 | - | if(!IsValidObjectModel(model) || !IsNumeric(inputtext)) |
1854 | + | |
1855 | else | |
1856 | - | format(AOE_STR, sizeof(AOE_STR), "* Sorry, you've entered an invalid object model number/id [%s]!", inputtext); |
1856 | + | |
1857 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
1857 | + | |
1858 | - | GameTextForPlayer(playerid, "~r~~h~Invalid object model!", 3000, 3); |
1858 | + | |
1859 | } | |
1860 | - | else AOE_ShowPlayerDialog(playerid, 4, E_AOED_CREATE_BONE, "Create Attached Object", "Select", "Sel Model"); |
1860 | + | |
1861 | - | } |
1861 | + | else SendClientMessage(playerid, AOE_COLOR0, AOE_M_EDIT_CANCEL); |
1862 | - | else AOE_ShowPlayerDialog(playerid, 5, E_AOED_CREATE_SLOT, "Create Attached Object", "Select", "Cancel"); |
1862 | + | |
1863 | - | } |
1863 | + | case AOE_D_EDIT: |
1864 | - | case E_AOED_CREATE_BONE: |
1864 | + | |
1865 | - | { |
1865 | + | if(response) |
1866 | - | if(response) |
1866 | + | |
1867 | valstr(AOE_STR, EPV[playerid][PAO_INDEX1]); | |
1868 | - | new slot = GetPVarInt(playerid, "PAO_CAOI"), model = GetPVarInt(playerid, "PAO_CAOM"), bone = listitem+1; |
1868 | + | |
1869 | - | SetPVarInt(playerid, "PAO_CAOB", bone); |
1869 | + | |
1870 | - | CreatePlayerAttachedObject(playerid, slot, model, bone); |
1870 | + | case 0: cmd_editattachedobject(playerid, AOE_STR); |
1871 | - | format(AOE_STR, sizeof(AOE_STR), "* Created attached object model %d at slot/index number %d [Bone: %s (%d)]!", model, slot, GetAttachedObjectBoneName(bone), bone); |
1871 | + | case 1: |
1872 | - | SendClientMessage(playerid, COLOR_BLUE, AOE_STR); |
1872 | + | |
1873 | - | format(AOE_STR, sizeof(AOE_STR), "~b~Created attached object~n~~w~index/number: %d~n~Model: %d - Bone: %d", slot, model, bone); |
1873 | + | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object Properties (%d)", listitem); |
1874 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1874 | + | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT_PROPERTIES, AOE_D_EDIT_PROPERTIES, AOE_STR, AOE_B_EDIT, AOE_B_CANCEL); |
1875 | - | AOE_ShowPlayerDialog(playerid, 9, E_AOED_CREATE_EDIT, "Create Attached Object (Edit)", "Edit", "Skip"); |
1875 | + | |
1876 | - | } |
1876 | + | case 2: cmd_attachedobjectproperties(playerid, AOE_STR); |
1877 | - | else AOE_ShowPlayerDialog(playerid, 3, E_AOED_CREATE_MODEL, "Create Attached Object", "Enter", "Sel Index"); |
1877 | + | case 3: cmd_duplicateattachedobject(playerid, AOE_STR); |
1878 | - | } |
1878 | + | case 4: cmd_removeattachedobject(playerid, AOE_STR); |
1879 | - | case E_AOED_CREATE_REPLACE: |
1879 | + | |
1880 | - | { |
1880 | + | |
1881 | - | if(response) AOE_ShowPlayerDialog(playerid, 3, E_AOED_CREATE_MODEL, "Create Attached Object", "Enter", "Sel Index"); |
1881 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_USED, AOE_D_EDIT_SLOT, AOE_T_EDIT, AOE_B_SELECT, AOE_B_CLOSE); |
1882 | - | else AOE_ShowPlayerDialog(playerid, 5, E_AOED_CREATE_SLOT, "Create Attached Object", "Select", "Cancel"); |
1882 | + | |
1883 | - | } |
1883 | + | case AOE_D_EDIT_PROPERTIES: |
1884 | - | case E_AOED_CREATE_EDIT: |
1884 | + | |
1885 | - | { |
1885 | + | if(response) |
1886 | - | if(response) |
1886 | + | |
1887 | valstr(AOE_STR, EPV[playerid][PAO_INDEX1]); | |
1888 | - | valstr(AOE_STR, GetPVarInt(playerid, "PAO_CAOI")); |
1888 | + | if(3 <= listitem <= 13) EPV[playerid][PAO_EDITING] = listitem; |
1889 | switch(listitem) | |
1890 | { | |
1891 | case 0: cmd_setattachedobjectindex(playerid, AOE_STR); | |
1892 | case 1: cmd_setattachedobjectmodel(playerid, AOE_STR); | |
1893 | - | SendClientMessage(playerid, COLOR_WHITE, "* You've skipped to edit your attached object"); |
1893 | + | case 2: cmd_setattachedobjectbone(playerid, AOE_STR); |
1894 | - | SendClientMessage(playerid, COLOR_WHITE, "** Note: use /editattachedobject command to edit your attached object"); |
1894 | + | case 3..5: // offset |
1895 | { | |
1896 | - | } |
1896 | + | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object %c (%d)", ('X'-3)+listitem, EPV[playerid][PAO_INDEX1]); |
1897 | - | case E_AOED_EDIT_SLOT: |
1897 | + | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT_XYZ, AOE_D_EDIT_XYZ, AOE_STR, AOE_B_ENTER, AOE_B_BACK); |
1898 | - | { |
1898 | + | |
1899 | - | if(response) |
1899 | + | case 6..8: // rotation |
1900 | - | { |
1900 | + | |
1901 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, listitem)) |
1901 | + | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object R%c (%d)", ('X'-6)+listitem, EPV[playerid][PAO_INDEX1]); |
1902 | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT_XYZ, AOE_D_EDIT_XYZ, AOE_STR, AOE_B_ENTER, AOE_B_BACK); | |
1903 | - | valstr(AOE_STR, listitem); |
1903 | + | |
1904 | - | cmd_editattachedobject(playerid, AOE_STR); |
1904 | + | case 9..11: // scale |
1905 | { | |
1906 | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object S%c (%d)", ('X'-9)+listitem, EPV[playerid][PAO_INDEX1]); | |
1907 | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT_XYZ, AOE_D_EDIT_XYZ, AOE_STR, AOE_B_ENTER, AOE_B_BACK); | |
1908 | } | |
1909 | case 12..13: // color | |
1910 | { | |
1911 | - | } |
1911 | + | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object Color %c (%d)", ('1'-12)+listitem, EPV[playerid][PAO_INDEX1]); |
1912 | - | SetPVarInt(playerid, "PAO_EAO", 0); |
1912 | + | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT_COLOR, AOE_D_EDIT_COLOR, AOE_STR, AOE_B_ENTER, AOE_B_BACK); |
1913 | - | } |
1913 | + | |
1914 | - | case E_AOED_REMOVE_SLOT: |
1914 | + | |
1915 | - | { |
1915 | + | |
1916 | - | if(response) |
1916 | + | |
1917 | { | |
1918 | - | valstr(AOE_STR, listitem); |
1918 | + | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object (%d)", EPV[playerid][PAO_INDEX1]); |
1919 | - | cmd_removeattachedobject(playerid, AOE_STR); |
1919 | + | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT, AOE_D_EDIT, AOE_STR, AOE_B_SELECT, AOE_B_CANCEL); |
1920 | - | } |
1920 | + | |
1921 | - | } |
1921 | + | |
1922 | - | case E_AOED_REMOVEALL: |
1922 | + | case AOE_D_SET_SLOT: |
1923 | - | { |
1923 | + | |
1924 | - | if(response) |
1924 | + | if(response) |
1925 | - | { |
1925 | + | |
1926 | - | new slots = RemovePlayerAttachedObjectEx(playerid, MAX_PLAYER_ATTACHED_OBJECTS); |
1926 | + | format(AOE_STR, sizeof AOE_STR, "%d %d", EPV[playerid][PAO_INDEX1], listitem); |
1927 | - | format(AOE_STR, sizeof(AOE_STR), "* You've removed all of your %d attached object(s)!", slots); |
1927 | + | |
1928 | - | SendClientMessage(playerid, COLOR_RED, AOE_STR); |
1928 | + | |
1929 | - | format(AOE_STR, sizeof(AOE_STR), "~r~Removed all your attached object(s)~n~~w~Total: %d", slots); |
1929 | + | |
1930 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1930 | + | |
1931 | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object (%d)", EPV[playerid][PAO_INDEX1]); | |
1932 | - | else SendClientMessage(playerid, COLOR_WHITE, "* You've canceled removing all your attached object(s)"); |
1932 | + | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT_PROPERTIES, AOE_D_EDIT_PROPERTIES, AOE_STR, AOE_B_SELECT, AOE_B_BACK); |
1933 | - | } |
1933 | + | |
1934 | - | case E_AOED_STATS_SLOT: |
1934 | + | |
1935 | case AOE_D_SET_SLOT_REPLACE: | |
1936 | - | if(response) |
1936 | + | |
1937 | if(response) | |
1938 | { | |
1939 | - | cmd_attachedobjectstats(playerid, AOE_STR); |
1939 | + | if(ChangePlayerAttachedObjectIndex(playerid, EPV[playerid][PAO_INDEX1], EPV[playerid][PAO_INDEX2])) |
1940 | - | } |
1940 | + | |
1941 | format(AOE_STR, sizeof AOE_STR, "* Moved & replaced your attached object from index number %d to %d!", EPV[playerid][PAO_INDEX1], EPV[playerid][PAO_INDEX2]); | |
1942 | - | case E_AOED_STATS: |
1942 | + | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); |
1943 | - | { |
1943 | + | format(AOE_STR, sizeof AOE_STR, "~g~Attached object moved~n~~w~index/number:~n~%d to %d", EPV[playerid][PAO_INDEX1], EPV[playerid][PAO_INDEX2]); |
1944 | - | if(response && IsPlayerAdmin(playerid)) |
1944 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
1945 | } | |
1946 | - | new slot = GetPVarInt(playerid, "PAO_AOSI"), targetid = GetPVarInt(playerid, "PAO_AOSU"); |
1946 | + | else SendClientMessage(playerid, AOE_COLOR1, AOE_M_SET_SLOT_FAIL); |
1947 | - | GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); |
1947 | + | |
1948 | - | printf(" >> Admin %s (ID:%d) has requested to print attached object stats", PlayerName, playerid); |
1948 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_EMPTY, AOE_D_SET_SLOT, AOE_T_SET_INDEX, AOE_B_SELECT, AOE_B_BACK); |
1949 | - | GetPlayerName(targetid, PlayerName, sizeof(PlayerName)); |
1949 | + | |
1950 | - | printf(" Player: %s (ID:%d)\nAttached object slot/index number: %d\n - Model ID/Number/Type: %d\n - Bone: %s (BID:%d)\n - Offsets:\n -- X: %.2f ~ Y: %.2f ~ Z: %.2f\n - Rotations:\n -- RX: %.2f ~ RY: %.2f ~ RZ: %.2f\ |
1950 | + | case AOE_D_SET_MODEL: |
1951 | - | \n - Scales:\n -- SX: %.2f ~ SY: %.2f ~ SZ: %.2f\n - Material Colors:\n -- Color 1: 0x%04x%04x (%i) ~ Color 2: 0x%04x%04x (%i)", PlayerName, targetid, slot, PAO[targetid][slot][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[targetid][slot][AO_BONE_ID]), |
1951 | + | |
1952 | - | PAO[targetid][slot][AO_BONE_ID], PAO[targetid][slot][AO_X], PAO[targetid][slot][AO_Y], PAO[targetid][slot][AO_Z], PAO[targetid][slot][AO_RX], PAO[targetid][slot][AO_RY], PAO[targetid][slot][AO_RZ], |
1952 | + | if(response) |
1953 | - | PAO[targetid][slot][AO_SX], PAO[targetid][slot][AO_SY], PAO[targetid][slot][AO_SZ], AOE_HexFormat(PAO[targetid][slot][AO_MC1]), PAO[targetid][slot][AO_MC1], AOE_HexFormat(PAO[targetid][slot][AO_MC2], PAO[targetid][slot][AO_MC2])); |
1953 | + | |
1954 | - | printf(" Skin: %d ~ Code usage (playerid = %d):\n SetPlayerAttachedObject(playerid, %d, %d, %d, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %d);", GetPlayerSkin(targetid), targetid, |
1954 | + | format(AOE_STR, sizeof AOE_STR, "%d %d", EPV[playerid][PAO_INDEX1], strval(inputtext)); |
1955 | - | slot, PAO[targetid][slot][AO_MODEL_ID], PAO[targetid][slot][AO_BONE_ID], PAO[targetid][slot][AO_X], PAO[targetid][slot][AO_Y], PAO[targetid][slot][AO_Z], PAO[targetid][slot][AO_RX], PAO[targetid][slot][AO_RY], PAO[targetid][slot][AO_RZ], |
1955 | + | |
1956 | - | PAO[targetid][slot][AO_SX], PAO[targetid][slot][AO_SY], PAO[targetid][slot][AO_SZ], PAO[targetid][slot][AO_MC1], PAO[targetid][slot][AO_MC2]); |
1956 | + | |
1957 | - | SendClientMessage(playerid, COLOR_WHITE, "SERVER: Attached object stats has been printed to server console!"); |
1957 | + | |
1958 | - | } |
1958 | + | |
1959 | - | else SendClientMessage(playerid, COLOR_WHITE, "* You've closed your attached object stats dialog"); |
1959 | + | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object (%d)", EPV[playerid][PAO_INDEX1]); |
1960 | - | } |
1960 | + | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT_PROPERTIES, AOE_D_EDIT_PROPERTIES, AOE_STR, AOE_B_SELECT, AOE_B_BACK); |
1961 | - | case E_AOED_DUPLICATE_SLOT1: |
1961 | + | |
1962 | - | { |
1962 | + | |
1963 | - | if(response) |
1963 | + | case AOE_D_SET_BONE: |
1964 | { | |
1965 | if(response) | |
1966 | { | |
1967 | - | } |
1967 | + | format(AOE_STR, sizeof AOE_STR, "%d %d", EPV[playerid][PAO_INDEX1], listitem+1); |
1968 | - | } |
1968 | + | |
1969 | - | case E_AOED_DUPLICATE_SLOT2: |
1969 | + | |
1970 | - | { |
1970 | + | |
1971 | - | if(response) |
1971 | + | |
1972 | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object (%d)", EPV[playerid][PAO_INDEX1]); | |
1973 | - | format(AOE_STR, sizeof(AOE_STR), "%d %d", GetPVarInt(playerid, "PAO_DAOI1"), listitem); |
1973 | + | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT_PROPERTIES, AOE_D_EDIT_PROPERTIES, AOE_STR, AOE_B_SELECT, AOE_B_BACK); |
1974 | } | |
1975 | - | } |
1975 | + | |
1976 | - | else AOE_ShowPlayerDialog(playerid, 6, E_AOED_DUPLICATE_SLOT1, "Duplicate Attached Object Index (1)", "Select", "Cancel"); |
1976 | + | case AOE_D_EDIT_XYZ: |
1977 | - | } |
1977 | + | |
1978 | - | case E_AOED_DUPLICATE_REPLACE: |
1978 | + | AOSelection = EPV[playerid][PAO_EDITING]; |
1979 | - | { |
1979 | + | if(response) |
1980 | - | if(response) |
1980 | + | |
1981 | - | { |
1981 | + | if(sscanf(inputtext, "f", AOAxis)) |
1982 | - | new slot1 = GetPVarInt(playerid, "PAO_DAOI1"), slot2 = GetPVarInt(playerid, "PAO_DAOI2"); |
1982 | + | |
1983 | - | DuplicatePlayerAttachedObject(playerid, slot1, slot2); |
1983 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_INVALID_XYZ); |
1984 | - | format(AOE_STR, sizeof(AOE_STR), "* Duplicated your attached object from slot/index number %d to %d!", slot1, slot2); |
1984 | + | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object XYZ (%d)", EPV[playerid][PAO_INDEX1]); |
1985 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
1985 | + | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT_XYZ, AOE_D_EDIT_XYZ, AOE_STR, AOE_B_ENTER, AOE_B_BACK); |
1986 | - | format(AOE_STR, sizeof(AOE_STR), "~g~Attached object duplicated~n~~w~index/number:~n~%d to %d", slot1, slot2); |
1986 | + | |
1987 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
1987 | + | |
1988 | - | } |
1988 | + | |
1989 | - | else AOE_ShowPlayerDialog(playerid, 5, E_AOED_DUPLICATE_SLOT2, "Duplicate Attached Object Index (2)", "Select", "Sel Idx1"); |
1989 | + | EPV[playerid][PAO_EDITING] = 0; |
1990 | - | } |
1990 | + | switch(AOSelection) |
1991 | - | case E_AOED_SET_SLOT1: |
1991 | + | |
1992 | - | { |
1992 | + | case 3..5: |
1993 | - | if(response) |
1993 | + | |
1994 | format(AOE_STR, sizeof AOE_STR, "%d %c %f", EPV[playerid][PAO_INDEX1], ('x'-3)+AOSelection, AOAxis); | |
1995 | - | valstr(AOE_STR, listitem); |
1995 | + | cmd_setattachedobjectoffset(playerid, AOE_STR); |
1996 | } | |
1997 | - | } |
1997 | + | case 6..8: |
1998 | - | } |
1998 | + | |
1999 | - | case E_AOED_SET_SLOT2: |
1999 | + | format(AOE_STR, sizeof AOE_STR, "%d %c %f", EPV[playerid][PAO_INDEX1], ('x'-6)+AOSelection, AOAxis); |
2000 | cmd_setattachedobjectrot(playerid, AOE_STR); | |
2001 | - | if(response) |
2001 | + | |
2002 | case 9..11: | |
2003 | - | format(AOE_STR, sizeof(AOE_STR), "%d %d", GetPVarInt(playerid, "PAO_SAOI1"), listitem); |
2003 | + | |
2004 | format(AOE_STR, sizeof AOE_STR, "%d %c %f", EPV[playerid][PAO_INDEX1], ('x'-9)+AOSelection, AOAxis); | |
2005 | - | } |
2005 | + | cmd_setattachedobjectscale(playerid, AOE_STR); |
2006 | - | else AOE_ShowPlayerDialog(playerid, 6, E_AOED_SET_SLOT1, "Set Attached Object Index (1)", "Select", "Cancel"); |
2006 | + | |
2007 | } | |
2008 | - | case E_AOED_SET_SLOT_REPLACE: |
2008 | + | |
2009 | } | |
2010 | - | if(response) |
2010 | + | |
2011 | - | { |
2011 | + | |
2012 | - | new slot = GetPVarInt(playerid, "PAO_SAOI1"), newslot = GetPVarInt(playerid, "PAO_SAOI2"); |
2012 | + | EPV[playerid][PAO_EDITING] = 0; |
2013 | - | MovePlayerAttachedObjectIndex(playerid, slot, newslot); |
2013 | + | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object (%d)", EPV[playerid][PAO_INDEX1]); |
2014 | - | format(AOE_STR, sizeof(AOE_STR), "* Moved & replaced your attached object from slot/index number %d to %d!", slot, newslot); |
2014 | + | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT_PROPERTIES, AOE_D_EDIT_PROPERTIES, AOE_STR, AOE_B_SELECT, AOE_B_BACK); |
2015 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
2015 | + | |
2016 | - | format(AOE_STR, sizeof(AOE_STR), "~g~Attached object moved~n~~w~index/number:~n~%d to %d", slot, newslot); |
2016 | + | |
2017 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
2017 | + | case AOE_D_EDIT_COLOR: |
2018 | - | } |
2018 | + | |
2019 | - | else AOE_ShowPlayerDialog(playerid, 5, E_AOED_SET_SLOT2, "Set Attached Object Index (2)", "Select", "Sel Idx1"); |
2019 | + | AOSelection = EPV[playerid][PAO_EDITING]; |
2020 | if(response) | |
2021 | - | case E_AOED_SET_MODEL_SLOT: |
2021 | + | |
2022 | if(sscanf(inputtext, "x", AOMC)) | |
2023 | - | if(response) |
2023 | + | |
2024 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_INVALID_COLOR); | |
2025 | - | valstr(AOE_STR, listitem); |
2025 | + | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object Color (%d)", EPV[playerid][PAO_INDEX1]); |
2026 | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT_COLOR, AOE_D_EDIT_COLOR, AOE_STR, AOE_B_ENTER, AOE_B_BACK); | |
2027 | - | } |
2027 | + | |
2028 | else | |
2029 | - | case E_AOED_SET_MODEL: |
2029 | + | |
2030 | EPV[playerid][PAO_EDITING] = 0; | |
2031 | - | if(response) |
2031 | + | format(AOE_STR, sizeof AOE_STR, "%d %x", EPV[playerid][PAO_INDEX1], AOMC); |
2032 | switch(AOSelection) | |
2033 | - | format(AOE_STR, sizeof(AOE_STR), "%d %d", GetPVarInt(playerid, "PAO_SAOMI"), strval(inputtext)); |
2033 | + | |
2034 | - | cmd_setattachedobjectmodel(playerid, AOE_STR); |
2034 | + | case 12: cmd_setattachedobjectmc1(playerid, AOE_STR); |
2035 | - | } |
2035 | + | case 13: cmd_setattachedobjectmc2(playerid, AOE_STR); |
2036 | - | else AOE_ShowPlayerDialog(playerid, 6, E_AOED_SET_MODEL_SLOT, "Set Attached Object Model", "Select", "Cancel"); |
2036 | + | |
2037 | } | |
2038 | - | case E_AOED_SET_BONE_SLOT: |
2038 | + | |
2039 | else | |
2040 | - | if(response) |
2040 | + | |
2041 | EPV[playerid][PAO_EDITING] = 0; | |
2042 | - | valstr(AOE_STR, listitem); |
2042 | + | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object (%d)", EPV[playerid][PAO_INDEX1]); |
2043 | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT_PROPERTIES, AOE_D_EDIT_PROPERTIES, AOE_STR, AOE_B_SELECT, AOE_B_BACK); | |
2044 | - | } |
2044 | + | |
2045 | } | |
2046 | - | case E_AOED_SET_BONE: |
2046 | + | case AOE_D_PROPERTIES: |
2047 | { | |
2048 | - | if(response) |
2048 | + | if(response && IsPlayerAdmin(playerid)) |
2049 | { | |
2050 | - | format(AOE_STR, sizeof(AOE_STR), "%d %d", GetPVarInt(playerid, "PAO_SAOBI"), listitem+1); |
2050 | + | AOSlot = EPV[playerid][PAO_INDEX1], AOTarget = EPV[playerid][PAO_TARGET]; |
2051 | GetPlayerName(playerid, pName, sizeof pName); | |
2052 | - | } |
2052 | + | printf(" >> Admin %s (ID:%d) has requested to print attached object properties", pName, playerid); |
2053 | - | else AOE_ShowPlayerDialog(playerid, 6, E_AOED_SET_BONE_SLOT, "Set Attached Object Bone", "Select", "Cancel"); |
2053 | + | GetPlayerName(AOTarget, pName, sizeof pName); |
2054 | printf(" Player: %s (ID:%d)\n Attached object index number: %d\n - Model ID/type number: %d\n - Bone: %s (%d)\n - Offsets:\n -- X: %.2f ~ Y: %.2f ~ Z: %.2f\n - Rotations:\n -- RX: %.2f ~ RY: %.2f ~ RZ: %.2f\ | |
2055 | - | case E_AOED_SAVE_SLOT: |
2055 | + | \n - Scales:\n -- SX: %.2f ~ SY: %.2f ~ SZ: %.2f\n - Material Colors:\n -- Color 1: 0x%04x%04x (%i) ~ Color 2: 0x%04x%04x (%i)", pName, AOTarget, AOSlot, PAO[AOTarget][AOSlot][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[AOTarget][AOSlot][AO_BONE_ID]), |
2056 | PAO[AOTarget][AOSlot][AO_BONE_ID], PAO[AOTarget][AOSlot][AO_X], PAO[AOTarget][AOSlot][AO_Y], PAO[AOTarget][AOSlot][AO_Z], PAO[AOTarget][AOSlot][AO_RX], PAO[AOTarget][AOSlot][AO_RY], PAO[AOTarget][AOSlot][AO_RZ], | |
2057 | - | if(response) |
2057 | + | PAO[AOTarget][AOSlot][AO_SX], PAO[AOTarget][AOSlot][AO_SY], PAO[AOTarget][AOSlot][AO_SZ], HexPrintFormat(PAO[AOTarget][AOSlot][AO_MC1]), PAO[AOTarget][AOSlot][AO_MC1], HexPrintFormat(PAO[AOTarget][AOSlot][AO_MC2], PAO[AOTarget][AOSlot][AO_MC2])); |
2058 | printf(" Skin: %d ~ Code usage (playerid = %d):\n SetPlayerAttachedObject(playerid, %d, %d, %d, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %d);", GetPlayerSkin(AOTarget), AOTarget, | |
2059 | - | valstr(AOE_STR, listitem); |
2059 | + | AOSlot, PAO[AOTarget][AOSlot][AO_MODEL_ID], PAO[AOTarget][AOSlot][AO_BONE_ID], PAO[AOTarget][AOSlot][AO_X], PAO[AOTarget][AOSlot][AO_Y], PAO[AOTarget][AOSlot][AO_Z], PAO[AOTarget][AOSlot][AO_RX], PAO[AOTarget][AOSlot][AO_RY], PAO[AOTarget][AOSlot][AO_RZ], |
2060 | - | cmd_saveattachedobject(playerid, AOE_STR); |
2060 | + | PAO[AOTarget][AOSlot][AO_SX], PAO[AOTarget][AOSlot][AO_SY], PAO[AOTarget][AOSlot][AO_SZ], PAO[AOTarget][AOSlot][AO_MC1], PAO[AOTarget][AOSlot][AO_MC2]); |
2061 | SendClientMessage(playerid, AOE_COLOR0, AOE_M_OBJECT_DATA_S_PRINT); | |
2062 | } | |
2063 | - | case E_AOED_SAVE: |
2063 | + | else SendClientMessage(playerid, AOE_COLOR0, AOE_M_PROPERTIES_CLOSE); |
2064 | } | |
2065 | - | if(response) |
2065 | + | case AOE_D_DUPLICATE_SLOT: |
2066 | { | |
2067 | - | format(AOE_STR, sizeof(AOE_STR), "%d %s", GetPVarInt(playerid, "PAO_SAOI"), inputtext); |
2067 | + | if(response) |
2068 | - | cmd_saveattachedobject(playerid, AOE_STR); |
2068 | + | |
2069 | format(AOE_STR, sizeof AOE_STR, "%d %d", EPV[playerid][PAO_INDEX1], listitem); | |
2070 | - | else AOE_ShowPlayerDialog(playerid, 6, E_AOED_SAVE_SLOT, "Save Attached Object", "Select", "Cancel"); |
2070 | + | |
2071 | } | |
2072 | - | case E_AOED_SAVE_REPLACE: |
2072 | + | |
2073 | { | |
2074 | - | if(response) |
2074 | + | format(AOE_STR, sizeof AOE_STR, "Edit Attached Object (%d)", EPV[playerid][PAO_INDEX1]); |
2075 | AOE_ShowPlayerDialog(playerid, AOE_C_EDIT, AOE_D_EDIT, AOE_STR, AOE_B_SELECT, AOE_B_CANCEL); | |
2076 | - | new filename[32+1], slot = GetPVarInt(playerid, "PAO_SAOI"), filelen; |
2076 | + | |
2077 | - | GetPVarString(playerid, "PAO_SAON", filename, sizeof(filename)); |
2077 | + | |
2078 | - | SendClientMessage(playerid, COLOR_WHITE, "* Saving attached object file, please wait..."); |
2078 | + | case AOE_D_DUPLICATE_REPLACE: |
2079 | - | if(AOE_SavePlayerAttachedObject(playerid, filename, slot, "", filelen)) |
2079 | + | |
2080 | - | { |
2080 | + | if(response) |
2081 | - | format(AOE_STR, sizeof(AOE_STR), "** Your attached object from index %d has been saved as \"%s\" (Model: %d - Bone: %d - %d bytes)!", slot, filename, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID], filelen); |
2081 | + | |
2082 | - | SendClientMessage(playerid, COLOR_BLUE, AOE_STR); |
2082 | + | DuplicatePlayerAttachedObject(playerid, EPV[playerid][PAO_INDEX1], EPV[playerid][PAO_INDEX2]); |
2083 | - | SendClientMessage(playerid, COLOR_BLUE, "** The attached object data on file has been overwritten (Re-Created)"); |
2083 | + | format(AOE_STR, sizeof AOE_STR, "* Duplicated your attached object from index number %d to %d!", EPV[playerid][PAO_INDEX1], EPV[playerid][PAO_INDEX2]); |
2084 | SendClientMessage(playerid, AOE_COLOR2, AOE_STR); | |
2085 | - | else |
2085 | + | format(AOE_STR, sizeof AOE_STR, "~g~Attached object duplicated~n~~w~index/number:~n~%d to %d", EPV[playerid][PAO_INDEX1], EPV[playerid][PAO_INDEX2]); |
2086 | AOE_GameTextForPlayer(playerid, AOE_STR); | |
2087 | - | SendClientMessage(playerid, COLOR_RED, "* Error: Invalid attached object data, save canceled"); |
2087 | + | |
2088 | - | GameTextForPlayer(playerid, "~r~~h~Invalid attached object data!", 3000, 3); |
2088 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_SLOT_EMPTY, AOE_D_DUPLICATE_SLOT, AOE_T_DUPLICATE, AOE_B_SELECT, AOE_B_BACK); |
2089 | } | |
2090 | case AOE_D_REMOVE_ALL: | |
2091 | { | |
2092 | - | case E_AOED_SAVE2: if(response) cmd_saveattachedobjects(playerid, inputtext); |
2092 | + | if(response) |
2093 | - | case E_AOED_SAVE2_REPLACE: |
2093 | + | |
2094 | slots = RemovePlayerAttachedObjectEx(playerid, MAX_PLAYER_ATTACHED_OBJECTS); | |
2095 | - | if(response) |
2095 | + | format(AOE_STR, sizeof AOE_STR, "* You've removed all %d of your attached object(s)!", slots); |
2096 | SendClientMessage(playerid, AOE_COLOR1, AOE_STR); | |
2097 | - | new filename[32+1], filelen; |
2097 | + | format(AOE_STR, sizeof AOE_STR, "~r~Removed all your attached object(s)~n~~w~Total: %d", slots); |
2098 | - | GetPVarString(playerid, "PAO_SAON", filename, sizeof(filename)); |
2098 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
2099 | - | SendClientMessage(playerid, COLOR_WHITE, "* Saving attached object(s) set file, please wait..."); |
2099 | + | |
2100 | - | new slots = AOE_SavePlayerAttachedObject(playerid, filename, MAX_PLAYER_ATTACHED_OBJECTS, "", filelen); |
2100 | + | else SendClientMessage(playerid, AOE_COLOR0, AOE_M_REMOVE_ALL_CANCEL); |
2101 | } | |
2102 | case AOE_D_REFRESH: | |
2103 | - | format(AOE_STR, sizeof(AOE_STR), "** Your attached object set has been saved as \"%s\" (Total: %d - %d bytes)!", filename, slots, filelen); |
2103 | + | |
2104 | - | SendClientMessage(playerid, COLOR_BLUE, AOE_STR); |
2104 | + | AOTarget = EPV[playerid][PAO_TARGET]; |
2105 | - | SendClientMessage(playerid, COLOR_BLUE, "** The attached object(s) data on file has been overwritten (Re-Created)"); |
2105 | + | if(response) |
2106 | { | |
2107 | - | else SendClientMessage(playerid, COLOR_RED, "** Error: file saving was canceled because there were no valid attached object!"); |
2107 | + | if(AOE_TargetHasSlot(playerid, AOTarget, listitem)) |
2108 | { | |
2109 | format(AOE_STR, sizeof AOE_STR, "%d %d", AOTarget, listitem); | |
2110 | - | case E_AOED_LOAD: if(response) cmd_loadattachedobject(playerid, inputtext); |
2110 | + | cmd_refreshattachedobject(playerid, AOE_STR); |
2111 | - | case E_AOED_LOAD_SLOT: |
2111 | + | |
2112 | else AOE_ShowPlayerDialog(playerid, AOE_C_REFRESH, AOE_D_REFRESH, AOE_T_REFRESH, AOE_B_SELECT, AOE_B_CANCEL); | |
2113 | - | if(response) |
2113 | + | |
2114 | else | |
2115 | - | GetPVarString(playerid, "PAO_LAON", AOE_STR, sizeof(AOE_STR)); |
2115 | + | |
2116 | - | format(AOE_STR, sizeof(AOE_STR), "%s %d", AOE_STR, strval(inputtext)); |
2116 | + | GetPlayerName(AOTarget, pName, sizeof pName); |
2117 | - | cmd_loadattachedobject(playerid, AOE_STR); |
2117 | + | format(AOE_STR, sizeof AOE_STR, "* You've canceled loading %s (ID:%d)'s attached object from index %d.", pName, EPV[playerid][PAO_TARGET], listitem); |
2118 | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); | |
2119 | - | else AOE_ShowPlayerDialog(playerid, 14, E_AOED_LOAD, "Load Attached Object", "Enter", "Cancel"); |
2119 | + | |
2120 | } | |
2121 | - | case E_AOED_LOAD_REPLACE: |
2121 | + | case AOE_D_REFRESH_REPLACE: |
2122 | { | |
2123 | - | if(response) |
2123 | + | AOTarget = EPV[playerid][PAO_TARGET]; |
2124 | if(response) | |
2125 | - | SendClientMessage(playerid, COLOR_WHITE, "* Loading attached object file, please wait..."); |
2125 | + | |
2126 | - | new slot = GetPVarInt(playerid, "PAO_LAOI"), filename[32+1], comment[64+1]; |
2126 | + | format(AOE_STR, sizeof AOE_STR, "%d %d", AOTarget, EPV[playerid][PAO_INDEX1]); |
2127 | - | GetPVarString(playerid, "PAO_LAON", filename, sizeof(filename)); |
2127 | + | RemovePlayerAttachedObject(playerid, EPV[playerid][PAO_INDEX1]); |
2128 | - | if(AOE_LoadPlayerAttachedObject(playerid, filename, slot, comment, sizeof(comment))) |
2128 | + | cmd_refreshattachedobject(playerid, AOE_STR); |
2129 | - | { |
2129 | + | |
2130 | - | format(AOE_STR, sizeof(AOE_STR), "** You've loaded & replaced your attached object from file \"%s\" by s from skin d (Index: %d - Model: %d - Bone: %d)!", AOE_STR, |
2130 | + | else AOE_ShowPlayerDialog(playerid, AOE_C_REFRESH, AOE_D_REFRESH, AOE_T_REFRESH, AOE_B_SELECT, AOE_B_CANCEL); |
2131 | - | slot, PAO[playerid][slot][AO_MODEL_ID], PAO[playerid][slot][AO_BONE_ID]); |
2131 | + | |
2132 | - | SendClientMessage(playerid, COLOR_GREEN, AOE_STR); |
2132 | + | |
2133 | return 0; | |
2134 | - | } |
2134 | + | |
2135 | ||
2136 | - | case E_AOED_LOAD2: if(response) cmd_loadattachedobjects(playerid, inputtext); |
2136 | + | |
2137 | { | |
2138 | if(response == EDIT_RESPONSE_FINAL) | |
2139 | { | |
2140 | if(MAX_ATTACHED_OBJECT_OFFSET <= fOffsetX <= MIN_ATTACHED_OBJECT_OFFSET || MAX_ATTACHED_OBJECT_OFFSET <= fOffsetY <= MIN_ATTACHED_OBJECT_OFFSET || MAX_ATTACHED_OBJECT_OFFSET <= fOffsetZ <= MIN_ATTACHED_OBJECT_OFFSET | |
2141 | || MAX_ATTACHED_OBJECT_ROTATION <= fRotX <= MIN_ATTACHED_OBJECT_ROTATION || MAX_ATTACHED_OBJECT_ROTATION <= fRotY <= MIN_ATTACHED_OBJECT_ROTATION || MAX_ATTACHED_OBJECT_ROTATION <= fRotZ <= MIN_ATTACHED_OBJECT_ROTATION | |
2142 | || MAX_ATTACHED_OBJECT_SIZE <= fScaleX <= MIN_ATTACHED_OBJECT_SIZE || MAX_ATTACHED_OBJECT_SIZE <= fScaleY <= MIN_ATTACHED_OBJECT_SIZE || MAX_ATTACHED_OBJECT_SIZE <= fScaleZ <= MIN_ATTACHED_OBJECT_SIZE) | |
2143 | - | if(response == EDIT_RESPONSE_FINAL) |
2143 | + | |
2144 | format(AOE_STR, sizeof AOE_STR, "* Sorry your edit on index %d was aborted, because you cannot edit with value of:", index); | |
2145 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, index)) RemovePlayerAttachedObject(playerid, index); |
2145 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
2146 | - | UpdatePlayerAttachedObjectEx(playerid, index, modelid, boneid, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ, PAO[playerid][index][AO_MC1], PAO[playerid][index][AO_MC2]); |
2146 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_ACCEPTABLE_OFFSET); |
2147 | - | format(AOE_STR, sizeof(AOE_STR), "* You've edited your attached object from slot/index number %d", index); |
2147 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_ACCEPTABLE_ROTATION); |
2148 | - | SendClientMessage(playerid, COLOR_CYAN, AOE_STR); |
2148 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_M_ACCEPTABLE_SCALE); |
2149 | - | format(AOE_STR, sizeof(AOE_STR), "~b~~h~Edited your attached object~n~~w~index/number: %d", index); |
2149 | + | format(AOE_STR, sizeof AOE_STR, "* Edit was: X=%.2f|Y=%.2f|Z=%.2f|RX=%.2f|RY=%.2f|RZ=%.2f|SX=%.2f|SY=%.2f|SZ=%.2f", fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ); |
2150 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
2150 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); |
2151 | SetPlayerAttachedObject(playerid, index, PAO[playerid][index][AO_MODEL_ID], PAO[playerid][index][AO_BONE_ID], PAO[playerid][index][AO_X], PAO[playerid][index][AO_Y], PAO[playerid][index][AO_Z], | |
2152 | PAO[playerid][index][AO_RX], PAO[playerid][index][AO_RY], PAO[playerid][index][AO_RZ], PAO[playerid][index][AO_SX], PAO[playerid][index][AO_SY], PAO[playerid][index][AO_SZ], PAO[playerid][index][AO_MC1], PAO[playerid][index][AO_MC2]); | |
2153 | PAO[playerid][index][AO_STATUS] = 1; | |
2154 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, index)) RemovePlayerAttachedObject(playerid, index); |
2154 | + | |
2155 | else | |
2156 | - | PAO[playerid][index][AO_RX], PAO[playerid][index][AO_RY], PAO[playerid][index][AO_RZ], PAO[playerid][index][AO_SX], PAO[playerid][index][AO_SY], PAO[playerid][index][AO_SZ], PAO[playerid][index][AO_MC1], PAO[playerid][index][AO_MC2]); |
2156 | + | |
2157 | - | PAO[playerid][index][AO_STATUS] = 1; |
2157 | + | if(IsValidPlayerAttachedObject(playerid, index) != 1) |
2158 | - | format(AOE_STR, sizeof(AOE_STR), "* You've canceled editing your attached object from slot/index number %d", index); |
2158 | + | |
2159 | - | SendClientMessage(playerid, COLOR_YELLOW, AOE_STR); |
2159 | + | format(AOE_STR, sizeof AOE_STR, "* Refreshing attached object (ID:%d) data (excluding material colors)...", index); |
2160 | - | format(AOE_STR, sizeof(AOE_STR), "~r~~h~Canceled editing your attached object~n~~w~index/number: %d", index); |
2160 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
2161 | - | GameTextForPlayer(playerid, AOE_STR, 5000, 3); |
2161 | + | |
2162 | if(EPV[playerid][PAO_EDITING] == 2) | |
2163 | - | SetPVarInt(playerid, "PAO_EAO", 0); |
2163 | + | |
2164 | PAO[playerid][index][AO_STATUS] = 1; | |
2165 | PAO[playerid][index][AO_MODEL_ID] = modelid; | |
2166 | PAO[playerid][index][AO_BONE_ID] = boneid; | |
2167 | } | |
2168 | PAO[playerid][index][AO_X] = fOffsetX, PAO[playerid][index][AO_Y] = fOffsetY, PAO[playerid][index][AO_Z] = fOffsetZ; | |
2169 | PAO[playerid][index][AO_RX] = fRotX, PAO[playerid][index][AO_RY] = fRotY, PAO[playerid][index][AO_RZ] = fRotZ; | |
2170 | PAO[playerid][index][AO_SX] = fScaleX, PAO[playerid][index][AO_SY] = fScaleY, PAO[playerid][index][AO_SZ] = fScaleZ; | |
2171 | format(AOE_STR, sizeof AOE_STR, "* You've edited your attached object from index number %d.", index); | |
2172 | SendClientMessage(playerid, AOE_COLOR5, AOE_STR); | |
2173 | format(AOE_STR, sizeof AOE_STR, "~b~~h~Edited your attached object~n~~w~index/number: %d", index); | |
2174 | AOE_GameTextForPlayer(playerid, AOE_STR); | |
2175 | } | |
2176 | } | |
2177 | if(response == EDIT_RESPONSE_CANCEL) | |
2178 | { | |
2179 | - | if(GetPVarInt(playerid, "PAO_EAO") == 1) CancelEdit(playerid); |
2179 | + | |
2180 | - | DeletePVar(playerid, "PAO_CAOI"); |
2180 | + | |
2181 | - | DeletePVar(playerid, "PAO_CAOM"); |
2181 | + | |
2182 | - | DeletePVar(playerid, "PAO_CAOB"); |
2182 | + | format(AOE_STR, sizeof AOE_STR, "* You've canceled editing your attached object from index number %d.", index); |
2183 | - | DeletePVar(playerid, "PAO_EAO"); |
2183 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
2184 | - | DeletePVar(playerid, "PAO_AOSI"); |
2184 | + | format(AOE_STR, sizeof AOE_STR, "~r~~h~Canceled editing your attached object~n~~w~index/number: %d", index); |
2185 | - | DeletePVar(playerid, "PAO_AOSU"); |
2185 | + | AOE_GameTextForPlayer(playerid, AOE_STR); |
2186 | - | DeletePVar(playerid, "PAO_DAOI1"); |
2186 | + | |
2187 | - | DeletePVar(playerid, "PAO_DAOI2"); |
2187 | + | EPV[playerid][PAO_EDITING] = 0; |
2188 | - | DeletePVar(playerid, "PAO_SAOI1"); |
2188 | + | |
2189 | - | DeletePVar(playerid, "PAO_SAOI2"); |
2189 | + | |
2190 | - | DeletePVar(playerid, "PAO_SAOMI"); |
2190 | + | |
2191 | - | DeletePVar(playerid, "PAO_SAOBI"); |
2191 | + | public AOE_GetPVar(playerid, varname[]) |
2192 | - | DeletePVar(playerid, "PAO_SAOI"); |
2192 | + | |
2193 | - | DeletePVar(playerid, "PAO_SAON"); |
2193 | + | if(!strcmp(varname, "PAO_INDEX1")) return EPV[playerid][PAO_INDEX1]; |
2194 | - | DeletePVar(playerid, "PAO_LAON"); |
2194 | + | else if(!strcmp(varname, "PAO_INDEX2")) return EPV[playerid][PAO_INDEX2]; |
2195 | - | DeletePVar(playerid, "PAO_LAOI"); |
2195 | + | else if(!strcmp(varname, "PAO_MODEL_ID")) return EPV[playerid][PAO_MODEL_ID]; |
2196 | - | DeletePVar(playerid, "PAO_LAOR"); |
2196 | + | else if(!strcmp(varname, "PAO_BONE_ID")) return EPV[playerid][PAO_BONE_ID]; |
2197 | else if(!strcmp(varname, "PAO_EDITING")) return EPV[playerid][PAO_EDITING]; | |
2198 | else if(!strcmp(varname, "PAO_TARGET")) return EPV[playerid][PAO_TARGET]; | |
2199 | - | AOE_ShowPlayerDialog(playerid, type, dialogid, caption[], button1[], button2[] = "") |
2199 | + | else if(!strcmp(varname, "PAO_LAST_REMOVED")) return EPV[playerid][PAO_LAST_REMOVED]; |
2200 | else if(!strcmp(varname, "PAO_NAME")) return EPV[playerid][PAO_NAME]; | |
2201 | - | new AOE_STR2[1560], slot, slot2; |
2201 | + | return -1; |
2202 | - | switch(type) |
2202 | + | |
2203 | ||
2204 | - | case 0: // AOE menu |
2204 | + | |
2205 | - | { |
2205 | + | |
2206 | - | new slots = GetPlayerAttachedObjectsCount(playerid); |
2206 | + | |
2207 | - | slot = GetPVarInt(playerid, "PAO_LAOR"); |
2207 | + | |
2208 | - | if(!GetPVarType(playerid, "PAO_LAOR")) AOE_STR = "{FF3333}Restore your last deleted attached object"; |
2208 | + | |
2209 | - | else if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) format(AOE_STR, sizeof(AOE_STR), "{CCCCCC}Restore your last deleted attached object [Index:%d]", slot); |
2209 | + | |
2210 | - | else format(AOE_STR, sizeof(AOE_STR), "Restore your last deleted attached object [Index:%d]", slot); |
2210 | + | |
2211 | - | if(!slots) |
2211 | + | |
2212 | } | |
2213 | - | format(AOE_STR2, sizeof(AOE_STR2), "Create your attached object\n{FF3333}Duplicate your attached object\n{FF3333}Edit your attached object\n\ |
2213 | + | |
2214 | - | {FF3333}Edit your attached object index\n{FF3333}Edit your attached object model\n{FF3333}Edit your attached object bone\n\ |
2214 | + | |
2215 | - | {FF3333}Save your attached object\n{FF3333}Save all of your attached object(s) [Total:%d]\nLoad attached object file\nLoad attached object(s) set", slots); |
2215 | + | |
2216 | - | format(AOE_STR2, sizeof(AOE_STR2), "%s\n{FF3333}Remove your attached object\n{FF3333}Remove all of your attached object(s) [Total:%d]\n%s\n\ |
2216 | + | if(EPV[playerid][PAO_EDITING] >= 1) CancelEdit(playerid); |
2217 | - | {FF3333}View your attached object stats\n{FFFFFF}Total attached object(s) [%d]", AOE_STR2, slots, AOE_STR, slots); |
2217 | + | EPV[playerid][PAO_INDEX1] = 0; |
2218 | EPV[playerid][PAO_INDEX2] = 0; | |
2219 | - | else if(slots == MAX_PLAYER_ATTACHED_OBJECTS) |
2219 | + | EPV[playerid][PAO_MODEL_ID] = 0; |
2220 | EPV[playerid][PAO_BONE_ID] = 0; | |
2221 | - | format(AOE_STR2, sizeof(AOE_STR2), "{FF3333}Create your attached object\n{CCCCCC}Duplicate your attached object\nEdit your attached object\n\ |
2221 | + | EPV[playerid][PAO_EDITING] = 0; |
2222 | - | Edit your attached object index\nEdit your attached object model\nEdit your attached object bone\n\ |
2222 | + | EPV[playerid][PAO_TARGET] = 0; |
2223 | - | Save your attached object\nSave all of your attached object(s) [Total:%d]\n{FF3333}Load attached object file\n{FF3333}Load attached object(s) set", slots); |
2223 | + | EPV[playerid][PAO_NAME][0] = EOS; |
2224 | - | format(AOE_STR2, sizeof(AOE_STR2), "%s\nRemove your attached object\nRemove all of your attached object(s) [Total:%d]\n%s\n\ |
2224 | + | EPV[playerid][PAO_LAST_REMOVED] = MAX_PLAYER_ATTACHED_OBJECTS; |
2225 | - | View your attached object stats\nTotal attached object(s) [%d]", AOE_STR2, slots, AOE_STR, slots); |
2225 | + | |
2226 | ||
2227 | AOE_ShowPlayerDialog(playerid, class, dialogid, caption[], button1[], button2[] = "") | |
2228 | { | |
2229 | - | format(AOE_STR2, sizeof(AOE_STR2), "Create your attached object\nDuplicate your attached object\nEdit your attached object\n\ |
2229 | + | new slots, AOE_STR2[1430]; |
2230 | - | Edit your attached object index\nEdit your attached object model\nEdit your attached object bone\n\ |
2230 | + | switch(class) |
2231 | - | Save your attached object\nSave all of your attached object(s) [Total:%d]\nLoad attached object file\nLoad attached object(s) set", slots); |
2231 | + | |
2232 | - | format(AOE_STR2, sizeof(AOE_STR2), "%s\nRemove your attached object\nRemove all of your attached object(s) [Total:%d]\n%s\n\ |
2232 | + | case AOE_C: // Menu |
2233 | - | View your attached object stats\nTotal attached object(s) [%d]", AOE_STR2, slots, AOE_STR, slots); |
2233 | + | |
2234 | slots = GetPlayerAttachedObjectsCount(playerid); | |
2235 | - | strcat(AOE_STR2, "\nHelp/commands\nAbout this editor"); |
2235 | + | if(slots) format(AOE_STR, sizeof AOE_STR, "Edit...\nClear all [%d]", slots); |
2236 | else AOE_STR = "{808080}Edit...\n{808080}Clear all"; | |
2237 | - | } |
2237 | + | if(0 <= EPV[playerid][PAO_LAST_REMOVED] < MAX_PLAYER_ATTACHED_OBJECTS) |
2238 | - | case 1: // AOE help |
2238 | + | |
2239 | - | { |
2239 | + | if(IsPlayerAttachedObjectSlotUsed(playerid, EPV[playerid][PAO_LAST_REMOVED])) format(AOE_STR2, sizeof AOE_STR2, "{FF3333}Restore last deleted", EPV[playerid][PAO_LAST_REMOVED]); |
2240 | - | strcat(AOE_STR2, "/attachedobjecteditor (/aoe): Shows attached object editor menu dialog\n\ |
2240 | + | else format(AOE_STR2, sizeof AOE_STR2, "Restore last deleted [index: %d]", EPV[playerid][PAO_LAST_REMOVED]); |
2241 | } | |
2242 | else AOE_STR2 = "{808080}Restore last deleted"; | |
2243 | - | /duplicateattachedobject (/dao): Duplicate your attached object\n"); |
2243 | + | format(AOE_STR2, sizeof AOE_STR2, "%sCreate...\nFile...\n%s\n%s\n%sStatistics\nHelp commands\nAbout this editor", |
2244 | - | strcat(AOE_STR2, "/removeattachedobject (/rao): Remove your attached object\n\ |
2244 | + | (slots == MAX_PLAYER_ATTACHED_OBJECTS ? ("{FF3333}") : ("")), AOE_STR, AOE_STR2, (IsPlayerAdmin(playerid) ? ("{006699}") : (""))); |
2245 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, AOE_STR2, button1, button2); | |
2246 | - | /undeleteattachedobject (/udao): Restore your last deleted attached object\n\ |
2246 | + | |
2247 | case AOE_C_FILE: // File menu | |
2248 | { | |
2249 | slots = GetPlayerAttachedObjectsCount(playerid); | |
2250 | if(slots == MAX_PLAYER_ATTACHED_OBJECTS) AOE_STR2 = "{FF3333}Load an attached object\n{FF3333}Load attached object(s) set\nSave attached object"; | |
2251 | - | /attachedobjectstats (/aos): Shows a player's or your attached object stats\n"); |
2251 | + | else if(slots == 0) AOE_STR2 = "Load an attached object\nLoad attached object(s) set\n{808080}Save attached object"; |
2252 | - | strcat(AOE_STR2, "/totalattachedobjects (/taos): Shows the number of attached object(s)\n\ |
2252 | + | else AOE_STR2 = "Load an attached object\nLoad attached object(s) set\nSave attached object"; |
2253 | - | /refreshattachedobject (/rpao): Refresh another player's attached object\n\ |
2253 | + | if(IsPlayerAdmin(playerid)) strcat(AOE_STR2, "\n{FFFF66}Delete attached object file"); |
2254 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, AOE_STR2, button1, button2); | |
2255 | } | |
2256 | case AOE_C_EDIT: // Edit menu | |
2257 | - | /setattachedobjectoffset[x/y/z] (/saoo[x/y/z]): Set your attached object offset [X/Y/Z]\n\ |
2257 | + | |
2258 | - | /setattachedobjectrot[x/y/z] (/saor[x/y/z]): Set your attached object rotation [RX/RY/RZ]\n"); |
2258 | + | slots = GetPlayerAttachedObjectsCount(playerid); |
2259 | - | strcat(AOE_STR2, "/setattachedobjectscale[x/y/z] (/saos[x/y/z]): Set your attached object size [SX/SY/SZ]\n\ |
2259 | + | format(AOE_STR2, sizeof AOE_STR2, "Adjust\nEdit Properties\nView Properties\n%sDuplicate\n%sRemove", |
2260 | - | /setattachedobjectmc[1/2] (/saomc[1/2]): Set your attached object material color [#1/#2]"); |
2260 | + | (slots == MAX_PLAYER_ATTACHED_OBJECTS ? ("{FF3333}") : ("")), (slots == MAX_PLAYER_ATTACHED_OBJECTS ? ("{FFFFFF}") : (""))); |
2261 | - | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, AOE_STR2, button1, button2); |
2261 | + | |
2262 | - | } |
2262 | + | |
2263 | - | case 2: // AOE about |
2263 | + | case AOE_C_HELP: // Help |
2264 | - | { |
2264 | + | |
2265 | - | GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); |
2265 | + | AOE_STR2 = "/attachedobjecteditor (/aoe): Shows attached object editor menu dialog\n\ |
2266 | - | format(AOE_STR2, sizeof(AOE_STR2), "[FilterScript] Attached Object Editor for SA:MP 0.3e or upper\nAn editor for player attachment\n\nVersion: %s\nCreated by: Robo_N1X\nhttp://forum.sa-mp.com/showthread.php?t=416138\n\nCredits & Thanks to:\n\ |
2266 | + | |
2267 | - | > SA:MP Team (www.sa-mp.com)\n> h02/Scott: attachments editor idea\n> Y-Less (y-less.com)\n> Zeex: ZCMD\n> SA:MP Wiki Contributors (wiki.sa-mp.com)\nAnd whoever that made useful function for this script\nAlso you, %s for using this editor!", |
2267 | + | |
2268 | - | AOE_VERSION, PlayerName); |
2268 | + | /duplicateattachedobject (/dao): Duplicate your attached object\n"; |
2269 | strcat(AOE_STR2, "/removeattachedobject (/rao): Remove your attached object\n\ | |
2270 | - | } |
2270 | + | |
2271 | - | case 3: // AOE object model input |
2271 | + | /undeleteattachedobject (/udao): Restore your deleted attached object\n\ |
2272 | /saveattachedobject (/sao): Save your attached object to a file\n"); | |
2273 | - | format(AOE_STR, sizeof(AOE_STR), "* %s: Please enter object model id/number...", caption); |
2273 | + | |
2274 | - | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, "Please enter a valid GTA:SA/SA:MP object model id/number below:", button1, button2); |
2274 | + | |
2275 | - | SendClientMessage(playerid, COLOR_WHITE, AOE_STR); |
2275 | + | |
2276 | /attachedobjectstats (/aos): Shows a player or your attached object stats\n"); | |
2277 | - | case 4: // AOE bone list |
2277 | + | strcat(AOE_STR2, "/refreshattachedobject (/rpao): Refresh another player's attached object\n\ |
2278 | /setattachedobjectindex (/saoi): Set your attached object index\n\ | |
2279 | /setattachedobjectmodel (/saom): Set your attached object model\n"); | |
2280 | strcat(AOE_STR2, "/setattachedobjectbone (/saob): Set your attached object bone\n\ | |
2281 | - | format(AOE_STR2, sizeof(AOE_STR2), "%s%d. %s\n", AOE_STR2, i, GetAttachedObjectBoneName(i)); |
2281 | + | /setattachedobjectoffset (/saoo): Set your attached object offset [X/Y/Z]\n\ |
2282 | /setattachedobjectrot (/saor): Set your attached object rotation [RX/RY/RZ]\n"); | |
2283 | - | format(AOE_STR, sizeof(AOE_STR), "* %s: Please select attached object bone...", caption); |
2283 | + | strcat(AOE_STR2, "/setattachedobjectscale (/saos): Set your attached object size [SX/SY/SZ]\n\ |
2284 | /setattachedobjectmc (/saomc[1/2]): Set your attached object material color [#1/#2]"); | |
2285 | - | SendClientMessage(playerid, COLOR_WHITE, AOE_STR); |
2285 | + | |
2286 | } | |
2287 | - | case 5: // AOE slot/index list (free slot) |
2287 | + | case AOE_C_ABOUT: // About |
2288 | { | |
2289 | GetPlayerName(playerid, pName, sizeof pName); | |
2290 | format(AOE_STR2, sizeof AOE_STR2, "[FilterScript] Attached Object Editor for SA:MP 0.3e or upper\nAn editor for player attachment\n\nVersion: %s\nCreated by: Robo_N1X\nhttp://forum.sa-mp.com/showthread.php?t=416138\n\nCredits & Thanks to:\n\ | |
2291 | - | if(IsValidPlayerAttachedObject(playerid, i) == -1) format(AOE_STR2, sizeof(AOE_STR2), "%s{FFFFFF}%d. None - (Not Used)\n", AOE_STR2, i); |
2291 | + | > SA:MP Team (www.sa-mp.com)\n> Scott: attachments editor idea\n> Y_Less (y-less.com)\n> Zeex: ZCMD\n> SA:MP Wiki Contributors (wiki.sa-mp.com)\nAnd whoever that made useful function for this script\nAlso you, %s for using this editor!", |
2292 | - | else if(!IsValidPlayerAttachedObject(playerid, i)) format(AOE_STR2, sizeof(AOE_STR2), "%s{CCCCCC}%d. Unknown - Invalid attached object info\n", AOE_STR2, i); |
2292 | + | AOE_VERSION, pName); // Keep the script form like this or the compiler will crash! |
2293 | - | else format(AOE_STR2, sizeof(AOE_STR2), "%s{FF3333}%d. %d - %s (BID:%d) - (Used)\n", AOE_STR2, i, PAO[playerid][i][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[playerid][i][AO_BONE_ID]), PAO[playerid][i][AO_BONE_ID]); |
2293 | + | |
2294 | } | |
2295 | - | if(!strcmp(button1, "Select", true)) format(AOE_STR, sizeof(AOE_STR), "* %s: Please select attached object slot/index number...", caption); |
2295 | + | case AOE_C_SLOT_EMPTY: // Free slot list |
2296 | - | else format(AOE_STR, sizeof(AOE_STR), "* %s: Please select attached object slot/index number to %s...", caption, button1); |
2296 | + | |
2297 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) | |
2298 | - | SendClientMessage(playerid, COLOR_WHITE, AOE_STR); |
2298 | + | |
2299 | if(IsValidPlayerAttachedObject(playerid, i) == -1) format(AOE_STR2, sizeof AOE_STR2, "%s{FFFFFF}%d. None\n", AOE_STR2, i); | |
2300 | - | case 6: // AOE slot/index list (used slot) |
2300 | + | else if(!IsValidPlayerAttachedObject(playerid, i)) format(AOE_STR2, sizeof AOE_STR2, "%s{808080}%d. Unknown - Invalid attached object info\n", AOE_STR2, i); |
2301 | else format(AOE_STR2, sizeof AOE_STR2, "%s{FF3333}%d. %d - %s (Bone:%d) - (Used)\n", AOE_STR2, i, PAO[playerid][i][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[playerid][i][AO_BONE_ID]), PAO[playerid][i][AO_BONE_ID]); | |
2302 | } | |
2303 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, AOE_STR2, button1, button2); | |
2304 | - | if(IsValidPlayerAttachedObject(playerid, i) == -1) format(AOE_STR2, sizeof(AOE_STR2), "%s{FF3333}%d. None - (Not Used)\n", AOE_STR2, i); |
2304 | + | if(!strcmp(button1, AOE_B_SELECT, true)) format(AOE_STR, sizeof AOE_STR, "* %s: Please select attached object index number...", caption); |
2305 | - | else if(!IsValidPlayerAttachedObject(playerid, i)) format(AOE_STR2, sizeof(AOE_STR2), "%s{CCCCCC}%d. Unknown - Invalid attached object info\n", AOE_STR2, i); |
2305 | + | else format(AOE_STR, sizeof AOE_STR, "* %s: Please select attached object index number to %s...", caption, button1); |
2306 | - | else format(AOE_STR2, sizeof(AOE_STR2), "%s{FFFFFF}%d. %d - %s (BID:%d) - (Used)\n", AOE_STR2, i, PAO[playerid][i][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[playerid][i][AO_BONE_ID]), PAO[playerid][i][AO_BONE_ID]); |
2306 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); |
2307 | } | |
2308 | - | if(!strcmp(button1, "Select", true)) format(AOE_STR, sizeof(AOE_STR), "* %s: Please select attached object slot/index number...", caption); |
2308 | + | case AOE_C_SLOT_USED: // Used slot list |
2309 | - | else format(AOE_STR, sizeof(AOE_STR), "* %s: Please select attached object slot/index number to %s...", caption, button1); |
2309 | + | |
2310 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) | |
2311 | - | SendClientMessage(playerid, COLOR_WHITE, AOE_STR); |
2311 | + | |
2312 | if(IsValidPlayerAttachedObject(playerid, i) == -1) format(AOE_STR2, sizeof AOE_STR2, "%s{FF3333}%d. None - (Not Used)\n", AOE_STR2, i); | |
2313 | - | case 7: // AOE stats |
2313 | + | else if(!IsValidPlayerAttachedObject(playerid, i)) format(AOE_STR2, sizeof AOE_STR2, "%s{CCCCCC}%d. Unknown - Invalid attached object info\n", AOE_STR2, i); |
2314 | else format(AOE_STR2, sizeof AOE_STR2, "%s{FFFFFF}%d. %d - %s (Bone:%d)\n", AOE_STR2, i, PAO[playerid][i][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[playerid][i][AO_BONE_ID]), PAO[playerid][i][AO_BONE_ID]); | |
2315 | - | slot = GetPVarInt(playerid, "PAO_AOSI"); |
2315 | + | |
2316 | - | new targetid = GetPVarInt(playerid, "PAO_AOSU"); |
2316 | + | |
2317 | - | GetPlayerName(targetid, PlayerName, sizeof(PlayerName)); |
2317 | + | if(!strcmp(button1, AOE_B_SELECT, true)) format(AOE_STR, sizeof AOE_STR, "* %s: Please select attached object index number...", caption); |
2318 | - | format(AOE_STR2, sizeof(AOE_STR2), "Attached object slot/index number %d stats...\n\nStatus: %s\nModel ID/Number/Type: %d\nBone: %s (%d)\n\nOffsets\nX Offset: %f\nY Offset: %f\nZ Offset: %f\n\nRotations\nX Rotation: %f\nY Rotation: %f\ |
2318 | + | else format(AOE_STR, sizeof AOE_STR, "* %s: Please select attached object index number to %s...", caption, button1); |
2319 | - | \nZ Rotation: %f\n\nScales\nX Scale: %f\nY Scale: %f\nZ Scale: %f\n\nMaterials\nColor 1: 0x%x (%i) {%06x}¤{A9C4E4}\nColor 2: 0x%x (%i) {%06x}¤{A9C4E4}\n\nSkin ID: %d\nTotal of %s's attached object(s): %d", slot, |
2319 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); |
2320 | - | ((PAO[targetid][slot][AO_STATUS] == 0) ? ("Invalid data") : ((PAO[targetid][slot][AO_STATUS] == 1) ? ("Valid Data") : ("Editing"))), PAO[targetid][slot][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[targetid][slot][AO_BONE_ID]), PAO[targetid][slot][AO_BONE_ID], |
2320 | + | |
2321 | - | PAO[targetid][slot][AO_X], PAO[targetid][slot][AO_Y], PAO[targetid][slot][AO_Z], PAO[targetid][slot][AO_RX], PAO[targetid][slot][AO_RY], PAO[targetid][slot][AO_RZ], PAO[targetid][slot][AO_SX], PAO[targetid][slot][AO_SY], PAO[targetid][slot][AO_SZ], |
2321 | + | case AOE_C_SLOT_ALL: // Used slot list + all |
2322 | - | PAO[targetid][slot][AO_MC1], PAO[targetid][slot][AO_MC1], PAO[targetid][slot][AO_MC1] & 0xFFFFFF, PAO[targetid][slot][AO_MC2], PAO[targetid][slot][AO_MC2], PAO[targetid][slot][AO_MC2] & 0xFFFFFF, GetPlayerSkin(targetid), PlayerName, GetPlayerAttachedObjectsCount(targetid)); |
2322 | + | |
2323 | - | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, AOE_STR2, (IsPlayerAdmin(playerid) ? button1 : button2), (IsPlayerAdmin(playerid) ? button2 : "")); // Only show "Close" button for non-admin |
2323 | + | |
2324 | - | if(targetid == playerid) format(AOE_STR, sizeof(AOE_STR), "* You're viewing your attached object stats from slot/index number %d", slot); |
2324 | + | |
2325 | - | else format(AOE_STR, sizeof(AOE_STR), "* You're viewing %s's attached object stats from slot/index number %d", PlayerName, slot); |
2325 | + | if(IsValidPlayerAttachedObject(playerid, i) == -1) format(AOE_STR2, sizeof AOE_STR2, "%s{FF3333}%d. None - (Not Used)\n", AOE_STR2, i); |
2326 | - | SendClientMessage(playerid, COLOR_CYAN, AOE_STR); |
2326 | + | else if(!IsValidPlayerAttachedObject(playerid, i)) |
2327 | - | if(IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_WHITE, "* As you're an admin, you can print this attached object stats & usage to the console"); |
2327 | + | |
2328 | format(AOE_STR2, sizeof AOE_STR2, "%s{808080}%d. Unknown - Invalid attached object info\n", AOE_STR2, i); | |
2329 | - | case 8: // AOE create replace |
2329 | + | slots++; |
2330 | } | |
2331 | - | format(AOE_STR2, sizeof(AOE_STR2), "Sorry, attached object slot/index number %d\nis already used, do you want to replace it?\n(This action can't be undone)", GetPVarInt(playerid, "PAO_CAOI")); |
2331 | + | |
2332 | { | |
2333 | format(AOE_STR2, sizeof AOE_STR2, "%s{FFFFFF}%d. %d - %s (Bone:%d)\n", AOE_STR2, i, PAO[playerid][i][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[playerid][i][AO_BONE_ID]), PAO[playerid][i][AO_BONE_ID]); | |
2334 | - | case 9: // AOE create final |
2334 | + | slots++; |
2335 | } | |
2336 | - | format(AOE_STR2, sizeof(AOE_STR2), "You've created your attached object\nat slot/index number: %d\nModel: %d\nBone: %s (BID:%d)\n\nDo you want to edit your attached object?", GetPVarInt(playerid, "PAO_CAOI"), |
2336 | + | |
2337 | - | GetPVarInt(playerid, "PAO_CAOM"), GetAttachedObjectBoneName(GetPVarInt(playerid, "PAO_CAOB")), GetPVarInt(playerid, "PAO_CAOB")); |
2337 | + | format(AOE_STR2, sizeof AOE_STR2, "%s{CCFFFF}%s all used attached object index (%d)", AOE_STR2, button1, slots); |
2338 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, AOE_STR2, button1, button2); | |
2339 | if(!strcmp(button1, AOE_B_SELECT, true)) format(AOE_STR, sizeof AOE_STR, "* %s: Please select attached object index number...", caption); | |
2340 | - | case 10: // AOE remove all |
2340 | + | else format(AOE_STR, sizeof AOE_STR, "* %s: Please select attached object index number to %s...", caption, button1); |
2341 | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); | |
2342 | - | 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)); |
2342 | + | |
2343 | - | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, AOE_STR2, button1, button2); |
2343 | + | case AOE_C_REFRESH: // Target's used slot list |
2344 | { | |
2345 | - | case 11: // AOE duplicate replace |
2345 | + | AOTarget = EPV[playerid][PAO_TARGET]; |
2346 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) | |
2347 | - | slot = GetPVarInt(playerid, "PAO_DAOI1"), slot2 = GetPVarInt(playerid, "PAO_DAOI2"); |
2347 | + | |
2348 | - | format(AOE_STR2, sizeof(AOE_STR2), "You already have attached object at slot/index number %d!\nDo you want to replace it with attached object from slot %d?", slot, slot2); |
2348 | + | if(IsValidPlayerAttachedObject(AOTarget, i) == -1) format(AOE_STR2, sizeof AOE_STR2, "%s{FF3333}%d. None - (Not Used)\n", AOE_STR2, i); |
2349 | else if(!IsValidPlayerAttachedObject(AOTarget, i)) format(AOE_STR2, sizeof AOE_STR2, "%s{CCCCCC}%d. Unknown - Invalid attached object info\n", AOE_STR2, i); | |
2350 | else format(AOE_STR2, sizeof AOE_STR2, "%s{FFFFFF}%d. %d - %s (Bone:%d)\n", AOE_STR2, i, PAO[AOTarget][i][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[AOTarget][i][AO_BONE_ID]), PAO[AOTarget][i][AO_BONE_ID]); | |
2351 | - | case 12: // AOE set index replace |
2351 | + | |
2352 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, AOE_STR2, button1, button2); | |
2353 | - | slot = GetPVarInt(playerid, "PAO_SAOI1"), slot2 = GetPVarInt(playerid, "PAO_SAOI2"); |
2353 | + | format(AOE_STR, sizeof AOE_STR, "* Refresh Attached Object: Please select attached object index number from target player...", caption); |
2354 | - | format(AOE_STR2, sizeof(AOE_STR2), "You already have attached object at slot/index number %d!\nDo you want to replace it with attached object from slot %d?", slot2, slot); |
2354 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); |
2355 | } | |
2356 | case AOE_C_MODEL: // Object model input | |
2357 | - | case 13: // AOE save |
2357 | + | |
2358 | format(AOE_STR, sizeof AOE_STR, "* %s: Please enter object model id/number...", caption); | |
2359 | - | format(AOE_STR, sizeof(AOE_STR), "* %s: Please enter attached object file name to save...", caption); |
2359 | + | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, AOE_I_ENTER_MODEL, button1, button2); |
2360 | - | 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\ |
2360 | + | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); |
2361 | - | A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, .\nand the length must be 1-24 characters long", button1, button2); |
2361 | + | |
2362 | - | SendClientMessage(playerid, COLOR_WHITE, AOE_STR); |
2362 | + | case AOE_C_BONE: // Bone list |
2363 | { | |
2364 | - | case 14: // AOE load |
2364 | + | |
2365 | { | |
2366 | - | format(AOE_STR, sizeof(AOE_STR), "* %s: Please enter attached object file name to load...", caption); |
2366 | + | format(AOE_STR2, sizeof AOE_STR2, "%s%d. %s\n", AOE_STR2, i, GetAttachedObjectBoneName(i)); |
2367 | - | 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\ |
2367 | + | |
2368 | - | A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, .\nand the length must be 1-24 characters long", button1, button2); |
2368 | + | |
2369 | - | SendClientMessage(playerid, COLOR_WHITE, AOE_STR); |
2369 | + | format(AOE_STR, sizeof AOE_STR, "* %s: Please select attached object bone...", caption); |
2370 | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); | |
2371 | - | case 15: // AOE load replace |
2371 | + | |
2372 | case AOE_C_CREATE_FINAL: // Final create | |
2373 | - | format(AOE_STR2, sizeof(AOE_STR2), "You already have attached object at slot/index number %d!\nDo you want to continue loading and replace it?", GetPVarInt(playerid, "PAO_LAOI")); |
2373 | + | |
2374 | - | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, AOE_STR2, button1, button2); |
2374 | + | format(AOE_STR2, sizeof AOE_STR2, "You've created your attached object\nat index number: %d\nModel: %d\nBone: %s (%d)\n\nDo you want to edit your attached object?", EPV[playerid][PAO_INDEX1], |
2375 | EPV[playerid][PAO_MODEL_ID], GetAttachedObjectBoneName(EPV[playerid][PAO_BONE_ID]), EPV[playerid][PAO_BONE_ID]); | |
2376 | - | case 16: // AOE save replace |
2376 | + | |
2377 | } | |
2378 | - | new name[32]; |
2378 | + | case AOE_C_REMOVE_ALL: // Remove all |
2379 | - | GetPVarString(playerid, "PAO_SAON", name, sizeof(name)); |
2379 | + | |
2380 | - | format(AOE_STR2, sizeof(AOE_STR2), "The file \"%s\" is already exist!\nDo you want to replace and overwrite it?\n(This action can't be undone)", name); |
2380 | + | 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)); |
2381 | - | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, AOE_STR2, button1, button2); |
2381 | + | |
2382 | - | SendClientMessage(playerid, COLOR_WHITE, "* As you're an admin, you can replace an existed attached object file"); |
2382 | + | |
2383 | case AOE_C_PROPERTIES: // View properties | |
2384 | { | |
2385 | AOSlot = EPV[playerid][PAO_INDEX1], AOTarget = EPV[playerid][PAO_TARGET]; | |
2386 | GetPlayerName(AOTarget, pName, sizeof pName); | |
2387 | - | AOE_SavePlayerAttachedObject(playerid, filename[], index, comment[] = "", &filelen) // use MAX_PLAYER_ATTACHED_OBJECTS to save all |
2387 | + | format(AOE_STR2, sizeof AOE_STR2, "Attached object index number %d properties...\n\nStatus: %s\nModel ID/Number/Type: %d\nBone: %s (%d)\n\nOffsets\nX Offset: %f\nY Offset: %f\nZ Offset: %f\n\nRotations\nX Rotation: %f\nY Rotation: %f\ |
2388 | \nZ Rotation: %f\n\nScales\nX Scale: %f\nY Scale: %f\nZ Scale: %f\n\nMaterials\nColor 1: 0x%x (%i) {%06x}{A9C4E4}\nColor 2: 0x%x (%i) {%06x}{A9C4E4}\n\nSkin ID: %d\nTotal of %s's attached object(s): %d", AOSlot, | |
2389 | - | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; |
2389 | + | ((PAO[AOTarget][AOSlot][AO_STATUS] == 0) ? ("Invalid data") : ((PAO[AOTarget][AOSlot][AO_STATUS] == 1) ? ("Valid Data") : ("Editing"))), PAO[AOTarget][AOSlot][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[AOTarget][AOSlot][AO_BONE_ID]), PAO[AOTarget][AOSlot][AO_BONE_ID], |
2390 | - | new File:SAO = fopen(filename, io_write), slots = 0; |
2390 | + | PAO[AOTarget][AOSlot][AO_X], PAO[AOTarget][AOSlot][AO_Y], PAO[AOTarget][AOSlot][AO_Z], PAO[AOTarget][AOSlot][AO_RX], PAO[AOTarget][AOSlot][AO_RY], PAO[AOTarget][AOSlot][AO_RZ], PAO[AOTarget][AOSlot][AO_SX], PAO[AOTarget][AOSlot][AO_SY], PAO[AOTarget][AOSlot][AO_SZ], |
2391 | PAO[AOTarget][AOSlot][AO_MC1], PAO[AOTarget][AOSlot][AO_MC1], PAO[AOTarget][AOSlot][AO_MC1] & 0xFFFFFF, PAO[AOTarget][AOSlot][AO_MC2], PAO[AOTarget][AOSlot][AO_MC2], PAO[AOTarget][AOSlot][AO_MC2] & 0xFFFFFF, GetPlayerSkin(AOTarget), pName, GetPlayerAttachedObjectsCount(AOTarget)); | |
2392 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, AOE_STR2, (IsPlayerAdmin(playerid) ? button1 : button2), (IsPlayerAdmin(playerid) ? button2 : "")); // Only show close button for non-admin | |
2393 | - | new AOE_STR2[256], Year, Month, Day, Hour, Minute, Second; |
2393 | + | if(AOTarget == playerid) format(AOE_STR, sizeof AOE_STR, "* You're viewing your attached object properties from index number %d.", AOSlot); |
2394 | - | GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); |
2394 | + | else format(AOE_STR, sizeof AOE_STR, "* You're viewing %s's attached object properties from index number %d.", pName, AOSlot); |
2395 | - | getdate(Year, Month, Day); |
2395 | + | SendClientMessage(playerid, AOE_COLOR5, AOE_STR); |
2396 | - | gettime(Hour, Minute, Second); |
2396 | + | if(IsPlayerAdmin(playerid)) SendClientMessage(playerid, AOE_COLOR0, AOE_M_OBJECT_DATA_PRINT); |
2397 | - | if(!strlen(comment)) |
2397 | + | |
2398 | case AOE_C_EDIT_PROPERTIES: // Edit properties | |
2399 | - | format(AOE_STR, sizeof(AOE_STR), "// Created by %s for skin ID %d on %02d/%02d/%d - %02d:%02d:%02d", PlayerName, GetPlayerSkin(playerid), Day, Month, Year, Hour, Minute, Second); |
2399 | + | |
2400 | - | fwrite(SAO, AOE_STR); |
2400 | + | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, "Change index\nChange model\nChange bone\nChange X offset\nChange Y offset\nChange Z offset\n\ |
2401 | Change X rotation\nChange Y rotation\nChange Z rotation\nChange X scale\nChange Y scale\nChange Z scale\nChange #1 material color\nChange #2 material color", button1, button2); | |
2402 | - | if(index == MAX_PLAYER_ATTACHED_OBJECTS) |
2402 | + | |
2403 | case AOE_C_EDIT_XYZ: // Edit property value | |
2404 | - | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) |
2404 | + | |
2405 | - | { |
2405 | + | new xyz_selection[3]; |
2406 | - | if(IsValidPlayerAttachedObject(playerid, i) == 1) |
2406 | + | switch(EPV[playerid][PAO_EDITING]) |
2407 | { | |
2408 | - | format(AOE_STR2, sizeof(AOE_STR2), "\r\nSetPlayerAttachedObject(playerid, %d, %d, %d, %f, %f, %f, %f, %f, %f, %f, %f, %f, %x, %x);", i, PAO[playerid][i][AO_MODEL_ID], PAO[playerid][i][AO_BONE_ID], |
2408 | + | case 3: |
2409 | - | PAO[playerid][i][AO_X], PAO[playerid][i][AO_Y], PAO[playerid][i][AO_Z], PAO[playerid][i][AO_RX], PAO[playerid][i][AO_RY], PAO[playerid][i][AO_RZ], |
2409 | + | |
2410 | - | PAO[playerid][i][AO_SX], PAO[playerid][i][AO_SY], PAO[playerid][i][AO_SZ], PAO[playerid][i][AO_MC1], PAO[playerid][i][AO_MC2]); |
2410 | + | xyz_selection = "X"; |
2411 | - | fwrite(SAO, AOE_STR2); |
2411 | + | AOAxis = PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_X]; |
2412 | - | slots++; |
2412 | + | |
2413 | case 4: | |
2414 | - | } |
2414 | + | |
2415 | xyz_selection = "Y"; | |
2416 | AOAxis = PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_Y]; | |
2417 | } | |
2418 | - | if(IsValidPlayerAttachedObject(playerid, index) == 1) |
2418 | + | case 5: |
2419 | { | |
2420 | - | format(AOE_STR2, sizeof(AOE_STR2), "\r\nSetPlayerAttachedObject(playerid, %d, %d, %d, %f, %f, %f, %f, %f, %f, %f, %f, %f, %x, %x);", index, PAO[playerid][index][AO_MODEL_ID], PAO[playerid][index][AO_BONE_ID], |
2420 | + | xyz_selection = "Z"; |
2421 | - | PAO[playerid][index][AO_X], PAO[playerid][index][AO_Y], PAO[playerid][index][AO_Z], PAO[playerid][index][AO_RX], PAO[playerid][index][AO_RY], PAO[playerid][index][AO_RZ], |
2421 | + | AOAxis = PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_Z]; |
2422 | - | PAO[playerid][index][AO_SX], PAO[playerid][index][AO_SY], PAO[playerid][index][AO_SZ], PAO[playerid][index][AO_MC1], PAO[playerid][index][AO_MC2]); |
2422 | + | |
2423 | - | fwrite(SAO, AOE_STR2); |
2423 | + | case 6: |
2424 | - | slots++; |
2424 | + | |
2425 | xyz_selection = "RX"; | |
2426 | AOAxis = PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_RX]; | |
2427 | - | fclose(SAO); |
2427 | + | |
2428 | case 7: | |
2429 | { | |
2430 | xyz_selection = "RY"; | |
2431 | AOAxis = PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_RY]; | |
2432 | } | |
2433 | case 8: | |
2434 | { | |
2435 | xyz_selection = "RZ"; | |
2436 | - | filelen = flength(SAO); |
2436 | + | AOAxis = PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_RZ]; |
2437 | } | |
2438 | case 9: | |
2439 | { | |
2440 | xyz_selection = "SX"; | |
2441 | AOAxis = PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_SX]; | |
2442 | } | |
2443 | case 10: | |
2444 | { | |
2445 | - | AOE_LoadPlayerAttachedObject(playerid, filename[], index, const comment[], commentlen) // use MAX_PLAYER_ATTACHED_OBJECTS to load all |
2445 | + | xyz_selection = "SY"; |
2446 | AOAxis = PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_SY]; | |
2447 | } | |
2448 | case 11: | |
2449 | { | |
2450 | - | new File:LAO = fopen(filename, io_read), slots = 0; |
2450 | + | xyz_selection = "SZ"; |
2451 | AOAxis = PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_SZ]; | |
2452 | } | |
2453 | - | enum E_ATTACHED_OBJECT_L |
2453 | + | default: return; |
2454 | - | { |
2454 | + | |
2455 | - | LAO_MODEL_ID, LAO_BONE_ID, |
2455 | + | format(AOE_STR2, sizeof AOE_STR2, "Current %s value is %.4f\nEnter a new value below:", xyz_selection, AOAxis); |
2456 | - | Float:LAO_X, Float:LAO_Y, Float:LAO_Z, |
2456 | + | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, AOE_STR2, button1, button2); |
2457 | - | Float:LAO_RX, Float:LAO_RY, Float:LAO_RZ, |
2457 | + | |
2458 | - | Float:LAO_SX, Float:LAO_SY, Float:LAO_SZ, |
2458 | + | case AOE_C_EDIT_COLOR: // Edit color |
2459 | - | hex:LAO_MC1, hex:LAO_MC2 |
2459 | + | |
2460 | - | } |
2460 | + | switch(EPV[playerid][PAO_EDITING]) |
2461 | - | new AOE_STR2[256], idx, LAOD[E_ATTACHED_OBJECT_L]; |
2461 | + | |
2462 | - | while(fread(LAO, AOE_STR2)) |
2462 | + | case 12: |
2463 | - | { |
2463 | + | |
2464 | - | if(!unformat(AOE_STR2, "'// 's[160]", AOE_STR2)) |
2464 | + | format(AOE_STR2, sizeof AOE_STR2, "Current material color (#1) value is: 0x%x (%i) {%06x}{A9C4E4}\n\nEnter a new value below:", |
2465 | - | { |
2465 | + | PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_MC1], PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_MC1], PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_MC1] & 0xFFFFFF); |
2466 | - | for(new i = 0; i < commentlen; i++) setarg(3, i, AOE_STR2[i]); |
2466 | + | |
2467 | case 13: | |
2468 | - | else |
2468 | + | |
2469 | format(AOE_STR2, sizeof AOE_STR2, "Current material color (#2) value is: 0x%x (%i) {%06x}{A9C4E4}\n\nEnter a new value below:", | |
2470 | - | if(!unformat(AOE_STR2, "'SetPlayerAttachedObject'P<();,>{s[3]s[32]}dddF(0.0)F(0.0)F(0.0)F(0.0)F(0.0)F(0.0)F(1.0)F(1.0)F(1.0)X(0)X(0)", idx, LAOD[LAO_MODEL_ID], LAOD[LAO_BONE_ID], |
2470 | + | PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_MC2], PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_MC2], PAO[playerid][EPV[playerid][PAO_INDEX1]][AO_MC2] & 0xFFFFFF); |
2471 | - | LAOD[LAO_X], LAOD[LAO_Y], LAOD[LAO_Z], LAOD[LAO_RX], LAOD[LAO_RY], LAOD[LAO_RZ], LAOD[LAO_SX], LAOD[LAO_SY], LAOD[LAO_SZ], LAOD[LAO_MC1], LAOD[LAO_MC2])) |
2471 | + | |
2472 | - | { |
2472 | + | default: return; |
2473 | - | if(IsValidAttachedObjectSlot(idx) && IsValidObjectModel(LAOD[LAO_MODEL_ID]) && IsValidAttachedObjectBone(LAOD[LAO_BONE_ID])) |
2473 | + | |
2474 | - | { |
2474 | + | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, AOE_STR2, button1, button2); |
2475 | - | if(index == MAX_PLAYER_ATTACHED_OBJECTS) |
2475 | + | |
2476 | - | { |
2476 | + | |
2477 | - | if(slots == MAX_PLAYER_ATTACHED_OBJECTS) break; |
2477 | + | case AOE_C_DUPLICATE_REPLACE: // Replace duplicate |
2478 | - | slots += UpdatePlayerAttachedObjectEx(playerid, idx, LAOD[LAO_MODEL_ID], LAOD[LAO_BONE_ID], LAOD[LAO_X], LAOD[LAO_Y], LAOD[LAO_Z], |
2478 | + | |
2479 | - | LAOD[LAO_RX], LAOD[LAO_RY], LAOD[LAO_RZ], LAOD[LAO_SX], LAOD[LAO_SY], LAOD[LAO_SZ], LAOD[LAO_MC1], LAOD[LAO_MC2]); |
2479 | + | format(AOE_STR, sizeof AOE_STR, "You already have attached object at index number %d!\nDo you want to replace it with attached object from slot %d?", EPV[playerid][PAO_INDEX1], EPV[playerid][PAO_INDEX2]); |
2480 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, AOE_STR, button1, button2); | |
2481 | } | |
2482 | case AOE_C_CREATE_REPLACE: // Replace create | |
2483 | - | if(index == idx) |
2483 | + | |
2484 | - | { |
2484 | + | format(AOE_STR, sizeof AOE_STR, "Sorry, attached object index number %d\nis already used, do you want to replace it?\n(This action can't be undone)", EPV[playerid][PAO_INDEX1]); |
2485 | - | slots += UpdatePlayerAttachedObjectEx(playerid, idx, LAOD[LAO_MODEL_ID], LAOD[LAO_BONE_ID], LAOD[LAO_X], LAOD[LAO_Y], LAOD[LAO_Z], |
2485 | + | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, AOE_STR, button1, button2); |
2486 | - | LAOD[LAO_RX], LAOD[LAO_RY], LAOD[LAO_RZ], LAOD[LAO_SX], LAOD[LAO_SY], LAOD[LAO_SZ], LAOD[LAO_MC1], LAOD[LAO_MC2]); |
2486 | + | |
2487 | - | break; |
2487 | + | case AOE_C_SET_INDEX_REPLACE: // Replace set index |
2488 | - | } |
2488 | + | |
2489 | format(AOE_STR, sizeof AOE_STR, "You already have attached object at index number %d!\nDo you want to replace it with attached object from slot %d?", EPV[playerid][PAO_INDEX1], EPV[playerid][PAO_INDEX2]); | |
2490 | - | } |
2490 | + | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, AOE_STR, button1, button2); |
2491 | } | |
2492 | - | } |
2492 | + | case AOE_C_REFRESH_REPLACE: // Replace refresh |
2493 | - | } |
2493 | + | |
2494 | - | fclose(LAO); |
2494 | + | AOSlot = EPV[playerid][PAO_INDEX1], AOTarget = EPV[playerid][PAO_TARGET]; |
2495 | GetPlayerName(AOTarget, pName, sizeof pName); | |
2496 | format(AOE_STR2, sizeof AOE_STR2, "You are about to replace your attached object,\nIndex: %d, Model: %d, Bone: %s (%d)\nwith %s (ID:%d)'s attached object,\nIndex: %d, Model: %d, Bone: %s (%d)\n\nContinue?", AOSlot, PAO[playerid][AOSlot][AO_MODEL_ID], | |
2497 | GetAttachedObjectBoneName(PAO[playerid][AOSlot][AO_BONE_ID]), PAO[playerid][AOSlot][AO_BONE_ID], pName, AOTarget, AOSlot, PAO[AOTarget][AOSlot][AO_MODEL_ID], GetAttachedObjectBoneName(PAO[AOTarget][AOSlot][AO_BONE_ID]), PAO[AOTarget][AOSlot][AO_BONE_ID]); | |
2498 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, AOE_STR2, button1, button2); | |
2499 | - | CreatePlayerAttachedObject(playerid, index, modelid, bone) |
2499 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_REFRESH_WARNING); |
2500 | } | |
2501 | - | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; |
2501 | + | case AOE_C_LOAD_REPLACE: // Replace load |
2502 | - | if(!IsValidAttachedObjectSlot(index) || !IsValidObjectModel(modelid) || !IsValidAttachedObjectBone(bone)) return 0; |
2502 | + | |
2503 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, index)) RemovePlayerAttachedObject(playerid, index); |
2503 | + | format(AOE_STR, sizeof AOE_STR, "You already have attached object at index number %d!\nDo you want to continue loading and replace it?", EPV[playerid][PAO_INDEX1]); |
2504 | - | SetPVarInt(playerid, "PAO_CAOI", index); |
2504 | + | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, AOE_STR, button1, button2); |
2505 | - | SetPVarInt(playerid, "PAO_CAOM", modelid); |
2505 | + | |
2506 | - | SetPVarInt(playerid, "PAO_CAOB", bone); |
2506 | + | case AOE_C_SAVE_REPLACE: // Replace save |
2507 | - | PAO[playerid][index][AO_STATUS] = 1; |
2507 | + | |
2508 | - | PAO[playerid][index][AO_MODEL_ID] = modelid; |
2508 | + | format(AOE_STR2, sizeof AOE_STR2, "The file \"{FFFFFF}%s{A9C4E4}\" is already exist!\nDo you want to replace and overwrite it?\n(This action can't be undone)", EPV[playerid][PAO_NAME]); |
2509 | - | PAO[playerid][index][AO_BONE_ID] = bone; |
2509 | + | |
2510 | SendClientMessage(playerid, AOE_COLOR0, AOE_M_OVERWRITE); | |
2511 | } | |
2512 | - | PAO[playerid][index][AO_SX] = 1.0, PAO[playerid][index][AO_SY] = 1.0, PAO[playerid][index][AO_SZ] = 1.0; |
2512 | + | case AOE_C_SAVE: // Save |
2513 | { | |
2514 | - | return SetPlayerAttachedObject(playerid, index, modelid, bone); |
2514 | + | format(AOE_STR, sizeof AOE_STR, "* %s: Please enter attached object file name to save...", caption); |
2515 | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, AOE_I_SAVE_NAME, button1, button2); | |
2516 | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); | |
2517 | - | UpdatePlayerAttachedObject(playerid, index, modelid, bone) |
2517 | + | |
2518 | - | return UpdatePlayerAttachedObjectEx(playerid, index, modelid, bone, PAO[playerid][index][AO_X], PAO[playerid][index][AO_Y], PAO[playerid][index][AO_Z], PAO[playerid][index][AO_RX], PAO[playerid][index][AO_RY], PAO[playerid][index][AO_RZ], |
2518 | + | case AOE_C_LOAD: // Load |
2519 | - | PAO[playerid][index][AO_SX], PAO[playerid][index][AO_SY], PAO[playerid][index][AO_SZ], PAO[playerid][index][AO_MC1], PAO[playerid][index][AO_MC2]); |
2519 | + | |
2520 | format(AOE_STR, sizeof AOE_STR, "* %s: Please enter attached object file name to load...", caption); | |
2521 | - | 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) |
2521 | + | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, AOE_I_LOAD_NAME, button1, button2); |
2522 | SendClientMessage(playerid, AOE_COLOR0, AOE_STR); | |
2523 | - | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; |
2523 | + | |
2524 | - | if(!IsValidAttachedObjectSlot(index) || !IsValidObjectModel(modelid) || !IsValidAttachedObjectBone(bone)) return 0; |
2524 | + | case AOE_C_DELETE: // Delete |
2525 | - | PAO[playerid][index][AO_STATUS] = 1; |
2525 | + | |
2526 | - | PAO[playerid][index][AO_MODEL_ID] = modelid; |
2526 | + | ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, "Please enter attached object file name below\n\nName length must be 1-24 characters without extension\n\ |
2527 | - | PAO[playerid][index][AO_BONE_ID] = bone; |
2527 | + | Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =\n\nPlease note that the file will be deleted permanently and can't be restored", button1, button2); |
2528 | - | PAO[playerid][index][AO_X] = fOffsetX, PAO[playerid][index][AO_Y] = fOffsetY, PAO[playerid][index][AO_Z] = fOffsetZ; |
2528 | + | |
2529 | - | PAO[playerid][index][AO_RX] = fRotX, PAO[playerid][index][AO_RY] = fRotY, PAO[playerid][index][AO_RZ] = fRotZ; |
2529 | + | |
2530 | - | PAO[playerid][index][AO_SX] = fScaleX, PAO[playerid][index][AO_SY] = fScaleY, PAO[playerid][index][AO_SZ] = fScaleZ; |
2530 | + | |
2531 | - | PAO[playerid][index][AO_MC1] = materialcolor1, PAO[playerid][index][AO_MC2] = materialcolor2; |
2531 | + | |
2532 | - | return SetPlayerAttachedObject(playerid, index, modelid, bone, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ, materialcolor1, materialcolor2); |
2532 | + | AOE_GameTextForPlayer(playerid, const string[]) |
2533 | return GameTextForPlayer(playerid, string, 3000, 3); | |
2534 | ||
2535 | AOE_CanEdit(playerid) | |
2536 | { | |
2537 | - | if(IsValidPlayerAttachedObject(playerid, fromindex) && IsValidAttachedObjectSlot(fromindex) && IsValidAttachedObjectSlot(asindex)) |
2537 | + | new playerState = GetPlayerState(playerid); |
2538 | if(playerState == PLAYER_STATE_WASTED || playerState == PLAYER_STATE_SPECTATING) | |
2539 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, asindex)) RemovePlayerAttachedObject(playerid, asindex); |
2539 | + | |
2540 | SendClientMessage(playerid, AOE_COLOR1, AOE_M_CANT_EDIT); | |
2541 | return false; | |
2542 | } | |
2543 | else if(EPV[playerid][PAO_EDITING] != 0) | |
2544 | { | |
2545 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_EDIT_NOTICE); | |
2546 | - | MovePlayerAttachedObjectIndex(playerid, fromindex, toindex) |
2546 | + | return false; |
2547 | } | |
2548 | - | if(IsValidPlayerAttachedObject(playerid, fromindex) && IsValidAttachedObjectSlot(toindex)) |
2548 | + | else return true; |
2549 | } | |
2550 | ||
2551 | AOE_HasFreeSlot(playerid) | |
2552 | { | |
2553 | if(GetPlayerAttachedObjectsCount(playerid) == MAX_PLAYER_ATTACHED_OBJECTS) | |
2554 | { | |
2555 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_NO_ENOUGH_SLOT); | |
2556 | AOE_GameTextForPlayer(playerid, AOE_G_NO_ENOUGH_SLOT); | |
2557 | SendClientMessage(playerid, AOE_COLOR0, AOE_M_MAX_SLOT_INFO); | |
2558 | return false; | |
2559 | - | if(!IsPlayerConnected(playerid) || !IsPlayerConnected(forplayerid)) return INVALID_PLAYER_ID; |
2559 | + | |
2560 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, index) || IsValidPlayerAttachedObject(playerid, index)) |
2560 | + | else return true; |
2561 | - | { |
2561 | + | |
2562 | ||
2563 | AOE_HasSlot(playerid, index) | |
2564 | { | |
2565 | if(!IsPlayerAttachedObjectSlotUsed(playerid, index)) | |
2566 | { | |
2567 | format(AOE_STR, sizeof AOE_STR, "* Sorry, you don't have attached object at index number %d.", index); | |
2568 | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); | |
2569 | format(AOE_STR, sizeof AOE_STR, "~r~~h~You have no attached object~n~~w~index number: %d", index); | |
2570 | AOE_GameTextForPlayer(playerid, AOE_STR); | |
2571 | - | if(IsValidAttachedObjectSlot(index) || IsValidObjectModel(PAO[playerid][index][AO_MODEL_ID]) || IsValidAttachedObjectBone(PAO[playerid][index][AO_BONE_ID])) |
2571 | + | return false; |
2572 | } | |
2573 | return true; | |
2574 | - | return SetPlayerAttachedObject(playerid, index, PAO[playerid][index][AO_MODEL_ID], PAO[playerid][index][AO_BONE_ID], PAO[playerid][index][AO_X], PAO[playerid][index][AO_Y], PAO[playerid][index][AO_Z], |
2574 | + | |
2575 | ||
2576 | AOE_TargetHasSlot(playerid, targetid, index) | |
2577 | { | |
2578 | if(!IsPlayerAttachedObjectSlotUsed(targetid, index)) | |
2579 | { | |
2580 | - | RemovePlayerAttachedObjectEx(playerid, index = -1) // use MAX_PLAYER_ATTACHED_OBJECTS as index to remove all |
2580 | + | GetPlayerName(targetid, pName, sizeof pName); |
2581 | format(AOE_STR, sizeof AOE_STR, "* Sorry, %s (ID:%d) has no attached object at index number {FFFFFF}%d{%06x}.", pName, targetid, index, AOE_COLOR4 >>> 8); | |
2582 | - | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; |
2582 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
2583 | - | new _AttachedObjectsRemoved = 0; |
2583 | + | return false; |
2584 | } | |
2585 | return true; | |
2586 | } | |
2587 | ||
2588 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, i)) |
2588 | + | AOE_HasAttachedObject(playerid) |
2589 | { | |
2590 | - | _AttachedObjectsRemoved += RemovePlayerAttachedObject(playerid, i); |
2590 | + | if(GetPlayerAttachedObjectsCount(playerid) == 0) |
2591 | - | PAO[playerid][i][AO_STATUS] = 0; |
2591 | + | |
2592 | - | SetPVarInt(playerid, "PAO_LAOR", i); |
2592 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_M_NO_ATTACHED_OBJECT); |
2593 | AOE_GameTextForPlayer(playerid, AOE_G_NO_ATTACHED_OBJECT); | |
2594 | return false; | |
2595 | } | |
2596 | return true; | |
2597 | } | |
2598 | - | if(index == -1) index = GetPVarInt(playerid, "PAO_LAOR"); |
2598 | + | |
2599 | - | if(!IsValidAttachedObjectSlot(index)) return 0; |
2599 | + | AOE_EnteredValidSlot(playerid, index) |
2600 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, index)) |
2600 | + | |
2601 | if(!IsValidAttachedObjectSlot(index)) | |
2602 | - | _AttachedObjectsRemoved += RemovePlayerAttachedObject(playerid, index); |
2602 | + | |
2603 | - | PAO[playerid][index][AO_STATUS] = 0; |
2603 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you've entered invalid attached object index number (%d).", index); |
2604 | - | SetPVarInt(playerid, "PAO_LAOR", index); |
2604 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
2605 | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_SLOT); | |
2606 | return false; | |
2607 | - | return _AttachedObjectsRemoved; |
2607 | + | |
2608 | return true; | |
2609 | } | |
2610 | - | GetAttachedObjectBoneName(BoneID) |
2610 | + | |
2611 | AOE_EnteredValidModel(playerid, modelid) | |
2612 | - | new _AttachedObjectBoneName[15+1]; |
2612 | + | |
2613 | - | if(!IsValidAttachedObjectBone(BoneID)) _AttachedObjectBoneName = "INVALID_BONE_ID"; |
2613 | + | if(!IsValidObjectModel(modelid)) |
2614 | - | else _AttachedObjectBoneName = AttachedObjectBones[BoneID - 1]; |
2614 | + | |
2615 | - | return _AttachedObjectBoneName; |
2615 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you've entered invalid object model number (%d).", modelid); |
2616 | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); | |
2617 | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_MODEL); | |
2618 | - | GetAttachedObjectBone(const BoneName[]) |
2618 | + | return false; |
2619 | } | |
2620 | - | if(!IsValidAttachedObjectBoneName(BoneName)) return 0; |
2620 | + | |
2621 | - | if(IsNumeric(BoneName) && IsValidAttachedObjectBoneName(BoneName)) return strval(BoneName); |
2621 | + | |
2622 | - | for(new i = 0; i < sizeof(AttachedObjectBones); i++) |
2622 | + | |
2623 | AOE_EnteredValidBone(playerid, const bone[]) | |
2624 | - | if(strfind(AttachedObjectBones[i], BoneName, true) != -1) return i + 1; |
2624 | + | |
2625 | if(!IsValidAttachedObjectBoneName(bone)) | |
2626 | { | |
2627 | format(AOE_STR, sizeof AOE_STR, "* Sorry, you've entered invalid attached object bone name/number (%s).", bone); | |
2628 | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); | |
2629 | - | GetAttachedObjectsCount() |
2629 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_BONE); |
2630 | return false; | |
2631 | - | new _AttachedObjectsCount; |
2631 | + | |
2632 | - | new j = GetMaxPlayers(); |
2632 | + | |
2633 | - | if(j > MAX_PLAYERS) j = MAX_PLAYERS; |
2633 | + | |
2634 | - | for(new i = 0; i < j; i++) |
2634 | + | |
2635 | AOE_EnteredValidFileName(playerid, const filename[]) | |
2636 | - | if(IsPlayerConnected(i)) |
2636 | + | |
2637 | - | { |
2637 | + | if(!IsValidFileName(filename)) |
2638 | - | for(new x = 0; x < MAX_PLAYER_ATTACHED_OBJECTS; x++) |
2638 | + | |
2639 | - | { |
2639 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, you've entered invalid attached object(s) file name ({FFFFFF}%s{%06x}).", filename, AOE_COLOR4 >>> 8); |
2640 | - | if(IsPlayerAttachedObjectSlotUsed(i, x)) _AttachedObjectsCount++; |
2640 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
2641 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_VALID_NAME_INFO1); | |
2642 | SendClientMessage(playerid, AOE_COLOR4, AOE_M_VALID_NAME_INFO2); | |
2643 | - | } |
2643 | + | AOE_GameTextForPlayer(playerid, AOE_G_INVALID_FILE_NAME); |
2644 | - | return _AttachedObjectsCount; |
2644 | + | return false; |
2645 | } | |
2646 | return true; | |
2647 | } | |
2648 | ||
2649 | AOE_EnteredExistedFileName(playerid, filename[]) | |
2650 | - | new _PlayerAttachedObjectsCount; |
2650 | + | |
2651 | if(!fexist(filename)) | |
2652 | { | |
2653 | - | if(IsPlayerAttachedObjectSlotUsed(playerid, i)) _PlayerAttachedObjectsCount++; |
2653 | + | new len = strlen(filename); |
2654 | strdel(filename, len-(strlen(AOE_FILE_NAME)-2), len); | |
2655 | - | return _PlayerAttachedObjectsCount; |
2655 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, attached object(s) file \"{FFFFFF}%s{%06x}\" does not exist.", filename, AOE_COLOR4 >>> 8); |
2656 | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); | |
2657 | AOE_GameTextForPlayer(playerid, AOE_G_FILE_NOT_EXIST); | |
2658 | return false; | |
2659 | } | |
2660 | return true; | |
2661 | } | |
2662 | ||
2663 | AOE_EnteredNonExistFileName(playerid, filename[]) | |
2664 | { | |
2665 | if(fexist(filename)) | |
2666 | - | IsValidAttachedObjectSlot(SlotID) |
2666 | + | |
2667 | - | return (0 <= SlotID < MAX_PLAYER_ATTACHED_OBJECTS); |
2667 | + | if(IsPlayerAdmin(playerid)) AOE_ShowPlayerDialog(playerid, AOE_C_SAVE_REPLACE, AOE_D_SAVE_REPLACE, AOE_T_SAVE#AOE_T_REPLACE, AOE_B_YES, AOE_B_BACK); |
2668 | else | |
2669 | - | IsValidAttachedObjectBone(BoneID) |
2669 | + | |
2670 | - | return (1 <= BoneID <= MAX_ATTACHED_OBJECT_BONES); |
2670 | + | new len = strlen(filename); |
2671 | strdel(filename, len-(strlen(AOE_FILE_NAME)-2), len); | |
2672 | - | IsValidAttachedObjectBoneName(const BoneName[]) |
2672 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, attached object file \"{FFFFFF}%s{%06x}\" already exists.", filename, AOE_COLOR4 >>> 8); |
2673 | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); | |
2674 | - | new length = strlen(BoneName); |
2674 | + | AOE_GameTextForPlayer(playerid, AOE_G_FILE_EXISTED); |
2675 | - | if(!length || length > 16) return false; |
2675 | + | |
2676 | - | for(new i = 0; i < sizeof(AttachedObjectBones); i++) |
2676 | + | return false; |
2677 | } | |
2678 | - | if(!strcmp(BoneName, AttachedObjectBones[i], true)) return true; |
2678 | + | |
2679 | } | |
2680 | - | if(IsNumeric(BoneName) && IsValidAttachedObjectBone(strval(BoneName))) return true; |
2680 | + | |
2681 | AOE_EnteredNonExistFileName2(playerid, filename[]) | |
2682 | { | |
2683 | if(fexist(filename)) | |
2684 | - | IsValidObjectModel(ModelID) |
2684 | + | |
2685 | if(IsPlayerAdmin(playerid)) AOE_ShowPlayerDialog(playerid, AOE_C_SAVE_REPLACE, AOE_D_SAVE2_REPLACE, AOE_T_SAVE_SET#AOE_T_REPLACE, AOE_B_YES, AOE_B_BACK); | |
2686 | - | return((ModelID >= 321 && ModelID <= 328) |
2686 | + | |
2687 | - | || (ModelID >= 330 && ModelID <= 331) |
2687 | + | |
2688 | - | || (ModelID >= 333 && ModelID <= 339) |
2688 | + | new len = strlen(filename); |
2689 | - | || (ModelID >= 341 && ModelID <= 373) |
2689 | + | strdel(filename, len-(strlen(AOE_FILE_NAME)-2), len); |
2690 | - | || (ModelID >= 615 && ModelID <= 698) |
2690 | + | format(AOE_STR, sizeof AOE_STR, "* Sorry, attached object(s) set file \"{FFFFFF}%s{%06x}\" already exists.", filename, AOE_COLOR4 >>> 8); |
2691 | - | || (ModelID >= 700 && ModelID <= 1193) |
2691 | + | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); |
2692 | - | || (ModelID >= 1207 && ModelID <= 1698) |
2692 | + | AOE_GameTextForPlayer(playerid, AOE_G_FILE_EXISTED); |
2693 | - | || (ModelID >= 1700 && ModelID <= 4762) |
2693 | + | |
2694 | - | || (ModelID >= 4806 && ModelID <= 6525) |
2694 | + | return false; |
2695 | - | || (ModelID >= 6863 && ModelID <= 11681) |
2695 | + | |
2696 | - | || (ModelID >= 12800 && ModelID <= 13890) |
2696 | + | |
2697 | - | || (ModelID >= 14383 && ModelID <= 14898) |
2697 | + | |
2698 | - | || (ModelID >= 14900 && ModelID <= 14903) |
2698 | + | |
2699 | - | || (ModelID >= 15025 && ModelID <= 15064) |
2699 | + | AOE_SavePlayerAttachedObject(playerid, const filename[], index, const comment[] = "", &Float:filelen) // MAX_PLAYER_ATTACHED_OBJECTS for all slot |
2700 | - | || (ModelID >= 16000 && ModelID <= 16790) |
2700 | + | |
2701 | - | || (ModelID >= 17000 && ModelID <= 18630) |
2701 | + | |
2702 | - | // SA:MP Objects 18631 - 19521 (0.3x RC2-4) |
2702 | + | new File:SAO = fopen(filename, io_write), slots; |
2703 | - | || (ModelID >= 18631 && ModelID <= 19521) |
2703 | + | |
2704 | - | // Custom Objects 19522 - 19999 (can be changed) |
2704 | + | |
2705 | - | || (ModelID >= 19522 && ModelID <= 19999)); |
2705 | + | new year, month, day, hour, minute, second, AOE_STR2[256]; |
2706 | GetPlayerName(playerid, pName, sizeof pName); | |
2707 | getdate(year, month, day); | |
2708 | gettime(hour, minute, second); | |
2709 | if(isnull(comment)) | |
2710 | - | new length = strlen(filename); |
2710 | + | |
2711 | - | if(1 < length > 24) return false; |
2711 | + | format(AOE_STR2, sizeof AOE_STR2, "// Created by %s (Skin ID %d) on %02d/%02d/%d %02d:%02d:%02d (server time)", pName, GetPlayerSkin(playerid), day, month, year, hour, minute, second); |
2712 | - | for(new j = 0; j < length; j++) |
2712 | + | fwrite(SAO, AOE_STR2); |
2713 | } | |
2714 | new i = ((index == MAX_PLAYER_ATTACHED_OBJECTS) ? (0) : (index)); | |
2715 | SaveLoop: | |
2716 | - | || filename[j] != ']' || filename[j] != '_' || filename[j] != '=' || filename[j] != '.')) return false; |
2716 | + | |
2717 | if(IsValidPlayerAttachedObject(playerid, i) == 1) | |
2718 | { | |
2719 | #if AOE_SMALLER_SAVE true | |
2720 | if(PAO[playerid][i][AO_MC1] == 0 && PAO[playerid][i][AO_MC2] == 0) | |
2721 | - | stock IsNumeric(const string[]) |
2721 | + | |
2722 | if(PAO[playerid][i][AO_SX] == 1.0 && PAO[playerid][i][AO_SY] == 1.0 && PAO[playerid][i][AO_SZ] == 1.0) | |
2723 | - | new length = strlen(string); |
2723 | + | |
2724 | - | if(!length) return false; |
2724 | + | if(PAO[playerid][i][AO_RX] == 0.0 && PAO[playerid][i][AO_RY] == 0.0 && PAO[playerid][i][AO_RZ] == 0.0) |
2725 | - | for(new i = 0; i < length; i++) |
2725 | + | |
2726 | if(PAO[playerid][i][AO_X] == 0.0 && PAO[playerid][i][AO_Y] == 0.0 && PAO[playerid][i][AO_Z] == 0.0) | |
2727 | - | if(string[i] > '9' || string[i] <'0') return false; |
2727 | + | |
2728 | - | } |
2728 | + | format(AOE_STR2, sizeof AOE_STR2, "\r\nSetPlayerAttachedObject(playerid, %d, %d, %d);", i, PAO[playerid][i][AO_MODEL_ID], PAO[playerid][i][AO_BONE_ID]); |
2729 | - | return true; |
2729 | + | |
2730 | else | |
2731 | { | |
2732 | format(AOE_STR2, sizeof AOE_STR2, "\r\nSetPlayerAttachedObject(playerid, %d, %d, %d, %f, %f, %f);", i, | |
2733 | PAO[playerid][i][AO_MODEL_ID], PAO[playerid][i][AO_BONE_ID],PAO[playerid][i][AO_X], PAO[playerid][i][AO_Y], PAO[playerid][i][AO_Z]); | |
2734 | } | |
2735 | } | |
2736 | else | |
2737 | { | |
2738 | format(AOE_STR2, sizeof AOE_STR2, "\r\nSetPlayerAttachedObject(playerid, %d, %d, %d, %f, %f, %f, %f, %f, %f);", i, PAO[playerid][i][AO_MODEL_ID], PAO[playerid][i][AO_BONE_ID], | |
2739 | PAO[playerid][i][AO_X], PAO[playerid][i][AO_Y], PAO[playerid][i][AO_Z], PAO[playerid][i][AO_RX], PAO[playerid][i][AO_RY], PAO[playerid][i][AO_RZ]); | |
2740 | } | |
2741 | } | |
2742 | else | |
2743 | { | |
2744 | format(AOE_STR2, sizeof AOE_STR2, "\r\nSetPlayerAttachedObject(playerid, %d, %d, %d, %f, %f, %f, %f, %f, %f, %f, %f, %f);", i, | |
2745 | PAO[playerid][i][AO_MODEL_ID], PAO[playerid][i][AO_BONE_ID], PAO[playerid][i][AO_X], PAO[playerid][i][AO_Y], PAO[playerid][i][AO_Z], | |
2746 | PAO[playerid][i][AO_RX], PAO[playerid][i][AO_RY], PAO[playerid][i][AO_RZ], PAO[playerid][i][AO_SX], PAO[playerid][i][AO_SY], PAO[playerid][i][AO_SZ]); | |
2747 | } | |
2748 | } | |
2749 | else | |
2750 | { | |
2751 | #endif | |
2752 | format(AOE_STR2, sizeof AOE_STR2, "\r\nSetPlayerAttachedObject(playerid, %d, %d, %d, %f, %f, %f, %f, %f, %f, %f, %f, %f, 0x%x, 0x%x);", i, PAO[playerid][i][AO_MODEL_ID], PAO[playerid][i][AO_BONE_ID], | |
2753 | PAO[playerid][i][AO_X], PAO[playerid][i][AO_Y], PAO[playerid][i][AO_Z], PAO[playerid][i][AO_RX], PAO[playerid][i][AO_RY], PAO[playerid][i][AO_RZ], | |
2754 | PAO[playerid][i][AO_SX], PAO[playerid][i][AO_SY], PAO[playerid][i][AO_SZ], PAO[playerid][i][AO_MC1], PAO[playerid][i][AO_MC2]); | |
2755 | #if AOE_SMALLER_SAVE true | |
2756 | } | |
2757 | #endif | |
2758 | fwrite(SAO, AOE_STR2); | |
2759 | slots++; | |
2760 | } | |
2761 | } | |
2762 | if(index == MAX_PLAYER_ATTACHED_OBJECTS && i < MAX_PLAYER_ATTACHED_OBJECTS) | |
2763 | { | |
2764 | i++; | |
2765 | goto SaveLoop; | |
2766 | } | |
2767 | fclose(SAO); | |
2768 | if(fexist(filename)) | |
2769 | { | |
2770 | if(!slots) fremove(filename); | |
2771 | else | |
2772 | { | |
2773 | SAO = fopen(filename, io_read); | |
2774 | if(SAO) | |
2775 | { | |
2776 | filelen = float(flength(SAO))/1024.0; | |
2777 | fclose(SAO); | |
2778 | } | |
2779 | } | |
2780 | } | |
2781 | } | |
2782 | return slots; | |
2783 | } | |
2784 | ||
2785 | AOE_LoadPlayerAttachedObject(playerid, const filename[], index, const comment[]) | |
2786 | { | |
2787 | #pragma unused comment | |
2788 | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; | |
2789 | if(!fexist(filename)) return 0; | |
2790 | new File:LAO = fopen(filename, io_read), slots; | |
2791 | if(LAO) | |
2792 | { | |
2793 | AOComment[0] = EOS; | |
2794 | new idx, replaced, LAOD[E_ATTACHED_OBJECT], AOE_STR2[256]; | |
2795 | while(fread(LAO, AOE_STR2) && slots != MAX_PLAYER_ATTACHED_OBJECTS) | |
2796 | { | |
2797 | if(!unformat(AOE_STR2, "'SetPlayerAttachedObject'P<();,>{s[3]}{s[32]}dddF(0.0)F(0.0)F(0.0)F(0.0)F(0.0)F(0.0)F(1.0)F(1.0)F(1.0)X(0)X(0)", idx, LAOD[AO_MODEL_ID], LAOD[AO_BONE_ID], | |
2798 | LAOD[AO_X], LAOD[AO_Y], LAOD[AO_Z], LAOD[AO_RX], LAOD[AO_RY], LAOD[AO_RZ], LAOD[AO_SX], LAOD[AO_SY], LAOD[AO_SZ], LAOD[AO_MC1], LAOD[AO_MC2])) | |
2799 | { | |
2800 | if(IsValidAttachedObjectSlot(idx) && IsValidObjectModel(LAOD[AO_MODEL_ID]) && IsValidAttachedObjectBone(LAOD[AO_BONE_ID])) | |
2801 | { | |
2802 | if(index == MAX_PLAYER_ATTACHED_OBJECTS) | |
2803 | { | |
2804 | if(IsPlayerAttachedObjectSlotUsed(playerid, idx)) | |
2805 | { | |
2806 | switch(replaced++) | |
2807 | { | |
2808 | case 0: format(AOE_STR, sizeof AOE_STR, "** Attached object index number %d", idx); | |
2809 | default: format(AOE_STR, sizeof AOE_STR, "%s, %d", AOE_STR, idx); | |
2810 | } | |
2811 | } | |
2812 | slots += UpdatePlayerAttachedObjectEx(playerid, idx, LAOD[AO_MODEL_ID], LAOD[AO_BONE_ID], LAOD[AO_X], LAOD[AO_Y], LAOD[AO_Z], | |
2813 | LAOD[AO_RX], LAOD[AO_RY], LAOD[AO_RZ], LAOD[AO_SX], LAOD[AO_SY], LAOD[AO_SZ], LAOD[AO_MC1], LAOD[AO_MC2]); | |
2814 | } | |
2815 | else | |
2816 | { | |
2817 | if(index == idx) | |
2818 | { | |
2819 | slots += UpdatePlayerAttachedObjectEx(playerid, idx, LAOD[AO_MODEL_ID], LAOD[AO_BONE_ID], LAOD[AO_X], LAOD[AO_Y], LAOD[AO_Z], | |
2820 | LAOD[AO_RX], LAOD[AO_RY], LAOD[AO_RZ], LAOD[AO_SX], LAOD[AO_SY], LAOD[AO_SZ], LAOD[AO_MC1], LAOD[AO_MC2]); | |
2821 | break; | |
2822 | } | |
2823 | } | |
2824 | } | |
2825 | } | |
2826 | else if(!unformat(AOE_STR2, "'/*'s[251]'*/'", comment) || !unformat(AOE_STR2, "'//'s[253]", comment)) { } | |
2827 | } | |
2828 | if(0 < replaced < MAX_PLAYER_ATTACHED_OBJECTS) | |
2829 | { | |
2830 | format(AOE_STR, sizeof AOE_STR, "%s was replaced (Total: %d).", AOE_STR, replaced); | |
2831 | SendClientMessage(playerid, AOE_COLOR4, AOE_STR); | |
2832 | } | |
2833 | fclose(LAO); | |
2834 | } | |
2835 | return slots; | |
2836 | } | |
2837 | //------------------------------------------------------------------------------ | |
2838 | UpdatePlayerAttachedObject(playerid, index, modelid, boneid) | |
2839 | return UpdatePlayerAttachedObjectEx(playerid, index, modelid, boneid, PAO[playerid][index][AO_X], PAO[playerid][index][AO_Y], PAO[playerid][index][AO_Z], PAO[playerid][index][AO_RX], PAO[playerid][index][AO_RY], PAO[playerid][index][AO_RZ], | |
2840 | PAO[playerid][index][AO_SX], PAO[playerid][index][AO_SY], PAO[playerid][index][AO_SZ], PAO[playerid][index][AO_MC1], PAO[playerid][index][AO_MC2]); | |
2841 | ||
2842 | UpdatePlayerAttachedObjectEx(playerid, index, modelid, boneid, 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) | |
2843 | { | |
2844 | if(IsValidAttachedObjectSlot(index) || IsValidObjectModel(modelid) || IsValidAttachedObjectBone(boneid)) | |
2845 | { | |
2846 | if(SetPlayerAttachedObject(playerid, index, modelid, boneid, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ, materialcolor1, materialcolor2)) | |
2847 | { | |
2848 | PAO[playerid][index][AO_MODEL_ID] = modelid; | |
2849 | PAO[playerid][index][AO_BONE_ID] = boneid; | |
2850 | PAO[playerid][index][AO_X] = fOffsetX, PAO[playerid][index][AO_Y] = fOffsetY, PAO[playerid][index][AO_Z] = fOffsetZ; | |
2851 | PAO[playerid][index][AO_RX] = fRotX, PAO[playerid][index][AO_RY] = fRotY, PAO[playerid][index][AO_RZ] = fRotZ; | |
2852 | PAO[playerid][index][AO_SX] = fScaleX, PAO[playerid][index][AO_SY] = fScaleY, PAO[playerid][index][AO_SZ] = fScaleZ; | |
2853 | PAO[playerid][index][AO_MC1] = materialcolor1, PAO[playerid][index][AO_MC2] = materialcolor2; | |
2854 | PAO[playerid][index][AO_STATUS] = 1; | |
2855 | return 1; | |
2856 | } | |
2857 | } | |
2858 | return 0; | |
2859 | } | |
2860 | ||
2861 | DuplicatePlayerAttachedObject(playerid, fromindex, asindex) | |
2862 | { | |
2863 | if(IsValidAttachedObjectSlot(fromindex) && IsValidAttachedObjectSlot(asindex)) | |
2864 | { | |
2865 | return UpdatePlayerAttachedObjectEx(playerid, asindex, PAO[playerid][fromindex][AO_MODEL_ID], PAO[playerid][fromindex][AO_BONE_ID], PAO[playerid][fromindex][AO_X], PAO[playerid][fromindex][AO_Y], PAO[playerid][fromindex][AO_Z], | |
2866 | PAO[playerid][fromindex][AO_RX], PAO[playerid][fromindex][AO_RY], PAO[playerid][fromindex][AO_RZ], PAO[playerid][fromindex][AO_SX], PAO[playerid][fromindex][AO_SY], PAO[playerid][fromindex][AO_SZ], PAO[playerid][fromindex][AO_MC1], PAO[playerid][fromindex][AO_MC2]); | |
2867 | } | |
2868 | return 0; | |
2869 | } | |
2870 | ||
2871 | ChangePlayerAttachedObjectIndex(playerid, fromindex, toindex) | |
2872 | { | |
2873 | if(IsValidAttachedObjectSlot(toindex) && IsValidPlayerAttachedObject(playerid, fromindex)) | |
2874 | { | |
2875 | if(IsPlayerAttachedObjectSlotUsed(playerid, fromindex)) RemovePlayerAttachedObject(playerid, fromindex), PAO[playerid][fromindex][AO_STATUS] = 0; | |
2876 | return UpdatePlayerAttachedObjectEx(playerid, toindex, PAO[playerid][fromindex][AO_MODEL_ID], PAO[playerid][fromindex][AO_BONE_ID], PAO[playerid][fromindex][AO_X], PAO[playerid][fromindex][AO_Y], PAO[playerid][fromindex][AO_Z], | |
2877 | PAO[playerid][fromindex][AO_RX], PAO[playerid][fromindex][AO_RY], PAO[playerid][fromindex][AO_RZ], PAO[playerid][fromindex][AO_SX], PAO[playerid][fromindex][AO_SY], PAO[playerid][fromindex][AO_SZ], PAO[playerid][fromindex][AO_MC1], PAO[playerid][fromindex][AO_MC2]); | |
2878 | } | |
2879 | return 0; | |
2880 | } | |
2881 | ||
2882 | RefreshPlayerAttachedObject(playerid, forplayerid, index) | |
2883 | { | |
2884 | if(IsValidPlayerAttachedObject(playerid, index) == 1) | |
2885 | { | |
2886 | return UpdatePlayerAttachedObjectEx(forplayerid, index, PAO[playerid][index][AO_MODEL_ID], PAO[playerid][index][AO_BONE_ID], PAO[playerid][index][AO_X], PAO[playerid][index][AO_Y], PAO[playerid][index][AO_Z], | |
2887 | PAO[playerid][index][AO_RX], PAO[playerid][index][AO_RY], PAO[playerid][index][AO_RZ], PAO[playerid][index][AO_SX], PAO[playerid][index][AO_SY], PAO[playerid][index][AO_SZ], PAO[playerid][index][AO_MC1], PAO[playerid][index][AO_MC2]); | |
2888 | } | |
2889 | return 0; | |
2890 | } | |
2891 | ||
2892 | RestorePlayerAttachedObject(playerid, index) | |
2893 | { | |
2894 | if(IsValidAttachedObjectSlot(index) && IsValidObjectModel(PAO[playerid][index][AO_MODEL_ID]) && IsValidAttachedObjectBone(PAO[playerid][index][AO_BONE_ID])) | |
2895 | { | |
2896 | if(SetPlayerAttachedObject(playerid, index, PAO[playerid][index][AO_MODEL_ID], PAO[playerid][index][AO_BONE_ID], PAO[playerid][index][AO_X], PAO[playerid][index][AO_Y], PAO[playerid][index][AO_Z], | |
2897 | PAO[playerid][index][AO_RX], PAO[playerid][index][AO_RY], PAO[playerid][index][AO_RZ], PAO[playerid][index][AO_SX], PAO[playerid][index][AO_SY], PAO[playerid][index][AO_SZ], PAO[playerid][index][AO_MC1], PAO[playerid][index][AO_MC2])) | |
2898 | { | |
2899 | PAO[playerid][index][AO_STATUS] = 1; | |
2900 | return 1; | |
2901 | } | |
2902 | } | |
2903 | return 0; | |
2904 | } | |
2905 | ||
2906 | RemovePlayerAttachedObjectEx(playerid, index) // MAX_PLAYER_ATTACHED_OBJECTS for all slot | |
2907 | { | |
2908 | new attachedobjectsremoved; | |
2909 | if(index == MAX_PLAYER_ATTACHED_OBJECTS) | |
2910 | { | |
2911 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) | |
2912 | { | |
2913 | if(IsPlayerAttachedObjectSlotUsed(playerid, i)) | |
2914 | { | |
2915 | attachedobjectsremoved += RemovePlayerAttachedObject(playerid, i); | |
2916 | if(PAO[playerid][i][AO_STATUS] == 0) | |
2917 | { | |
2918 | AOE_UnsetValues(playerid, i); | |
2919 | } | |
2920 | else | |
2921 | { | |
2922 | PAO[playerid][i][AO_STATUS] = 0; | |
2923 | EPV[playerid][PAO_LAST_REMOVED] = i; | |
2924 | } | |
2925 | } | |
2926 | } | |
2927 | } | |
2928 | else | |
2929 | { | |
2930 | if(!IsValidAttachedObjectSlot(index)) return 0; | |
2931 | if(IsPlayerAttachedObjectSlotUsed(playerid, index)) | |
2932 | { | |
2933 | attachedobjectsremoved += RemovePlayerAttachedObject(playerid, index); | |
2934 | if(PAO[playerid][index][AO_STATUS] == 0) | |
2935 | { | |
2936 | AOE_UnsetValues(playerid, index); | |
2937 | } | |
2938 | else | |
2939 | { | |
2940 | PAO[playerid][index][AO_STATUS] = 0; | |
2941 | EPV[playerid][PAO_LAST_REMOVED] = index; | |
2942 | } | |
2943 | } | |
2944 | } | |
2945 | return attachedobjectsremoved; | |
2946 | } | |
2947 | ||
2948 | GetAttachedObjectBoneName(boneid) | |
2949 | { | |
2950 | new attachedobjectbonename[MAX_ATTACHED_OBJECT_BONE_NAME]; | |
2951 | if(!IsValidAttachedObjectBone(boneid)) attachedobjectbonename = "Invalid Bone ID"; | |
2952 | else attachedobjectbonename = AttachedObjectBones[boneid-1]; | |
2953 | return attachedobjectbonename; | |
2954 | } | |
2955 | ||
2956 | GetAttachedObjectBone(const bonename[]) | |
2957 | { | |
2958 | if(!IsValidAttachedObjectBoneName(bonename)) return 0; | |
2959 | if(IsNumeric(bonename)) return strval(bonename); | |
2960 | for(new i = 0; i < sizeof AttachedObjectBones; i++) | |
2961 | { | |
2962 | if(strfind(AttachedObjectBones[i], bonename, true) != -1) return i+1; | |
2963 | } | |
2964 | return 0; | |
2965 | } | |
2966 | ||
2967 | GetPlayerAttachedObjectsCount(playerid) | |
2968 | { | |
2969 | new playerattachedobjectscount; | |
2970 | for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) | |
2971 | { | |
2972 | playerattachedobjectscount += IsPlayerAttachedObjectSlotUsed(playerid, i); | |
2973 | } | |
2974 | return playerattachedobjectscount; | |
2975 | } | |
2976 | ||
2977 | IsValidPlayerAttachedObject(playerid, index) | |
2978 | { | |
2979 | if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; // Player is offline | |
2980 | if(!IsPlayerAttachedObjectSlotUsed(playerid, index)) return -1; // Not used | |
2981 | if(!IsValidAttachedObjectSlot(index) || !IsValidObjectModel(PAO[playerid][index][AO_MODEL_ID]) || !IsValidAttachedObjectBone(PAO[playerid][index][AO_BONE_ID]) || !PAO[playerid][index][AO_STATUS]) return 0; // Invalid data | |
2982 | return 1; | |
2983 | } | |
2984 | ||
2985 | IsValidAttachedObjectSlot(slotid) | |
2986 | return (0 <= slotid < MAX_PLAYER_ATTACHED_OBJECTS); | |
2987 | ||
2988 | IsValidAttachedObjectBone(boneid) | |
2989 | return (1 <= boneid <= MAX_ATTACHED_OBJECT_BONES); | |
2990 | ||
2991 | IsValidAttachedObjectBoneName(const bonename[]) | |
2992 | { | |
2993 | new len = strlen(bonename); | |
2994 | if(len < 1 || len >= MAX_ATTACHED_OBJECT_BONE_NAME) return false; | |
2995 | for(new i = 0; i < sizeof AttachedObjectBones; i++) | |
2996 | { | |
2997 | if(!strcmp(bonename, AttachedObjectBones[i], true)) return true; | |
2998 | } | |
2999 | if(IsNumeric(bonename) && IsValidAttachedObjectBone(strval(bonename))) return true; | |
3000 | return false; | |
3001 | } | |
3002 | ||
3003 | IsValidComment(const comment[]) | |
3004 | { | |
3005 | new len = strlen(comment); | |
3006 | if(len < 1 || len >= sizeof AOComment) return false; | |
3007 | for(new j = 0; j < len; j++) | |
3008 | { | |
3009 | if((comment[j] < 'A' || comment[j] > 'Z') && (comment[j] < 'a' || comment[j] > 'z') && (comment[j] < '0' || comment[j] > '9') | |
3010 | && comment[j] != ' ') return false; | |
3011 | } | |
3012 | return true; | |
3013 | } | |
3014 | ||
3015 | IsValidFileName(const filename[]) | |
3016 | { | |
3017 | new len = strlen(filename); | |
3018 | if(!(1 <= len <= 24)) return false; | |
3019 | for(new j = 0; j < len; j++) | |
3020 | { | |
3021 | if((filename[j] < 'A' || filename[j] > 'Z') && (filename[j] < 'a' || filename[j] > 'z') && (filename[j] < '0' || filename[j] > '9') | |
3022 | && (filename[j] != '@' || filename[j] != '$' || filename[j] != '(' || filename[j] != ')' || filename[j] != '[' | |
3023 | || filename[j] != ']' || filename[j] != '_' || filename[j] != '=')) return false; | |
3024 | } | |
3025 | return true; | |
3026 | } | |
3027 | ||
3028 | IsValidObjectModel(modelid) | |
3029 | { | |
3030 | return((321 <= modelid <= 328) | |
3031 | || (330 <= modelid <= 331) | |
3032 | || (333 <= modelid <= 339) | |
3033 | || (341 <= modelid <= 373) | |
3034 | || (615 <= modelid <= 698) | |
3035 | || (700 <= modelid <= 1193) | |
3036 | || (1207 <= modelid <= 1698) | |
3037 | || (1700 <= modelid <= 4762) | |
3038 | || (4806 <= modelid <= 6525) | |
3039 | || (6863 <= modelid <= 11681) | |
3040 | || (11682 <= modelid <= 12799) // SA:MP 0.3.7 Objects | |
3041 | || (12800 <= modelid <= 13890) | |
3042 | || (14383 <= modelid <= 14898) | |
3043 | || (14900 <= modelid <= 14903) | |
3044 | || (15025 <= modelid <= 15064) | |
3045 | || (15065 <= modelid <= 15999) // SA:MP Custom IMG Objects | |
3046 | || (16000 <= modelid <= 16790) | |
3047 | || (17000 <= modelid <= 18630) | |
3048 | || (18631 <= modelid <= 19999)); // SA:MP 0.3.7 Objects | |
3049 | } | |
3050 | ||
3051 | IsNumeric(const string[]) | |
3052 | { | |
3053 | new len = strlen(string); | |
3054 | if(len == 0) return false; | |
3055 | for(new i = 0; i < len; i++) | |
3056 | { | |
3057 | if(string[i] > '9' || string[i] < '0') return false; | |
3058 | } | |
3059 | return true; | |
3060 | } |