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