├── mapedit.amx ├── mapedit.pwn └── mapedit ├── attach ├── callbacks.pwn ├── data.pwn ├── functions.pwn ├── hooks.pwn └── macros.pwn ├── cam ├── callbacks.pwn ├── data.pwn └── functions.pwn ├── cbrowser ├── callbacks.pwn ├── data.pwn ├── functions.pwn └── macros.pwn ├── color.pwn ├── dialog ├── callbacks.pwn ├── data.pwn ├── hooks.pwn └── macros.pwn ├── info ├── callbacks.pwn ├── data.pwn └── functions.pwn ├── mbrowser ├── callbacks.pwn ├── data.pwn ├── functions.pwn └── macros.pwn ├── mmode ├── callbacks.pwn ├── data.pwn ├── functions.pwn ├── hooks.pwn └── macros.pwn ├── mparse ├── data.pwn └── functions.pwn ├── new ├── callbacks.pwn ├── data.pwn └── functions.pwn ├── obj ├── attach.pwn ├── callbacks.pwn ├── data.pwn ├── dialog.pwn ├── functions.pwn ├── hooks.pwn └── macros.pwn ├── oedit ├── callbacks.pwn ├── data.pwn └── functions.pwn ├── open ├── callbacks.pwn └── data.pwn ├── pick ├── callbacks.pwn ├── data.pwn ├── functions.pwn ├── hooks.pwn └── macros.pwn ├── resources ├── alignments.pwn ├── components.pwn ├── filename.pwn ├── fonts.pwn ├── objmodels.pwn ├── textsizes.pwn ├── textures.pwn ├── tuningshops.pwn ├── vectorpos.pwn ├── vehcolors.pwn └── vehmodels.pwn ├── save ├── callbacks.pwn ├── data.pwn └── functions.pwn ├── tmoney.pwn ├── toolbar ├── callbacks.pwn └── data.pwn └── veh ├── callbacks.pwn ├── data.pwn ├── functions.pwn ├── hooks.pwn └── macros.pwn /mapedit.amx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fusez/Map-Editor/ad60edf402544af7a2b1f61b25204c08cb476a08/mapedit.amx -------------------------------------------------------------------------------- /mapedit.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | native IsValidVehicle(vehicleid); 4 | #include 5 | #include 6 | #include 7 | 8 | /******************************************************************************/ 9 | 10 | #pragma dynamic 12000 11 | 12 | /******************************************************************************/ 13 | 14 | #include "mapedit/resources/objmodels.pwn" // object model names 15 | #include "mapedit/resources/textures.pwn" // object textures 16 | #include "mapedit/resources/fonts.pwn" // fonts for objects 17 | #include "mapedit/resources/textsizes.pwn" // textsizes for objects 18 | #include "mapedit/resources/alignments.pwn" // text alignments for objects 19 | #include "mapedit/resources/vehcolors.pwn" // colors for objects & vehicles 20 | #include "mapedit/resources/vehmodels.pwn" // vehicle model names 21 | #include "mapedit/resources/components.pwn" // compatible vehicle components 22 | #include "mapedit/resources/tuningshops.pwn" // vehicle tuningshops for teleport 23 | #include "mapedit/resources/filename.pwn" // function for checking invalid filenames 24 | #include "mapedit/resources/vectorpos.pwn" // function for transforming vector to position (for spawning stuff) 25 | 26 | #include "mapedit/color.pwn" // color defines & macros 27 | #include "mapedit/dialog/data.pwn" // dialog stuff 28 | #include "mapedit/tmoney.pwn" // money for tuning 29 | #include "mapedit/mmode/data.pwn" // mousemode 30 | #include "mapedit/toolbar/data.pwn" // toolbar 31 | #include "mapedit/mbrowser/data.pwn" // model browser 32 | #include "mapedit/cbrowser/data.pwn" // color browser 33 | #include "mapedit/obj/data.pwn" // objects 34 | #include "mapedit/veh/data.pwn" // vehicles 35 | #include "mapedit/pick/data.pwn" // pickups 36 | #include "mapedit/attach/data.pwn" // player attachables 37 | #include "mapedit/cam/data.pwn" // camera mode 38 | #include "mapedit/oedit/data.pwn" // offset editor 39 | #include "mapedit/new/data.pwn" // new map 40 | #include "mapedit/mparse/data.pwn" // map parser 41 | #include "mapedit/open/data.pwn" // open map 42 | #include "mapedit/save/data.pwn" // save map 43 | #include "mapedit/info/data.pwn" // ingame information 44 | 45 | /******************************************************************************/ 46 | 47 | public OnFilterScriptInit() 48 | print("\nFusez's Map Editor loaded successfully!\n"); 49 | 50 | /******************************************************************************/ 51 | -------------------------------------------------------------------------------- /mapedit/attach/data.pwn: -------------------------------------------------------------------------------- 1 | #define MAX_ATTACHED_INDEX 10 2 | #define MAX_ATTACHED_BONE 19 3 | 4 | new 5 | bool: g_pIsAttached [MAX_PLAYERS][MAX_ATTACHED_INDEX], 6 | g_pAttachedModel [MAX_PLAYERS][MAX_ATTACHED_INDEX], 7 | g_pAttachedBone [MAX_PLAYERS][MAX_ATTACHED_INDEX], 8 | Float: g_pAttachedOffset [MAX_PLAYERS][MAX_ATTACHED_INDEX][3], 9 | Float: g_pAttachedRot [MAX_PLAYERS][MAX_ATTACHED_INDEX][3], 10 | Float: g_pAttachedScale [MAX_PLAYERS][MAX_ATTACHED_INDEX][3], 11 | g_pAttachedColor [MAX_PLAYERS][MAX_ATTACHED_INDEX][2], 12 | 13 | g_pEditAttachIndex [MAX_PLAYERS char], 14 | 15 | g_AttachIndexDialog, 16 | g_AttachEditDialog, 17 | g_AttachBoneDialog, 18 | g_AttachXDialog, 19 | g_AttachYDialog, 20 | g_AttachZDialog, 21 | g_AttachRXDialog, 22 | g_AttachRYDialog, 23 | g_AttachRZDialog, 24 | g_AttachSXDialog, 25 | g_AttachSYDialog, 26 | g_AttachSZDialog, 27 | 28 | g_AttachModelBrowser, 29 | g_pAttachModelChoice [MAX_PLAYERS] = {-1, ...}, 30 | g_pAttachModelPage [MAX_PLAYERS], 31 | g_pAttachModelSearch [MAX_PLAYERS][MAX_MBROWSER_SEARCH], 32 | g_pAttachModelResult [MAX_PLAYERS][MAX_MBROWSER_PAGESIZE], 33 | 34 | g_AttachColorBrowser [2], 35 | g_pAttachColorPage [MAX_PLAYERS][2] 36 | ; 37 | 38 | #include "mapedit/attach/macros.pwn" 39 | #include "mapedit/attach/hooks.pwn" 40 | #include "mapedit/attach/functions.pwn" 41 | #include "mapedit/attach/callbacks.pwn" 42 | -------------------------------------------------------------------------------- /mapedit/attach/functions.pwn: -------------------------------------------------------------------------------- 1 | GetBoneName(boneid) 2 | { 3 | new output[16]; 4 | 5 | switch(boneid) 6 | { 7 | case 1: 8 | strunpack(output, !"Spine"); 9 | case 2: 10 | strunpack(output, !"Head"); 11 | case 3: 12 | strunpack(output, !"Left Upper Arm"); 13 | case 4: 14 | strunpack(output, !"Right Upper Arm"); 15 | case 5: 16 | strunpack(output, !"Left Hand"); 17 | case 6: 18 | strunpack(output, !"Right Hand"); 19 | case 7: 20 | strunpack(output, !"Left Thigh"); 21 | case 8: 22 | strunpack(output, !"Right Thigh"); 23 | case 9: 24 | strunpack(output, !"Left Foot"); 25 | case 10: 26 | strunpack(output, !"Right Foot"); 27 | case 11: 28 | strunpack(output, !"Right Calf"); 29 | case 12: 30 | strunpack(output, !"Left Calf"); 31 | case 13: 32 | strunpack(output, !"Left Forearm"); 33 | case 14: 34 | strunpack(output, !"Right Forearm"); 35 | case 15: 36 | strunpack(output, !"Left Clavicle"); 37 | case 16: 38 | strunpack(output, !"Right Clavicle"); 39 | case 17: 40 | strunpack(output, !"Neck"); 41 | case 18: 42 | strunpack(output, !"Jaw"); 43 | default: 44 | strunpack(output, !"Unknown Bone"); 45 | } 46 | return output; 47 | } 48 | 49 | stock ShowPlayerAttachDialog(playerid, dialogid) 50 | { 51 | if(dialogid == g_AttachIndexDialog) 52 | { 53 | new info[1000]; 54 | for(new index; index < MAX_ATTACHED_INDEX; index ++) 55 | { 56 | if(IsPlayerAttachedObjectSlotUsed(playerid, index)) 57 | { 58 | new 59 | modelid = GetPlayerAttachedObjectModel(playerid, index), 60 | boneid = GetPlayerAttachedObjectBone(playerid, index) 61 | ; 62 | 63 | strcat(info, 64 | sprintf("%s attached to %s\n", GetObjectModelName(modelid), GetBoneName(boneid)) 65 | ); 66 | } 67 | else 68 | strcat(info, "\n"); 69 | } 70 | 71 | ShowPlayerDialog( 72 | playerid, 73 | dialogid, 74 | DIALOG_STYLE_LIST, 75 | "Attached Objects", 76 | info, 77 | "Select", 78 | "Close" 79 | ); 80 | 81 | return 1; 82 | } 83 | else if(dialogid == g_AttachEditDialog) 84 | { 85 | new 86 | index = g_pEditAttachIndex{playerid}, 87 | modelid = GetPlayerAttachedObjectModel(playerid, index), 88 | boneid = GetPlayerAttachedObjectBone(playerid, index), 89 | Float: o [3], 90 | Float: r [3], 91 | Float: s [3], 92 | attach_argb [2], 93 | info [500] 94 | ; 95 | 96 | GetPlayerAttachedObjectOffset ( playerid, index, o[0], o[1], o[2] ); 97 | GetPlayerAttachedObjectRot ( playerid, index, r[0], r[1], r[2] ); 98 | GetPlayerAttachedObjectScale ( playerid, index, s[0], s[1], s[2] ); 99 | GetPlayerAttachedObjectColor ( playerid, index, attach_argb[0], attach_argb[1] ); 100 | 101 | strcat ( info, "Remove\n" ); 102 | strcat ( info, "Move\n" ); 103 | strcat ( info, sprintf("Model: \t\t%s\n", GetObjectModelName(modelid)) ); 104 | strcat ( info, sprintf("Bone: \t\t%s\n", GetBoneName(boneid)) ); 105 | strcat ( info, sprintf("X Offset: \t\t%.4f\n", o[0]) ); 106 | strcat ( info, sprintf("Y Offset: \t\t%.4f\n", o[1]) ); 107 | strcat ( info, sprintf("Z Offset: \t\t%.4f\n", o[2]) ); 108 | strcat ( info, sprintf("X Rotation:\t\t%.4f\n", r[0]) ); 109 | strcat ( info, sprintf("Y Rotation:\t\t%.4f\n", r[1]) ); 110 | strcat ( info, sprintf("Z Rotation:\t\t%.4f\n", r[2]) ); 111 | strcat ( info, sprintf("X Scale: \t\t%.4f\n", s[0]) ); 112 | strcat ( info, sprintf("Y Scale: \t\t%.4f\n", s[1]) ); 113 | strcat ( info, sprintf("Z Scale: \t\t%.4f\n", s[2]) ); 114 | for(new i; i < 2; i ++) 115 | strcat ( info, sprintf("Set Color %i\n", i + 1) ); 116 | 117 | ShowPlayerDialog( 118 | playerid, 119 | dialogid, 120 | DIALOG_STYLE_LIST, 121 | "Attached Object Settings", 122 | info, 123 | "Continue", 124 | "Back" 125 | ); 126 | 127 | return 1; 128 | } 129 | else if(dialogid == g_AttachBoneDialog) 130 | { 131 | new info[200]; 132 | for(new boneid = 1; boneid < MAX_ATTACHED_BONE; boneid ++) 133 | strcat( info, sprintf("%s\n", GetBoneName(boneid)) ); 134 | 135 | ShowPlayerDialog( 136 | playerid, 137 | dialogid, 138 | DIALOG_STYLE_LIST, 139 | "Attached Object Bone", 140 | info, 141 | "Select", 142 | "Back" 143 | ); 144 | 145 | return 1; 146 | } 147 | else if( 148 | dialogid == g_AttachXDialog || 149 | dialogid == g_AttachYDialog || 150 | dialogid == g_AttachZDialog || 151 | dialogid == g_AttachRXDialog || 152 | dialogid == g_AttachRYDialog || 153 | dialogid == g_AttachRZDialog || 154 | dialogid == g_AttachSXDialog || 155 | dialogid == g_AttachSYDialog || 156 | dialogid == g_AttachSZDialog 157 | ){ 158 | new index = g_pEditAttachIndex{playerid}, 159 | Float: o [3], 160 | Float: r [3], 161 | Float: s [3], 162 | caption [27], 163 | info [22]; 164 | 165 | GetPlayerAttachedObjectOffset ( playerid, index, o[0], o[1], o[2] ); 166 | GetPlayerAttachedObjectRot ( playerid, index, r[0], r[1], r[2] ); 167 | GetPlayerAttachedObjectScale ( playerid, index, s[0], s[1], s[2] ); 168 | 169 | if(dialogid == g_AttachXDialog) 170 | { 171 | caption = "Attached Object X Offset"; 172 | format(info, sizeof info, "X Offset: %.4f", o[0]); 173 | } 174 | else if(dialogid == g_AttachYDialog) 175 | { 176 | caption = "Attached Object Y Offset"; 177 | format(info, sizeof info, "Y Offset: %.4f", o[1]); 178 | } 179 | else if(dialogid == g_AttachZDialog) 180 | { 181 | caption = "Attached Object Z Offset"; 182 | format(info, sizeof info, "Z Offset: %.4f", o[2]); 183 | } 184 | else if(dialogid == g_AttachRXDialog) 185 | { 186 | caption = "Attached Object X Rotation"; 187 | format(info, sizeof info, "X Rotation: %.4f", r[0]); 188 | } 189 | else if(dialogid == g_AttachRYDialog) 190 | { 191 | caption = "Attached Object Y Rotation"; 192 | format(info, sizeof info, "Y Rotation: %.4f", r[1]); 193 | } 194 | else if(dialogid == g_AttachRZDialog) 195 | { 196 | caption = "Attached Object Z Rotation"; 197 | format(info, sizeof info, "Z Rotation: %.4f", r[2]); 198 | } 199 | else if(dialogid == g_AttachSXDialog) 200 | { 201 | caption = "Attached Object X Scale"; 202 | format(info, sizeof info, "X Scale: %.4f", s[0]); 203 | } 204 | else if(dialogid == g_AttachSYDialog) 205 | { 206 | caption = "Attached Object Y Scale"; 207 | format(info, sizeof info, "Y Scale: %.4f", s[1]); 208 | } 209 | else if(dialogid == g_AttachSZDialog) 210 | { 211 | caption = "Attached Object Z Scale"; 212 | format(info, sizeof info, "Z Scale: %.4f", s[2]); 213 | } 214 | 215 | ShowPlayerDialog( 216 | playerid, 217 | dialogid, 218 | DIALOG_STYLE_INPUT, 219 | caption, 220 | info, 221 | "Enter", 222 | "Back" 223 | ); 224 | 225 | return 1; 226 | } 227 | return 0; 228 | } 229 | -------------------------------------------------------------------------------- /mapedit/attach/hooks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | stock a_RemovePlayerAttachedObject(playerid, index) 4 | { 5 | new success = RemovePlayerAttachedObject(playerid, index); 6 | if(success) 7 | { 8 | g_pIsAttached [playerid][index] = false; 9 | 10 | g_pAttachedModel [playerid][index] = 0; 11 | 12 | g_pAttachedBone [playerid][index] = 0; 13 | 14 | for(new i; i < 3; i ++) 15 | g_pAttachedOffset [playerid][index][i] = 0.0; 16 | 17 | for(new i; i < 3; i ++) 18 | g_pAttachedRot [playerid][index][i] = 0.0; 19 | 20 | for(new i; i < 3; i ++) 21 | g_pAttachedScale [playerid][index][i] = 1.0; 22 | 23 | for(new i; i < 2; i ++) 24 | g_pAttachedColor [playerid][index][i] = 0xFFFFFFFF; 25 | 26 | new cbrowserid = GetPlayerCBrowser(playerid), 27 | dialogid = GetPlayerDialog(playerid); 28 | 29 | if(GetPlayerMBrowser(playerid) == g_AttachModelBrowser) 30 | HideMBrowser(playerid); 31 | 32 | if( 33 | cbrowserid == g_AttachColorBrowser[0] || 34 | cbrowserid == g_AttachColorBrowser[1] 35 | ){ 36 | HideCBrowser(playerid); 37 | } 38 | 39 | if(dialogid == g_AttachIndexDialog) 40 | ShowPlayerAttachDialog(playerid, dialogid); 41 | else if( 42 | dialogid == g_AttachEditDialog || 43 | dialogid == g_AttachBoneDialog || 44 | dialogid == g_AttachXDialog || 45 | dialogid == g_AttachYDialog || 46 | dialogid == g_AttachZDialog || 47 | dialogid == g_AttachRXDialog || 48 | dialogid == g_AttachRYDialog || 49 | dialogid == g_AttachRZDialog || 50 | dialogid == g_AttachSXDialog || 51 | dialogid == g_AttachSYDialog || 52 | dialogid == g_AttachSZDialog 53 | ){ 54 | HidePlayerDialog(playerid); 55 | } 56 | } 57 | return success; 58 | } 59 | #if defined _ALS_RemovePlayerAttachedObject 60 | #undef RemovePlayerAttachedObject 61 | #else 62 | #define _ALS_RemovePlayerAttachedObject 63 | #endif 64 | #define RemovePlayerAttachedObject a_RemovePlayerAttachedObject 65 | 66 | /******************************************************************************/ 67 | 68 | stock a_SetPlayerAttachedObject(playerid, index, modelid, bone, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ, materialcolor1, materialcolor2) 69 | { 70 | new 71 | success = SetPlayerAttachedObject( 72 | playerid, 73 | index, 74 | modelid, 75 | bone, 76 | fOffsetX, 77 | fOffsetY, 78 | fOffsetZ, 79 | fRotX, 80 | fRotY, 81 | fRotZ, 82 | fScaleX, 83 | fScaleY, 84 | fScaleZ, 85 | materialcolor1, 86 | materialcolor2 87 | ); 88 | 89 | if(success) 90 | { 91 | g_pIsAttached [playerid][index] = true; 92 | 93 | g_pAttachedModel [playerid][index] = modelid; 94 | 95 | g_pAttachedBone [playerid][index] = bone; 96 | 97 | g_pAttachedOffset [playerid][index][0] = fOffsetX; 98 | g_pAttachedOffset [playerid][index][1] = fOffsetY; 99 | g_pAttachedOffset [playerid][index][2] = fOffsetZ; 100 | 101 | g_pAttachedRot [playerid][index][0] = fRotX; 102 | g_pAttachedRot [playerid][index][1] = fRotY; 103 | g_pAttachedRot [playerid][index][2] = fRotZ; 104 | 105 | g_pAttachedScale [playerid][index][0] = fScaleX; 106 | g_pAttachedScale [playerid][index][1] = fScaleY; 107 | g_pAttachedScale [playerid][index][2] = fScaleZ; 108 | 109 | g_pAttachedColor [playerid][index][0] = materialcolor1; 110 | g_pAttachedColor [playerid][index][1] = materialcolor2; 111 | 112 | new dialogid = GetPlayerDialog(playerid); 113 | if(dialogid == g_AttachIndexDialog) 114 | ShowPlayerAttachDialog(playerid, dialogid); 115 | } 116 | return success; 117 | } 118 | #if defined _ALS_SetPlayerAttachedObject 119 | #undef SetPlayerAttachedObject 120 | #else 121 | #define _ALS_SetPlayerAttachedObject 122 | #endif 123 | #define SetPlayerAttachedObject a_SetPlayerAttachedObject 124 | 125 | /******************************************************************************/ 126 | 127 | stock a_IsPlayerAttachedObject(playerid, index) 128 | { 129 | if(index < 0 || index >= MAX_ATTACHED_INDEX) 130 | return 0; 131 | 132 | return (g_pIsAttached[playerid][index]) ? 1 : 0; 133 | } 134 | #if defined _ALS_IsPlayerAttachedObject 135 | #undef IsPlayerAttachedObjectSlotUsed 136 | #else 137 | #define _ALS_IsPlayerAttachedObject 138 | #endif 139 | #define IsPlayerAttachedObjectSlotUsed a_IsPlayerAttachedObject 140 | 141 | /******************************************************************************/ 142 | -------------------------------------------------------------------------------- /mapedit/attach/macros.pwn: -------------------------------------------------------------------------------- 1 | #define GetPlayerAttachedObjectModel(%0,%1) \ 2 | (g_pAttachedModel[%0][%1]) 3 | 4 | #define GetPlayerAttachedObjectBone(%0,%1) \ 5 | (g_pAttachedBone[%0][%1]) 6 | 7 | #define GetPlayerAttachedObjectOffset(%0,%1,%2,%3,%4) \ 8 | (%2 = g_pAttachedOffset[%0][%1][0], %3 = g_pAttachedOffset[%0][%1][1], %4 = g_pAttachedOffset[%0][%1][2]) 9 | 10 | #define GetPlayerAttachedObjectRot(%0,%1,%2,%3,%4) \ 11 | (%2 = g_pAttachedRot[%0][%1][0], %3 = g_pAttachedRot[%0][%1][1], %4 = g_pAttachedRot[%0][%1][2]) 12 | 13 | #define GetPlayerAttachedObjectScale(%0,%1,%2,%3,%4) \ 14 | (%2 = g_pAttachedScale[%0][%1][0], %3 = g_pAttachedScale[%0][%1][1], %4 = g_pAttachedScale[%0][%1][2]) 15 | 16 | #define GetPlayerAttachedObjectColor(%0,%1,%2,%3) \ 17 | (%2 = g_pAttachedColor[%0][%1][0], %3 = g_pAttachedColor[%0][%1][1]) 18 | -------------------------------------------------------------------------------- /mapedit/cam/callbacks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | public OnFilterScriptExit() 4 | { 5 | for(new playerid; playerid < MAX_PLAYERS; playerid ++) 6 | { 7 | if(IsPlayerConnected(playerid) && g_IsPlayerCamActivated{playerid}) 8 | TogglePlayerFreeCam(playerid, false); 9 | } 10 | 11 | #if defined fc_OnFilterScriptExit 12 | fc_OnFilterScriptExit(); 13 | #endif 14 | } 15 | #if defined _ALS_OnFilterScriptExit 16 | #undef OnFilterScriptExit 17 | #else 18 | #define _ALS_OnFilterScriptExit 19 | #endif 20 | #define OnFilterScriptExit fc_OnFilterScriptExit 21 | #if defined fc_OnFilterScriptExit 22 | forward fc_OnFilterScriptExit(); 23 | #endif 24 | 25 | /******************************************************************************/ 26 | 27 | public OnPlayerDisconnect(playerid, reason) 28 | { 29 | if(g_IsPlayerCamActivated{playerid}) 30 | TogglePlayerFreeCam(playerid, false); 31 | 32 | #if defined fc_OnPlayerDisconnect 33 | fc_OnPlayerDisconnect(playerid, reason); 34 | #endif 35 | } 36 | #if defined _ALS_OnPlayerDisconnect 37 | #undef OnPlayerDisconnect 38 | #else 39 | #define _ALS_OnPlayerDisconnect 40 | #endif 41 | #define OnPlayerDisconnect fc_OnPlayerDisconnect 42 | #if defined fc_OnPlayerDisconnect 43 | forward fc_OnPlayerDisconnect(playerid, reason); 44 | #endif 45 | 46 | /******************************************************************************/ 47 | 48 | public OnPlayerUpdate(playerid) 49 | { 50 | static previous_tick[MAX_PLAYERS]; 51 | 52 | if( 53 | g_IsPlayerCamActivated{playerid} && 54 | GetTickCount() - previous_tick[playerid] > 100 55 | ){ 56 | new 57 | keys, 58 | ud, 59 | lr, 60 | direction 61 | ; 62 | 63 | GetPlayerKeys(playerid, keys, ud, lr); 64 | direction = GetPlayerNextCamDirection(ud, lr); 65 | 66 | if(direction) 67 | { 68 | new Float: pos [3], 69 | Float: vector [3], 70 | Float: x, 71 | Float: y, 72 | Float: z, 73 | Float: speed; 74 | 75 | GetPlayerCameraPos(playerid, pos[0], pos[1], pos[2]); 76 | GetPlayerCameraFrontVector(playerid, vector[0], vector[1], vector[2]); 77 | GetPlayerNextCamPos(direction, pos, vector, x, y, z); 78 | 79 | g_PlayerCamAcceleration[playerid] += 0.05; 80 | if(g_PlayerCamAcceleration[playerid] > 1.0) 81 | g_PlayerCamAcceleration[playerid] = 1.0; 82 | 83 | if( (keys & KEY_JUMP) == KEY_JUMP ) 84 | speed = 200.0 * g_PlayerCamAcceleration[playerid]; 85 | else if( (keys & KEY_WALK) == KEY_WALK ) 86 | speed = 10.0 * g_PlayerCamAcceleration[playerid]; 87 | else 88 | speed = 50.0 * g_PlayerCamAcceleration[playerid]; 89 | 90 | MovePlayerObject(playerid, g_PlayerCamObject[playerid], x, y, z, speed, 0.0, 0.0, 0.0); 91 | } 92 | else 93 | { 94 | StopPlayerObject(playerid, g_PlayerCamObject[playerid]); 95 | g_PlayerCamAcceleration[playerid] = 0.0; 96 | } 97 | g_PlayerCamDirection{playerid} = direction; 98 | previous_tick[playerid] = GetTickCount(); 99 | } 100 | 101 | #if defined fc_OnPlayerUpdate 102 | return fc_OnPlayerUpdate(playerid); 103 | #else 104 | return 1; 105 | #endif 106 | } 107 | #if defined _ALS_OnPlayerUpdate 108 | #undef OnPlayerUpdate 109 | #else 110 | #define _ALS_OnPlayerUpdate 111 | #endif 112 | #define OnPlayerUpdate fc_OnPlayerUpdate 113 | #if defined fc_OnPlayerUpdate 114 | forward fc_OnPlayerUpdate(playerid); 115 | #endif 116 | 117 | /******************************************************************************/ 118 | 119 | public OnToolbarResponse(playerid, response) 120 | { 121 | if(response == TOOLBAR_CAM) 122 | { 123 | new 124 | bool: toggle = (g_IsPlayerCamActivated{playerid}) ? (false) : (true) 125 | ; 126 | 127 | if(TogglePlayerFreeCam(playerid, toggle)) 128 | CancelSelectTextDraw(playerid); 129 | 130 | return 1; 131 | } 132 | 133 | #if defined fc_OnToolbarResponse 134 | return fc_OnToolbarResponse(playerid, response); 135 | #else 136 | return 0; 137 | #endif 138 | } 139 | #if defined _ALS_OnToolbarResponse 140 | #undef OnToolbarResponse 141 | #else 142 | #define _ALS_OnToolbarResponse 143 | #endif 144 | #define OnToolbarResponse fc_OnToolbarResponse 145 | #if defined fc_OnToolbarResponse 146 | forward fc_OnToolbarResponse(playerid, response); 147 | #endif 148 | 149 | /******************************************************************************/ 150 | -------------------------------------------------------------------------------- /mapedit/cam/data.pwn: -------------------------------------------------------------------------------- 1 | new 2 | bool: g_IsPlayerCamActivated [MAX_PLAYERS char], 3 | g_PlayerCamDirection [MAX_PLAYERS char], 4 | g_PlayerCamObject [MAX_PLAYERS], 5 | Float: g_PlayerCamAcceleration [MAX_PLAYERS] 6 | ; 7 | 8 | enum 9 | { 10 | CAM_MODE_STOP, 11 | CAM_MODE_FORWARD, 12 | CAM_MODE_BACKWARD, 13 | CAM_MODE_LEFT, 14 | CAM_MODE_RIGHT, 15 | CAM_MODE_FORWARD_LEFT, 16 | CAM_MODE_FORWARD_RIGHT, 17 | CAM_MODE_BACKWARD_LEFT, 18 | CAM_MODE_BACKWARD_RIGHT 19 | } 20 | 21 | #include "mapedit/cam/functions.pwn" 22 | #include "mapedit/cam/callbacks.pwn" 23 | -------------------------------------------------------------------------------- /mapedit/cam/functions.pwn: -------------------------------------------------------------------------------- 1 | TogglePlayerFreeCam(playerid, bool:toggle) 2 | { 3 | if(toggle == g_IsPlayerCamActivated{playerid}) 4 | return 0; 5 | 6 | if(toggle) 7 | { 8 | switch(GetPlayerState(playerid)) 9 | { 10 | case PLAYER_STATE_NONE, PLAYER_STATE_WASTED, PLAYER_STATE_SPECTATING: 11 | return 0; 12 | case PLAYER_STATE_DRIVER, PLAYER_STATE_PASSENGER: 13 | { 14 | new 15 | Float: x, 16 | Float: y, 17 | Float: z 18 | ; 19 | 20 | GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z); 21 | SetPlayerPos(playerid, x, y, z); 22 | } 23 | } 24 | 25 | new 26 | Float: x, 27 | Float: y, 28 | Float: z 29 | ; 30 | 31 | GetPlayerPos(playerid, x, y, z); 32 | 33 | g_IsPlayerCamActivated{playerid} = true; 34 | TogglePlayerSpectating(playerid, true); 35 | 36 | g_PlayerCamObject[playerid] = CreatePlayerObject(playerid, 19300, x, y, z, 0.0, 0.0, 0.0); 37 | AttachCameraToPlayerObject(playerid, g_PlayerCamObject[playerid]); 38 | 39 | GameTextForPlayer(playerid, "~w~camera mode ~g~toggled", 2000, 4); 40 | } 41 | else 42 | { 43 | new 44 | Float: x, 45 | Float: y, 46 | Float: z 47 | ; 48 | 49 | GetPlayerObjectPos(playerid, g_PlayerCamObject[playerid], x, y, z); 50 | 51 | DestroyPlayerObject(playerid, g_PlayerCamObject[playerid]); 52 | g_PlayerCamObject[playerid] = INVALID_OBJECT_ID; 53 | 54 | g_IsPlayerCamActivated{playerid} = false; 55 | TogglePlayerSpectating(playerid, false); 56 | 57 | SetPlayerPos(playerid, x, y, z); 58 | GameTextForPlayer(playerid, "~w~camera mode ~r~untoggled", 2000, 4); 59 | } 60 | return 1; 61 | } 62 | 63 | GetPlayerNextCamDirection(ud, lr) 64 | { 65 | new direction; 66 | 67 | if(ud < 0) 68 | { 69 | if(lr > 0) 70 | direction = CAM_MODE_FORWARD_RIGHT; 71 | else if(lr < 0) 72 | direction = CAM_MODE_FORWARD_LEFT; 73 | else 74 | direction = CAM_MODE_FORWARD; 75 | } 76 | else if(ud > 0) 77 | { 78 | if(lr > 0) 79 | direction = CAM_MODE_BACKWARD_RIGHT; 80 | else if(lr < 0) 81 | direction = CAM_MODE_BACKWARD_LEFT; 82 | else 83 | direction = CAM_MODE_BACKWARD; 84 | } 85 | else if(lr > 0) 86 | direction = CAM_MODE_RIGHT; 87 | else if(lr < 0) 88 | direction = CAM_MODE_LEFT; 89 | else 90 | direction = CAM_MODE_STOP; 91 | 92 | return direction; 93 | } 94 | 95 | GetPlayerNextCamPos(direction, Float:pos[3], Float:vector[3], &Float:x, &Float:y, &Float:z) 96 | { 97 | #define OFFSET_X (vector[0] * 6000.0) 98 | #define OFFSET_Y (vector[1] * 6000.0) 99 | #define OFFSET_Z (vector[2] * 6000.0) 100 | 101 | switch(direction) 102 | { 103 | case CAM_MODE_FORWARD: 104 | { 105 | x = pos[0] + OFFSET_X; 106 | y = pos[1] + OFFSET_Y; 107 | z = pos[2] + OFFSET_Z; 108 | } 109 | case CAM_MODE_BACKWARD: 110 | { 111 | x = pos[0] - OFFSET_X; 112 | y = pos[1] - OFFSET_Y; 113 | z = pos[2] - OFFSET_Z; 114 | } 115 | case CAM_MODE_LEFT: 116 | { 117 | x = pos[0] - OFFSET_Y; 118 | y = pos[1] + OFFSET_X; 119 | z = pos[2]; 120 | } 121 | case CAM_MODE_RIGHT: 122 | { 123 | x = pos[0] + OFFSET_Y; 124 | y = pos[1] - OFFSET_X; 125 | z = pos[2]; 126 | } 127 | case CAM_MODE_FORWARD_LEFT: 128 | { 129 | x = pos[0] + (OFFSET_X - OFFSET_Y); 130 | y = pos[1] + (OFFSET_Y + OFFSET_X); 131 | z = pos[2] + OFFSET_Z; 132 | } 133 | case CAM_MODE_FORWARD_RIGHT: 134 | { 135 | x = pos[0] + (OFFSET_X + OFFSET_Y); 136 | y = pos[1] + (OFFSET_Y - OFFSET_X); 137 | z = pos[2] + OFFSET_Z; 138 | } 139 | case CAM_MODE_BACKWARD_LEFT: 140 | { 141 | x = pos[0] + (-OFFSET_X - OFFSET_Y); 142 | y = pos[1] + (-OFFSET_Y + OFFSET_X); 143 | z = pos[2] - OFFSET_Z; 144 | } 145 | case CAM_MODE_BACKWARD_RIGHT: 146 | { 147 | x = pos[0] + (-OFFSET_X + OFFSET_Y); 148 | y = pos[1] + (-OFFSET_Y - OFFSET_X); 149 | z = pos[2] - OFFSET_Z; 150 | } 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /mapedit/cbrowser/callbacks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | public OnFilterScriptInit() 4 | { 5 | for(new playerid; playerid < MAX_PLAYERS; playerid ++) 6 | { 7 | if(IsPlayerConnected(playerid)) 8 | CreateCBrowserTextdraws(playerid); 9 | } 10 | 11 | #if defined cb_OnFilterScriptInit 12 | cb_OnFilterScriptInit(); 13 | #endif 14 | } 15 | #if defined _ALS_OnFilterScriptInit 16 | #undef OnFilterScriptInit 17 | #else 18 | #define _ALS_OnFilterScriptInit 19 | #endif 20 | #define OnFilterScriptInit cb_OnFilterScriptInit 21 | #if defined cb_OnFilterScriptInit 22 | forward cb_OnFilterScriptInit(); 23 | #endif 24 | 25 | /******************************************************************************/ 26 | 27 | public OnFilterScriptExit() 28 | { 29 | for(new playerid; playerid < MAX_PLAYERS; playerid ++) 30 | { 31 | if(IsPlayerConnected(playerid)) 32 | DestroyCBrowserTextdraws(playerid); 33 | } 34 | 35 | #if defined cb_OnFilterScriptExit 36 | cb_OnFilterScriptExit(); 37 | #endif 38 | } 39 | #if defined _ALS_OnFilterScriptExit 40 | #undef OnFilterScriptExit 41 | #else 42 | #define _ALS_OnFilterScriptExit 43 | #endif 44 | #define OnFilterScriptExit cb_OnFilterScriptExit 45 | #if defined cb_OnFilterScriptExit 46 | forward cb_OnFilterScriptExit(); 47 | #endif 48 | 49 | /******************************************************************************/ 50 | 51 | public OnPlayerConnect(playerid) 52 | { 53 | CreateCBrowserTextdraws(playerid); 54 | 55 | #if defined cb_OnPlayerConnect 56 | cb_OnPlayerConnect(playerid); 57 | #endif 58 | } 59 | #if defined _ALS_OnPlayerConnect 60 | #undef OnPlayerConnect 61 | #else 62 | #define _ALS_OnPlayerConnect 63 | #endif 64 | #define OnPlayerConnect cb_OnPlayerConnect 65 | #if defined cb_OnPlayerConnect 66 | forward cb_OnPlayerConnect(playerid); 67 | #endif 68 | 69 | /******************************************************************************/ 70 | 71 | public OnPlayerDisconnect(playerid, reason) 72 | { 73 | DestroyCBrowserTextdraws(playerid); 74 | 75 | #if defined cb_OnPlayerDisconnect 76 | cb_OnPlayerDisconnect(playerid, reason); 77 | #endif 78 | } 79 | #if defined _ALS_OnPlayerDisconnect 80 | #undef OnPlayerDisconnect 81 | #else 82 | #define _ALS_OnPlayerDisconnect 83 | #endif 84 | #define OnPlayerDisconnect cb_OnPlayerDisconnect 85 | #if defined cb_OnPlayerDisconnect 86 | forward cb_OnPlayerDisconnect(playerid, reason); 87 | #endif 88 | 89 | /******************************************************************************/ 90 | 91 | public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) 92 | { 93 | if(playertextid == g_cbCloseTD[playerid]) 94 | { 95 | OnCBrowserResponse(playerid, g_cbID[playerid], CBROWSER_RESPONSE_CLOSE, 0); 96 | PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); 97 | return 1; 98 | } 99 | if(playertextid == g_cbPageTD[playerid][0]) 100 | { 101 | OnCBrowserResponse(playerid, g_cbID[playerid], CBROWSER_RESPONSE_PAGE_BACK, 0); 102 | PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); 103 | return 1; 104 | } 105 | if(playertextid == g_cbPageTD[playerid][2]) 106 | { 107 | OnCBrowserResponse(playerid, g_cbID[playerid], CBROWSER_RESPONSE_PAGE_NEXT, 0); 108 | PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); 109 | return 1; 110 | } 111 | for(new index; index < MAX_CBROWSER_PAGESIZE; index ++) 112 | { 113 | if(playertextid == g_cbColorTD[playerid][index]) 114 | { 115 | OnCBrowserResponse(playerid, g_cbID[playerid], CBROWSER_RESPONSE_COLOR, index); 116 | PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); 117 | return 1; 118 | } 119 | } 120 | 121 | #if defined cb_OnPlayerClickPlayerTextDraw 122 | return cb_OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid); 123 | #else 124 | return 0; 125 | #endif 126 | } 127 | #if defined _ALS_OnPlayerClickPTD 128 | #undef OnPlayerClickPlayerTextDraw 129 | #else 130 | #define _ALS_OnPlayerClickPTD 131 | #endif 132 | #define OnPlayerClickPlayerTextDraw cb_OnPlayerClickPlayerTextDraw 133 | #if defined cb_OnPlayerClickPlayerTextDraw 134 | forward cb_OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid); 135 | #endif 136 | 137 | /******************************************************************************/ 138 | -------------------------------------------------------------------------------- /mapedit/cbrowser/data.pwn: -------------------------------------------------------------------------------- 1 | #define INVALID_CBROWSER_ID ( -1 ) 2 | #define MAX_CBROWSER_ID ( 20 ) 3 | #define MAX_CBROWSER_TITLE ( 20+1 ) 4 | #define MAX_CBROWSER_PAGESIZE ( 25 ) 5 | 6 | new 7 | PlayerText: g_cbBackgroundTD [MAX_PLAYERS][3], 8 | PlayerText: g_cbTitleTD [MAX_PLAYERS], 9 | PlayerText: g_cbCloseTD [MAX_PLAYERS], 10 | PlayerText: g_cbPageTD [MAX_PLAYERS][3], 11 | PlayerText: g_cbColorTD [MAX_PLAYERS][MAX_CBROWSER_PAGESIZE], 12 | g_cbTitleString [MAX_CBROWSER_ID][MAX_CBROWSER_TITLE], 13 | g_cbID [MAX_PLAYERS] = {INVALID_CBROWSER_ID, ...} 14 | ; 15 | 16 | enum 17 | { 18 | CBROWSER_RESPONSE_CLOSE, 19 | CBROWSER_RESPONSE_PAGE_BACK, 20 | CBROWSER_RESPONSE_PAGE_NEXT, 21 | CBROWSER_RESPONSE_COLOR 22 | } 23 | 24 | forward OnCBrowserShown(playerid, browserid, page); 25 | forward OnCBrowserResponse(playerid, browserid, response, color); 26 | 27 | #include "mapedit/cbrowser/macros.pwn" 28 | #include "mapedit/cbrowser/functions.pwn" 29 | #include "mapedit/cbrowser/callbacks.pwn" 30 | -------------------------------------------------------------------------------- /mapedit/cbrowser/functions.pwn: -------------------------------------------------------------------------------- 1 | stock CreateCBrowserTextdraws(playerid) 2 | { 3 | g_cbBackgroundTD[playerid][0] = 4 | CreatePlayerTextDraw (playerid, 320.0, 120.0, "_"); 5 | PlayerTextDrawAlignment (playerid, g_cbBackgroundTD[playerid][0], 2); 6 | PlayerTextDrawBackgroundColor (playerid, g_cbBackgroundTD[playerid][0], 0); 7 | PlayerTextDrawFont (playerid, g_cbBackgroundTD[playerid][0], 1); 8 | PlayerTextDrawLetterSize (playerid, g_cbBackgroundTD[playerid][0], 0.500000, 1.0); 9 | PlayerTextDrawColor (playerid, g_cbBackgroundTD[playerid][0], 0); 10 | PlayerTextDrawSetOutline (playerid, g_cbBackgroundTD[playerid][0], 0); 11 | PlayerTextDrawSetProportional (playerid, g_cbBackgroundTD[playerid][0], 1); 12 | PlayerTextDrawSetShadow (playerid, g_cbBackgroundTD[playerid][0], 1); 13 | PlayerTextDrawUseBox (playerid, g_cbBackgroundTD[playerid][0], 1); 14 | PlayerTextDrawBoxColor (playerid, g_cbBackgroundTD[playerid][0], 100); 15 | PlayerTextDrawTextSize (playerid, g_cbBackgroundTD[playerid][0], 0.0, 170.0); 16 | PlayerTextDrawSetSelectable (playerid, g_cbBackgroundTD[playerid][0], 0); 17 | 18 | g_cbBackgroundTD[playerid][1] = 19 | CreatePlayerTextDraw (playerid, 320.0, 133.0, "_"); 20 | PlayerTextDrawAlignment (playerid, g_cbBackgroundTD[playerid][1], 2); 21 | PlayerTextDrawBackgroundColor (playerid, g_cbBackgroundTD[playerid][1], 0); 22 | PlayerTextDrawFont (playerid, g_cbBackgroundTD[playerid][1], 1); 23 | PlayerTextDrawLetterSize (playerid, g_cbBackgroundTD[playerid][1], 0.500000, 1.0); 24 | PlayerTextDrawColor (playerid, g_cbBackgroundTD[playerid][1], 0); 25 | PlayerTextDrawSetOutline (playerid, g_cbBackgroundTD[playerid][1], 0); 26 | PlayerTextDrawSetProportional (playerid, g_cbBackgroundTD[playerid][1], 1); 27 | PlayerTextDrawSetShadow (playerid, g_cbBackgroundTD[playerid][1], 1); 28 | PlayerTextDrawUseBox (playerid, g_cbBackgroundTD[playerid][1], 1); 29 | PlayerTextDrawBoxColor (playerid, g_cbBackgroundTD[playerid][1], 100); 30 | PlayerTextDrawTextSize (playerid, g_cbBackgroundTD[playerid][1], 0.0, 170.0); 31 | PlayerTextDrawSetSelectable (playerid, g_cbBackgroundTD[playerid][1], 0); 32 | 33 | g_cbBackgroundTD[playerid][2] = 34 | CreatePlayerTextDraw (playerid, 320.0, 146.0, "_"); 35 | PlayerTextDrawAlignment (playerid, g_cbBackgroundTD[playerid][2], 2); 36 | PlayerTextDrawBackgroundColor (playerid, g_cbBackgroundTD[playerid][2], 0); 37 | PlayerTextDrawFont (playerid, g_cbBackgroundTD[playerid][2], 1); 38 | PlayerTextDrawLetterSize (playerid, g_cbBackgroundTD[playerid][2], 0.500000, 19.399997); 39 | PlayerTextDrawColor (playerid, g_cbBackgroundTD[playerid][2], 0); 40 | PlayerTextDrawSetOutline (playerid, g_cbBackgroundTD[playerid][2], 0); 41 | PlayerTextDrawSetProportional (playerid, g_cbBackgroundTD[playerid][2], 1); 42 | PlayerTextDrawSetShadow (playerid, g_cbBackgroundTD[playerid][2], 1); 43 | PlayerTextDrawUseBox (playerid, g_cbBackgroundTD[playerid][2], 1); 44 | PlayerTextDrawBoxColor (playerid, g_cbBackgroundTD[playerid][2], 100); 45 | PlayerTextDrawTextSize (playerid, g_cbBackgroundTD[playerid][2], 0.0, 170.0); 46 | PlayerTextDrawSetSelectable (playerid, g_cbBackgroundTD[playerid][2], 0); 47 | 48 | g_cbTitleTD[playerid] = 49 | CreatePlayerTextDraw (playerid, 239.0, 108.0, "Title"); 50 | PlayerTextDrawBackgroundColor (playerid, g_cbTitleTD[playerid], 255); 51 | PlayerTextDrawFont (playerid, g_cbTitleTD[playerid], 0); 52 | PlayerTextDrawLetterSize (playerid, g_cbTitleTD[playerid], 0.500000, 2.0); 53 | PlayerTextDrawColor (playerid, g_cbTitleTD[playerid], -1); 54 | PlayerTextDrawSetOutline (playerid, g_cbTitleTD[playerid], 1); 55 | PlayerTextDrawSetProportional (playerid, g_cbTitleTD[playerid], 1); 56 | PlayerTextDrawSetSelectable (playerid, g_cbTitleTD[playerid], 0); 57 | 58 | g_cbCloseTD[playerid] = 59 | CreatePlayerTextDraw (playerid, 396.0, 119.0, "LD_BEAT:cross"); 60 | PlayerTextDrawAlignment (playerid, g_cbCloseTD[playerid], 2); 61 | PlayerTextDrawBackgroundColor (playerid, g_cbCloseTD[playerid], 255); 62 | PlayerTextDrawFont (playerid, g_cbCloseTD[playerid], 4); 63 | PlayerTextDrawLetterSize (playerid, g_cbCloseTD[playerid], 0.349999, 1.299999); 64 | PlayerTextDrawColor (playerid, g_cbCloseTD[playerid], -1); 65 | PlayerTextDrawSetOutline (playerid, g_cbCloseTD[playerid], 1); 66 | PlayerTextDrawSetProportional (playerid, g_cbCloseTD[playerid], 1); 67 | PlayerTextDrawUseBox (playerid, g_cbCloseTD[playerid], 1); 68 | PlayerTextDrawBoxColor (playerid, g_cbCloseTD[playerid], 255); 69 | PlayerTextDrawTextSize (playerid, g_cbCloseTD[playerid], 10.0, 10.0); 70 | PlayerTextDrawSetSelectable (playerid, g_cbCloseTD[playerid], 1); 71 | 72 | g_cbPageTD[playerid][0] = 73 | CreatePlayerTextDraw (playerid, 235.0, 132.0, "LD_BEAT:left"); 74 | PlayerTextDrawAlignment (playerid, g_cbPageTD[playerid][0], 2); 75 | PlayerTextDrawBackgroundColor (playerid, g_cbPageTD[playerid][0], 255); 76 | PlayerTextDrawFont (playerid, g_cbPageTD[playerid][0], 4); 77 | PlayerTextDrawLetterSize (playerid, g_cbPageTD[playerid][0], 0.34, 1.299999); 78 | PlayerTextDrawColor (playerid, g_cbPageTD[playerid][0], -1); 79 | PlayerTextDrawSetOutline (playerid, g_cbPageTD[playerid][0], 1); 80 | PlayerTextDrawSetProportional (playerid, g_cbPageTD[playerid][0], 1); 81 | PlayerTextDrawUseBox (playerid, g_cbPageTD[playerid][0], 1); 82 | PlayerTextDrawBoxColor (playerid, g_cbPageTD[playerid][0], 255); 83 | PlayerTextDrawTextSize (playerid, g_cbPageTD[playerid][0], 12.0, 12.0); 84 | PlayerTextDrawSetSelectable (playerid, g_cbPageTD[playerid][0], 1); 85 | 86 | g_cbPageTD[playerid][1] = 87 | CreatePlayerTextDraw (playerid, 320.0, 131.0, "Page"); 88 | PlayerTextDrawAlignment (playerid, g_cbPageTD[playerid][1], 2); 89 | PlayerTextDrawBackgroundColor (playerid, g_cbPageTD[playerid][1], 255); 90 | PlayerTextDrawFont (playerid, g_cbPageTD[playerid][1], 2); 91 | PlayerTextDrawLetterSize (playerid, g_cbPageTD[playerid][1], 0.33, 1.3); 92 | PlayerTextDrawColor (playerid, g_cbPageTD[playerid][1], -1); 93 | PlayerTextDrawSetOutline (playerid, g_cbPageTD[playerid][1], 1); 94 | PlayerTextDrawSetProportional (playerid, g_cbPageTD[playerid][1], 1); 95 | PlayerTextDrawSetSelectable (playerid, g_cbPageTD[playerid][1], 0); 96 | 97 | g_cbPageTD[playerid][2] = 98 | CreatePlayerTextDraw (playerid, 394.0, 132.0, "LD_BEAT:right"); 99 | PlayerTextDrawAlignment (playerid, g_cbPageTD[playerid][2], 2); 100 | PlayerTextDrawBackgroundColor (playerid, g_cbPageTD[playerid][2], 255); 101 | PlayerTextDrawFont (playerid, g_cbPageTD[playerid][2], 4); 102 | PlayerTextDrawLetterSize (playerid, g_cbPageTD[playerid][2], 0.34, 1.299999); 103 | PlayerTextDrawColor (playerid, g_cbPageTD[playerid][2], -1); 104 | PlayerTextDrawSetOutline (playerid, g_cbPageTD[playerid][2], 1); 105 | PlayerTextDrawSetProportional (playerid, g_cbPageTD[playerid][2], 1); 106 | PlayerTextDrawUseBox (playerid, g_cbPageTD[playerid][2], 1); 107 | PlayerTextDrawBoxColor (playerid, g_cbPageTD[playerid][2], 255); 108 | PlayerTextDrawTextSize (playerid, g_cbPageTD[playerid][2], 12.0, 12.0); 109 | PlayerTextDrawSetSelectable (playerid, g_cbPageTD[playerid][2], 1); 110 | 111 | for(new height, index; height < 5; height ++) 112 | { 113 | for(new width; width < 5; width ++, index ++) 114 | { 115 | g_cbColorTD[playerid][index] = 116 | CreatePlayerTextDraw (playerid, 252.0 + (34.0 * width), 148.0 + (35.0 * height), "_"); 117 | PlayerTextDrawAlignment (playerid, g_cbColorTD[playerid][index], 2); 118 | PlayerTextDrawBackgroundColor (playerid, g_cbColorTD[playerid][index], 0); 119 | PlayerTextDrawFont (playerid, g_cbColorTD[playerid][index], 1); 120 | PlayerTextDrawLetterSize (playerid, g_cbColorTD[playerid][index], 0.500000, 3.399999); 121 | PlayerTextDrawColor (playerid, g_cbColorTD[playerid][index], 0); 122 | PlayerTextDrawSetOutline (playerid, g_cbColorTD[playerid][index], 0); 123 | PlayerTextDrawSetProportional (playerid, g_cbColorTD[playerid][index], 1); 124 | PlayerTextDrawSetShadow (playerid, g_cbColorTD[playerid][index], 1); 125 | PlayerTextDrawUseBox (playerid, g_cbColorTD[playerid][index], 1); 126 | PlayerTextDrawBoxColor (playerid, g_cbColorTD[playerid][index], 255); 127 | PlayerTextDrawTextSize (playerid, g_cbColorTD[playerid][index], 30.0, 30.0); 128 | PlayerTextDrawSetSelectable (playerid, g_cbColorTD[playerid][index], 1); 129 | } 130 | } 131 | } 132 | 133 | stock DestroyCBrowserTextdraws(playerid) 134 | { 135 | PlayerTextDrawDestroy(playerid, g_cbTitleTD[playerid]); 136 | PlayerTextDrawDestroy(playerid, g_cbCloseTD[playerid]); 137 | 138 | for(new i; i < 3; i ++) 139 | PlayerTextDrawDestroy(playerid, g_cbBackgroundTD[playerid][i]); 140 | 141 | for(new i; i < 3; i ++) 142 | PlayerTextDrawDestroy(playerid, g_cbPageTD[playerid][i]); 143 | 144 | for(new i; i < 25; i ++) 145 | PlayerTextDrawDestroy(playerid, g_cbColorTD[playerid][i]); 146 | } 147 | 148 | stock ShowCBrowser(playerid, browserid, page) 149 | { 150 | if(g_cbID[playerid] != browserid) 151 | { 152 | g_cbID[playerid] = browserid; 153 | 154 | for(new i; i < 3; i ++) 155 | PlayerTextDrawShow(playerid, g_cbBackgroundTD[playerid][i]); 156 | 157 | for(new i; i < 3; i ++) 158 | PlayerTextDrawShow(playerid, g_cbPageTD[playerid][i]); 159 | 160 | PlayerTextDrawShow(playerid, g_cbTitleTD[playerid]); 161 | PlayerTextDrawShow(playerid, g_cbCloseTD[playerid]); 162 | 163 | PlayerTextDrawSetString ( playerid, g_cbTitleTD[playerid], g_cbTitleString[browserid] ); 164 | } 165 | 166 | PlayerTextDrawSetString ( playerid, g_cbPageTD[playerid][1], sprintf("Page %i", page + 1) ); 167 | return OnCBrowserShown(playerid, browserid, page); 168 | } 169 | 170 | stock HideCBrowser(playerid) 171 | { 172 | if(g_cbID[playerid] == INVALID_CBROWSER_ID) 173 | return 0; 174 | 175 | g_cbID[playerid] = INVALID_CBROWSER_ID; 176 | 177 | PlayerTextDrawHide(playerid, g_cbTitleTD[playerid]); 178 | PlayerTextDrawHide(playerid, g_cbCloseTD[playerid]); 179 | 180 | for(new td = 0; td < 3; td ++) 181 | PlayerTextDrawHide(playerid, g_cbBackgroundTD[playerid][td]); 182 | 183 | for(new i; i < 3; i ++) 184 | PlayerTextDrawHide(playerid, g_cbPageTD[playerid][i]); 185 | 186 | for(new i; i < 25; i ++) 187 | PlayerTextDrawHide(playerid, g_cbColorTD[playerid][i]); 188 | return 1; 189 | } 190 | 191 | stock SetCBrowserColor(playerid, index, color) 192 | { 193 | PlayerTextDrawBoxColor(playerid, g_cbColorTD[playerid][index], color); 194 | PlayerTextDrawShow(playerid, g_cbColorTD[playerid][index]); 195 | } 196 | 197 | stock CreateCBrowser(&browserid, const title[]) 198 | { 199 | static browsers; 200 | if(browsers == MAX_CBROWSER_ID) 201 | return 0; 202 | 203 | browserid = browsers ++; 204 | format(g_cbTitleString[browserid], MAX_CBROWSER_TITLE, title); 205 | return 1; 206 | } 207 | -------------------------------------------------------------------------------- /mapedit/cbrowser/macros.pwn: -------------------------------------------------------------------------------- 1 | #define GetPlayerCBrowser(%0) (g_cbID[%0]) 2 | #define HideCBrowserColor(%0,%1) (PlayerTextDrawHide(%0, g_cbColorTD[%0][%1])) 3 | -------------------------------------------------------------------------------- /mapedit/color.pwn: -------------------------------------------------------------------------------- 1 | #define RGBA_WHITE (0xFFFFFFFF) 2 | #define RGBA_GREEN (0x00FF00FF) 3 | #define RGBA_RED (0xFF0000FF) 4 | #define RGBA_YELLOW (0xFFFF00FF) 5 | #define RGBAtoARGB(%0) (%0 >>> 8 | %0 << 24) 6 | -------------------------------------------------------------------------------- /mapedit/dialog/callbacks.pwn: -------------------------------------------------------------------------------- 1 | public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 2 | { 3 | new 4 | soundid = (response) ? (1083) : (1084) 5 | ; 6 | 7 | PlayerPlaySound(playerid, soundid, 0.0, 0.0, 0.0); 8 | g_pDialogID[playerid] = INVALID_DIALOG_ID; 9 | 10 | #if defined d_OnDialogResponse 11 | return d_OnDialogResponse(playerid, dialogid, response, listitem, inputtext); 12 | #else 13 | return 0; 14 | #endif 15 | } 16 | #if defined _ALS_OnDialogResponse 17 | #undef OnDialogResponse 18 | #else 19 | #define _ALS_OnDialogResponse 20 | #endif 21 | #define OnDialogResponse d_OnDialogResponse 22 | #if defined d_OnDialogResponse 23 | forward d_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]); 24 | #endif 25 | -------------------------------------------------------------------------------- /mapedit/dialog/data.pwn: -------------------------------------------------------------------------------- 1 | #define MIN_DIALOG_ID (1000) 2 | #define INVALID_DIALOG_ID (-1) 3 | 4 | new 5 | g_pDialogID[MAX_PLAYERS], 6 | g_DialogsCreated = MIN_DIALOG_ID 7 | ; 8 | 9 | #include "mapedit/dialog/macros.pwn" 10 | #include "mapedit/dialog/hooks.pwn" 11 | #include "mapedit/dialog/callbacks.pwn" 12 | -------------------------------------------------------------------------------- /mapedit/dialog/hooks.pwn: -------------------------------------------------------------------------------- 1 | stock d_ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]) 2 | { 3 | g_pDialogID[playerid] = dialogid; 4 | ShowPlayerDialog(playerid, dialogid, style, caption, info, button1, button2); 5 | } 6 | #if defined _ALS_ShowPlayerDialog 7 | #undef ShowPlayerDialog 8 | #else 9 | #define _ALS_ShowPlayerDialog 10 | #endif 11 | #define ShowPlayerDialog d_ShowPlayerDialog 12 | -------------------------------------------------------------------------------- /mapedit/dialog/macros.pwn: -------------------------------------------------------------------------------- 1 | #define HidePlayerDialog(%0) \ 2 | (ShowPlayerDialog(%0, INVALID_DIALOG_ID, 0, "", "", "", "")) 3 | 4 | #define GetPlayerDialog(%0) \ 5 | (g_pDialogID[%0]) 6 | 7 | #define CreateDialog(%0) \ 8 | (%0 = g_DialogsCreated ++) 9 | -------------------------------------------------------------------------------- /mapedit/info/callbacks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | public OnFilterScriptInit() 4 | { 5 | CreateInfoTextdraws(); 6 | 7 | #if defined info_OnFilterScriptInit 8 | info_OnFilterScriptInit(); 9 | #endif 10 | } 11 | #if defined _ALS_OnFilterScriptInit 12 | #undef OnFilterScriptInit 13 | #else 14 | #define _ALS_OnFilterScriptInit 15 | #endif 16 | #define OnFilterScriptInit info_OnFilterScriptInit 17 | #if defined info_OnFilterScriptInit 18 | forward info_OnFilterScriptInit(); 19 | #endif 20 | 21 | /******************************************************************************/ 22 | 23 | public OnFilterScriptExit() 24 | { 25 | DestroyInfoTextdraws(); 26 | 27 | #if defined info_OnFilterScriptExit 28 | info_OnFilterScriptExit(); 29 | #endif 30 | } 31 | #if defined _ALS_OnFilterScriptExit 32 | #undef OnFilterScriptExit 33 | #else 34 | #define _ALS_OnFilterScriptExit 35 | #endif 36 | #define OnFilterScriptExit info_OnFilterScriptExit 37 | #if defined info_OnFilterScriptExit 38 | forward info_OnFilterScriptExit(); 39 | #endif 40 | 41 | /******************************************************************************/ 42 | 43 | public OnPlayerClickTextDraw(playerid, Text:clickedid) 44 | { 45 | if(clickedid == Text:INVALID_TEXT_DRAW) 46 | HidePlayerInfoTextdraws(playerid); 47 | 48 | else if(clickedid == g_InfoCloseTD) 49 | { 50 | HidePlayerInfoTextdraws(playerid); 51 | PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); 52 | return 1; 53 | } 54 | 55 | #if defined info_OnPlayerClickTextDraw 56 | return info_OnPlayerClickTextDraw(playerid, clickedid); 57 | #else 58 | return 0; 59 | #endif 60 | } 61 | #if defined _ALS_OnPlayerClickTextDraw 62 | #undef OnPlayerClickTextDraw 63 | #else 64 | #define _ALS_OnPlayerClickTextDraw 65 | #endif 66 | #define OnPlayerClickTextDraw info_OnPlayerClickTextDraw 67 | #if defined info_OnPlayerClickTextDraw 68 | forward info_OnPlayerClickTextDraw(playerid, Text:clickedid); 69 | #endif 70 | 71 | /******************************************************************************/ 72 | 73 | public OnToolbarResponse(playerid, response) 74 | { 75 | if(response == TOOLBAR_INFO) 76 | return ShowPlayerInfoTextdraws(playerid), 1; 77 | 78 | #if defined info_OnToolbarResponse 79 | return info_OnToolbarResponse(playerid, response); 80 | #else 81 | return 0; 82 | #endif 83 | } 84 | #if defined _ALS_OnToolbarResponse 85 | #undef OnToolbarResponse 86 | #else 87 | #define _ALS_OnToolbarResponse 88 | #endif 89 | #define OnToolbarResponse info_OnToolbarResponse 90 | #if defined info_OnToolbarResponse 91 | forward info_OnToolbarResponse(playerid, response); 92 | #endif 93 | 94 | /******************************************************************************/ 95 | -------------------------------------------------------------------------------- /mapedit/info/data.pwn: -------------------------------------------------------------------------------- 1 | #define MAX_INFO_KEYSTROKES (14) 2 | 3 | new 4 | Text: g_InfoBackgroundTD, 5 | Text: g_InfoTitleTD, 6 | Text: g_InfoCloseTD, 7 | Text: g_InfoContentTD, 8 | Text: g_InfoKeysTD[MAX_INFO_KEYSTROKES][2] 9 | ; 10 | 11 | #include "mapedit/info/functions.pwn" 12 | #include "mapedit/info/callbacks.pwn" 13 | -------------------------------------------------------------------------------- /mapedit/info/functions.pwn: -------------------------------------------------------------------------------- 1 | CreateInfoTextdraws() 2 | { 3 | g_InfoBackgroundTD = 4 | TextDrawCreate (320.0, 69.0, "_"); 5 | TextDrawAlignment (g_InfoBackgroundTD, 2); 6 | TextDrawLetterSize (g_InfoBackgroundTD, 0.0, 33.3); 7 | TextDrawUseBox (g_InfoBackgroundTD, 1); 8 | TextDrawBoxColor (g_InfoBackgroundTD, 150); 9 | TextDrawTextSize (g_InfoBackgroundTD, 0.0, 350.0); 10 | 11 | g_InfoTitleTD = 12 | TextDrawCreate (150.0, 53.0, "Map Editor Information"); 13 | TextDrawBackgroundColor (g_InfoTitleTD, 255); 14 | TextDrawFont (g_InfoTitleTD, 0); 15 | TextDrawLetterSize (g_InfoTitleTD, 0.73, 2.5); 16 | TextDrawColor (g_InfoTitleTD, -1); 17 | TextDrawSetOutline (g_InfoTitleTD, 1); 18 | TextDrawSetProportional (g_InfoTitleTD, 1); 19 | 20 | g_InfoCloseTD = 21 | TextDrawCreate (482.0, 68.0, "LD_BEAT:cross"); 22 | TextDrawFont (g_InfoCloseTD, 4); 23 | TextDrawColor (g_InfoCloseTD, -1); 24 | TextDrawUseBox (g_InfoCloseTD, 1); 25 | TextDrawTextSize (g_InfoCloseTD, 14.0, 14.0); 26 | TextDrawSetSelectable (g_InfoCloseTD, 1); 27 | 28 | g_InfoContentTD = 29 | TextDrawCreate (320.0, 82.0, "Information"); 30 | TextDrawAlignment (g_InfoContentTD, 2); 31 | TextDrawBackgroundColor (g_InfoContentTD, 255); 32 | TextDrawFont (g_InfoContentTD, 1); 33 | TextDrawLetterSize (g_InfoContentTD, 0.25, 1.2); 34 | TextDrawColor (g_InfoContentTD, -1); 35 | TextDrawSetOutline (g_InfoContentTD, 0); 36 | TextDrawSetProportional (g_InfoContentTD, 1); 37 | TextDrawSetShadow (g_InfoContentTD, 1); 38 | 39 | for(new r; r < MAX_INFO_KEYSTROKES; r ++) 40 | { 41 | g_InfoKeysTD[r][0] = 42 | TextDrawCreate (318.0, 210.0 + (r * 11.0), ""); 43 | TextDrawAlignment (g_InfoKeysTD[r][0], 3); 44 | 45 | g_InfoKeysTD[r][1] = 46 | TextDrawCreate (322.0, 210.0 + (r * 11.0), ""); 47 | TextDrawAlignment (g_InfoKeysTD[r][1], 1); 48 | 49 | for(new c; c < 2; c ++) 50 | { 51 | TextDrawBackgroundColor (g_InfoKeysTD[r][c], 255); 52 | TextDrawFont (g_InfoKeysTD[r][c], 2); 53 | TextDrawLetterSize (g_InfoKeysTD[r][c], 0.25, 1.2); 54 | TextDrawColor (g_InfoKeysTD[r][c], -1); 55 | TextDrawSetOutline (g_InfoKeysTD[r][c], 0); 56 | TextDrawSetProportional (g_InfoKeysTD[r][c], 1); 57 | TextDrawSetShadow (g_InfoKeysTD[r][c], 1); 58 | } 59 | 60 | switch(r) 61 | { 62 | case 0: 63 | { 64 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~~k~~CONVERSATION_YES~ / ~k~~PED_DUCK~"); 65 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~toggle (mouse mode)"); 66 | } 67 | case 1: 68 | { 69 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~ESC"); 70 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~untoggle (mouse mode)"); 71 | } 72 | case 2: 73 | { 74 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~~k~~PED_SPRINT~ + ~k~~VEHICLE_TURRETLEFT~ / ~k~~VEHICLE_TURRETRIGHT~"); 75 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~set mode (offset edit)"); 76 | } 77 | case 3: 78 | { 79 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~~k~~VEHICLE_TURRETLEFT~ / ~k~~VEHICLE_TURRETRIGHT~"); 80 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~move object (offset edit)"); 81 | } 82 | case 4: 83 | { 84 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~~k~~SNEAK_ABOUT~"); 85 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~move slower (offset edit)"); 86 | } 87 | case 5: 88 | { 89 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~~k~~VEHICLE_ENTER_EXIT~"); 90 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~untoggle (offset edit)"); 91 | } 92 | case 6: 93 | { 94 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~~k~~PED_SPRINT~"); 95 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~look around (object edit)"); 96 | } 97 | case 7: 98 | { 99 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~ESC"); 100 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~untoggle (object edit)"); 101 | } 102 | case 8: 103 | { 104 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~~k~~GO_FORWARD~"); 105 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~move forward (camera mode)"); 106 | } 107 | case 9: 108 | { 109 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~~k~~GO_BACK~"); 110 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~move back (camera mode)"); 111 | } 112 | case 10: 113 | { 114 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~~k~~GO_LEFT~"); 115 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~move left (camera mode)"); 116 | } 117 | case 11: 118 | { 119 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~~k~~GO_RIGHT~"); 120 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~move right (camera mode)"); 121 | } 122 | case 12: 123 | { 124 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~~k~~SNEAK_ABOUT~"); 125 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~move slower (camera mode)"); 126 | } 127 | case 13: 128 | { 129 | TextDrawSetString(g_InfoKeysTD[r][0], "~r~~k~~PED_JUMPING~"); 130 | TextDrawSetString(g_InfoKeysTD[r][1], "~y~move faster (camera mode)"); 131 | } 132 | } 133 | } 134 | 135 | static info[1024]; 136 | info = ""; 137 | 138 | strcat(info, "~y~What is this?~w~~n~"); 139 | strcat(info, "This is a script designed for creating maps ingame; a map editor!~n~"); 140 | strcat(info, "~n~~y~What can i do with this mapeditor?~w~~n~"); 141 | strcat(info, "Create & modify vehicles, objects, pickups, and player attachments~n~"); 142 | strcat(info, "Attach objects to other objects & vehicles~n~"); 143 | strcat(info, "Apply textures & text to objects~n~"); 144 | strcat(info, "Apply components & paintjobs to vehicles easily~n~"); 145 | strcat(info, "Apply colors to objects, vehicles, and player attachments~n~"); 146 | strcat(info, "Move your camera around in camera mode~n~"); 147 | strcat(info, "Save, load, and clear the map~n~"); 148 | 149 | TextDrawSetString(g_InfoContentTD, info); 150 | 151 | return 1; 152 | } 153 | 154 | DestroyInfoTextdraws() 155 | { 156 | TextDrawDestroy(g_InfoBackgroundTD); 157 | TextDrawDestroy(g_InfoTitleTD); 158 | TextDrawDestroy(g_InfoCloseTD); 159 | TextDrawDestroy(g_InfoContentTD); 160 | 161 | for(new r; r < MAX_INFO_KEYSTROKES; r ++) 162 | { 163 | for(new c; c < 2; c ++) 164 | TextDrawDestroy(g_InfoKeysTD[r][c]); 165 | } 166 | 167 | return 1; 168 | } 169 | 170 | ShowPlayerInfoTextdraws(playerid) 171 | { 172 | TextDrawShowForPlayer(playerid, g_InfoBackgroundTD); 173 | TextDrawShowForPlayer(playerid, g_InfoTitleTD); 174 | TextDrawShowForPlayer(playerid, g_InfoCloseTD); 175 | TextDrawShowForPlayer(playerid, g_InfoContentTD); 176 | 177 | for(new r; r < MAX_INFO_KEYSTROKES; r ++) 178 | { 179 | for(new c; c < 2; c ++) 180 | TextDrawShowForPlayer(playerid, g_InfoKeysTD[r][c]); 181 | } 182 | 183 | return 1; 184 | } 185 | 186 | HidePlayerInfoTextdraws(playerid) 187 | { 188 | TextDrawHideForPlayer(playerid, g_InfoBackgroundTD); 189 | TextDrawHideForPlayer(playerid, g_InfoTitleTD); 190 | TextDrawHideForPlayer(playerid, g_InfoCloseTD); 191 | TextDrawHideForPlayer(playerid, g_InfoContentTD); 192 | 193 | for(new r; r < MAX_INFO_KEYSTROKES; r ++) 194 | { 195 | for(new c; c < 2; c ++) 196 | TextDrawHideForPlayer(playerid, g_InfoKeysTD[r][c]); 197 | } 198 | 199 | return 1; 200 | } 201 | -------------------------------------------------------------------------------- /mapedit/mbrowser/callbacks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | public OnFilterScriptInit() 4 | { 5 | CreateDialog(g_mbSearchDialog); 6 | CreateDialog(g_mbPageDialog); 7 | 8 | for(new playerid; playerid < MAX_PLAYERS; playerid ++) 9 | { 10 | if(IsPlayerConnected(playerid)) 11 | CreateMBrowserTextdraws(playerid); 12 | } 13 | 14 | #if defined mb_OnFilterScriptInit 15 | mb_OnFilterScriptInit(); 16 | #endif 17 | } 18 | #if defined _ALS_OnFilterScriptInit 19 | #undef OnFilterScriptInit 20 | #else 21 | #define _ALS_OnFilterScriptInit 22 | #endif 23 | #define OnFilterScriptInit mb_OnFilterScriptInit 24 | #if defined mb_OnFilterScriptInit 25 | forward mb_OnFilterScriptInit(); 26 | #endif 27 | 28 | /******************************************************************************/ 29 | 30 | public OnFilterScriptExit() 31 | { 32 | for(new playerid; playerid < MAX_PLAYERS; playerid ++) 33 | { 34 | if(IsPlayerConnected(playerid)) 35 | DestroyMBrowserTextdraws(playerid); 36 | } 37 | 38 | #if defined mb_OnFilterScriptExit 39 | mb_OnFilterScriptExit(); 40 | #endif 41 | } 42 | #if defined _ALS_OnFilterScriptExit 43 | #undef OnFilterScriptExit 44 | #else 45 | #define _ALS_OnFilterScriptExit 46 | #endif 47 | #define OnFilterScriptExit mb_OnFilterScriptExit 48 | #if defined mb_OnFilterScriptExit 49 | forward mb_OnFilterScriptExit(); 50 | #endif 51 | 52 | /******************************************************************************/ 53 | 54 | public OnPlayerConnect(playerid) 55 | { 56 | CreateMBrowserTextdraws(playerid); 57 | 58 | #if defined mb_OnPlayerConnect 59 | mb_OnPlayerConnect(playerid); 60 | #endif 61 | } 62 | #if defined _ALS_OnPlayerConnect 63 | #undef OnPlayerConnect 64 | #else 65 | #define _ALS_OnPlayerConnect 66 | #endif 67 | #define OnPlayerConnect mb_OnPlayerConnect 68 | #if defined mb_OnPlayerConnect 69 | forward mb_OnPlayerConnect(playerid); 70 | #endif 71 | 72 | /******************************************************************************/ 73 | 74 | public OnPlayerDisconnect(playerid, reason) 75 | { 76 | g_mbID[playerid] = INVALID_MBROWSER_ID; 77 | g_mbModelShown{playerid} = false; 78 | 79 | DestroyMBrowserTextdraws(playerid); 80 | 81 | #if defined mb_OnPlayerDisconnect 82 | mb_OnPlayerDisconnect(playerid, reason); 83 | #endif 84 | } 85 | #if defined _ALS_OnPlayerDisconnect 86 | #undef OnPlayerDisconnect 87 | #else 88 | #define _ALS_OnPlayerDisconnect 89 | #endif 90 | #define OnPlayerDisconnect mb_OnPlayerDisconnect 91 | #if defined mb_OnPlayerDisconnect 92 | forward mb_OnPlayerDisconnect(playerid, reason); 93 | #endif 94 | 95 | /******************************************************************************/ 96 | 97 | public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 98 | { 99 | if(dialogid == g_mbSearchDialog) 100 | { 101 | if(!response) 102 | return 1; 103 | 104 | OnMBrowserResponse(playerid, g_mbID[playerid], MBROWSER_RESPONSE_SEARCH, 0, 0, inputtext); 105 | return 1; 106 | } 107 | else if(dialogid == g_mbPageDialog) 108 | { 109 | if(!response) 110 | return 1; 111 | 112 | if(strlen(inputtext) == 0) 113 | { 114 | ShowPlayerDialog(playerid, g_mbPageDialog, DIALOG_STYLE_INPUT, "Page", " ", "Set Page", "Cancel"); 115 | return 1; 116 | } 117 | 118 | new page = strval(inputtext) - 1; 119 | if(page < 0) 120 | { 121 | ShowPlayerDialog(playerid, g_mbPageDialog, DIALOG_STYLE_INPUT, "Page", " ", "Set Page", "Cancel"); 122 | return 1; 123 | } 124 | 125 | OnMBrowserResponse(playerid, g_mbID[playerid], MBROWSER_RESPONSE_PAGE_SET, page, 0, ""); 126 | return 1; 127 | } 128 | 129 | #if defined mb_OnDialogResponse 130 | return mb_OnDialogResponse(playerid, dialogid, response, listitem, inputtext); 131 | #else 132 | return 0; 133 | #endif 134 | } 135 | #if defined _ALS_OnDialogResponse 136 | #undef OnDialogResponse 137 | #else 138 | #define _ALS_OnDialogResponse 139 | #endif 140 | #define OnDialogResponse mb_OnDialogResponse 141 | #if defined mb_OnDialogResponse 142 | forward mb_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]); 143 | #endif 144 | 145 | /******************************************************************************/ 146 | 147 | public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) 148 | { 149 | if(playertextid == g_mbCloseTD[playerid]) 150 | { 151 | OnMBrowserResponse(playerid, g_mbID[playerid], MBROWSER_RESPONSE_CLOSE, 0, 0, ""); 152 | PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); 153 | return 1; 154 | } 155 | if(playertextid == g_mbButtonTD[playerid]) 156 | { 157 | OnMBrowserResponse(playerid, g_mbID[playerid], MBROWSER_RESPONSE_BUTTON, 0, 0, ""); 158 | PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); 159 | return 1; 160 | } 161 | if(playertextid == g_mbSearchTD[playerid][0]) 162 | { 163 | ShowPlayerDialog(playerid, g_mbSearchDialog, DIALOG_STYLE_INPUT, "Search", " ", "Search", "Cancel"); 164 | PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); 165 | return 1; 166 | } 167 | if(playertextid == g_mbPageTD[playerid][0]) 168 | { 169 | OnMBrowserResponse(playerid, g_mbID[playerid], MBROWSER_RESPONSE_PAGE_BACK, 0, 0, ""); 170 | PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); 171 | return 1; 172 | } 173 | if(playertextid == g_mbPageTD[playerid][1]) 174 | { 175 | ShowPlayerDialog(playerid, g_mbPageDialog, DIALOG_STYLE_INPUT, "Page", " ", "Set Page", "Cancel"); 176 | PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); 177 | return 1; 178 | } 179 | if(playertextid == g_mbPageTD[playerid][2]) 180 | { 181 | OnMBrowserResponse(playerid, g_mbID[playerid], MBROWSER_RESPONSE_PAGE_NEXT, 0, 0, ""); 182 | PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); 183 | return 1; 184 | } 185 | for(new listitem; listitem < MAX_MBROWSER_PAGESIZE; listitem ++) 186 | { 187 | if(playertextid == g_mbListTD[playerid][listitem]) 188 | { 189 | OnMBrowserResponse(playerid, g_mbID[playerid], MBROWSER_RESPONSE_LISTITEM, 0, listitem, ""); 190 | PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); 191 | return 1; 192 | } 193 | } 194 | 195 | #if defined mb_OnPlayerClickPlayerTextDraw 196 | return mb_OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid); 197 | #else 198 | return 0; 199 | #endif 200 | } 201 | #if defined _ALS_OnPlayerClickPTD 202 | #undef OnPlayerClickPlayerTextDraw 203 | #else 204 | #define _ALS_OnPlayerClickPTD 205 | #endif 206 | #define OnPlayerClickPlayerTextDraw mb_OnPlayerClickPlayerTextDraw 207 | #if defined mb_OnPlayerClickPlayerTextDraw 208 | forward mb_OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid); 209 | #endif 210 | 211 | /******************************************************************************/ 212 | -------------------------------------------------------------------------------- /mapedit/mbrowser/data.pwn: -------------------------------------------------------------------------------- 1 | #define INVALID_MBROWSER_ID (-1) 2 | #define MAX_MBROWSER_ID (20) 3 | #define MAX_MBROWSER_TITLE (20+1) 4 | #define MAX_MBROWSER_BUTTON (20+1) 5 | #define MAX_MBROWSER_SEARCH (20+1) 6 | #define MAX_MBROWSER_PAGESIZE (20) 7 | 8 | new 9 | PlayerText: g_mbBackgroundTD [MAX_PLAYERS][6], 10 | PlayerText: g_mbCloseTD [MAX_PLAYERS], 11 | PlayerText: g_mbTitleTD [MAX_PLAYERS], 12 | PlayerText: g_mbPreviewTD [MAX_PLAYERS], 13 | PlayerText: g_mbButtonTD [MAX_PLAYERS], 14 | PlayerText: g_mbSearchTD [MAX_PLAYERS][2], 15 | PlayerText: g_mbPageTD [MAX_PLAYERS][3], 16 | PlayerText: g_mbListTD [MAX_PLAYERS][MAX_MBROWSER_PAGESIZE], 17 | 18 | g_mbTitleString [MAX_MBROWSER_ID][MAX_MBROWSER_TITLE], 19 | g_mbButtonString [MAX_MBROWSER_ID][MAX_MBROWSER_BUTTON], 20 | 21 | bool: g_mbModelShown [MAX_PLAYERS char], 22 | g_mbID [MAX_PLAYERS] = {INVALID_MBROWSER_ID, ...}, 23 | 24 | g_mbSearchDialog, 25 | g_mbPageDialog; 26 | 27 | enum 28 | { 29 | MBROWSER_RESPONSE_CLOSE, 30 | MBROWSER_RESPONSE_SEARCH, 31 | MBROWSER_RESPONSE_PAGE_BACK, 32 | MBROWSER_RESPONSE_PAGE_NEXT, 33 | MBROWSER_RESPONSE_PAGE_SET, 34 | MBROWSER_RESPONSE_BUTTON, 35 | MBROWSER_RESPONSE_LISTITEM 36 | } 37 | 38 | forward OnMBrowserShown(playerid, browserid); 39 | forward OnMBrowserResponse(playerid, browserid, response, page, listitem, search[]); 40 | 41 | #include "mapedit/mbrowser/macros.pwn" 42 | #include "mapedit/mbrowser/functions.pwn" 43 | #include "mapedit/mbrowser/callbacks.pwn" 44 | -------------------------------------------------------------------------------- /mapedit/mbrowser/macros.pwn: -------------------------------------------------------------------------------- 1 | #define GetPlayerMBrowser(%0) \ 2 | (g_mbID[%0]) 3 | 4 | #define HideMBrowserListItem(%0,%1) \ 5 | (PlayerTextDrawHide(%0, g_mbListTD[%0][%1])) 6 | 7 | #define HideMBrowserSearch(%0) \ 8 | (PlayerTextDrawHide(%0, g_mbSearchTD[%0][1])) 9 | -------------------------------------------------------------------------------- /mapedit/mmode/callbacks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | public OnFilterScriptInit() 4 | { 5 | for(new playerid; playerid < MAX_PLAYERS; playerid ++) 6 | { 7 | if(IsPlayerConnected(playerid)) 8 | CreatePlayerMousemodeTextdraw(playerid); 9 | } 10 | 11 | #if defined mm_OnFilterScriptInit 12 | mm_OnFilterScriptInit(); 13 | #endif 14 | } 15 | #if defined _ALS_OnFilterScriptInit 16 | #undef OnFilterScriptInit 17 | #else 18 | #define _ALS_OnFilterScriptInit 19 | #endif 20 | #define OnFilterScriptInit mm_OnFilterScriptInit 21 | #if defined mm_OnFilterScriptInit 22 | forward mm_OnFilterScriptInit(); 23 | #endif 24 | 25 | /******************************************************************************/ 26 | 27 | public OnFilterScriptExit() 28 | { 29 | for(new playerid; playerid < MAX_PLAYERS; playerid ++) 30 | { 31 | if(IsPlayerConnected(playerid)) 32 | DestroyPlayerMousemodeTextdraw(playerid); 33 | } 34 | 35 | #if defined mm_OnFilterScriptExit 36 | mm_OnFilterScriptExit(); 37 | #endif 38 | } 39 | #if defined _ALS_OnFilterScriptExit 40 | #undef OnFilterScriptExit 41 | #else 42 | #define _ALS_OnFilterScriptExit 43 | #endif 44 | #define OnFilterScriptExit mm_OnFilterScriptExit 45 | #if defined mm_OnFilterScriptExit 46 | forward mm_OnFilterScriptExit(); 47 | #endif 48 | 49 | /******************************************************************************/ 50 | 51 | public OnPlayerConnect(playerid) 52 | { 53 | CreatePlayerMousemodeTextdraw(playerid); 54 | UpdatePlayerMousemodeTextdraw(playerid); 55 | 56 | #if defined mm_OnPlayerConnect 57 | mm_OnPlayerConnect(playerid); 58 | #endif 59 | } 60 | #if defined _ALS_OnPlayerConnect 61 | #undef OnPlayerConnect 62 | #else 63 | #define _ALS_OnPlayerConnect 64 | #endif 65 | #define OnPlayerConnect mm_OnPlayerConnect 66 | #if defined mm_OnPlayerConnect 67 | forward mm_OnPlayerConnect(playerid); 68 | #endif 69 | 70 | /******************************************************************************/ 71 | 72 | public OnPlayerDisconnect(playerid, reason) 73 | { 74 | DestroyPlayerMousemodeTextdraw(playerid); 75 | g_IsPlayerInMouseMode{playerid} = false; 76 | 77 | #if defined mm_OnPlayerDisconnect 78 | mm_OnPlayerDisconnect(playerid, reason); 79 | #endif 80 | } 81 | #if defined _ALS_OnPlayerDisconnect 82 | #undef OnPlayerDisconnect 83 | #else 84 | #define _ALS_OnPlayerDisconnect 85 | #endif 86 | #define OnPlayerDisconnect mm_OnPlayerDisconnect 87 | #if defined mm_OnPlayerDisconnect 88 | forward mm_OnPlayerDisconnect(playerid, reason); 89 | #endif 90 | 91 | /******************************************************************************/ 92 | 93 | public OnPlayerStateChange(playerid, newstate, oldstate) 94 | { 95 | if(!g_IsPlayerInMouseMode{playerid} && (newstate == PLAYER_STATE_SPECTATING || oldstate == PLAYER_STATE_SPECTATING)) 96 | UpdatePlayerMousemodeTextdraw(playerid); 97 | 98 | #if defined mm_OnPlayerStateChange 99 | mm_OnPlayerStateChange(playerid, newstate, oldstate); 100 | #endif 101 | } 102 | #if defined _ALS_OnPlayerStateChange 103 | #undef OnPlayerStateChange 104 | #else 105 | #define _ALS_OnPlayerStateChange 106 | #endif 107 | #define OnPlayerStateChange mm_OnPlayerStateChange 108 | #if defined mm_OnPlayerStateChange 109 | forward mm_OnPlayerStateChange(playerid, newstate, oldstate); 110 | #endif 111 | 112 | /******************************************************************************/ 113 | 114 | public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) 115 | { 116 | new is_spectating = GetPlayerState(playerid) == PLAYER_STATE_SPECTATING; 117 | if( 118 | ( (newkeys & KEY_CROUCH) == KEY_CROUCH && (oldkeys & KEY_CROUCH) != KEY_CROUCH && is_spectating) || 119 | ( (newkeys & KEY_YES) == KEY_YES && (oldkeys & KEY_YES) != KEY_YES && !is_spectating) 120 | ){ 121 | SelectTextDraw(playerid, 0xFF0000FF); 122 | 123 | PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); 124 | } 125 | 126 | #if defined tb_OnPlayerKeyStateChange 127 | return tb_OnPlayerKeyStateChange(playerid, newkeys, oldkeys); 128 | #else 129 | return 1; 130 | #endif 131 | } 132 | #if defined _ALS_OnPlayerKeyStateChange 133 | #undef OnPlayerKeyStateChange 134 | #else 135 | #define _ALS_OnPlayerKeyStateChange 136 | #endif 137 | #define OnPlayerKeyStateChange tb_OnPlayerKeyStateChange 138 | #if defined tb_OnPlayerKeyStateChange 139 | forward tb_OnPlayerKeyStateChange(playerid, newkeys, oldkeys); 140 | #endif 141 | 142 | /******************************************************************************/ 143 | 144 | public OnPlayerClickTextDraw(playerid, Text:clickedid) 145 | { 146 | if(clickedid == Text:INVALID_TEXT_DRAW) 147 | { 148 | g_IsPlayerInMouseMode{playerid} = false; 149 | UpdatePlayerMousemodeTextdraw(playerid); 150 | 151 | PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); 152 | } 153 | 154 | #if defined mm_OnPlayerClickTextDraw 155 | return mm_OnPlayerClickTextDraw(playerid, Text:clickedid); 156 | #else 157 | return 0; 158 | #endif 159 | } 160 | #if defined _ALS_OnPlayerClickTextDraw 161 | #undef OnPlayerClickTextDraw 162 | #else 163 | #define _ALS_OnPlayerClickTextDraw 164 | #endif 165 | #define OnPlayerClickTextDraw mm_OnPlayerClickTextDraw 166 | #if defined mm_OnPlayerClickTextDraw 167 | forward mm_OnPlayerClickTextDraw(playerid, Text:clickedid); 168 | #endif 169 | 170 | /******************************************************************************/ 171 | -------------------------------------------------------------------------------- /mapedit/mmode/data.pwn: -------------------------------------------------------------------------------- 1 | new 2 | bool: g_IsPlayerInMouseMode [MAX_PLAYERS char], 3 | PlayerText: g_MouseModeTD [MAX_PLAYERS] 4 | ; 5 | 6 | #include "mapedit/mmode/macros.pwn" 7 | #include "mapedit/mmode/functions.pwn" 8 | #include "mapedit/mmode/hooks.pwn" 9 | #include "mapedit/mmode/callbacks.pwn" 10 | -------------------------------------------------------------------------------- /mapedit/mmode/functions.pwn: -------------------------------------------------------------------------------- 1 | CreatePlayerMousemodeTextdraw(playerid) 2 | { 3 | g_MouseModeTD[playerid] = 4 | CreatePlayerTextDraw (playerid, 637.0, 375.0, "_"); 5 | PlayerTextDrawAlignment (playerid, g_MouseModeTD[playerid], 3); 6 | PlayerTextDrawBackgroundColor (playerid, g_MouseModeTD[playerid], 255); 7 | PlayerTextDrawFont (playerid, g_MouseModeTD[playerid], 3); 8 | PlayerTextDrawLetterSize (playerid, g_MouseModeTD[playerid], 0.529999, 1.899999); 9 | PlayerTextDrawColor (playerid, g_MouseModeTD[playerid], -1); 10 | PlayerTextDrawSetOutline (playerid, g_MouseModeTD[playerid], 1); 11 | PlayerTextDrawSetProportional (playerid, g_MouseModeTD[playerid], 1); 12 | PlayerTextDrawSetSelectable (playerid, g_MouseModeTD[playerid], 0); 13 | PlayerTextDrawShow (playerid, g_MouseModeTD[playerid]); 14 | 15 | UpdatePlayerMousemodeTextdraw(playerid); 16 | } 17 | 18 | UpdatePlayerMousemodeTextdraw(playerid) 19 | { 20 | if(g_IsPlayerInMouseMode{playerid}) 21 | { 22 | PlayerTextDrawSetString(playerid, g_MouseModeTD[playerid], 23 | "~w~Press ~r~ESC~w~ to exit mouse mode"); 24 | } 25 | else 26 | { 27 | if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) 28 | { 29 | PlayerTextDrawSetString(playerid, g_MouseModeTD[playerid], 30 | "~w~Press ~r~~k~~PED_DUCK~~w~ to use mouse mode" 31 | ); 32 | } else { 33 | PlayerTextDrawSetString(playerid, g_MouseModeTD[playerid], 34 | "~w~Press ~r~~k~~CONVERSATION_YES~~w~ to use mouse mode" 35 | ); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /mapedit/mmode/hooks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | stock mm_SelectTextDraw(playerid, hovercolor) 4 | { 5 | g_IsPlayerInMouseMode{playerid} = true; 6 | UpdatePlayerMousemodeTextdraw(playerid); 7 | SelectTextDraw(playerid, hovercolor); 8 | } 9 | #if defined _ALS_SelectTextDraw 10 | #undef SelectTextDraw 11 | #else 12 | #define _ALS_SelectTextDraw 13 | #endif 14 | #define SelectTextDraw mm_SelectTextDraw 15 | 16 | /******************************************************************************/ 17 | 18 | stock mm_CancelSelectTextDraw(playerid) 19 | { 20 | g_IsPlayerInMouseMode{playerid} = false; 21 | UpdatePlayerMousemodeTextdraw(playerid); 22 | CancelSelectTextDraw(playerid); 23 | } 24 | #if defined _ALS_CancelSelectTextDraw 25 | #undef CancelSelectTextDraw 26 | #else 27 | #define _ALS_CancelSelectTextDraw 28 | #endif 29 | #define CancelSelectTextDraw mm_CancelSelectTextDraw 30 | 31 | /******************************************************************************/ 32 | -------------------------------------------------------------------------------- /mapedit/mmode/macros.pwn: -------------------------------------------------------------------------------- 1 | #define DestroyPlayerMousemodeTextdraw(%0) \ 2 | (PlayerTextDrawDestroy(%0, g_MouseModeTD[%0])) 3 | -------------------------------------------------------------------------------- /mapedit/mparse/data.pwn: -------------------------------------------------------------------------------- 1 | #define MAX_MPARSE_PREFIX \ 2 | (30 + 1) 3 | 4 | enum 5 | { 6 | MPARSE_PREFIX_OBJECT, 7 | MPARSE_PREFIX_VEHICLE, 8 | MPARSE_PREFIX_PICKUP 9 | } 10 | 11 | enum MPARSE_PREFIX_DATA 12 | { 13 | MPARSE_PREFIX_NAME[MAX_MPARSE_PREFIX char], 14 | MPARSE_PREFIX_ID 15 | } 16 | 17 | new 18 | g_ObjectVariables[MAX_OBJECTS][MPARSE_PREFIX_DATA], 19 | g_ObjectsAdded, 20 | 21 | g_VehicleVariables[MAX_VEHICLES][MPARSE_PREFIX_DATA], 22 | g_VehiclesAdded, 23 | 24 | g_PickupVariables[MAX_PICKUPS][MPARSE_PREFIX_DATA], 25 | g_PickupsAdded 26 | ; 27 | 28 | #include "mapedit/mparse/functions.pwn" 29 | -------------------------------------------------------------------------------- /mapedit/mparse/functions.pwn: -------------------------------------------------------------------------------- 1 | mparse_SetPrefixData(type, prefix[], id) 2 | { 3 | strtrim(prefix, " "); 4 | 5 | switch(type) 6 | { 7 | case MPARSE_PREFIX_OBJECT: 8 | { 9 | if(g_ObjectsAdded == MAX_OBJECTS) 10 | return 0; 11 | 12 | strpack(g_ObjectVariables[g_ObjectsAdded][MPARSE_PREFIX_NAME], prefix, MAX_MPARSE_PREFIX); 13 | g_ObjectVariables[g_ObjectsAdded ++][MPARSE_PREFIX_ID] = id; 14 | } 15 | case MPARSE_PREFIX_VEHICLE: 16 | { 17 | if(g_VehiclesAdded == MAX_VEHICLES) 18 | return 0; 19 | 20 | strpack(g_VehicleVariables[g_VehiclesAdded][MPARSE_PREFIX_NAME], prefix, MAX_MPARSE_PREFIX); 21 | g_VehicleVariables[g_VehiclesAdded ++][MPARSE_PREFIX_ID] = id; 22 | } 23 | case MPARSE_PREFIX_PICKUP: 24 | { 25 | if(g_PickupsAdded == MAX_PICKUPS) 26 | return 0; 27 | 28 | strpack(g_PickupVariables[g_PickupsAdded][MPARSE_PREFIX_NAME], prefix, MAX_MPARSE_PREFIX); 29 | g_PickupVariables[g_PickupsAdded ++][MPARSE_PREFIX_ID] = id; 30 | } 31 | default: 32 | return 0; 33 | } 34 | return 1; 35 | } 36 | 37 | mparse_GetPrefixData(type, prefix[]) 38 | { 39 | new 40 | prefix_packed[MAX_MPARSE_PREFIX] 41 | ; 42 | 43 | strtrim(prefix, " "); 44 | strpack(prefix_packed, prefix, MAX_MPARSE_PREFIX); 45 | 46 | switch(type) 47 | { 48 | case MPARSE_PREFIX_OBJECT: 49 | { 50 | for(new index = g_ObjectsAdded - 1; index >= 0; index --) 51 | { 52 | if(strcmp(g_ObjectVariables[index][MPARSE_PREFIX_NAME], prefix_packed) == 0) 53 | return g_ObjectVariables[index][MPARSE_PREFIX_ID]; 54 | } 55 | return INVALID_OBJECT_ID; 56 | } 57 | case MPARSE_PREFIX_VEHICLE: 58 | { 59 | for(new index = g_VehiclesAdded - 1; index >= 0; index --) 60 | { 61 | if(strcmp(g_VehicleVariables[index][MPARSE_PREFIX_NAME], prefix_packed) == 0) 62 | return g_VehicleVariables[index][MPARSE_PREFIX_ID]; 63 | } 64 | return INVALID_VEHICLE_ID; 65 | } 66 | case MPARSE_PREFIX_PICKUP: 67 | { 68 | for(new index = g_PickupsAdded - 1; index >= 0; index --) 69 | { 70 | if(strcmp(g_PickupVariables[index][MPARSE_PREFIX_NAME], prefix_packed) == 0) 71 | return g_PickupVariables[index][MPARSE_PREFIX_ID]; 72 | } 73 | return INVALID_PICKUP_ID; 74 | } 75 | } 76 | return 0; 77 | } 78 | 79 | mparse_LoadMap(map[]) 80 | { 81 | new path[50]; 82 | format(path, sizeof path, "maps/%s.map", map); 83 | 84 | if(!fexist(path)) 85 | return 0; 86 | 87 | new 88 | File:file_handle = fopen(path, io_read), 89 | buffer[300] 90 | ; 91 | 92 | if(!file_handle) 93 | return 0; 94 | 95 | while(fread(file_handle, buffer)) 96 | { 97 | new start_index; 98 | if((start_index = strfind(buffer, "SetObjectMaterialText")) != -1) 99 | { 100 | new 101 | prefix[MAX_MPARSE_PREFIX], 102 | text[50], 103 | materialindex, 104 | materialsize, 105 | fontface[50], 106 | fontsize, 107 | bold, 108 | fontcolor, 109 | backcolor, 110 | alignment 111 | ; 112 | 113 | if( 114 | sscanf(buffer[start_index], "p<(>{s[22]}p<,>s[31]s[50]iis[50]iixxp<)>i", prefix, text, materialindex, materialsize, fontface, fontsize, bold, fontcolor, backcolor, alignment) && 115 | sscanf(buffer[start_index], "p<(>{s[22]}p<,>s[31]s[50]iis[50]iiiip<)>i", prefix, text, materialindex, materialsize, fontface, fontsize, bold, fontcolor, backcolor, alignment) 116 | ){ 117 | continue; 118 | } 119 | 120 | new objectid = mparse_GetPrefixData(MPARSE_PREFIX_OBJECT, prefix); 121 | if(objectid == INVALID_OBJECT_ID) 122 | continue; 123 | 124 | strtrim(text, "\""); 125 | strtrim(fontface, "\""); 126 | 127 | SetObjectMaterialText( 128 | objectid, 129 | text, 130 | materialindex, 131 | materialsize, 132 | fontface, 133 | fontsize, 134 | bold, 135 | fontcolor, 136 | backcolor, 137 | alignment 138 | ); 139 | } 140 | else if((start_index = strfind(buffer, "SetObjectMaterial")) != -1) 141 | { 142 | new 143 | prefix[MAX_MPARSE_PREFIX], 144 | materialindex, 145 | modelid, 146 | txd[50], 147 | texture[50], 148 | color 149 | ; 150 | 151 | if( 152 | sscanf(buffer[start_index], "p<(>{s[18]}p<,>s[31]iis[50]s[50]p<)>x", prefix, materialindex, modelid, txd, texture, color) && 153 | sscanf(buffer[start_index], "p<(>{s[18]}p<,>s[31]iis[50]s[50]p<)>i", prefix, materialindex, modelid, txd, texture, color) 154 | ){ 155 | continue; 156 | } 157 | 158 | new objectid = mparse_GetPrefixData(MPARSE_PREFIX_OBJECT, prefix); 159 | if(objectid == INVALID_OBJECT_ID) 160 | continue; 161 | 162 | strtrim(txd, "\""); 163 | strtrim(texture, "\""); 164 | 165 | SetObjectMaterial( 166 | objectid, 167 | materialindex, 168 | modelid, 169 | txd, 170 | texture, 171 | color 172 | ); 173 | } 174 | else if((start_index = strfind(buffer, "AddVehicleComponent")) != -1) 175 | { 176 | new 177 | prefix[MAX_MPARSE_PREFIX], 178 | componentid 179 | ; 180 | 181 | if(sscanf(buffer[start_index], "p<(>{s[20]}p<,>s[31]p<)>i", prefix, componentid)) 182 | continue; 183 | 184 | new vehicleid = mparse_GetPrefixData(MPARSE_PREFIX_VEHICLE, prefix); 185 | if(vehicleid != INVALID_VEHICLE_ID) 186 | AddVehicleComponent(vehicleid, componentid); 187 | } 188 | else if((start_index = strfind(buffer, "ChangeVehiclePaintjob")) != -1) 189 | { 190 | new 191 | prefix[MAX_MPARSE_PREFIX], 192 | paintjobid 193 | ; 194 | 195 | if(sscanf(buffer[start_index], "p<(>{s[22]}p<,>s[31]p<)>i", prefix, paintjobid)) 196 | continue; 197 | 198 | new vehicleid = mparse_GetPrefixData(MPARSE_PREFIX_VEHICLE, prefix); 199 | if(vehicleid != INVALID_VEHICLE_ID) 200 | ChangeVehiclePaintjob(vehicleid, paintjobid); 201 | } 202 | else if((start_index = strfind(buffer, "AttachObjectToObject")) != -1) 203 | { 204 | new 205 | object_prefix[MAX_MPARSE_PREFIX], 206 | attachto_prefix[MAX_MPARSE_PREFIX], 207 | Float:x, 208 | Float:y, 209 | Float:z, 210 | Float:rx, 211 | Float:ry, 212 | Float:rz 213 | ; 214 | 215 | if(sscanf(buffer[start_index], "p<(>{s[21]}p<,>s[31]s[31]fffffp<)>f", object_prefix, attachto_prefix, x, y, z, rx, ry, rz)) 216 | continue; 217 | 218 | new objectid = mparse_GetPrefixData(MPARSE_PREFIX_OBJECT, object_prefix); 219 | if(objectid == INVALID_OBJECT_ID) 220 | continue; 221 | 222 | new attachtoid = mparse_GetPrefixData(MPARSE_PREFIX_OBJECT, attachto_prefix); 223 | if(attachtoid == INVALID_OBJECT_ID) 224 | continue; 225 | 226 | AttachObjectToObject(objectid, attachtoid, x, y, z, rx, ry, rz); 227 | } 228 | else if((start_index = strfind(buffer, "AttachObjectToVehicle")) != -1) 229 | { 230 | new 231 | object_prefix[MAX_MPARSE_PREFIX], 232 | vehicle_prefix[MAX_MPARSE_PREFIX], 233 | Float:x, 234 | Float:y, 235 | Float:z, 236 | Float:rx, 237 | Float:ry, 238 | Float:rz 239 | ; 240 | 241 | if(sscanf(buffer[start_index], "p<(>{s[22]}p<,>s[31]s[31]fffffp<)>f", object_prefix, vehicle_prefix, x, y, z, rx, ry, rz)) 242 | continue; 243 | 244 | new objectid = mparse_GetPrefixData(MPARSE_PREFIX_OBJECT, object_prefix); 245 | if(objectid == INVALID_OBJECT_ID) 246 | continue; 247 | 248 | new vehicleid = mparse_GetPrefixData(MPARSE_PREFIX_VEHICLE, vehicle_prefix); 249 | if(vehicleid == INVALID_VEHICLE_ID) 250 | continue; 251 | 252 | AttachObjectToVehicle(objectid, vehicleid, x, y, z, rx, ry, rz); 253 | } 254 | else if((start_index = strfind(buffer, "CreateObject")) != -1) 255 | { 256 | new 257 | bool:prefix_found, 258 | prefix[MAX_MPARSE_PREFIX], 259 | modelid, 260 | Float:x, 261 | Float:y, 262 | Float:z, 263 | Float:rx, 264 | Float:ry, 265 | Float:rz, 266 | Float:stream_distance 267 | ; 268 | 269 | if(start_index > 0 && !sscanf(buffer, "p<=>s[31]p<(>{s[14]}p<,>ifffffp<)>f", prefix, modelid, x, y, z, rx, ry, rz)) 270 | prefix_found = true, stream_distance = 0.0; 271 | else if(start_index > 0 && !sscanf(buffer, "p<=>s[31]p<(>{s[14]}p<,>iffffffp<)>f", prefix, modelid, x, y, z, rx, ry, rz, stream_distance)) 272 | prefix_found = true; 273 | else if(!sscanf(buffer[start_index], "p<(>{s[13]}p<,>ifffffp<)>f", modelid, x, y, z, rx, ry, rz)) 274 | prefix_found = false, stream_distance = 0.0; 275 | else if(!sscanf(buffer[start_index], "p<(>{s[13]}p<,>iffffffp<)>f", modelid, x, y, z, rx, ry, rz, stream_distance)) 276 | prefix_found = false; 277 | else 278 | continue; 279 | 280 | new objectid = CreateObject(modelid, x, y, z, rx, ry, rz, stream_distance); 281 | if(prefix_found && objectid != INVALID_OBJECT_ID) 282 | mparse_SetPrefixData(MPARSE_PREFIX_OBJECT, prefix, objectid); 283 | } 284 | else if( 285 | (start_index = strfind(buffer, "AddStaticVehicleEx")) != -1 || 286 | (start_index = strfind(buffer, "AddStaticVehicle")) != -1 || 287 | (start_index = strfind(buffer, "CreateVehicle")) != -1 288 | ){ 289 | new 290 | bool:prefix_found, 291 | prefix[MAX_MPARSE_PREFIX], 292 | modelid, 293 | Float:x, 294 | Float:y, 295 | Float:z, 296 | Float:r, 297 | color1, 298 | color2, 299 | respawn_delay 300 | ; 301 | 302 | if(start_index > 0 && !sscanf(buffer, "p<=>s[31]p<(>{s[20]}p<,>iffffip<)>i", prefix, modelid, x, y, z, r, color1, color2)) 303 | prefix_found = true, respawn_delay = -1; 304 | else if(start_index > 0 && !sscanf(buffer, "p<=>s[31]p<(>{s[20]}p<,>iffffiip<)>i", prefix, modelid, x, y, z, r, color1, color2, respawn_delay)) 305 | prefix_found = true; 306 | else if(!sscanf(buffer[start_index], "p<(>{s[19]}p<,>iffffip<)>i", modelid, x, y, z, r, color1, color2)) 307 | prefix_found = false, respawn_delay = -1; 308 | else if(!sscanf(buffer[start_index], "p<(>{s[19]}p<,>iffffiip<)>i", modelid, x, y, z, r, color1, color2, respawn_delay)) 309 | prefix_found = false; 310 | else 311 | continue; 312 | 313 | new vehicleid = CreateVehicle(modelid, x, y, z, r, color1, color2, respawn_delay); 314 | if(prefix_found && vehicleid != INVALID_VEHICLE_ID) 315 | mparse_SetPrefixData(MPARSE_PREFIX_VEHICLE, prefix, vehicleid); 316 | } 317 | else if( 318 | (start_index = strfind(buffer, "AddStaticPickup")) != -1 || 319 | (start_index = strfind(buffer, "CreatePickup")) != -1 320 | ){ 321 | new 322 | bool:prefix_found, 323 | prefix[MAX_MPARSE_PREFIX], 324 | modelid, 325 | type, 326 | Float:x, 327 | Float:y, 328 | Float:z, 329 | virtual_world 330 | ; 331 | 332 | if(start_index > 0 && !sscanf(buffer, "p<=>s[31]p<(>{s[17]}p<,>iiffp<)>f", prefix, modelid, type, x, y, z)) 333 | prefix_found = true, virtual_world = -1; 334 | else if(start_index > 0 && !sscanf(buffer, "p<=>s[31]p<(>{s[17]}p<,>iifffp<)>i", prefix, modelid, type, x, y, z, virtual_world)) 335 | prefix_found = true; 336 | else if(!sscanf(buffer[start_index], "p<(>{s[16]}p<,>iiffp<)>f", modelid, type, x, y, z)) 337 | prefix_found = false, virtual_world = -1; 338 | else if(!sscanf(buffer[start_index], "p<(>{s[16]}p<,>iifffp<)>i", modelid, type, x, y, z, virtual_world)) 339 | prefix_found = false; 340 | else 341 | continue; 342 | 343 | new pickupid = CreatePickup(modelid, type, x, y, z, virtual_world); 344 | if(prefix_found && pickupid != INVALID_PICKUP_ID) 345 | mparse_SetPrefixData(MPARSE_PREFIX_PICKUP, prefix, pickupid); 346 | } 347 | else if((start_index = strfind(buffer, "SetPlayerAttachedObject")) != -1) 348 | { 349 | new 350 | index, 351 | modelid, 352 | bone, 353 | Float:x, 354 | Float:y, 355 | Float:z, 356 | Float:rx, 357 | Float:ry, 358 | Float:rz, 359 | Float:sx, 360 | Float:sy, 361 | Float:sz, 362 | color1, 363 | color2 364 | ; 365 | 366 | if( 367 | sscanf(buffer[start_index], "p<(>{s[24]}p<,>{s[9]}iiifffffffffxp<)>x", index, modelid, bone, x, y, z, rx, ry, rz, sx, sy, sz, color1, color2) && 368 | sscanf(buffer[start_index], "p<(>{s[24]}p<,>{s[9]}iiifffffffffip<)>i", index, modelid, bone, x, y, z, rx, ry, rz, sx, sy, sz, color1, color2) 369 | ){ 370 | continue; 371 | } 372 | 373 | for(new playerid, max_playerid = GetMaxPlayers(); playerid < max_playerid; playerid ++) 374 | { 375 | if(IsPlayerConnected(playerid)) 376 | SetPlayerAttachedObject(playerid, index, modelid, bone, x, y, z, rx, ry, rz, sx, sy, sz, color1, color2); 377 | } 378 | } 379 | } 380 | 381 | g_ObjectsAdded = 0; 382 | g_VehiclesAdded = 0; 383 | g_PickupsAdded = 0; 384 | 385 | fclose(file_handle); 386 | return 1; 387 | } 388 | -------------------------------------------------------------------------------- /mapedit/new/callbacks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | public OnFilterScriptInit() 4 | { 5 | CreateDialog(g_NewDialog); 6 | ClearMap(); 7 | 8 | #if defined new_OnFilterScriptInit 9 | new_OnFilterScriptInit(); 10 | #endif 11 | } 12 | #if defined _ALS_OnFilterScriptInit 13 | #undef OnFilterScriptInit 14 | #else 15 | #define _ALS_OnFilterScriptInit 16 | #endif 17 | #define OnFilterScriptInit new_OnFilterScriptInit 18 | #if defined new_OnFilterScriptInit 19 | forward new_OnFilterScriptInit(); 20 | #endif 21 | 22 | /******************************************************************************/ 23 | 24 | public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 25 | { 26 | if(dialogid == g_NewDialog) 27 | { 28 | if(!response) 29 | return 1; 30 | 31 | ClearMap(); 32 | 33 | SendClientMessageToAll(RGBA_WHITE, 34 | sprintf("%s (ID: %i) has created a new map.", ret_GetPlayerName(playerid), playerid) 35 | ); 36 | return 1; 37 | } 38 | #if defined new_OnDialogResponse 39 | return new_OnDialogResponse(playerid, dialogid, response, listitem, inputtext); 40 | #else 41 | return 0; 42 | #endif 43 | } 44 | #if defined _ALS_OnDialogResponse 45 | #undef OnDialogResponse 46 | #else 47 | #define _ALS_OnDialogResponse 48 | #endif 49 | #define OnDialogResponse new_OnDialogResponse 50 | #if defined new_OnDialogResponse 51 | forward new_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]); 52 | #endif 53 | 54 | /******************************************************************************/ 55 | 56 | public OnToolbarResponse(playerid, response) 57 | { 58 | if(response == TOOLBAR_NEW) 59 | { 60 | ShowPlayerDialog(playerid, g_NewDialog, DIALOG_STYLE_MSGBOX, "New Map", "Are you sure you want to start a new map?", "Yes", "No"); 61 | return 1; 62 | } 63 | 64 | #if defined new_OnToolbarResponse 65 | return new_OnToolbarResponse(playerid, response); 66 | #else 67 | return 0; 68 | #endif 69 | } 70 | #if defined _ALS_OnToolbarResponse 71 | #undef OnToolbarResponse 72 | #else 73 | #define _ALS_OnToolbarResponse 74 | #endif 75 | #define OnToolbarResponse new_OnToolbarResponse 76 | #if defined new_OnToolbarResponse 77 | forward new_OnToolbarResponse(playerid, response); 78 | #endif 79 | 80 | /******************************************************************************/ 81 | -------------------------------------------------------------------------------- /mapedit/new/data.pwn: -------------------------------------------------------------------------------- 1 | new g_NewDialog; 2 | 3 | #include "mapedit/new/functions.pwn" 4 | #include "mapedit/new/callbacks.pwn" 5 | -------------------------------------------------------------------------------- /mapedit/new/functions.pwn: -------------------------------------------------------------------------------- 1 | ClearMap() 2 | { 3 | for(new objectid = 1; objectid <= MAX_OBJECTS; objectid ++) 4 | DestroyObject(objectid); 5 | 6 | for(new vehicleid = 1; vehicleid <= MAX_VEHICLES; vehicleid ++) 7 | DestroyVehicle(vehicleid); 8 | 9 | for(new pickupid; pickupid < MAX_PICKUPS; pickupid ++) 10 | DestroyPickup(pickupid); 11 | 12 | for(new playerid, max_playerid = GetMaxPlayers(); playerid < max_playerid; playerid ++) 13 | { 14 | if(!IsPlayerConnected(playerid)) 15 | continue; 16 | 17 | for(new index; index < MAX_ATTACHED_INDEX; index ++) 18 | RemovePlayerAttachedObject(playerid, index); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /mapedit/obj/attach.pwn: -------------------------------------------------------------------------------- 1 | stock GetObjectAttachOffset(objectid, &Float:x, &Float:y, &Float:z, &Float:rx, &Float:ry, &Float:rz) 2 | { 3 | if(!IsValidObject(objectid)) 4 | return 0; 5 | 6 | x = g_ObjectAttachOffset[objectid - 1][0]; 7 | y = g_ObjectAttachOffset[objectid - 1][1]; 8 | z = g_ObjectAttachOffset[objectid - 1][2]; 9 | rx = g_ObjectAttachOffset[objectid - 1][3]; 10 | ry = g_ObjectAttachOffset[objectid - 1][4]; 11 | rz = g_ObjectAttachOffset[objectid - 1][5]; 12 | return 1; 13 | } 14 | 15 | UnAttachObject(objectid) 16 | { 17 | if(!IsValidObject(objectid)) 18 | return 0; 19 | 20 | g_ObjectAttachToObject [objectid - 1] = INVALID_OBJECT_ID; 21 | g_ObjectAttachToVehicle [objectid - 1] = INVALID_VEHICLE_ID; 22 | for(new i; i < 6; i ++) 23 | g_ObjectAttachOffset [objectid - 1][i] = 0.0; 24 | return 1; 25 | } 26 | -------------------------------------------------------------------------------- /mapedit/obj/data.pwn: -------------------------------------------------------------------------------- 1 | #define OBJECT_MOVESPEED 100.0 2 | #define MAX_OBJECT_INDEX 16 3 | #define MAX_OBJECT_TEXT 50 4 | #define MAX_OBJECT_FONT 30 5 | 6 | enum 7 | { 8 | OBJECT_TYPE_TEXTURE, 9 | OBJECT_TYPE_TEXT 10 | } 11 | 12 | new 13 | g_ObjectAttachToObject [MAX_OBJECTS] = {INVALID_OBJECT_ID, ...}, 14 | g_ObjectAttachToVehicle [MAX_OBJECTS] = {INVALID_VEHICLE_ID, ...}, 15 | Float: g_ObjectAttachOffset [MAX_OBJECTS][6], 16 | g_pSelectedAttachObject [MAX_PLAYERS] = {INVALID_OBJECT_ID, ...}, 17 | 18 | Float: g_ObjectSavePos [MAX_OBJECTS][3], 19 | Float: g_ObjectSaveRot [MAX_OBJECTS][3], 20 | Float: g_pObjectSavePos [MAX_PLAYERS][MAX_OBJECTS][3], 21 | Float: g_pObjectSaveRot [MAX_PLAYERS][MAX_OBJECTS][3], 22 | 23 | g_pEditObject [MAX_PLAYERS], 24 | g_pEditObjectIndex [MAX_PLAYERS char], 25 | 26 | g_ObjectTextureID [MAX_OBJECTS][MAX_OBJECT_INDEX], 27 | g_ObjectTextureColor [MAX_OBJECTS][MAX_OBJECT_INDEX], 28 | 29 | bool: g_IsObjectText [MAX_OBJECTS][MAX_OBJECT_INDEX], 30 | g_ObjectText [MAX_OBJECTS][MAX_OBJECT_INDEX][MAX_OBJECT_TEXT], 31 | g_ObjectMaterialSize [MAX_OBJECTS][MAX_OBJECT_INDEX], 32 | g_ObjectFont [MAX_OBJECTS][MAX_OBJECT_INDEX][MAX_OBJECT_FONT], 33 | g_ObjectFontSize [MAX_OBJECTS][MAX_OBJECT_INDEX], 34 | bool: g_IsObjectTextBold [MAX_OBJECTS][MAX_OBJECT_INDEX], 35 | g_ObjectTextColor [MAX_OBJECTS][MAX_OBJECT_INDEX], 36 | g_ObjectTextBackColor [MAX_OBJECTS][MAX_OBJECT_INDEX], 37 | g_ObjectTextAlignment [MAX_OBJECTS][MAX_OBJECT_INDEX], 38 | 39 | g_ObjectSelectBrowser, 40 | g_pSelectObjectChoice [MAX_PLAYERS] = {INVALID_OBJECT_ID, ...}, 41 | g_pSelectObjectPage [MAX_PLAYERS], 42 | g_pSelectObjectSearch [MAX_PLAYERS][MAX_MBROWSER_SEARCH], 43 | g_pSelectObjectResult [MAX_PLAYERS][MAX_MBROWSER_PAGESIZE], 44 | 45 | g_ObjectCreateBrowser, 46 | g_pCreateObjectChoice [MAX_PLAYERS] = {-1, ...}, 47 | g_pCreateObjectPage [MAX_PLAYERS], 48 | g_pCreateObjectSearch [MAX_PLAYERS][MAX_MBROWSER_SEARCH], 49 | g_pCreateObjectResult [MAX_PLAYERS][MAX_MBROWSER_PAGESIZE], 50 | 51 | g_ObjectMaterialBrowser, 52 | g_pTextureObjectPage [MAX_PLAYERS], 53 | g_pTextureObjectSearch [MAX_PLAYERS][MAX_MBROWSER_SEARCH], 54 | g_pTextureObjectResult [MAX_PLAYERS][MAX_MBROWSER_PAGESIZE], 55 | 56 | g_ObjectTextureColorBrowser, 57 | g_pObjectTextureColorPage [MAX_PLAYERS char], 58 | 59 | g_ObjectFontColorBrowser, 60 | g_pObjectFontColorPage [MAX_PLAYERS char], 61 | 62 | g_ObjectBackColorBrowser, 63 | g_pObjectBackColorPage [MAX_PLAYERS char], 64 | 65 | g_ObjectMainDialog, 66 | g_ObjectEditDialog, 67 | g_ObjectIndexDialog, 68 | g_ObjectXDialog, 69 | g_ObjectYDialog, 70 | g_ObjectZDialog, 71 | g_ObjectRXDialog, 72 | g_ObjectRYDialog, 73 | g_ObjectRZDialog, 74 | g_ObjectTextStringDialog, 75 | g_ObjectTextMaterialSizeDialog, 76 | g_ObjectTextFontDialog, 77 | g_ObjectTextFontSizeDialog, 78 | g_ObjectTextAlignmentDialog 79 | ; 80 | 81 | 82 | #include "mapedit/obj/macros.pwn" 83 | #include "mapedit/obj/hooks.pwn" 84 | #include "mapedit/obj/dialog.pwn" 85 | #include "mapedit/obj/attach.pwn" 86 | #include "mapedit/obj/functions.pwn" 87 | #include "mapedit/obj/callbacks.pwn" 88 | -------------------------------------------------------------------------------- /mapedit/obj/dialog.pwn: -------------------------------------------------------------------------------- 1 | ShowPlayerObjectDialog(playerid, dialogid) 2 | { 3 | if(dialogid == g_ObjectMainDialog) 4 | { 5 | ShowPlayerDialog( 6 | playerid, 7 | dialogid, 8 | DIALOG_STYLE_LIST, 9 | "Object", 10 | "Select Object (List)\nSelect Object (3D Selection)\nCreate Object (List)", 11 | "Choose", 12 | "Close" 13 | ); 14 | return 1; 15 | } 16 | else if(dialogid == g_ObjectEditDialog) 17 | { 18 | new 19 | objectid = g_pEditObject[playerid], 20 | select_attach_object = g_pSelectedAttachObject[playerid], 21 | attach_to_objectid = GetObjectAttachedToObject(objectid), 22 | attach_to_vehicleid = GetObjectAttachedToVehicle(objectid), 23 | Float: position [3], 24 | Float: rotation [3], 25 | info [1000] 26 | ; 27 | 28 | strcat(info, "Remove\n"); 29 | strcat(info, "Duplicate\n"); 30 | strcat(info, "Move\n"); 31 | 32 | strcat(info, "Select As Attachment\n"); 33 | 34 | if(select_attach_object == INVALID_OBJECT_ID) 35 | strcat(info, "Attach Selected Object \n"); 36 | else if(select_attach_object == objectid) 37 | strcat(info, "Attach Selected Object \n"); 38 | else 39 | { 40 | new modelid = GetObjectModel(select_attach_object); 41 | 42 | strcat(info, 43 | sprintf("Attach Selected Object: %s\n", GetObjectModelName(modelid)) 44 | ); 45 | } 46 | 47 | if(attach_to_objectid != INVALID_OBJECT_ID) 48 | { 49 | new modelid = GetObjectModel(attach_to_objectid); 50 | 51 | strcat(info, 52 | sprintf("Unattach From Object: %s\n", GetObjectModelName(modelid)) 53 | ); 54 | } 55 | else if(attach_to_vehicleid != INVALID_VEHICLE_ID) 56 | { 57 | new modelid = GetVehicleModel(attach_to_vehicleid); 58 | 59 | strcat(info, 60 | sprintf("Unattach From Vehicle: %s\n", GetVehicleModelName(modelid)) 61 | ); 62 | } 63 | else 64 | strcat(info, "Unattach \n"); 65 | 66 | if( 67 | attach_to_objectid != INVALID_OBJECT_ID || 68 | attach_to_vehicleid != INVALID_VEHICLE_ID 69 | ){ 70 | GetObjectAttachOffset( 71 | objectid, 72 | position[0], 73 | position[1], 74 | position[2], 75 | rotation[0], 76 | rotation[1], 77 | rotation[2] 78 | ); 79 | 80 | strcat(info, sprintf("X Offset: %.4f\n", position[0]) ); 81 | strcat(info, sprintf("Y Offset: %.4f\n", position[1]) ); 82 | strcat(info, sprintf("Z Offset: %.4f\n", position[2]) ); 83 | strcat(info, sprintf("RX Offset: %.4f\n", rotation[0]) ); 84 | strcat(info, sprintf("RY Offset: %.4f\n", rotation[1]) ); 85 | strcat(info, sprintf("RZ Offset: %.4f\n", rotation[2]) ); 86 | } 87 | else 88 | { 89 | GetObjectPos(objectid, position[0], position[1], position[2]); 90 | GetObjectRot(objectid, rotation[0], rotation[1], rotation[2]); 91 | 92 | strcat(info, sprintf("X Position: %.4f\n", position[0]) ); 93 | strcat(info, sprintf("Y Position: %.4f\n", position[1]) ); 94 | strcat(info, sprintf("Z Position: %.4f\n", position[2]) ); 95 | strcat(info, sprintf("X Rotation: %.4f\n", rotation[0]) ); 96 | strcat(info, sprintf("Y Rotation: %.4f\n", rotation[1]) ); 97 | strcat(info, sprintf("Z Rotation: %.4f\n", rotation[2]) ); 98 | } 99 | 100 | for(new index; index < MAX_OBJECT_INDEX; index ++) 101 | { 102 | if(IsObjectTextured(objectid, index)) 103 | { 104 | new textureid = GetObjectTextureID(objectid, index); 105 | 106 | strcat(info, 107 | sprintf("Index %02i Texture: %s\n", index, GetTextureName(textureid)) 108 | ); 109 | } 110 | else if(IsObjectText(objectid, index)) 111 | { 112 | strcat(info, 113 | sprintf("Index %02i Text: %s\n", index, GetObjectMaterialText(objectid, index)) 114 | ); 115 | } 116 | else 117 | strcat( info, sprintf("Index %02i: \n", index) ); 118 | } 119 | 120 | ShowPlayerDialog( 121 | playerid, 122 | dialogid, 123 | DIALOG_STYLE_LIST, 124 | "Edit Object", 125 | info, 126 | "Choose", 127 | "Back" 128 | ); 129 | return 1; 130 | } 131 | 132 | else if( 133 | dialogid == g_ObjectXDialog || 134 | dialogid == g_ObjectYDialog || 135 | dialogid == g_ObjectZDialog || 136 | dialogid == g_ObjectRXDialog || 137 | dialogid == g_ObjectRYDialog || 138 | dialogid == g_ObjectRZDialog 139 | ){ 140 | new objectid = g_pEditObject[playerid], 141 | attach_to_objectid = GetObjectAttachedToObject(objectid), 142 | attach_to_vehicleid = GetObjectAttachedToVehicle(objectid), 143 | bool:is_attached = (attach_to_objectid == INVALID_OBJECT_ID && attach_to_vehicleid == INVALID_VEHICLE_ID) ? (false) : (true), 144 | Float: position [3], 145 | Float: rotation [3], 146 | caption [18], 147 | info [22]; 148 | 149 | if(is_attached) 150 | GetObjectAttachOffset(objectid, position[0], position[1], position[2], rotation[0], rotation[1], rotation[2]); 151 | else 152 | { 153 | GetObjectPos(objectid, position[0], position[1], position[2]); 154 | GetObjectRot(objectid, rotation[0], rotation[1], rotation[2]); 155 | } 156 | 157 | if(dialogid == g_ObjectXDialog) 158 | { 159 | if(is_attached) 160 | { 161 | caption = "Object X Offset"; 162 | format(info, sizeof info, "X Offset: %.4f", position[0]); 163 | } 164 | else 165 | { 166 | caption = "Object X Position"; 167 | format(info, sizeof info, "X Position: %.4f", position[0]); 168 | } 169 | } 170 | else if(dialogid == g_ObjectYDialog) 171 | { 172 | if(is_attached) 173 | { 174 | caption = "Object Y Offset"; 175 | format(info, sizeof info, "Y Offset: %.4f", position[1]); 176 | } 177 | else 178 | { 179 | caption = "Object Y Position"; 180 | format(info, sizeof info, "Y Position: %.4f", position[1]); 181 | } 182 | } 183 | else if(dialogid == g_ObjectZDialog) 184 | { 185 | if(is_attached) 186 | { 187 | caption = "Object Z Offset"; 188 | format(info, sizeof info, "Z Offset: %.4f", position[2]); 189 | } 190 | else 191 | { 192 | caption = "Object Z Position"; 193 | format(info, sizeof info, "Z Position: %.4f", position[2]); 194 | } 195 | } 196 | else if(dialogid == g_ObjectRXDialog) 197 | { 198 | if(is_attached) 199 | { 200 | caption = "Object RX Offset"; 201 | format(info, sizeof info, "RX Offset: %.4f", rotation[0]); 202 | } 203 | else 204 | { 205 | caption = "Object X Rotation"; 206 | format(info, sizeof info, "X Rotation: %.4f", rotation[0]); 207 | } 208 | } 209 | else if(dialogid == g_ObjectRYDialog) 210 | { 211 | if(is_attached) 212 | { 213 | caption = "Object RY Offset"; 214 | format(info, sizeof info, "RY Offset: %.4f", rotation[1]); 215 | } 216 | else 217 | { 218 | caption = "Object Y Rotation"; 219 | format(info, sizeof info, "Y Rotation: %.4f", rotation[1]); 220 | } 221 | } 222 | else if(dialogid == g_ObjectRZDialog) 223 | { 224 | if(is_attached) 225 | { 226 | caption = "Object RZ Offset"; 227 | format(info, sizeof info, "RZ Offset: %.4f", rotation[2]); 228 | } 229 | else 230 | { 231 | caption = "Object Z Rotation"; 232 | format(info, sizeof info, "Z Rotation: %.4f", rotation[2]); 233 | } 234 | } 235 | 236 | ShowPlayerDialog( 237 | playerid, 238 | dialogid, 239 | DIALOG_STYLE_INPUT, 240 | caption, 241 | info, 242 | "Set", 243 | "Back" 244 | ); 245 | 246 | return 1; 247 | } 248 | else if(dialogid == g_ObjectIndexDialog) 249 | { 250 | new objectid = g_pEditObject[playerid], 251 | index = g_pEditObjectIndex{playerid}, 252 | info[500]; 253 | 254 | if(IsObjectTextured(objectid, index)) 255 | { 256 | new textureid = GetObjectTextureID(objectid, index); 257 | 258 | strcat(info, 259 | sprintf("Texture: %s\n", GetTextureName(textureid)) 260 | ); 261 | } 262 | else 263 | strcat( info, "Texture: \n" ); 264 | 265 | strcat ( info, "Set Texture Color\n" ); 266 | 267 | if(IsObjectText(objectid, index)) 268 | strcat(info, sprintf("Text: %s\n", GetObjectMaterialText(objectid, index)) ); 269 | else 270 | strcat(info, "Text: \n"); 271 | 272 | if(IsObjectText(objectid, index)) 273 | { 274 | new size = (GetObjectTextMaterialSize(objectid, index) / 10) - 1; 275 | strcat(info, sprintf("Material Size: %s\n", g_TextSizes[size])); 276 | } 277 | else 278 | strcat(info, "Material Size: \n"); 279 | 280 | if(IsObjectText(objectid, index)) 281 | strcat(info, sprintf("Font: %s\n", GetObjectTextFont(objectid, index)) ); 282 | else 283 | strcat(info, "Font: \n"); 284 | 285 | if(IsObjectText(objectid, index)) 286 | strcat(info, sprintf("Font Size: %i\n", GetObjectTextFontSize(objectid, index)) ); 287 | else 288 | strcat(info, "Font Size: \n"); 289 | 290 | if(IsObjectText(objectid, index)) 291 | strcat(info, sprintf("Bold: %s\n", (IsObjectTextBold(objectid, index)) ? ("Yes") : ("No")) ); 292 | else 293 | strcat(info, "Bold: \n"); 294 | 295 | if(IsObjectText(objectid, index)) 296 | { 297 | new alignment = GetObjectTextAlignment(objectid, index); 298 | strcat(info, sprintf("Alignment: %s\n", g_TextAlignments[alignment])); 299 | } 300 | else 301 | strcat(info, "Alignment: \n"); 302 | 303 | if(IsObjectText(objectid, index)) 304 | strcat(info, sprintf("Font Color: 0x%08x\n", GetObjectTextColor(objectid, index)) ); 305 | else 306 | strcat(info, "Font Color: \n"); 307 | 308 | if(IsObjectText(objectid, index)) 309 | strcat(info, sprintf("Background Color: 0x%08x\n", GetObjectTextBackColor(objectid, index)) ); 310 | else 311 | strcat(info, "Background Color: \n"); 312 | 313 | strcat ( info, "Reset Texture\n" ); 314 | strcat ( info, "Remove Text\n" ); 315 | strcat ( info, "Reset Texture Color\n" ); 316 | strcat ( info, "Remove Text Background\n" ); 317 | 318 | ShowPlayerDialog( 319 | playerid, 320 | dialogid, 321 | DIALOG_STYLE_LIST, 322 | sprintf("Object Index %i", index), 323 | info, 324 | "Continue", 325 | "Back" 326 | ); 327 | 328 | return 1; 329 | } 330 | else if(dialogid == g_ObjectTextStringDialog) 331 | { 332 | new objectid = g_pEditObject[playerid], 333 | index = g_pEditObjectIndex{playerid}; 334 | 335 | ShowPlayerDialog( 336 | playerid, 337 | dialogid, 338 | DIALOG_STYLE_INPUT, 339 | "Set Text", 340 | sprintf("Current Text: %s", GetObjectMaterialText(objectid, index)), 341 | "Enter", 342 | "Back" 343 | ); 344 | 345 | return 1; 346 | } 347 | else if(dialogid == g_ObjectTextMaterialSizeDialog) 348 | { 349 | new info[500]; 350 | for(new i; i < g_MaxTextSizes; i ++) 351 | strcat( info, sprintf("%s\n", g_TextSizes[i]) ); 352 | 353 | ShowPlayerDialog( 354 | playerid, 355 | dialogid, 356 | DIALOG_STYLE_LIST, 357 | "Set Material Size", 358 | info, 359 | "Select", 360 | "Back" 361 | ); 362 | return 1; 363 | } 364 | else if(dialogid == g_ObjectTextFontDialog) 365 | { 366 | new info[500]; 367 | for(new i; i < g_MaxFonts; i ++) 368 | strcat( info, sprintf("%s\n", g_Fonts[i]) ); 369 | 370 | ShowPlayerDialog( 371 | playerid, 372 | dialogid, 373 | DIALOG_STYLE_LIST, 374 | "Set Font", 375 | info, 376 | "Select", 377 | "Back" 378 | ); 379 | return 1; 380 | } 381 | else if(dialogid == g_ObjectTextFontSizeDialog) 382 | { 383 | new 384 | objectid = g_pEditObject[playerid], 385 | index = g_pEditObjectIndex{playerid} 386 | ; 387 | 388 | ShowPlayerDialog( 389 | playerid, 390 | dialogid, 391 | DIALOG_STYLE_INPUT, 392 | "Set Font Size", 393 | sprintf("Font Size: %i", GetObjectTextFontSize(objectid, index)), 394 | "Enter", 395 | "Back" 396 | ); 397 | return 1; 398 | } 399 | else if(dialogid == g_ObjectTextAlignmentDialog) 400 | { 401 | new info[100]; 402 | for(new i; i < g_MaxTextAlignments; i ++) 403 | strcat(info, sprintf("%s\n", g_TextAlignments[i]) ); 404 | 405 | ShowPlayerDialog( 406 | playerid, 407 | dialogid, 408 | DIALOG_STYLE_LIST, 409 | "Set Alignment", 410 | info, 411 | "Select", 412 | "Back" 413 | ); 414 | return 1; 415 | } 416 | return 0; 417 | } 418 | -------------------------------------------------------------------------------- /mapedit/obj/functions.pwn: -------------------------------------------------------------------------------- 1 | stock SaveObjectPos(objectid, Float:x, Float:y, Float:z) 2 | { 3 | g_ObjectSavePos[objectid - 1][0] = x; 4 | g_ObjectSavePos[objectid - 1][1] = y; 5 | g_ObjectSavePos[objectid - 1][2] = z; 6 | } 7 | 8 | stock LoadObjectPos(objectid, &Float:x, &Float:y, &Float:z) 9 | { 10 | x = g_ObjectSavePos[objectid - 1][0]; 11 | y = g_ObjectSavePos[objectid - 1][1]; 12 | z = g_ObjectSavePos[objectid - 1][2]; 13 | } 14 | 15 | stock SaveObjectRot(objectid, Float:rx, Float:ry, Float:rz) 16 | { 17 | g_ObjectSaveRot[objectid - 1][0] = rx; 18 | g_ObjectSaveRot[objectid - 1][1] = ry; 19 | g_ObjectSaveRot[objectid - 1][2] = rz; 20 | } 21 | 22 | stock LoadObjectRot(objectid, &Float:rx, &Float:ry, &Float:rz) 23 | { 24 | rx = g_ObjectSaveRot[objectid - 1][0]; 25 | ry = g_ObjectSaveRot[objectid - 1][1]; 26 | rz = g_ObjectSaveRot[objectid - 1][2]; 27 | } 28 | 29 | stock SavePlayerObjectPos(playerid, objectid, Float:x, Float:y, Float:z) 30 | { 31 | g_pObjectSavePos[playerid][objectid - 1][0] = x; 32 | g_pObjectSavePos[playerid][objectid - 1][1] = y; 33 | g_pObjectSavePos[playerid][objectid - 1][2] = z; 34 | } 35 | 36 | stock LoadPlayerObjectPos(playerid, objectid, &Float:x, &Float:y, &Float:z) 37 | { 38 | x = g_pObjectSavePos[playerid][objectid - 1][0]; 39 | y = g_pObjectSavePos[playerid][objectid - 1][1]; 40 | z = g_pObjectSavePos[playerid][objectid - 1][2]; 41 | } 42 | 43 | stock SavePlayerObjectRot(playerid, objectid, Float:rx, Float:ry, Float:rz) 44 | { 45 | g_pObjectSaveRot[playerid][objectid - 1][0] = rx; 46 | g_pObjectSaveRot[playerid][objectid - 1][1] = ry; 47 | g_pObjectSaveRot[playerid][objectid - 1][2] = rz; 48 | } 49 | 50 | stock LoadPlayerObjectRot(playerid, objectid, &Float:rx, &Float:ry, &Float:rz) 51 | { 52 | rx = g_pObjectSaveRot[playerid][objectid - 1][0]; 53 | ry = g_pObjectSaveRot[playerid][objectid - 1][1]; 54 | rz = g_pObjectSaveRot[playerid][objectid - 1][2]; 55 | } 56 | 57 | DuplicateObject(old_objectid, bool:duplicate_attachments = true) 58 | { 59 | if(old_objectid == INVALID_OBJECT_ID) 60 | return INVALID_OBJECT_ID; 61 | 62 | new new_objectid, 63 | modelid = GetObjectModel(old_objectid), 64 | Float:x, 65 | Float:y, 66 | Float:z, 67 | Float:rx, 68 | Float:ry, 69 | Float:rz, 70 | attach_to_objectid = GetObjectAttachedToObject(old_objectid), 71 | attach_to_vehicleid = GetObjectAttachedToVehicle(old_objectid); 72 | 73 | GetObjectPos(old_objectid, x, y, z); 74 | GetObjectRot(old_objectid, rx, ry, rz); 75 | 76 | new_objectid = CreateObject(modelid, x, y, z, rx, ry, rz); 77 | if(new_objectid == INVALID_OBJECT_ID) 78 | return INVALID_OBJECT_ID; 79 | 80 | for(new materialindex; materialindex < MAX_OBJECT_INDEX; materialindex ++) 81 | { 82 | if(IsObjectTextured(old_objectid, materialindex)) 83 | { 84 | new textureid = GetObjectTextureID(old_objectid, materialindex); 85 | 86 | SetObjectMaterial( 87 | new_objectid, 88 | materialindex, 89 | GetTextureModel (textureid), 90 | GetTextureTXD (textureid), 91 | GetTextureName (textureid), 92 | GetObjectTextureColor (old_objectid, materialindex) 93 | ); 94 | } 95 | else if(IsObjectText(old_objectid, materialindex)) 96 | { 97 | SetObjectMaterialText( 98 | new_objectid, 99 | GetObjectMaterialText (old_objectid, materialindex), 100 | materialindex, 101 | GetObjectTextMaterialSize (old_objectid, materialindex), 102 | GetObjectTextFont (old_objectid, materialindex), 103 | GetObjectTextFontSize (old_objectid, materialindex), 104 | IsObjectTextBold (old_objectid, materialindex), 105 | GetObjectTextColor (old_objectid, materialindex), 106 | GetObjectTextBackColor (old_objectid, materialindex), 107 | GetObjectTextAlignment (old_objectid, materialindex) 108 | ); 109 | } 110 | } 111 | 112 | if(attach_to_objectid != INVALID_OBJECT_ID) 113 | { 114 | new 115 | Float:ox, 116 | Float:oy, 117 | Float:oz, 118 | Float:orx, 119 | Float:ory, 120 | Float:orz 121 | ; 122 | 123 | GetObjectAttachOffset(old_objectid, ox, oy, oz, orx, ory, orz); 124 | AttachObjectToObject(new_objectid, attach_to_objectid, ox, oy, oz, orx, ory, orz); 125 | } 126 | else if(attach_to_vehicleid != INVALID_VEHICLE_ID) 127 | { 128 | new Float:ox, 129 | Float:oy, 130 | Float:oz, 131 | Float:orx, 132 | Float:ory, 133 | Float:orz; 134 | 135 | GetObjectAttachOffset(old_objectid, ox, oy, oz, orx, ory, orz); 136 | AttachObjectToVehicle(new_objectid, attach_to_vehicleid, ox, oy, oz, orx, ory, orz); 137 | } 138 | 139 | if(!duplicate_attachments) 140 | return new_objectid; 141 | 142 | for(new loop_objectid = 1; loop_objectid <= MAX_OBJECTS; loop_objectid ++) 143 | { 144 | if(GetObjectAttachedToObject(loop_objectid) == old_objectid) 145 | { 146 | new attach_objectid = DuplicateObject(loop_objectid, false); 147 | if(attach_objectid == INVALID_OBJECT_ID) 148 | continue; 149 | 150 | new Float:ox, 151 | Float:oy, 152 | Float:oz, 153 | Float:orx, 154 | Float:ory, 155 | Float:orz; 156 | 157 | GetObjectAttachOffset(attach_objectid, ox, oy, oz, orx, ory, orz); 158 | AttachObjectToObject(attach_objectid, new_objectid, ox, oy, oz, orx, ory, orz); 159 | } 160 | } 161 | 162 | return new_objectid; 163 | } 164 | 165 | RemoveObjectMaterial(objectid, materialindex) 166 | { 167 | if(!IsValidObject(objectid)) 168 | return 0; 169 | 170 | g_ObjectTextureID [objectid - 1][materialindex] = -1; 171 | g_ObjectTextureColor [objectid - 1][materialindex] = 0; 172 | return 1; 173 | } 174 | 175 | RemoveObjectMaterialText(objectid, materialindex) 176 | { 177 | if(!IsValidObject(objectid)) 178 | return 0; 179 | 180 | g_IsObjectText [objectid - 1][materialindex] = false; 181 | g_ObjectText [objectid - 1][materialindex] = ""; 182 | g_ObjectMaterialSize [objectid - 1][materialindex] = OBJECT_MATERIAL_SIZE_256x128; 183 | g_ObjectFont [objectid - 1][materialindex] = "Arial"; 184 | g_ObjectFontSize [objectid - 1][materialindex] = 24; 185 | g_IsObjectTextBold [objectid - 1][materialindex] = true; 186 | g_ObjectTextColor [objectid - 1][materialindex] = 0xFFFFFFFF; 187 | g_ObjectTextBackColor [objectid - 1][materialindex] = 0; 188 | g_ObjectTextAlignment [objectid - 1][materialindex] = 0; 189 | return 1; 190 | } 191 | -------------------------------------------------------------------------------- /mapedit/obj/hooks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | stock o_CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance = 0.0) 4 | { 5 | new objectid = CreateObject(modelid, X, Y, Z, rX, rY, rZ, DrawDistance); 6 | if(objectid != INVALID_OBJECT_ID) 7 | { 8 | for(new materialindex; materialindex < MAX_OBJECT_INDEX; materialindex ++) 9 | { 10 | RemoveObjectMaterial(objectid, materialindex); 11 | RemoveObjectMaterialText(objectid, materialindex); 12 | } 13 | } 14 | return objectid; 15 | } 16 | #if defined _ALS_CreateObject 17 | #undef CreateObject 18 | #else 19 | #define _ALS_CreateObject 20 | #endif 21 | #define CreateObject o_CreateObject 22 | 23 | /******************************************************************************/ 24 | 25 | stock o_DestroyObject(objectid) 26 | { 27 | if(IsValidObject(objectid)) 28 | { 29 | if( 30 | GetObjectAttachedToObject(objectid) != INVALID_OBJECT_ID || 31 | GetObjectAttachedToVehicle(objectid) != INVALID_VEHICLE_ID 32 | ){ 33 | UnAttachObject(objectid); 34 | } 35 | 36 | for(new loop_objectid = 1; loop_objectid <= MAX_OBJECTS; loop_objectid ++) 37 | { 38 | if(GetObjectAttachedToObject(loop_objectid) == objectid) 39 | DestroyObject(loop_objectid); 40 | } 41 | 42 | for(new materialindex; materialindex < MAX_OBJECT_INDEX; materialindex ++) 43 | { 44 | RemoveObjectMaterial(objectid, materialindex); 45 | RemoveObjectMaterialText(objectid, materialindex); 46 | } 47 | 48 | for(new playerid; playerid < MAX_PLAYERS; playerid ++) 49 | { 50 | if(!IsPlayerConnected(playerid)) 51 | continue; 52 | 53 | if(g_pEditObject[playerid] == objectid) 54 | { 55 | new mbrowserid = GetPlayerMBrowser(playerid), 56 | cbrowserid = GetPlayerCBrowser(playerid), 57 | dialogid = GetPlayerDialog(playerid); 58 | 59 | if( 60 | mbrowserid == g_ObjectSelectBrowser || 61 | mbrowserid == g_ObjectCreateBrowser || 62 | mbrowserid == g_ObjectMaterialBrowser 63 | ){ 64 | HideMBrowser(playerid); 65 | } 66 | 67 | if( 68 | cbrowserid == g_ObjectTextureColorBrowser || 69 | cbrowserid == g_ObjectFontColorBrowser || 70 | cbrowserid == g_ObjectBackColorBrowser 71 | ){ 72 | HideCBrowser(playerid); 73 | } 74 | 75 | if( 76 | dialogid == g_ObjectMainDialog || 77 | dialogid == g_ObjectEditDialog || 78 | dialogid == g_ObjectIndexDialog || 79 | dialogid == g_ObjectXDialog || 80 | dialogid == g_ObjectYDialog || 81 | dialogid == g_ObjectZDialog || 82 | dialogid == g_ObjectRXDialog || 83 | dialogid == g_ObjectRYDialog || 84 | dialogid == g_ObjectRZDialog || 85 | dialogid == g_ObjectTextStringDialog || 86 | dialogid == g_ObjectTextMaterialSizeDialog || 87 | dialogid == g_ObjectTextFontDialog || 88 | dialogid == g_ObjectTextFontSizeDialog || 89 | dialogid == g_ObjectTextAlignmentDialog 90 | ){ 91 | HidePlayerDialog(playerid); 92 | } 93 | 94 | g_pEditObject[playerid] = INVALID_OBJECT_ID; 95 | } 96 | 97 | if(g_pSelectedAttachObject[playerid] == objectid) 98 | g_pSelectedAttachObject[playerid] = INVALID_OBJECT_ID; 99 | 100 | if(g_pSelectObjectChoice[playerid] == objectid) 101 | { 102 | if(GetPlayerMBrowser(playerid) == g_ObjectSelectBrowser) 103 | HideMBrowserModel(playerid); 104 | 105 | g_pSelectObjectChoice[playerid] = INVALID_OBJECT_ID; 106 | } 107 | 108 | for(new listitem; listitem < MAX_MBROWSER_PAGESIZE; listitem ++) 109 | { 110 | if(g_pSelectObjectResult[playerid][listitem] == objectid) 111 | { 112 | if(GetPlayerMBrowser(playerid) == g_ObjectSelectBrowser) 113 | HideMBrowserListItem(playerid, listitem); 114 | 115 | g_pSelectObjectResult[playerid][listitem] = INVALID_OBJECT_ID; 116 | } 117 | } 118 | } 119 | } 120 | DestroyObject(objectid); 121 | } 122 | #if defined _ALS_DestroyObject 123 | #undef DestroyObject 124 | #else 125 | #define _ALS_DestroyObject 126 | #endif 127 | #define DestroyObject o_DestroyObject 128 | 129 | /******************************************************************************/ 130 | 131 | stock o_SetObjectMaterial(objectid, materialindex, modelid, txdname[], texturename[], materialcolor = 0xFFFFFFFF) 132 | { 133 | new textureid = GetTextureID(modelid, txdname, texturename); 134 | 135 | g_ObjectTextureID [objectid - 1][materialindex] = textureid; 136 | g_ObjectTextureColor [objectid - 1][materialindex] = materialcolor; 137 | 138 | SetObjectMaterial( 139 | objectid, 140 | materialindex, 141 | modelid, 142 | txdname, 143 | texturename, 144 | materialcolor 145 | ); 146 | } 147 | #if defined _ALS_SetObjectMaterial 148 | #undef SetObjectMaterial 149 | #else 150 | #define _ALS_SetObjectMaterial 151 | #endif 152 | #define SetObjectMaterial o_SetObjectMaterial 153 | 154 | /******************************************************************************/ 155 | 156 | stock o_SetObjectMaterialText(objectid, text[], materialindex = 0, materialsize = OBJECT_MATERIAL_SIZE_256x128, fontface[] = "Arial", fontsize = 24, bold = 1, fontcolor = 0xFFFFFFFF, backcolor = 0, textalignment = 0) 157 | { 158 | new success = SetObjectMaterialText(objectid, text, materialindex, materialsize, fontface, fontsize, bold, fontcolor, backcolor, textalignment); 159 | if(success) 160 | { 161 | new bool: b_bold = (bold == 0) ? (false) : (true); 162 | 163 | g_IsObjectText [objectid - 1][materialindex] = true; 164 | format(g_ObjectText [objectid - 1][materialindex], MAX_OBJECT_TEXT, text); 165 | g_ObjectMaterialSize [objectid - 1][materialindex] = materialsize; 166 | format(g_ObjectFont [objectid - 1][materialindex], MAX_OBJECT_FONT, fontface); 167 | g_ObjectFontSize [objectid - 1][materialindex] = fontsize; 168 | g_IsObjectTextBold [objectid - 1][materialindex] = b_bold; 169 | g_ObjectTextColor [objectid - 1][materialindex] = fontcolor; 170 | g_ObjectTextBackColor [objectid - 1][materialindex] = backcolor; 171 | g_ObjectTextAlignment [objectid - 1][materialindex] = textalignment; 172 | } 173 | return success; 174 | } 175 | #if defined _ALS_SetObjectMaterialText 176 | #undef SetObjectMaterialText 177 | #else 178 | #define _ALS_SetObjectMaterialText 179 | #endif 180 | #define SetObjectMaterialText o_SetObjectMaterialText 181 | 182 | /******************************************************************************/ 183 | 184 | stock o_AttachObjectToObject(objectid, attachtoid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:RotX, Float:RotY, Float:RotZ, SyncRotation = 1) 185 | { 186 | if(!IsValidObject(objectid)) 187 | return 0; 188 | 189 | if(!IsValidObject(attachtoid)) 190 | return 0; 191 | 192 | if(objectid == attachtoid) 193 | return 0; 194 | 195 | AttachObjectToObject(objectid, attachtoid, OffsetX, OffsetY, OffsetZ, RotX, RotY, RotZ, SyncRotation); 196 | 197 | for(new loop_objectid = 1; loop_objectid <= MAX_OBJECTS; loop_objectid ++) 198 | { 199 | if(GetObjectAttachedToObject(loop_objectid) == objectid) 200 | UnAttachObject(loop_objectid); 201 | } 202 | 203 | g_ObjectAttachToObject [objectid - 1] = attachtoid; 204 | g_ObjectAttachToVehicle [objectid - 1] = INVALID_VEHICLE_ID; 205 | g_ObjectAttachOffset [objectid - 1][0] = OffsetX; 206 | g_ObjectAttachOffset [objectid - 1][1] = OffsetY; 207 | g_ObjectAttachOffset [objectid - 1][2] = OffsetZ; 208 | g_ObjectAttachOffset [objectid - 1][3] = RotX; 209 | g_ObjectAttachOffset [objectid - 1][4] = RotY; 210 | g_ObjectAttachOffset [objectid - 1][5] = RotZ; 211 | 212 | return 1; 213 | } 214 | #if defined _ALS_AttachObjectToObject 215 | #undef AttachObjectToObject 216 | #else 217 | #define _ALS_AttachObjectToObject 218 | #endif 219 | #define AttachObjectToObject o_AttachObjectToObject 220 | 221 | /******************************************************************************/ 222 | 223 | stock o_AttachObjectToVehicle(objectid, vehicleid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:RotX, Float:RotY, Float:RotZ) 224 | { 225 | if(!IsValidObject(objectid)) 226 | return 0; 227 | 228 | if(!IsValidVehicle(vehicleid)) 229 | return 0; 230 | 231 | AttachObjectToVehicle(objectid, vehicleid, OffsetX, OffsetY, OffsetZ, RotX, RotY, RotZ); 232 | 233 | for(new loop_objectid = 1; loop_objectid <= MAX_OBJECTS; loop_objectid ++) 234 | { 235 | if(GetObjectAttachedToObject(loop_objectid) == objectid) 236 | UnAttachObject(loop_objectid); 237 | } 238 | 239 | g_ObjectAttachToObject [objectid - 1] = INVALID_OBJECT_ID; 240 | g_ObjectAttachToVehicle [objectid - 1] = vehicleid; 241 | g_ObjectAttachOffset [objectid - 1][0] = OffsetX; 242 | g_ObjectAttachOffset [objectid - 1][1] = OffsetY; 243 | g_ObjectAttachOffset [objectid - 1][2] = OffsetZ; 244 | g_ObjectAttachOffset [objectid - 1][3] = RotX; 245 | g_ObjectAttachOffset [objectid - 1][4] = RotY; 246 | g_ObjectAttachOffset [objectid - 1][5] = RotZ; 247 | return 1; 248 | } 249 | #if defined _ALS_AttachObjectToVehicle 250 | #undef AttachObjectToVehicle 251 | #else 252 | #define _ALS_AttachObjectToVehicle 253 | #endif 254 | #define AttachObjectToVehicle o_AttachObjectToVehicle 255 | 256 | /******************************************************************************/ 257 | -------------------------------------------------------------------------------- /mapedit/obj/macros.pwn: -------------------------------------------------------------------------------- 1 | #define GetObjectAttachedToObject(%0) (g_ObjectAttachToObject[%0 - 1]) 2 | #define GetObjectAttachedToVehicle(%0) (g_ObjectAttachToVehicle[%0 - 1]) 3 | #define IsObjectTextured(%0,%1) (g_ObjectTextureID[%0 - 1][%1] != -1) 4 | #define GetObjectTextureID(%0,%1) (g_ObjectTextureID[%0 - 1][%1]) 5 | #define GetObjectTextureColor(%0,%1) (g_ObjectTextureColor[%0 - 1][%1]) 6 | #define IsObjectText(%0,%1) (g_IsObjectText[%0 - 1][%1]) 7 | #define GetObjectMaterialText(%0,%1) (g_ObjectText[%0 - 1][%1]) 8 | #define GetObjectTextMaterialSize(%0,%1) (g_ObjectMaterialSize[%0 - 1][%1]) 9 | #define GetObjectTextFont(%0,%1) (g_ObjectFont[%0 - 1][%1]) 10 | #define GetObjectTextFontSize(%0,%1) (g_ObjectFontSize[%0 - 1][%1]) 11 | #define IsObjectTextBold(%0,%1) (g_IsObjectTextBold[%0 - 1][%1]) 12 | #define GetObjectTextColor(%0,%1) (g_ObjectTextColor[%0 - 1][%1]) 13 | #define GetObjectTextBackColor(%0,%1) (g_ObjectTextBackColor[%0 - 1][%1]) 14 | #define GetObjectTextAlignment(%0,%1) (g_ObjectTextAlignment[%0 - 1][%1]) 15 | -------------------------------------------------------------------------------- /mapedit/oedit/callbacks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | public OnPlayerDisconnect(playerid, reason) 4 | { 5 | if(g_pOffsetEditToggled{playerid}) 6 | TogglePlayerOffsetEditor(playerid, false); 7 | 8 | #if defined oe_OnPlayerDisconnect 9 | oe_OnPlayerDisconnect(playerid, reason); 10 | #endif 11 | } 12 | #if defined _ALS_OnPlayerDisconnect 13 | #undef OnPlayerDisconnect 14 | #else 15 | #define _ALS_OnPlayerDisconnect 16 | #endif 17 | #define OnPlayerDisconnect oe_OnPlayerDisconnect 18 | #if defined oe_OnPlayerDisconnect 19 | forward oe_OnPlayerDisconnect(playerid, reason); 20 | #endif 21 | 22 | /******************************************************************************/ 23 | 24 | public OnPlayerOffsetEditUpdate(playerid) 25 | { 26 | static 27 | old_keys [ MAX_PLAYERS ] 28 | ; 29 | 30 | new 31 | new_keys, 32 | up_down, 33 | left_right 34 | ; 35 | 36 | GetPlayerKeys(playerid, new_keys, up_down, left_right); 37 | 38 | if((new_keys & KEY_SECONDARY_ATTACK) == KEY_SECONDARY_ATTACK) 39 | { 40 | // Exit Offset Editor 41 | 42 | TogglePlayerOffsetEditor(playerid, false); 43 | ClearAnimations(playerid); 44 | } 45 | else if((new_keys & KEY_SPRINT) == KEY_SPRINT) 46 | { 47 | // Change Mode 48 | 49 | if((new_keys & KEY_ANALOG_LEFT) == KEY_ANALOG_LEFT && (old_keys[playerid] & KEY_ANALOG_LEFT) != KEY_ANALOG_LEFT) 50 | { 51 | // Decrease 52 | 53 | if(-- g_pOffsetEditMode{playerid} < OFFSET_MODE_X) 54 | g_pOffsetEditMode{playerid} = OFFSET_MODE_RZ; 55 | 56 | ShowPlayerOffsetEditorMode(playerid); 57 | } 58 | 59 | else if((new_keys & KEY_ANALOG_RIGHT) == KEY_ANALOG_RIGHT && (old_keys[playerid] & KEY_ANALOG_RIGHT) != KEY_ANALOG_RIGHT) 60 | { 61 | // Increase 62 | 63 | if(++ g_pOffsetEditMode{playerid} > OFFSET_MODE_RZ) 64 | g_pOffsetEditMode{playerid} = OFFSET_MODE_X; 65 | 66 | ShowPlayerOffsetEditorMode(playerid); 67 | } 68 | } 69 | else 70 | { 71 | new 72 | objectid = g_pEditObject[playerid], 73 | attach_to_objectid = GetObjectAttachedToObject(objectid), 74 | attach_to_vehicleid = GetObjectAttachedToVehicle(objectid), 75 | bool: decrease = (new_keys & KEY_ANALOG_LEFT) == KEY_ANALOG_LEFT, 76 | bool: increase = (new_keys & KEY_ANALOG_RIGHT) == KEY_ANALOG_RIGHT, 77 | Float:x, 78 | Float:y, 79 | Float:z, 80 | Float:rx, 81 | Float:ry, 82 | Float:rz; 83 | 84 | if(g_pOffsetEditMode{playerid} == OFFSET_MODE_NONE || (!increase && !decrease)) 85 | g_pOffsetEditSpeed[playerid] = 0.0; 86 | else 87 | { 88 | switch(g_pOffsetEditMode{playerid}) 89 | { 90 | case OFFSET_MODE_X, OFFSET_MODE_Y, OFFSET_MODE_Z: 91 | { 92 | if( (new_keys & KEY_WALK) == KEY_WALK ) 93 | { 94 | g_pOffsetEditSpeed[playerid] += OE_MOVESPEED_SLOW_MULTIPLIER; 95 | if(g_pOffsetEditSpeed[playerid] > OE_MOVESPEED_SLOW_LIMIT) 96 | g_pOffsetEditSpeed[playerid] = OE_MOVESPEED_SLOW_LIMIT; 97 | } 98 | else 99 | { 100 | g_pOffsetEditSpeed[playerid] += OE_MOVESPEED_MULTIPLIER; 101 | if(g_pOffsetEditSpeed[playerid] > OE_MOVESPEED_LIMIT) 102 | g_pOffsetEditSpeed[playerid] = OE_MOVESPEED_LIMIT; 103 | } 104 | } 105 | case OFFSET_MODE_RX, OFFSET_MODE_RY, OFFSET_MODE_RZ: 106 | { 107 | if( (new_keys & KEY_WALK) == KEY_WALK ) 108 | { 109 | g_pOffsetEditSpeed[playerid] += OE_ROTATESPEED_SLOW_MULTIPLIER; 110 | if(g_pOffsetEditSpeed[playerid] > OE_ROTATESPEED_SLOW_LIMIT) 111 | g_pOffsetEditSpeed[playerid] = OE_ROTATESPEED_SLOW_LIMIT; 112 | } 113 | else 114 | { 115 | g_pOffsetEditSpeed[playerid] += OE_ROTATESPEED_MULTIPLIER; 116 | if(g_pOffsetEditSpeed[playerid] > OE_ROTATESPEED_LIMIT) 117 | g_pOffsetEditSpeed[playerid] = OE_ROTATESPEED_LIMIT; 118 | } 119 | } 120 | } 121 | 122 | GetObjectAttachOffset(objectid, x, y, z, rx, ry, rz); 123 | switch(g_pOffsetEditMode{playerid}) 124 | { 125 | case OFFSET_MODE_X: 126 | { 127 | if(increase) 128 | x += g_pOffsetEditSpeed[playerid]; 129 | else if(decrease) 130 | x -= g_pOffsetEditSpeed[playerid]; 131 | } 132 | case OFFSET_MODE_Y: 133 | { 134 | if(increase) 135 | y += g_pOffsetEditSpeed[playerid]; 136 | else if(decrease) 137 | y -= g_pOffsetEditSpeed[playerid]; 138 | } 139 | case OFFSET_MODE_Z: 140 | { 141 | if(increase) 142 | z += g_pOffsetEditSpeed[playerid]; 143 | else if(decrease) 144 | z -= g_pOffsetEditSpeed[playerid]; 145 | } 146 | case OFFSET_MODE_RX: 147 | { 148 | if(increase) 149 | { 150 | rx += g_pOffsetEditSpeed[playerid]; 151 | if(rx > 360.0) 152 | rx = 0.0; 153 | } 154 | else if(decrease) 155 | { 156 | rx -= g_pOffsetEditSpeed[playerid]; 157 | if(rx < 0.0) 158 | rx = 360.0; 159 | } 160 | } 161 | case OFFSET_MODE_RY: 162 | { 163 | if(increase) 164 | { 165 | ry += g_pOffsetEditSpeed[playerid]; 166 | if(ry > 360.0) 167 | ry = 0.0; 168 | } 169 | else if(decrease) 170 | { 171 | ry -= g_pOffsetEditSpeed[playerid]; 172 | if(ry < 0.0) 173 | ry = 360.0; 174 | } 175 | } 176 | case OFFSET_MODE_RZ: 177 | { 178 | if(increase) 179 | { 180 | rz += g_pOffsetEditSpeed[playerid]; 181 | if(rz > 360.0) 182 | rz = 0.0; 183 | } 184 | else if(decrease) 185 | { 186 | rz -= g_pOffsetEditSpeed[playerid]; 187 | if(rz < 0.0) 188 | rz = 360.0; 189 | } 190 | } 191 | } 192 | 193 | if(attach_to_objectid != INVALID_OBJECT_ID) 194 | { 195 | AttachObjectToObject(objectid, attach_to_objectid, x, y, z, rx, ry, rz); 196 | ShowPlayerOffsetEditorUpdate(playerid, x, y, z, rx, ry, rz); 197 | } 198 | else if(attach_to_vehicleid != INVALID_VEHICLE_ID) 199 | { 200 | AttachObjectToVehicle(objectid, attach_to_vehicleid, x, y, z, rx, ry, rz); 201 | ShowPlayerOffsetEditorUpdate(playerid, x, y, z, rx, ry, rz); 202 | } 203 | else 204 | TogglePlayerOffsetEditor(playerid, false); 205 | } 206 | } 207 | old_keys[playerid] = new_keys; 208 | } 209 | 210 | /******************************************************************************/ 211 | -------------------------------------------------------------------------------- /mapedit/oedit/data.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | #define OE_MOVESPEED_SLOW_MULTIPLIER (0.001) 4 | #define OE_MOVESPEED_SLOW_LIMIT (0.2) 5 | #define OE_MOVESPEED_MULTIPLIER (0.01) 6 | #define OE_MOVESPEED_LIMIT (2.0) 7 | #define OE_ROTATESPEED_SLOW_MULTIPLIER (0.01) 8 | #define OE_ROTATESPEED_SLOW_LIMIT (1.0) 9 | #define OE_ROTATESPEED_MULTIPLIER (0.1) 10 | #define OE_ROTATESPEED_LIMIT (5.0) 11 | 12 | /******************************************************************************/ 13 | 14 | enum 15 | { 16 | OFFSET_MODE_NONE, 17 | OFFSET_MODE_X, 18 | OFFSET_MODE_Y, 19 | OFFSET_MODE_Z, 20 | OFFSET_MODE_RX, 21 | OFFSET_MODE_RY, 22 | OFFSET_MODE_RZ 23 | } 24 | 25 | new 26 | bool: g_pOffsetEditToggled [MAX_PLAYERS char], 27 | g_pOffsetEditMode [MAX_PLAYERS char], 28 | g_pOffsetEditTimer [MAX_PLAYERS], 29 | Float: g_pOffsetEditSpeed [MAX_PLAYERS] 30 | ; 31 | 32 | /******************************************************************************/ 33 | 34 | forward OnPlayerOffsetEditUpdate(playerid); 35 | 36 | /******************************************************************************/ 37 | 38 | #include "mapedit/oedit/functions.pwn" 39 | #include "mapedit/oedit/callbacks.pwn" 40 | 41 | /******************************************************************************/ 42 | -------------------------------------------------------------------------------- /mapedit/oedit/functions.pwn: -------------------------------------------------------------------------------- 1 | ShowPlayerOffsetEditorToggle(playerid) 2 | { 3 | if(g_pOffsetEditToggled{playerid}) 4 | GameTextForPlayer(playerid, "~w~offset editor ~g~toggled", 4000, 4); 5 | else 6 | GameTextForPlayer(playerid, "~w~offset editor ~r~untoggled", 4000, 4); 7 | } 8 | 9 | ShowPlayerOffsetEditorMode(playerid) 10 | { 11 | switch(g_pOffsetEditMode{playerid}) 12 | { 13 | case OFFSET_MODE_X: 14 | GameTextForPlayer(playerid, "~r~editing x offset", 2000, 4); 15 | case OFFSET_MODE_Y: 16 | GameTextForPlayer(playerid, "~r~editing y offset", 2000, 4); 17 | case OFFSET_MODE_Z: 18 | GameTextForPlayer(playerid, "~r~editing z offset", 2000, 4); 19 | case OFFSET_MODE_RX: 20 | GameTextForPlayer(playerid, "~r~editing x rotation", 2000, 4); 21 | case OFFSET_MODE_RY: 22 | GameTextForPlayer(playerid, "~r~editing y rotation", 2000, 4); 23 | case OFFSET_MODE_RZ: 24 | GameTextForPlayer(playerid, "~r~editing z rotation", 2000, 4); 25 | } 26 | } 27 | 28 | ShowPlayerOffsetEditorUpdate(playerid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) 29 | { 30 | new string[30]; 31 | switch(g_pOffsetEditMode{playerid}) 32 | { 33 | case OFFSET_MODE_X: 34 | format(string, sizeof string, "~r~x offset: ~w~%.4f", x); 35 | case OFFSET_MODE_Y: 36 | format(string, sizeof string, "~r~y offset: ~w~%.4f", y); 37 | case OFFSET_MODE_Z: 38 | format(string, sizeof string, "~r~z offset: ~w~%.4f", z); 39 | case OFFSET_MODE_RX: 40 | format(string, sizeof string, "~r~x rotation: ~w~%.4f", rx); 41 | case OFFSET_MODE_RY: 42 | format(string, sizeof string, "~r~y rotation: ~w~%.4f", ry); 43 | case OFFSET_MODE_RZ: 44 | format(string, sizeof string, "~r~z rotation: ~w~%.4f", rz); 45 | default: 46 | return 0; 47 | } 48 | 49 | GameTextForPlayer(playerid, string, 1000, 4); 50 | return 1; 51 | } 52 | 53 | TogglePlayerOffsetEditor(playerid, bool:toggle) 54 | { 55 | if(toggle == g_pOffsetEditToggled{playerid}) 56 | return 0; 57 | 58 | g_pOffsetEditToggled {playerid} = toggle; 59 | g_pOffsetEditMode {playerid} = OFFSET_MODE_NONE; 60 | g_pOffsetEditSpeed [playerid] = 0.0; 61 | 62 | if(toggle) 63 | g_pOffsetEditTimer[playerid] = SetTimerEx("OnPlayerOffsetEditUpdate", 100, true, "i", playerid); 64 | else 65 | { 66 | KillTimer(g_pOffsetEditTimer[playerid]); 67 | 68 | if(g_pEditObject[playerid] != INVALID_OBJECT_ID) 69 | { 70 | SelectTextDraw(playerid, 0xFF0000FF); 71 | ShowPlayerObjectDialog(playerid, g_ObjectEditDialog); 72 | } 73 | } 74 | 75 | ShowPlayerOffsetEditorToggle(playerid); 76 | return 1; 77 | } 78 | -------------------------------------------------------------------------------- /mapedit/open/callbacks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | public OnFilterScriptInit() 4 | { 5 | CreateDialog(g_OpenDialog); 6 | 7 | #if defined open_OnFilterScriptInit 8 | open_OnFilterScriptInit(); 9 | #endif 10 | } 11 | #if defined _ALS_OnFilterScriptInit 12 | #undef OnFilterScriptInit 13 | #else 14 | #define _ALS_OnFilterScriptInit 15 | #endif 16 | #define OnFilterScriptInit open_OnFilterScriptInit 17 | #if defined open_OnFilterScriptInit 18 | forward open_OnFilterScriptInit(); 19 | #endif 20 | 21 | /******************************************************************************/ 22 | 23 | public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 24 | { 25 | if(dialogid == g_OpenDialog) 26 | { 27 | if(!response) 28 | return 1; 29 | 30 | new 31 | pre_tick = GetTickCount(), 32 | success = mparse_LoadMap(inputtext), 33 | post_tick = GetTickCount() 34 | ; 35 | 36 | if(!success) 37 | { 38 | SendClientMessage(playerid, RGBA_RED, "This map could not be opened!"); 39 | ShowPlayerDialog(playerid, g_OpenDialog, DIALOG_STYLE_INPUT, "Open Map", "Enter the name of the map", "Open", "Close"); 40 | return 1; 41 | } 42 | 43 | SendClientMessageToAll(RGBA_WHITE, 44 | sprintf("%s (ID: %i) has opened the map \"%s\", loading this map took %i ms.", 45 | ret_GetPlayerName(playerid), playerid, inputtext, post_tick - pre_tick 46 | ) 47 | ); 48 | return 1; 49 | } 50 | 51 | #if defined open_OnDialogResponse 52 | return open_OnDialogResponse(playerid, dialogid, response, listitem, inputtext); 53 | #else 54 | return 0; 55 | #endif 56 | } 57 | #if defined _ALS_OnDialogResponse 58 | #undef OnDialogResponse 59 | #else 60 | #define _ALS_OnDialogResponse 61 | #endif 62 | #define OnDialogResponse open_OnDialogResponse 63 | #if defined open_OnDialogResponse 64 | forward open_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]); 65 | #endif 66 | 67 | /******************************************************************************/ 68 | 69 | public OnToolbarResponse(playerid, response) 70 | { 71 | if(response == TOOLBAR_OPEN) 72 | { 73 | ShowPlayerDialog(playerid, g_OpenDialog, DIALOG_STYLE_INPUT, "Open Map", "Enter the name of the map", "Open", "Close"); 74 | return 1; 75 | } 76 | 77 | #if defined open_OnToolbarResponse 78 | return open_OnToolbarResponse(playerid, response); 79 | #else 80 | return 0; 81 | #endif 82 | } 83 | #if defined _ALS_OnToolbarResponse 84 | #undef OnToolbarResponse 85 | #else 86 | #define _ALS_OnToolbarResponse 87 | #endif 88 | #define OnToolbarResponse open_OnToolbarResponse 89 | #if defined open_OnToolbarResponse 90 | forward open_OnToolbarResponse(playerid, response); 91 | #endif 92 | 93 | /******************************************************************************/ 94 | -------------------------------------------------------------------------------- /mapedit/open/data.pwn: -------------------------------------------------------------------------------- 1 | new g_OpenDialog; 2 | 3 | #include "mapedit/open/callbacks.pwn" 4 | -------------------------------------------------------------------------------- /mapedit/pick/data.pwn: -------------------------------------------------------------------------------- 1 | #define INVALID_PICKUP_ID -1 2 | 3 | new 4 | bool: g_IsPickupValid [MAX_PICKUPS char], 5 | g_PickupModel [MAX_PICKUPS], 6 | Float: g_PickupPos [MAX_PICKUPS][3], 7 | 8 | g_pEditPickup [MAX_PLAYERS] = {INVALID_PICKUP_ID, ...}, 9 | g_pEditPickupObject [MAX_PLAYERS] = {INVALID_OBJECT_ID, ...}, 10 | 11 | g_PickupSelectBrowser, 12 | g_pSelectPickupChoice [MAX_PLAYERS] = {INVALID_PICKUP_ID, ...}, 13 | g_pSelectPickupPage [MAX_PLAYERS], 14 | g_pSelectPickupSearch [MAX_PLAYERS][MAX_MBROWSER_SEARCH], 15 | g_pSelectPickupResult [MAX_PLAYERS][MAX_MBROWSER_PAGESIZE], 16 | 17 | g_PickupCreateBrowser, 18 | g_pCreatePickupChoice [MAX_PLAYERS] = {-1, ...}, 19 | g_pCreatePickupPage [MAX_PLAYERS], 20 | g_pCreatePickupSearch [MAX_PLAYERS][MAX_MBROWSER_SEARCH], 21 | g_pCreatePickupResult [MAX_PLAYERS][MAX_MBROWSER_PAGESIZE], 22 | 23 | g_PickupMainDialog, 24 | g_PickupEditDialog, 25 | g_PickupXDialog, 26 | g_PickupYDialog, 27 | g_PickupZDialog 28 | ; 29 | 30 | #include "mapedit/pick/hooks.pwn" 31 | #include "mapedit/pick/macros.pwn" 32 | #include "mapedit/pick/functions.pwn" 33 | #include "mapedit/pick/callbacks.pwn" 34 | -------------------------------------------------------------------------------- /mapedit/pick/functions.pwn: -------------------------------------------------------------------------------- 1 | stock GetPickupPos(pickupid, &Float:x, &Float:y, &Float:z) 2 | { 3 | x = g_PickupPos[pickupid][0]; 4 | y = g_PickupPos[pickupid][1]; 5 | z = g_PickupPos[pickupid][2]; 6 | } 7 | 8 | stock ShowPlayerPickupDialog(playerid, dialogid) 9 | { 10 | if(dialogid == g_PickupMainDialog) 11 | { 12 | ShowPlayerDialog( 13 | playerid, 14 | dialogid, 15 | DIALOG_STYLE_LIST, 16 | "Pickup", 17 | "Select Pickup\nCreate Pickup", 18 | "Choose", 19 | "Close" 20 | ); 21 | return 1; 22 | } 23 | else if(dialogid == g_PickupEditDialog) 24 | { 25 | new 26 | pickupid = g_pEditPickup[playerid], 27 | Float:x, 28 | Float:y, 29 | Float:z, 30 | info[100] 31 | ; 32 | 33 | GetPickupPos(pickupid, x, y, z); 34 | 35 | strcat(info, "Remove\n"); 36 | strcat(info, "Duplicate\n"); 37 | strcat(info, "Move\n"); 38 | strcat(info, sprintf("X Position:\t\t%.4f\n", x) ); 39 | strcat(info, sprintf("Y Position:\t\t%.4f\n", y) ); 40 | strcat(info, sprintf("Z Position:\t\t%.4f\n", z) ); 41 | 42 | ShowPlayerDialog( 43 | playerid, 44 | dialogid, 45 | DIALOG_STYLE_LIST, 46 | "Edit Pickup", 47 | info, 48 | "Choose", 49 | "Back" 50 | ); 51 | return 1; 52 | } 53 | else if( 54 | dialogid == g_PickupXDialog || 55 | dialogid == g_PickupYDialog || 56 | dialogid == g_PickupZDialog 57 | ){ 58 | new 59 | pickupid = g_pEditPickup[playerid], 60 | Float:x, 61 | Float:y, 62 | Float:z, 63 | caption[18], 64 | info[22] 65 | ; 66 | 67 | GetPickupPos(pickupid, x, y, z); 68 | 69 | if(dialogid == g_PickupXDialog) 70 | { 71 | caption = "Pickup X Position"; 72 | format(info, sizeof info, "X Position: %.4f", x); 73 | } 74 | else if(dialogid == g_PickupYDialog) 75 | { 76 | caption = "Pickup Y Position"; 77 | format(info, sizeof info, "Y Position: %.4f", y); 78 | } 79 | else if(dialogid == g_PickupZDialog) 80 | { 81 | caption = "Pickup Z Position"; 82 | format(info, sizeof info, "Z Position: %.4f", z); 83 | } 84 | 85 | ShowPlayerDialog( 86 | playerid, 87 | dialogid, 88 | DIALOG_STYLE_INPUT, 89 | caption, 90 | info, 91 | "Set", 92 | "Back" 93 | ); 94 | return 1; 95 | } 96 | return 0; 97 | } 98 | -------------------------------------------------------------------------------- /mapedit/pick/hooks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | stock p_CreatePickup(model, type, Float:x, Float:y, Float:z, virtualworld = 0) 4 | { 5 | new pickupid = CreatePickup(model, type, x, y, z, virtualworld); 6 | if(pickupid != INVALID_PICKUP_ID) 7 | { 8 | g_IsPickupValid {pickupid} = true; 9 | g_PickupModel [pickupid] = model; 10 | g_PickupPos [pickupid][0] = x; 11 | g_PickupPos [pickupid][1] = y; 12 | g_PickupPos [pickupid][2] = z; 13 | } 14 | return pickupid; 15 | } 16 | #if defined _ALS_CreatePickup 17 | #undef CreatePickup 18 | #else 19 | #define _ALS_CreatePickup 20 | #endif 21 | #define CreatePickup p_CreatePickup 22 | 23 | /******************************************************************************/ 24 | 25 | stock p_DestroyPickup(pickupid) 26 | { 27 | if(pickupid >= 0 && pickupid < MAX_PICKUPS) 28 | { 29 | g_IsPickupValid{pickupid} = false; 30 | g_PickupModel[pickupid] = 0; 31 | 32 | for(new i; i < 3; i ++) 33 | g_PickupPos[pickupid][i] = 0.0; 34 | 35 | for(new playerid; playerid < MAX_PLAYERS; playerid ++) 36 | { 37 | if(!IsPlayerConnected(playerid)) 38 | continue; 39 | 40 | if(g_pEditPickup[playerid] == pickupid) 41 | { 42 | new mbrowserid = GetPlayerMBrowser(playerid), 43 | dialogid = GetPlayerDialog(playerid); 44 | 45 | if( 46 | mbrowserid == g_PickupSelectBrowser || 47 | mbrowserid == g_PickupCreateBrowser 48 | ){ 49 | HideMBrowser(playerid); 50 | } 51 | 52 | if( 53 | dialogid == g_PickupMainDialog || 54 | dialogid == g_PickupEditDialog || 55 | dialogid == g_PickupXDialog || 56 | dialogid == g_PickupYDialog || 57 | dialogid == g_PickupZDialog 58 | ){ 59 | HidePlayerDialog(playerid); 60 | } 61 | 62 | g_pEditPickup[playerid] = INVALID_PICKUP_ID; 63 | } 64 | 65 | if(g_pSelectPickupChoice[playerid] == pickupid) 66 | { 67 | if(GetPlayerMBrowser(playerid) == g_PickupSelectBrowser) 68 | HideMBrowserModel(playerid); 69 | 70 | g_pSelectPickupChoice[playerid] = INVALID_PICKUP_ID; 71 | } 72 | 73 | for(new listitem; listitem < MAX_MBROWSER_PAGESIZE; listitem ++) 74 | { 75 | if(g_pSelectPickupResult[playerid][listitem] == pickupid) 76 | { 77 | if(GetPlayerMBrowser(playerid) == g_PickupSelectBrowser) 78 | HideMBrowserListItem(playerid, listitem); 79 | 80 | g_pSelectPickupResult[playerid][listitem] = INVALID_PICKUP_ID; 81 | } 82 | } 83 | } 84 | } 85 | DestroyPickup(pickupid); 86 | } 87 | #if defined _ALS_DestroyPickup 88 | #undef DestroyPickup 89 | #else 90 | #define _ALS_DestroyPickup 91 | #endif 92 | #define DestroyPickup p_DestroyPickup 93 | 94 | /******************************************************************************/ 95 | -------------------------------------------------------------------------------- /mapedit/pick/macros.pwn: -------------------------------------------------------------------------------- 1 | #define IsValidPickup(%0) (%0 >= 0 && %0 < MAX_PICKUPS && g_IsPickupValid{%0}) 2 | #define GetPickupModel(%0) (g_PickupModel[%0]) 3 | 4 | -------------------------------------------------------------------------------- /mapedit/resources/alignments.pwn: -------------------------------------------------------------------------------- 1 | new const g_TextAlignments[][] = {"Left", "Center", "Right"}; 2 | new const g_MaxTextAlignments = sizeof g_TextAlignments; 3 | -------------------------------------------------------------------------------- /mapedit/resources/filename.pwn: -------------------------------------------------------------------------------- 1 | IsValidFilename(const filename[]) 2 | { 3 | new len = strlen(filename); 4 | if(len == 0) 5 | return 0; 6 | 7 | for(new i; i < len; i ++) 8 | { 9 | if( 10 | filename[i] == '/' || 11 | filename[i] == '?' || 12 | filename[i] == '<' || 13 | filename[i] == '>' || 14 | filename[i] == '\\' || 15 | filename[i] == ':' || 16 | filename[i] == '*' || 17 | filename[i] == '|' 18 | ){ 19 | return 0; 20 | } 21 | } 22 | return 1; 23 | } 24 | -------------------------------------------------------------------------------- /mapedit/resources/fonts.pwn: -------------------------------------------------------------------------------- 1 | new const g_Fonts[][] = 2 | { 3 | "Arial", "Arial Black", "Calibri", "Cambria", "Cambria Math", "Candara", 4 | "Comic Sans MS", "Consolas", "Constantia", "Corbel", "Courier", 5 | "Courier New", "Fixedsys", "Franklin Gothic Medium", "Gabriola", "Georgia", 6 | "GTAWEAPON3", "Impact", "Lucida Console", "Lucida Sans Unicode", 7 | "Microsoft Sans Serif", "Modern", "MS Sans Serif", "MS Serif", 8 | "Palatino Linotype", "Roman", "SampAux3", "Script", "Segoe Print", 9 | "Segoe Script", "Segoe UI", "Segoe UI Light", "Segoe UI Semibold", 10 | "Segoe UI Symbol", "Small Fonts", "Symbol", "System", "Tahoma", "Terminal", 11 | "Times New Roman", "Trebuchet MS", "Webdings", "Verdana", "Wingdings" 12 | }; 13 | 14 | new const g_MaxFonts = sizeof g_Fonts; 15 | -------------------------------------------------------------------------------- /mapedit/resources/textsizes.pwn: -------------------------------------------------------------------------------- 1 | new const g_TextSizes[][] = 2 | { 3 | "32x32", "64x32", "64x64", "128x32", "128x64", "128x128", "256x32", 4 | "256x64", "256x128", "256x256", "512x64", "512x128", "512x256", "512x512" 5 | }; 6 | 7 | new const g_MaxTextSizes = sizeof g_TextSizes; 8 | -------------------------------------------------------------------------------- /mapedit/resources/tuningshops.pwn: -------------------------------------------------------------------------------- 1 | enum 2 | { 3 | TUNINGSHOP_TRANSFENDER, 4 | TUNINGSHOP_LOCOLOW, 5 | TUNINGSHOP_WHEELARCH 6 | } 7 | 8 | stock GetVehicleModelTuningShop(modelid) 9 | { 10 | switch(modelid) 11 | { 12 | case 400, 401, 402, 404, 405, 409, 410, 411, 415, 418, 419, 420, 421, 422, 13 | 424, 426, 429, 436, 438, 439, 442, 445, 451, 458, 466, 467, 474, 475, 477, 14 | 478, 479, 480, 489, 491, 492, 496, 500, 506, 507, 516, 517, 518, 526, 527, 15 | 529, 533, 540, 541, 542, 545, 546, 547, 549, 550, 551, 555, 579, 580, 585, 16 | 587, 589, 600, 602, 603: 17 | return TUNINGSHOP_TRANSFENDER; 18 | 19 | case 412, 534, 535, 536, 566, 567, 575, 576: 20 | return TUNINGSHOP_LOCOLOW; 21 | 22 | case 558, 559, 560, 561, 562, 565: 23 | return TUNINGSHOP_WHEELARCH; 24 | } 25 | return -1; 26 | } 27 | 28 | stock GetTuningShopPosition(tuningshopid, &Float:x, &Float:y, &Float:z, &Float:a) 29 | { 30 | switch(tuningshopid) 31 | { 32 | case TUNINGSHOP_TRANSFENDER: 33 | x = 2386.7168, y = 1049.6642, z = 10.6430, a = 0.0; 34 | 35 | case TUNINGSHOP_LOCOLOW: 36 | x = 2644.8989, y = -2044.8210, z = 13.3657, a = 180.0; 37 | 38 | case TUNINGSHOP_WHEELARCH: 39 | x = -2723.5051, y = 217.1725, z = 4.2119, a = 90.0; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /mapedit/resources/vectorpos.pwn: -------------------------------------------------------------------------------- 1 | stock VectorToPos(playerid, &Float:x, &Float:y, &Float:z, Float:scale) 2 | { 3 | new 4 | Float: p[3], 5 | Float: v[3] 6 | ; 7 | 8 | GetPlayerCameraPos ( playerid, p[0], p[1], p[2] ); 9 | GetPlayerCameraFrontVector ( playerid, v[0], v[1], v[2] ); 10 | 11 | x = p[0] + (v[0] * scale); 12 | y = p[1] + (v[1] * scale); 13 | z = p[2] + (v[2] * scale); 14 | } 15 | -------------------------------------------------------------------------------- /mapedit/resources/vehcolors.pwn: -------------------------------------------------------------------------------- 1 | new const g_VehicleColors[] = 2 | { 3 | 0x000000FF, 0xFFFFFFFF, 0x2A77A1FF, 0x840410FF, 0x263739FF, 0x86446EFF, 0xD78E10FF, 0x4C75B7FF, 0xBDBEC6FF, 0x5E7072FF, 4 | 0x46597AFF, 0x656A79FF, 0x5D7E8DFF, 0x58595AFF, 0xD6DAD6FF, 0x9CA1A3FF, 0x335F3FFF, 0x730E1AFF, 0x7B0A2AFF, 0x9F9D94FF, 5 | 0x3B4E78FF, 0x732E3EFF, 0x691E3BFF, 0x96918CFF, 0x515459FF, 0x3F3E45FF, 0xA5A9A7FF, 0x635C5AFF, 0x3D4A68FF, 0x979592FF, 6 | 0x421F21FF, 0x5F272BFF, 0x8494ABFF, 0x767B7CFF, 0x646464FF, 0x5A5752FF, 0x252527FF, 0x2D3A35FF, 0x93A396FF, 0x6D7A88FF, 7 | 0x221918FF, 0x6F675FFF, 0x7C1C2AFF, 0x5F0A15FF, 0x193826FF, 0x5D1B20FF, 0x9D9872FF, 0x7A7560FF, 0x989586FF, 0xADB0B0FF, 8 | 0x848988FF, 0x304F45FF, 0x4D6268FF, 0x162248FF, 0x272F4BFF, 0x7D6256FF, 0x9EA4ABFF, 0x9C8D71FF, 0x6D1822FF, 0x4E6881FF, 9 | 0x9C9C98FF, 0x917347FF, 0x661C26FF, 0x949D9FFF, 0xA4A7A5FF, 0x8E8C46FF, 0x341A1EFF, 0x6A7A8CFF, 0xAAAD8EFF, 0xAB988FFF, 10 | 0x851F2EFF, 0x6F8297FF, 0x585853FF, 0x9AA790FF, 0x601A23FF, 0x20202CFF, 0xA4A096FF, 0xAA9D84FF, 0x78222BFF, 0x0E316DFF, 11 | 0x722A3FFF, 0x7B715EFF, 0x741D28FF, 0x1E2E32FF, 0x4D322FFF, 0x7C1B44FF, 0x2E5B20FF, 0x395A83FF, 0x6D2837FF, 0xA7A28FFF, 12 | 0xAFB1B1FF, 0x364155FF, 0x6D6C6EFF, 0x0F6A89FF, 0x204B6BFF, 0x2B3E57FF, 0x9B9F9DFF, 0x6C8495FF, 0x4D8495FF, 0xAE9B7FFF, 13 | 0x406C8FFF, 0x1F253BFF, 0xAB9276FF, 0x134573FF, 0x96816CFF, 0x64686AFF, 0x105082FF, 0xA19983FF, 0x385694FF, 0x525661FF, 14 | 0x7F6956FF, 0x8C929AFF, 0x596E87FF, 0x473532FF, 0x44624FFF, 0x730A27FF, 0x223457FF, 0x640D1BFF, 0xA3ADC6FF, 0x695853FF, 15 | 0x9B8B80FF, 0x620B1CFF, 0x5B5D5EFF, 0x624428FF, 0x731827FF, 0x1B376DFF, 0xEC6AAEFF, 0x000000FF, 16 | 0x177517FF, 0x210606FF, 0x125478FF, 0x452A0DFF, 0x571E1EFF, 0x010701FF, 0x25225AFF, 0x2C89AAFF, 0x8A4DBDFF, 0x35963AFF, 17 | 0xB7B7B7FF, 0x464C8DFF, 0x84888CFF, 0x817867FF, 0x817A26FF, 0x6A506FFF, 0x583E6FFF, 0x8CB972FF, 0x824F78FF, 0x6D276AFF, 18 | 0x1E1D13FF, 0x1E1306FF, 0x1F2518FF, 0x2C4531FF, 0x1E4C99FF, 0x2E5F43FF, 0x1E9948FF, 0x1E9999FF, 0x999976FF, 0x7C8499FF, 19 | 0x992E1EFF, 0x2C1E08FF, 0x142407FF, 0x993E4DFF, 0x1E4C99FF, 0x198181FF, 0x1A292AFF, 0x16616FFF, 0x1B6687FF, 0x6C3F99FF, 20 | 0x481A0EFF, 0x7A7399FF, 0x746D99FF, 0x53387EFF, 0x222407FF, 0x3E190CFF, 0x46210EFF, 0x991E1EFF, 0x8D4C8DFF, 0x805B80FF, 21 | 0x7B3E7EFF, 0x3C1737FF, 0x733517FF, 0x781818FF, 0x83341AFF, 0x8E2F1CFF, 0x7E3E53FF, 0x7C6D7CFF, 0x020C02FF, 0x072407FF, 22 | 0x163012FF, 0x16301BFF, 0x642B4FFF, 0x368452FF, 0x999590FF, 0x818D96FF, 0x99991EFF, 0x7F994CFF, 0x839292FF, 0x788222FF, 23 | 0x2B3C99FF, 0x3A3A0BFF, 0x8A794EFF, 0x0E1F49FF, 0x15371CFF, 0x15273AFF, 0x375775FF, 0x060820FF, 0x071326FF, 0x20394BFF, 24 | 0x2C5089FF, 0x15426CFF, 0x103250FF, 0x241663FF, 0x692015FF, 0x8C8D94FF, 0x516013FF, 0x090F02FF, 0x8C573AFF, 0x52888EFF, 25 | 0x995C52FF, 0x99581EFF, 0x993A63FF, 0x998F4EFF, 0x99311EFF, 0x0D1842FF, 0x521E1EFF, 0x42420DFF, 0x4C991EFF, 0x082A1DFF, 26 | 0x96821DFF, 0x197F19FF, 0x3B141FFF, 0x745217FF, 0x893F8DFF, 0x7E1A6CFF, 0x0B370BFF, 0x27450DFF, 0x071F24FF, 0x784573FF, 27 | 0x8A653AFF, 0x732617FF, 0x319490FF, 0x56941DFF, 0x59163DFF, 0x1B8A2FFF, 0x38160BFF, 0x041804FF, 0x355D8EFF, 0x2E3F5BFF, 28 | 0x561A28FF, 0x4E0E27FF, 0x706C67FF, 0x3B3E42FF, 0x2E2D33FF, 0x7B7E7DFF, 0x4A4442FF, 0x28344EFF 29 | }; 30 | new const g_MaxVehicleColors = sizeof g_VehicleColors; 31 | -------------------------------------------------------------------------------- /mapedit/resources/vehmodels.pwn: -------------------------------------------------------------------------------- 1 | #define MAX_VEHICLE_MODEL_NAME 18 2 | 3 | new const g_VehicleModels[212][MAX_VEHICLE_MODEL_NAME char] = 4 | { 5 | !"Landstalker", !"Bravura", !"Buffalo", !"Linerunner", !"Pereniel", !"Sentinel", 6 | !"Dumper", !"Firetruck", !"Trashmaster", !"Stretch", !"Manana", !"Infernus", 7 | !"Voodoo", !"Pony", !"Mule", !"Cheetah", !"Ambulance", !"Leviathan", !"Moonbeam", 8 | !"Esperanto", !"Taxi", !"Washington", !"Bobcat", !"Mr Whoopee", !"BF Injection", 9 | !"Hunter", !"Premier", !"Enforcer", !"Securicar", !"Banshee", !"Predator", !"Bus", 10 | !"Rhino", !"Barracks", !"Hotknife", !"Trailer", !"Previon", !"Coach", !"Cabbie", 11 | !"Stallion", !"Rumpo", !"RC Bandit", !"Romero", !"Packer", !"Monster", !"Admiral", 12 | !"Squalo", !"Seasparrow", !"Pizzaboy", !"Tram", !"Trailer", !"Turismo", !"Speeder", 13 | !"Reefer", !"Tropic", !"Flatbed", !"Yankee", !"Caddy", !"Solair", 14 | !"Berkley's RC Van", !"Skimmer", !"PCJ-600", !"Faggio", !"Freeway", !"RC Baron", 15 | !"RC Raider", !"Glendale", !"Oceanic", !"Sanchez", !"Sparrow", !"Patriot", !"Quad", 16 | !"Coastguard", !"Dinghy", !"Hermes", !"Sabre", !"Rustler", !"ZR3 50", !"Walton", 17 | !"Regina", !"Comet", !"BMX", !"Burrito", !"Camper", !"Marquis", !"Baggage", 18 | !"Dozer", !"Maverick", !"News Chopper", !"Rancher", !"FBI Rancher", !"Virgo", 19 | !"Greenwood", !"Jetmax", !"Hotring", !"Sandking", !"Blista Compact", 20 | !"Police Maverick", !"Boxville", !"Benson", !"Mesa", !"RC Goblin", 21 | !"Hotring Racer A", !"Hotring Racer B", !"Bloodring Banger", !"Rancher", 22 | !"Super GT", !"Elegant", !"Journey", !"Bike", !"Mountain Bike", !"Beagle", 23 | !"Cropdust", !"Stunt", !"Tanker", !"RoadTrain", !"Nebula", !"Majestic", 24 | !"Buccaneer", !"Shamal", !"Hydra", !"FCR-900", !"NRG-500", !"HPV1000", 25 | !"Cement Truck", !"Tow Truck", !"Fortune", !"Cadrona", !"FBI Truck", 26 | !"Willard", !"Forklift", !"Tractor", !"Combine", !"Feltzer", !"Remington", 27 | !"Slamvan", !"Blade", !"Freight", !"Streak", !"Vortex", !"Vincent", !"Bullet", 28 | !"Clover", !"Sadler", !"Firetruck", !"Hustler", !"Intruder", !"Primo", !"Cargobob", 29 | !"Tampa", !"Sunrise", !"Merit", !"Utility", !"Nevada", !"Yosemite", !"Windsor", 30 | !"Monster A", !"Monster B", !"Uranus", !"Jester", !"Sultan", !"Stratum", !"Elegy", 31 | !"Raindance", !"RC Tiger", !"Flash", !"Tahoma", !"Savanna", !"Bandito", !"Freight", 32 | !"Trailer", !"Kart", !"Mower", !"Duneride", !"Sweeper", !"Broadway", !"Tornado", 33 | !"AT-400", !"DFT-30", !"Huntley", !"Stafford", !"BF-400", !"Newsvan", !"Tug", 34 | !"Trailer A", !"Emperor", !"Wayfarer", !"Euros", !"Hotdog", !"Club", !"Trailer B", 35 | !"Trailer C", !"Andromada", !"Dodo", !"RC Cam", !"Launch", !"Police Car (LSPD)", 36 | !"Police Car (SFPD)", !"Police Car (LVPD)", !"Police Ranger", !"Picador", 37 | !"S.W.A.T. Van", !"Alpha", !"Phoenix", !"Glendale", !"Sadler", 38 | !"Luggage Trailer A", !"Luggage Trailer B", !"Stair Trailer", !"Boxville", 39 | !"Farm Plow", !"Utility Trailer" 40 | }; 41 | 42 | stock GetVehicleModelName(modelid) 43 | { 44 | new modelname[MAX_VEHICLE_MODEL_NAME]; 45 | switch(modelid) 46 | { 47 | case 400..611: 48 | strunpack(modelname, g_VehicleModels[modelid - 400]); 49 | default: 50 | strunpack(modelname, !"Unknown Model"); 51 | } 52 | return modelname; 53 | 54 | } 55 | -------------------------------------------------------------------------------- /mapedit/save/callbacks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | public OnFilterScriptInit() 4 | { 5 | CreateDialog(g_SaveDialog); 6 | 7 | if(!fexist("maps/")) 8 | printf("ERROR: The file path .../scriptfiles/maps does not exist!"); 9 | 10 | #if defined save_OnFilterScriptInit 11 | save_OnFilterScriptInit(); 12 | #endif 13 | } 14 | #if defined _ALS_OnFilterScriptInit 15 | #undef OnFilterScriptInit 16 | #else 17 | #define _ALS_OnFilterScriptInit 18 | #endif 19 | #define OnFilterScriptInit save_OnFilterScriptInit 20 | #if defined save_OnFilterScriptInit 21 | forward save_OnFilterScriptInit(); 22 | #endif 23 | 24 | /******************************************************************************/ 25 | 26 | public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 27 | { 28 | if(dialogid == g_SaveDialog) 29 | { 30 | if(!response) 31 | return 1; 32 | 33 | new 34 | tick = GetTickCount(), 35 | success = SaveMap(inputtext) 36 | ; 37 | 38 | if(!success) 39 | { 40 | SendClientMessage(playerid, RGBA_RED, "This map could not be saved!"); 41 | ShowPlayerDialog(playerid, g_SaveDialog, DIALOG_STYLE_INPUT, "Save Map", "Enter the name of the map", "Save", "Close"); 42 | return 1; 43 | } 44 | 45 | SendClientMessageToAll(RGBA_WHITE, 46 | sprintf("%s (ID: %i) has saved this map as \"%s\", saving this map took %i ms.", 47 | ret_GetPlayerName(playerid), playerid, inputtext, GetTickCount() - tick 48 | ) 49 | ); 50 | return 1; 51 | } 52 | 53 | #if defined save_OnDialogResponse 54 | return save_OnDialogResponse(playerid, dialogid, response, listitem, inputtext); 55 | #else 56 | return 0; 57 | #endif 58 | } 59 | #if defined _ALS_OnDialogResponse 60 | #undef OnDialogResponse 61 | #else 62 | #define _ALS_OnDialogResponse 63 | #endif 64 | #define OnDialogResponse save_OnDialogResponse 65 | #if defined save_OnDialogResponse 66 | forward save_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]); 67 | #endif 68 | 69 | /******************************************************************************/ 70 | 71 | public OnToolbarResponse(playerid, response) 72 | { 73 | if(response == TOOLBAR_SAVE) 74 | { 75 | ShowPlayerDialog(playerid, g_SaveDialog, DIALOG_STYLE_INPUT, "Save Map", "Enter the name of the map", "Save", "Close"); 76 | return 1; 77 | } 78 | 79 | #if defined save_OnToolbarResponse 80 | return save_OnToolbarResponse(playerid, response); 81 | #else 82 | return 0; 83 | #endif 84 | } 85 | #if defined _ALS_OnToolbarResponse 86 | #undef OnToolbarResponse 87 | #else 88 | #define _ALS_OnToolbarResponse 89 | #endif 90 | #define OnToolbarResponse save_OnToolbarResponse 91 | #if defined save_OnToolbarResponse 92 | forward save_OnToolbarResponse(playerid, response); 93 | #endif 94 | 95 | /******************************************************************************/ 96 | -------------------------------------------------------------------------------- /mapedit/save/data.pwn: -------------------------------------------------------------------------------- 1 | new g_SaveDialog; 2 | 3 | #include "mapedit/save/functions.pwn" 4 | #include "mapedit/save/callbacks.pwn" 5 | -------------------------------------------------------------------------------- /mapedit/save/functions.pwn: -------------------------------------------------------------------------------- 1 | SaveMap(const mapname[]) 2 | { 3 | if(!IsValidFilename(mapname)) 4 | return 0; 5 | 6 | new 7 | File:save_handle = fopen( sprintf("maps/%s.map", mapname), io_write) 8 | ; 9 | 10 | if(!save_handle) 11 | return 0; 12 | 13 | new 14 | valid_objects, 15 | valid_vehicles, 16 | valid_pickups, 17 | slot_objectid [MAX_OBJECTS], 18 | slot_vehicleid [MAX_VEHICLES], 19 | slot_pickupid [MAX_PICKUPS], 20 | objectid_slot [MAX_OBJECTS], 21 | vehicleid_slot [MAX_VEHICLES] 22 | ; 23 | 24 | for(new objectid = 1; objectid <= MAX_OBJECTS; objectid ++) 25 | { 26 | if(!IsValidObject(objectid)) 27 | continue; 28 | 29 | slot_objectid[valid_objects] = objectid; 30 | objectid_slot[objectid - 1] = valid_objects ++; 31 | } 32 | 33 | for(new vehicleid = 1; vehicleid <= MAX_VEHICLES; vehicleid ++) 34 | { 35 | if(!IsValidVehicle(vehicleid)) 36 | continue; 37 | 38 | slot_vehicleid[valid_vehicles] = vehicleid; 39 | vehicleid_slot[vehicleid - 1] = valid_vehicles ++; 40 | } 41 | 42 | for(new pickupid; pickupid < MAX_PICKUPS; pickupid ++) 43 | { 44 | if(IsValidPickup(pickupid)) 45 | slot_pickupid[valid_pickups ++] = pickupid; 46 | } 47 | 48 | if(valid_objects > 0) 49 | fwrite( save_handle, sprintf("new g_Object[%i];\r\n", valid_objects) ); 50 | 51 | if(valid_vehicles > 0) 52 | fwrite( save_handle, sprintf("new g_Vehicle[%i];\r\n", valid_vehicles) ); 53 | 54 | if(valid_pickups > 0) 55 | fwrite( save_handle, sprintf("new g_Pickup[%i];\r\n", valid_pickups) ); 56 | 57 | // objects, object textures, object text 58 | for(new o; o < valid_objects; o ++) 59 | { 60 | new 61 | objectid = slot_objectid[o], 62 | modelid = GetObjectModel(objectid), 63 | Float:x, 64 | Float:y, 65 | Float:z, 66 | Float:rx, 67 | Float:ry, 68 | Float:rz, 69 | save_str[200] 70 | ; 71 | 72 | GetObjectPos(objectid, x, y, z); 73 | GetObjectRot(objectid, rx, ry, rz); 74 | 75 | format(save_str, sizeof save_str, 76 | "g_Object[%i] = CreateObject(%i, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f); //%s\r\n", 77 | o, modelid, x, y, z, rx, ry, rz, GetObjectModelName(modelid) 78 | ); 79 | 80 | fwrite(save_handle, save_str); 81 | 82 | for(new index; index < MAX_OBJECT_INDEX; index ++) 83 | { 84 | if(IsObjectTextured(objectid, index)) 85 | { 86 | new textureid = GetObjectTextureID(objectid, index); 87 | 88 | format(save_str, sizeof save_str, 89 | "SetObjectMaterial(g_Object[%i], %i, %i, \"%s\", \"%s\", 0x%08x);\r\n", 90 | o, 91 | index, 92 | GetTextureModel(textureid), 93 | GetTextureTXD(textureid), 94 | GetTextureName(textureid), 95 | GetObjectTextureColor(objectid, index) 96 | ); 97 | 98 | fwrite(save_handle, save_str); 99 | } 100 | else if(IsObjectText(objectid, index)) 101 | { 102 | format(save_str, sizeof save_str, 103 | "SetObjectMaterialText(g_Object[%i], \"%s\", %i, %i, \"%s\", %i, %b, 0x%x, 0x%x, %i);\r\n", 104 | o, 105 | GetObjectMaterialText(objectid, index), 106 | index, 107 | GetObjectTextMaterialSize(objectid, index), 108 | GetObjectTextFont(objectid, index), 109 | GetObjectTextFontSize(objectid, index), 110 | IsObjectTextBold(objectid, index), 111 | GetObjectTextColor(objectid, index), 112 | GetObjectTextBackColor(objectid, index), 113 | GetObjectTextAlignment(objectid, index) 114 | ); 115 | 116 | fwrite(save_handle, save_str); 117 | } 118 | } 119 | } 120 | 121 | // vehicles, vehicle components, vehicle paintjobs 122 | for(new v; v < valid_vehicles; v ++) 123 | { 124 | new 125 | vehicleid = slot_vehicleid[v], 126 | modelid = GetVehicleModel(vehicleid), 127 | Float:x, 128 | Float:y, 129 | Float:z, 130 | Float:r, 131 | color[2], 132 | save_str[150] 133 | ; 134 | 135 | GetVehiclePos(vehicleid, x, y, z); 136 | GetVehicleZAngle(vehicleid, r); 137 | GetVehicleColor(vehicleid, color[0], color[1]); 138 | 139 | format(save_str, sizeof save_str, 140 | "g_Vehicle[%i] = CreateVehicle(%i, %.4f, %.4f, %.4f, %.4f, %i, %i, -1); //%s\r\n", 141 | v, modelid, x, y, z, r, color[0], color[1], GetVehicleModelName(modelid) 142 | ); 143 | 144 | fwrite(save_handle, save_str); 145 | 146 | for(new s; s < 14; s ++) 147 | { 148 | new componentid = GetVehicleComponentInSlot(vehicleid, s); 149 | if(componentid) 150 | { 151 | format(save_str, sizeof save_str, 152 | "AddVehicleComponent(g_Vehicle[%i], %i);\r\n", v, componentid 153 | ); 154 | 155 | fwrite(save_handle, save_str); 156 | } 157 | } 158 | 159 | new paintjobid = GetVehiclePaintjob(vehicleid); 160 | if(paintjobid != 3) 161 | { 162 | format(save_str, sizeof save_str, 163 | "ChangeVehiclePaintjob(g_Vehicle[%i], %i);\r\n", v, paintjobid 164 | ); 165 | 166 | fwrite(save_handle, save_str); 167 | } 168 | } 169 | 170 | // pickups 171 | for(new p; p < valid_pickups; p ++) 172 | { 173 | new 174 | pickupid = slot_pickupid[p], 175 | modelid = GetPickupModel(pickupid), 176 | Float:x, 177 | Float:y, 178 | Float:z, 179 | save_str[150] 180 | ; 181 | 182 | GetPickupPos(pickupid, x, y, z); 183 | 184 | format(save_str, sizeof save_str, 185 | "g_Pickup[%i] = CreatePickup(%i, 1, %.4f, %.4f, %.4f, -1); //%s\r\n", p, modelid, x, y, z, GetObjectModelName(modelid) 186 | ); 187 | 188 | fwrite(save_handle, save_str); 189 | } 190 | 191 | // Objects attached to other objects & vehicles 192 | for(new o; o < valid_objects; o ++) 193 | { 194 | new 195 | objectid = slot_objectid[o], 196 | attach_objectid = GetObjectAttachedToObject(objectid), 197 | attach_vehicleid = GetObjectAttachedToVehicle(objectid), 198 | save_str[200] 199 | ; 200 | 201 | if(attach_objectid != INVALID_OBJECT_ID) 202 | { 203 | new 204 | o_a_o = objectid_slot[attach_objectid - 1], 205 | Float:x, 206 | Float:y, 207 | Float:z, 208 | Float:rx, 209 | Float:ry, 210 | Float:rz 211 | ; 212 | 213 | GetObjectAttachOffset(objectid, x, y, z, rx, ry, rz); 214 | 215 | format(save_str, sizeof save_str, 216 | "AttachObjectToObject(g_Object[%i], g_Object[%i], %.4f, %.4f, %.4f, %.4f, %.4f, %.4f);\r\n", 217 | o, o_a_o, x, y, z, rx, ry, rz 218 | ); 219 | 220 | fwrite(save_handle, save_str); 221 | } 222 | else if(attach_vehicleid != INVALID_VEHICLE_ID) 223 | { 224 | new 225 | o_a_v = vehicleid_slot[attach_vehicleid - 1], 226 | Float:x, 227 | Float:y, 228 | Float:z, 229 | Float:rx, 230 | Float:ry, 231 | Float:rz 232 | ; 233 | 234 | GetObjectAttachOffset(objectid, x, y, z, rx, ry, rz); 235 | 236 | format(save_str, sizeof save_str, 237 | "AttachObjectToVehicle(g_Object[%i], g_Vehicle[%i], %.4f, %.4f, %.4f, %.4f, %.4f, %.4f);\r\n", 238 | o, o_a_v, x, y, z, rx, ry, rz 239 | ); 240 | 241 | fwrite(save_handle, save_str); 242 | } 243 | } 244 | 245 | // attached player objects 246 | for(new playerid; playerid < MAX_PLAYERS; playerid ++) 247 | { 248 | if(!IsPlayerConnected(playerid)) 249 | continue; 250 | 251 | new name[MAX_PLAYER_NAME + 1]; 252 | GetPlayerName(playerid, name, sizeof name); 253 | 254 | for(new index; index < MAX_ATTACHED_INDEX; index ++) 255 | { 256 | if(!IsPlayerAttachedObjectSlotUsed(playerid, index)) 257 | continue; 258 | 259 | new 260 | modelid = GetPlayerAttachedObjectModel(playerid, index), 261 | boneid = GetPlayerAttachedObjectBone(playerid, index), 262 | Float:x, 263 | Float:y, 264 | Float:z, 265 | Float:rx, 266 | Float:ry, 267 | Float:rz, 268 | Float:sx, 269 | Float:sy, 270 | Float:sz, 271 | color[2], 272 | save_str[300] 273 | ; 274 | 275 | GetPlayerAttachedObjectOffset ( playerid, index, x, y, z ); 276 | GetPlayerAttachedObjectRot ( playerid, index, rx, ry, rz ); 277 | GetPlayerAttachedObjectScale ( playerid, index, sx, sy, sz ); 278 | GetPlayerAttachedObjectColor ( playerid, index, color[0], color[1] ); 279 | 280 | format(save_str, sizeof save_str, 281 | "SetPlayerAttachedObject(playerid, %i, %i, %i, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, 0x%08x, 0x%08x); // %s attached to the %s of %s\r\n", 282 | index, modelid, boneid, x, y, z, rx, ry, rz, sx, sy, sz, color[0], color[1], GetObjectModelName(modelid), GetBoneName(boneid), name 283 | ); 284 | 285 | fwrite(save_handle, save_str); 286 | } 287 | } 288 | fclose(save_handle); 289 | return 1; 290 | } 291 | -------------------------------------------------------------------------------- /mapedit/tmoney.pwn: -------------------------------------------------------------------------------- 1 | #define TUNING_MONEY 10000 2 | 3 | new bool: g_IsPlayerTuning[MAX_PLAYERS char]; 4 | 5 | /******************************************************************************/ 6 | 7 | public OnPlayerDisconnect(playerid, reason) 8 | { 9 | g_IsPlayerTuning{playerid} = false; 10 | 11 | #if defined tm_OnPlayerDisconnect 12 | tm_OnPlayerDisconnect(playerid, reason); 13 | #endif 14 | } 15 | #if defined _ALS_OnPlayerDisconnect 16 | #undef OnPlayerDisconnect 17 | #else 18 | #define _ALS_OnPlayerDisconnect 19 | #endif 20 | #define OnPlayerDisconnect tm_OnPlayerDisconnect 21 | #if defined tm_OnPlayerDisconnect 22 | forward tm_OnPlayerDisconnect(playerid, reason); 23 | #endif 24 | 25 | /******************************************************************************/ 26 | 27 | public OnPlayerUpdate(playerid) 28 | { 29 | if(g_IsPlayerTuning{playerid} && GetPlayerMoney(playerid) != TUNING_MONEY) 30 | { 31 | ResetPlayerMoney(playerid); 32 | GivePlayerMoney(playerid, TUNING_MONEY); 33 | } 34 | 35 | #if defined tm_OnPlayerUpdate 36 | return tm_OnPlayerUpdate(playerid); 37 | #else 38 | return 1; 39 | #endif 40 | } 41 | #if defined _ALS_OnPlayerUpdate 42 | #undef OnPlayerUpdate 43 | #else 44 | #define _ALS_OnPlayerUpdate 45 | #endif 46 | #define OnPlayerUpdate tm_OnPlayerUpdate 47 | #if defined tm_OnPlayerUpdate 48 | forward tm_OnPlayerUpdate(playerid); 49 | #endif 50 | 51 | /******************************************************************************/ 52 | 53 | public OnEnterExitModShop(playerid, enterexit, interiorid) 54 | { 55 | g_IsPlayerTuning{playerid} = (enterexit) ? (true) : (false); 56 | if(!enterexit) // Leave 57 | ResetPlayerMoney(playerid); 58 | 59 | #if defined tm_OnEnterExitModShop 60 | tm_OnEnterExitModShop(playerid, enterexit, interiorid); 61 | #endif 62 | } 63 | #if defined _ALS_OnEnterExitModShop 64 | #undef OnEnterExitModShop 65 | #else 66 | #define _ALS_OnEnterExitModShop 67 | #endif 68 | #define OnEnterExitModShop tm_OnEnterExitModShop 69 | #if defined tm_OnEnterExitModShop 70 | forward tm_OnEnterExitModShop(playerid, enterexit, interiorid); 71 | #endif 72 | 73 | /******************************************************************************/ 74 | -------------------------------------------------------------------------------- /mapedit/toolbar/callbacks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | public OnFilterScriptInit() 4 | { 5 | g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_ICON] = 6 | TextDrawCreate (598.0, 396.0, "_"); 7 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_ICON], 50); 8 | TextDrawFont (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_ICON], 5); 9 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_ICON], 0.699999, 5.0); 10 | TextDrawColor (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_ICON], -1); 11 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_ICON], 1); 12 | TextDrawUseBox (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_ICON], 1); 13 | TextDrawBoxColor (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_ICON], 0); 14 | TextDrawTextSize (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_ICON], 40.0, 50.0); 15 | TextDrawSetPreviewModel (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_ICON], 557); 16 | TextDrawSetPreviewRot (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_ICON], 340.0, 0.0, 320.0, 0.8); 17 | TextDrawSetSelectable (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_ICON], 1); 18 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_ICON]); 19 | 20 | g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_TEXT] = 21 | TextDrawCreate (600.0, 435.0, "Vehicle"); 22 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_TEXT], 255); 23 | TextDrawFont (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_TEXT], 1); 24 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_TEXT], 0.199999, 1.0); 25 | TextDrawColor (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_TEXT], -1); 26 | TextDrawSetOutline (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_TEXT], 1); 27 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_TEXT], 1); 28 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_VEHICLE][TOOLBAR_TEXT]); 29 | 30 | 31 | g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_ICON] = 32 | TextDrawCreate (557.0, 396.0, "_"); 33 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_ICON], 50); 34 | TextDrawFont (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_ICON], 5); 35 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_ICON], 0.699999, 5.0); 36 | TextDrawColor (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_ICON], -1); 37 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_ICON], 1); 38 | TextDrawUseBox (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_ICON], 1); 39 | TextDrawBoxColor (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_ICON], 0); 40 | TextDrawTextSize (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_ICON], 40.0, 50.0); 41 | TextDrawSetPreviewModel (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_ICON], 1220); 42 | TextDrawSetPreviewRot (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_ICON], 335.0, 0.0, 45.0, 1.0); 43 | TextDrawSetSelectable (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_ICON], 1); 44 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_ICON]); 45 | 46 | g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_TEXT] = 47 | TextDrawCreate (559.0, 435.0, "Object"); 48 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_TEXT], 255); 49 | TextDrawFont (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_TEXT], 1); 50 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_TEXT], 0.199999, 1.0); 51 | TextDrawColor (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_TEXT], -1); 52 | TextDrawSetOutline (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_TEXT], 1); 53 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_TEXT], 1); 54 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_OBJECT][TOOLBAR_TEXT]); 55 | 56 | 57 | g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_ICON] = 58 | TextDrawCreate (516.0, 396.0, "_"); 59 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_ICON], 50); 60 | TextDrawFont (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_ICON], 5); 61 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_ICON], 0.699999, 5.0); 62 | TextDrawColor (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_ICON], -1); 63 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_ICON], 1); 64 | TextDrawUseBox (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_ICON], 1); 65 | TextDrawBoxColor (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_ICON], 0); 66 | TextDrawTextSize (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_ICON], 40.0, 50.0); 67 | TextDrawSetPreviewModel (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_ICON], 1240); 68 | TextDrawSetPreviewRot (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_ICON], 330.0, 0.0, 325.0, 1.0); 69 | TextDrawSetSelectable (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_ICON], 1); 70 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_ICON]); 71 | 72 | g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_TEXT] = 73 | TextDrawCreate (518.0, 435.0, "Pickup"); 74 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_TEXT], 255); 75 | TextDrawFont (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_TEXT], 1); 76 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_TEXT], 0.199999, 1.0); 77 | TextDrawColor (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_TEXT], -1); 78 | TextDrawSetOutline (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_TEXT], 1); 79 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_TEXT], 1); 80 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_PICKUP][TOOLBAR_TEXT]); 81 | 82 | 83 | g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_ICON] = 84 | TextDrawCreate (475.0, 396.0, "_"); 85 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_ICON], 50); 86 | TextDrawFont (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_ICON], 5); 87 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_ICON], 0.699999, 5.0); 88 | TextDrawColor (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_ICON], -1); 89 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_ICON], 1); 90 | TextDrawUseBox (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_ICON], 1); 91 | TextDrawBoxColor (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_ICON], 0); 92 | TextDrawTextSize (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_ICON], 40.0, 50.0); 93 | TextDrawSetPreviewModel (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_ICON], 18978); 94 | TextDrawSetPreviewRot (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_ICON], 0.0, 0.0, 50.0, 0.7); 95 | TextDrawSetSelectable (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_ICON], 1); 96 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_ICON]); 97 | 98 | g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_TEXT] = 99 | TextDrawCreate (477.0, 435.0, "Attached"); 100 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_TEXT], 255); 101 | TextDrawFont (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_TEXT], 1); 102 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_TEXT], 0.199999, 1.0); 103 | TextDrawColor (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_TEXT], -1); 104 | TextDrawSetOutline (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_TEXT], 1); 105 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_TEXT], 1); 106 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_ATTACH][TOOLBAR_TEXT]); 107 | 108 | 109 | g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_ICON] = 110 | TextDrawCreate (434.0, 396.0, "_"); 111 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_ICON], 50); 112 | TextDrawFont (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_ICON], 5); 113 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_ICON], 0.699999, 5.0); 114 | TextDrawColor (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_ICON], -1); 115 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_ICON], 1); 116 | TextDrawUseBox (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_ICON], 1); 117 | TextDrawBoxColor (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_ICON], 0); 118 | TextDrawTextSize (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_ICON], 40.0, 50.0); 119 | TextDrawSetPreviewModel (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_ICON], 1277); 120 | TextDrawSetPreviewRot (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_ICON], 330.0, 0.0, 330.0, 0.80); 121 | TextDrawSetSelectable (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_ICON], 1); 122 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_ICON]); 123 | 124 | g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_TEXT] = 125 | TextDrawCreate (436.0, 435.0, "Save"); 126 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_TEXT], 255); 127 | TextDrawFont (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_TEXT], 1); 128 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_TEXT], 0.199999, 1.0); 129 | TextDrawColor (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_TEXT], -1); 130 | TextDrawSetOutline (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_TEXT], 1); 131 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_TEXT], 1); 132 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_SAVE][TOOLBAR_TEXT]); 133 | 134 | 135 | g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_ICON] = 136 | TextDrawCreate (393.0, 396.0, "_"); 137 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_ICON], 50); 138 | TextDrawFont (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_ICON], 5); 139 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_ICON], 0.699999, 5.0); 140 | TextDrawColor (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_ICON], -1); 141 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_ICON], 1); 142 | TextDrawUseBox (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_ICON], 1); 143 | TextDrawBoxColor (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_ICON], 0); 144 | TextDrawTextSize (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_ICON], 40.0, 50.0); 145 | TextDrawSetPreviewModel (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_ICON], 1210); 146 | TextDrawSetPreviewRot (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_ICON], 330.0, 0.0, 340.0, 0.8); 147 | TextDrawSetSelectable (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_ICON], 1); 148 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_ICON]); 149 | 150 | g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_TEXT] = 151 | TextDrawCreate (395.0, 435.0, "Open"); 152 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_TEXT], 255); 153 | TextDrawFont (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_TEXT], 1); 154 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_TEXT], 0.199999, 1.0); 155 | TextDrawColor (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_TEXT], -1); 156 | TextDrawSetOutline (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_TEXT], 1); 157 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_TEXT], 1); 158 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_OPEN][TOOLBAR_TEXT]); 159 | 160 | 161 | g_tbIconTD[TOOLBAR_NEW][TOOLBAR_ICON] = 162 | TextDrawCreate (352.0, 396.0, "_"); 163 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_ICON], 50); 164 | TextDrawFont (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_ICON], 5); 165 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_ICON], 0.699999, 5.0); 166 | TextDrawColor (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_ICON], -1); 167 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_ICON], 1); 168 | TextDrawUseBox (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_ICON], 1); 169 | TextDrawBoxColor (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_ICON], 0); 170 | TextDrawTextSize (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_ICON], 40.0, 50.0); 171 | TextDrawSetPreviewModel (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_ICON], 3111); 172 | TextDrawSetPreviewRot (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_ICON], 90.0, 330.0, 180.0, 0.9); 173 | TextDrawSetSelectable (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_ICON], 1); 174 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_ICON]); 175 | 176 | g_tbIconTD[TOOLBAR_NEW][TOOLBAR_TEXT] = 177 | TextDrawCreate (354.0, 435.0, "New"); 178 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_TEXT], 255); 179 | TextDrawFont (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_TEXT], 1); 180 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_TEXT], 0.199999, 1.0); 181 | TextDrawColor (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_TEXT], -1); 182 | TextDrawSetOutline (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_TEXT], 1); 183 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_TEXT], 1); 184 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_NEW][TOOLBAR_TEXT]); 185 | 186 | 187 | g_tbIconTD[TOOLBAR_CAM][TOOLBAR_ICON] = 188 | TextDrawCreate (311.0, 396.0, "_"); 189 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_ICON], 50); 190 | TextDrawFont (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_ICON], 5); 191 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_ICON], 0.699999, 5.0); 192 | TextDrawColor (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_ICON], -1); 193 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_ICON], 1); 194 | TextDrawUseBox (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_ICON], 1); 195 | TextDrawBoxColor (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_ICON], 0); 196 | TextDrawTextSize (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_ICON], 40.0, 50.0); 197 | TextDrawSetPreviewModel (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_ICON], 367); 198 | TextDrawSetPreviewRot (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_ICON], 340.0, 0.0, 50.0, 0.8); 199 | TextDrawSetSelectable (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_ICON], 1); 200 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_ICON]); 201 | 202 | g_tbIconTD[TOOLBAR_CAM][TOOLBAR_TEXT] = 203 | TextDrawCreate (313.0, 435.0, "Camera"); 204 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_TEXT], 255); 205 | TextDrawFont (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_TEXT], 1); 206 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_TEXT], 0.199999, 1.0); 207 | TextDrawColor (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_TEXT], -1); 208 | TextDrawSetOutline (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_TEXT], 1); 209 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_TEXT], 1); 210 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_CAM][TOOLBAR_TEXT]); 211 | 212 | 213 | g_tbIconTD[TOOLBAR_INFO][TOOLBAR_ICON] = 214 | TextDrawCreate (270, 396.0, "_"); 215 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_ICON], 50); 216 | TextDrawFont (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_ICON], 5); 217 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_ICON], 0.699999, 5.0); 218 | TextDrawColor (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_ICON], -1); 219 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_ICON], 1); 220 | TextDrawUseBox (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_ICON], 1); 221 | TextDrawBoxColor (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_ICON], 0); 222 | TextDrawTextSize (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_ICON], 40.0, 50.0); 223 | TextDrawSetPreviewModel (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_ICON], 1239); 224 | TextDrawSetPreviewRot (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_ICON], 0.0, 0.0, 180.0, 1.0); 225 | TextDrawSetSelectable (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_ICON], 1); 226 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_ICON]); 227 | 228 | g_tbIconTD[TOOLBAR_INFO][TOOLBAR_TEXT] = 229 | TextDrawCreate (272, 435.0, "Info"); 230 | TextDrawBackgroundColor (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_TEXT], 255); 231 | TextDrawFont (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_TEXT], 1); 232 | TextDrawLetterSize (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_TEXT], 0.199999, 1.0); 233 | TextDrawColor (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_TEXT], -1); 234 | TextDrawSetOutline (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_TEXT], 1); 235 | TextDrawSetProportional (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_TEXT], 1); 236 | TextDrawShowForAll (g_tbIconTD[TOOLBAR_INFO][TOOLBAR_TEXT]); 237 | 238 | #if defined tb_OnFilterScriptInit 239 | tb_OnFilterScriptInit(); 240 | #endif 241 | } 242 | #if defined _ALS_OnFilterScriptInit 243 | #undef OnFilterScriptInit 244 | #else 245 | #define _ALS_OnFilterScriptInit 246 | #endif 247 | #define OnFilterScriptInit tb_OnFilterScriptInit 248 | #if defined tb_OnFilterScriptInit 249 | forward tb_OnFilterScriptInit(); 250 | #endif 251 | 252 | /******************************************************************************/ 253 | 254 | public OnFilterScriptExit() 255 | { 256 | for(new a; a < MAX_TOOLBAR_RESPONSES; a ++) 257 | { 258 | for(new b; b < 2; b ++) 259 | TextDrawDestroy(g_tbIconTD[a][b]); 260 | } 261 | 262 | #if defined tb_OnFilterScriptExit 263 | tb_OnFilterScriptExit(); 264 | #endif 265 | } 266 | #if defined _ALS_OnFilterScriptExit 267 | #undef OnFilterScriptExit 268 | #else 269 | #define _ALS_OnFilterScriptExit 270 | #endif 271 | #define OnFilterScriptExit tb_OnFilterScriptExit 272 | #if defined tb_OnFilterScriptExit 273 | forward tb_OnFilterScriptExit(); 274 | #endif 275 | 276 | /******************************************************************************/ 277 | 278 | public OnPlayerConnect(playerid) 279 | { 280 | for(new a; a < MAX_TOOLBAR_RESPONSES; a ++) 281 | { 282 | for(new b; b < 2; b ++) 283 | TextDrawShowForPlayer(playerid, g_tbIconTD[a][b]); 284 | } 285 | 286 | #if defined tb_OnPlayerConnect 287 | tb_OnPlayerConnect(playerid); 288 | #endif 289 | } 290 | #if defined _ALS_OnPlayerConnect 291 | #undef OnPlayerConnect 292 | #else 293 | #define _ALS_OnPlayerConnect 294 | #endif 295 | #define OnPlayerConnect tb_OnPlayerConnect 296 | #if defined tb_OnPlayerConnect 297 | forward tb_OnPlayerConnect(playerid); 298 | #endif 299 | 300 | /******************************************************************************/ 301 | 302 | public OnPlayerClickTextDraw(playerid, Text:clickedid) 303 | { 304 | for(new i; i < MAX_TOOLBAR_RESPONSES; i ++) 305 | { 306 | if(clickedid == g_tbIconTD[i][TOOLBAR_ICON]) 307 | { 308 | PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); 309 | CallLocalFunction("OnToolbarResponse", "ii", playerid, i); 310 | return 1; 311 | } 312 | } 313 | 314 | #if defined tb_OnPlayerClickTextDraw 315 | return tb_OnPlayerClickTextDraw(playerid, Text:clickedid); 316 | #else 317 | return 0; 318 | #endif 319 | } 320 | #if defined _ALS_OnPlayerClickTextDraw 321 | #undef OnPlayerClickTextDraw 322 | #else 323 | #define _ALS_OnPlayerClickTextDraw 324 | #endif 325 | #define OnPlayerClickTextDraw tb_OnPlayerClickTextDraw 326 | #if defined tb_OnPlayerClickTextDraw 327 | forward tb_OnPlayerClickTextDraw(playerid, Text:clickedid); 328 | #endif 329 | 330 | /******************************************************************************/ 331 | -------------------------------------------------------------------------------- /mapedit/toolbar/data.pwn: -------------------------------------------------------------------------------- 1 | #define MAX_TOOLBAR_RESPONSES 9 2 | 3 | enum 4 | { 5 | Text: TOOLBAR_VEHICLE, 6 | Text: TOOLBAR_OBJECT, 7 | Text: TOOLBAR_PICKUP, 8 | Text: TOOLBAR_ATTACH, 9 | Text: TOOLBAR_SAVE, 10 | Text: TOOLBAR_OPEN, 11 | Text: TOOLBAR_NEW, 12 | Text: TOOLBAR_CAM, 13 | Text: TOOLBAR_INFO 14 | } 15 | 16 | enum 17 | { 18 | Text: TOOLBAR_ICON, 19 | Text: TOOLBAR_TEXT 20 | } 21 | 22 | new Text: g_tbIconTD [MAX_TOOLBAR_RESPONSES][2]; 23 | 24 | forward OnToolbarResponse(playerid, response); 25 | 26 | #include "mapedit/toolbar/callbacks.pwn" 27 | -------------------------------------------------------------------------------- /mapedit/veh/data.pwn: -------------------------------------------------------------------------------- 1 | new 2 | g_VehicleColor [MAX_VEHICLES][2], 3 | g_VehiclePaintjob [MAX_VEHICLES char] = {3, ...}, 4 | g_VehicleComponent [MAX_VEHICLES][14], 5 | 6 | bool: g_VehicleTuningTeleported [MAX_VEHICLES char], 7 | Float: g_VehicleTuningPosition [MAX_VEHICLES][4], 8 | 9 | g_pEditVehicle [MAX_PLAYERS] = {INVALID_VEHICLE_ID, ...}, 10 | g_pEditVehicleObject [MAX_PLAYERS] = {INVALID_OBJECT_ID, ...}, 11 | g_pVehicleColor [MAX_PLAYERS][2], 12 | 13 | g_VehicleSelectBrowser, 14 | g_pSelectVehicleChoice [MAX_PLAYERS], 15 | g_pSelectVehiclePage [MAX_PLAYERS], 16 | g_pSelectVehicleSearch [MAX_PLAYERS][MAX_MBROWSER_SEARCH], 17 | g_pSelectVehicleResult [MAX_PLAYERS][MAX_MBROWSER_PAGESIZE], 18 | 19 | g_VehicleCreateBrowser, 20 | g_pCreateVehicleChoice [MAX_PLAYERS], 21 | g_pCreateVehiclePage [MAX_PLAYERS], 22 | g_pCreateVehicleSearch [MAX_PLAYERS][MAX_MBROWSER_SEARCH], 23 | g_pCreateVehicleResult [MAX_PLAYERS][MAX_MBROWSER_PAGESIZE], 24 | 25 | g_VehicleColorBrowser [2], 26 | g_pColorVehiclePage [MAX_PLAYERS][2], 27 | 28 | g_VehicleMainDialog, 29 | g_VehicleEditDialog, 30 | g_VehicleXDialog, 31 | g_VehicleYDialog, 32 | g_VehicleZDialog, 33 | g_VehicleRDialog 34 | ; 35 | 36 | #include "mapedit/veh/macros.pwn" 37 | #include "mapedit/veh/hooks.pwn" 38 | #include "mapedit/veh/functions.pwn" 39 | #include "mapedit/veh/callbacks.pwn" 40 | -------------------------------------------------------------------------------- /mapedit/veh/functions.pwn: -------------------------------------------------------------------------------- 1 | ShowPlayerVehicleDialog(playerid, dialogid) 2 | { 3 | if(dialogid == g_VehicleMainDialog) 4 | { 5 | ShowPlayerDialog( 6 | playerid, 7 | dialogid, 8 | DIALOG_STYLE_LIST, 9 | "Vehicle", 10 | "Select Vehicle\nCreate Vehicle", 11 | "Choose", 12 | "Close" 13 | ); 14 | return 1; 15 | } 16 | else if(dialogid == g_VehicleEditDialog) 17 | { 18 | new 19 | vehicleid = g_pEditVehicle[playerid], 20 | modelid = GetVehicleModel(vehicleid), 21 | modshopid = GetVehicleModelTuningShop(modelid), 22 | attach_objectid = g_pSelectedAttachObject[playerid], 23 | Float:x, 24 | Float:y, 25 | Float:z, 26 | Float:r, 27 | info[400] 28 | ; 29 | 30 | GetVehiclePos(vehicleid, x, y, z); 31 | GetVehicleZAngle(vehicleid, r); 32 | 33 | strcat ( info, "Remove\n" ); 34 | strcat ( info, "Duplicate\n" ); 35 | strcat ( info, "Move\n" ); 36 | strcat ( info, sprintf("X Position:\t\t%.4f\n", x) ); 37 | strcat ( info, sprintf("Y Position:\t\t%.4f\n", y) ); 38 | strcat ( info, sprintf("Z Position:\t\t%.4f\n", z) ); 39 | strcat ( info, sprintf("Rotation: \t\t%.4f\n", r) ); 40 | strcat ( info, "Set Color 1\n" ); 41 | strcat ( info, "Set Color 2\n" ); 42 | strcat ( info, "Repair Vehicle\n" ); 43 | 44 | switch(modshopid) 45 | { 46 | case TUNINGSHOP_TRANSFENDER: 47 | strcat ( info, "Tune Vehicle @ Transfender\n" ); 48 | case TUNINGSHOP_LOCOLOW: 49 | strcat ( info, "Tune Vehicle @ Loco Low Co\n" ); 50 | case TUNINGSHOP_WHEELARCH: 51 | strcat ( info, "Tune Vehicle @ Wheel Arch Angels\n" ); 52 | default: 53 | strcat ( info, "Tune Vehicle \n" ); 54 | } 55 | 56 | if(attach_objectid == INVALID_OBJECT_ID) 57 | strcat ( info, "Attach Selected Object \n" ); 58 | else 59 | { 60 | new attach_modelid = GetObjectModel(attach_objectid); 61 | 62 | strcat(info, 63 | sprintf("Attach Selected Object: %s\n", GetObjectModelName(attach_modelid)) 64 | ); 65 | } 66 | 67 | ShowPlayerDialog( 68 | playerid, 69 | dialogid, 70 | DIALOG_STYLE_LIST, 71 | "Edit Vehicle", 72 | info, 73 | "Continue", 74 | "Back" 75 | ); 76 | return 1; 77 | } 78 | else if( 79 | dialogid == g_VehicleXDialog || 80 | dialogid == g_VehicleYDialog || 81 | dialogid == g_VehicleZDialog || 82 | dialogid == g_VehicleRDialog 83 | ){ 84 | 85 | new 86 | vehicleid = g_pEditVehicle[playerid], 87 | Float:x, 88 | Float:y, 89 | Float:z, 90 | Float:r, 91 | caption[19], 92 | info[22] 93 | ; 94 | 95 | GetVehiclePos(vehicleid, x, y, z); 96 | GetVehicleZAngle(vehicleid, r); 97 | 98 | if(dialogid == g_VehicleXDialog) 99 | { 100 | caption = "Vehicle X Position"; 101 | format(info, sizeof info, "X Position: %.4f", x); 102 | } 103 | else if(dialogid == g_VehicleYDialog) 104 | { 105 | caption = "Vehicle Y Position"; 106 | format(info, sizeof info, "Y Position: %.4f", y); 107 | } 108 | else if(dialogid == g_VehicleZDialog) 109 | { 110 | caption = "Vehicle Z Position"; 111 | format(info, sizeof info, "Z Position: %.4f", z); 112 | } 113 | else if(dialogid == g_VehicleRDialog) 114 | { 115 | caption = "Vehicle Rotation"; 116 | format(info, sizeof info, "Rotation: %.4f", r); 117 | } 118 | 119 | ShowPlayerDialog( 120 | playerid, 121 | dialogid, 122 | DIALOG_STYLE_INPUT, 123 | caption, 124 | info, 125 | "Enter", 126 | "Back" 127 | ); 128 | return 1; 129 | } 130 | return 0; 131 | } 132 | 133 | DuplicateVehicle(old_vehicleid) 134 | { 135 | if(old_vehicleid == INVALID_VEHICLE_ID) 136 | return INVALID_VEHICLE_ID; 137 | 138 | new 139 | modelid, 140 | Float:x, 141 | Float:y, 142 | Float:z, 143 | Float:r, 144 | color[2], 145 | new_vehicleid 146 | ; 147 | 148 | modelid = GetVehicleModel(old_vehicleid); 149 | GetVehiclePos(old_vehicleid, x, y, z); 150 | GetVehicleZAngle(old_vehicleid, r); 151 | GetVehicleColor(old_vehicleid, color[0], color[1]); 152 | 153 | new_vehicleid = CreateVehicle(modelid, x, y, z, r, color[0], color[1], -1); 154 | if(new_vehicleid == INVALID_VEHICLE_ID) 155 | return INVALID_VEHICLE_ID; 156 | 157 | new paintjobid = GetVehiclePaintjob(old_vehicleid); 158 | if(paintjobid != 3) 159 | ChangeVehiclePaintjob(new_vehicleid, paintjobid); 160 | 161 | for(new slot; slot < 14; slot ++) 162 | { 163 | new componentid = GetVehicleComponentInSlot(old_vehicleid, slot); 164 | if(componentid != 0) 165 | AddVehicleComponent(new_vehicleid, componentid); 166 | } 167 | 168 | for(new objectid = 1; objectid <= MAX_OBJECTS; objectid ++) 169 | { 170 | if(GetObjectAttachedToVehicle(objectid) == old_vehicleid) 171 | { 172 | new attach_objectid = DuplicateObject(objectid, false); 173 | if(attach_objectid == INVALID_OBJECT_ID) 174 | continue; 175 | 176 | new 177 | Float:ox, 178 | Float:oy, 179 | Float:oz, 180 | Float:orx, 181 | Float:ory, 182 | Float:orz 183 | ; 184 | 185 | GetObjectAttachOffset(attach_objectid, ox, oy, oz, orx, ory, orz); 186 | AttachObjectToVehicle(attach_objectid, new_vehicleid, ox, oy, oz, orx, ory, orz); 187 | } 188 | } 189 | return new_vehicleid; 190 | } 191 | -------------------------------------------------------------------------------- /mapedit/veh/hooks.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | 3 | stock v_CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay) 4 | { 5 | new vehicleid = CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay); 6 | if(vehicleid != INVALID_VEHICLE_ID) 7 | { 8 | g_VehiclePaintjob{vehicleid - 1} = 3; 9 | 10 | g_VehicleColor[vehicleid - 1][0] = color1; 11 | g_VehicleColor[vehicleid - 1][1] = color2; 12 | } 13 | return vehicleid; 14 | } 15 | #if defined _ALS_CreateVehicle 16 | #undef CreateVehicle 17 | #else 18 | #define _ALS_CreateVehicle 19 | #endif 20 | #define CreateVehicle v_CreateVehicle 21 | 22 | /******************************************************************************/ 23 | 24 | stock v_DestroyVehicle(vehicleid) 25 | { 26 | if(IsValidVehicle(vehicleid)) 27 | { 28 | g_VehiclePaintjob{vehicleid - 1} = 3; 29 | 30 | for(new color_index; color_index < 2; color_index ++) 31 | g_VehicleColor[vehicleid - 1][color_index] = 0; 32 | 33 | for(new slot; slot < 14; slot ++) 34 | g_VehicleComponent[vehicleid - 1][slot] = 0; 35 | 36 | g_VehicleTuningTeleported{vehicleid - 1} = false; 37 | 38 | for(new i; i < 4; i ++) 39 | g_VehicleTuningPosition[vehicleid - 1][i] = 0.0; 40 | 41 | for(new loop_objectid = 1; loop_objectid <= MAX_OBJECTS; loop_objectid ++) 42 | { 43 | if(GetObjectAttachedToVehicle(loop_objectid) == vehicleid) 44 | DestroyObject(loop_objectid); 45 | } 46 | 47 | for(new playerid; playerid < MAX_PLAYERS; playerid ++) 48 | { 49 | if(!IsPlayerConnected(playerid)) 50 | continue; 51 | 52 | if(g_pEditVehicle[playerid] == vehicleid) 53 | { 54 | new mbrowserid = GetPlayerMBrowser(playerid), 55 | cbrowserid = GetPlayerCBrowser(playerid), 56 | dialogid = GetPlayerDialog(playerid); 57 | 58 | if( 59 | mbrowserid == g_VehicleSelectBrowser || 60 | mbrowserid == g_VehicleCreateBrowser 61 | ){ 62 | HideMBrowser(playerid); 63 | } 64 | 65 | if( 66 | cbrowserid == g_VehicleColorBrowser[0] || 67 | cbrowserid == g_VehicleColorBrowser[1] 68 | ){ 69 | HideCBrowser(playerid); 70 | } 71 | 72 | if( 73 | dialogid == g_VehicleMainDialog || 74 | dialogid == g_VehicleEditDialog || 75 | dialogid == g_VehicleXDialog || 76 | dialogid == g_VehicleYDialog || 77 | dialogid == g_VehicleZDialog || 78 | dialogid == g_VehicleRDialog 79 | ){ 80 | HidePlayerDialog(playerid); 81 | } 82 | 83 | g_pEditVehicle[playerid] = INVALID_VEHICLE_ID; 84 | } 85 | 86 | if(g_pSelectVehicleChoice[playerid] == vehicleid) 87 | { 88 | if(GetPlayerMBrowser(playerid) == g_VehicleSelectBrowser) 89 | HideMBrowserModel(playerid); 90 | 91 | g_pSelectVehicleChoice[playerid] = INVALID_VEHICLE_ID; 92 | } 93 | 94 | for(new listitem; listitem < MAX_MBROWSER_PAGESIZE; listitem ++) 95 | { 96 | if(g_pSelectVehicleResult[playerid][listitem] == vehicleid) 97 | { 98 | if(GetPlayerMBrowser(playerid) == g_VehicleSelectBrowser) 99 | HideMBrowserListItem(playerid, listitem); 100 | 101 | g_pSelectVehicleResult[playerid][listitem] = INVALID_VEHICLE_ID; 102 | } 103 | } 104 | } 105 | } 106 | return DestroyVehicle(vehicleid); 107 | } 108 | #if defined _ALS_DestroyVehicle 109 | #undef DestroyVehicle 110 | #else 111 | #define _ALS_DestroyVehicle 112 | #endif 113 | #define DestroyVehicle v_DestroyVehicle 114 | 115 | /******************************************************************************/ 116 | 117 | stock v_ChangeVehicleColor(vehicleid, color1, color2) 118 | { 119 | new success = ChangeVehicleColor(vehicleid, color1, color2); 120 | if(success) 121 | { 122 | g_VehicleColor[vehicleid - 1][0] = color1; 123 | g_VehicleColor[vehicleid - 1][1] = color2; 124 | } 125 | return success; 126 | } 127 | #if defined _ALS_ChangeVehicleColor 128 | #undef ChangeVehicleColor 129 | #else 130 | #define _ALS_ChangeVehicleColor 131 | #endif 132 | #define ChangeVehicleColor v_ChangeVehicleColor 133 | 134 | /******************************************************************************/ 135 | 136 | stock v_ChangeVehiclePaintjob(vehicleid, paintjobid) 137 | { 138 | g_VehiclePaintjob{vehicleid - 1} = paintjobid; 139 | return ChangeVehiclePaintjob(vehicleid, paintjobid); 140 | } 141 | #if defined _ALS_ChangeVehiclePaintjob 142 | #undef ChangeVehiclePaintjob 143 | #else 144 | #define _ALS_ChangeVehiclePaintjob 145 | #endif 146 | #define ChangeVehiclePaintjob v_ChangeVehiclePaintjob 147 | 148 | /******************************************************************************/ 149 | 150 | stock v_AddVehicleComponent(vehicleid, componentid) 151 | { 152 | new modelid = GetVehicleModel(vehicleid), 153 | success; 154 | 155 | if( IsVehicleComponentCompatible(modelid, componentid) ) 156 | { 157 | success = AddVehicleComponent(vehicleid, componentid); 158 | if(success) 159 | { 160 | new slot = GetVehicleComponentType(componentid); 161 | g_VehicleComponent[vehicleid - 1][slot] = componentid; 162 | } 163 | } 164 | return success; 165 | } 166 | #if defined _ALS_AddVehicleComponent 167 | #undef AddVehicleComponent 168 | #else 169 | #define _ALS_AddVehicleComponent 170 | #endif 171 | #define AddVehicleComponent v_AddVehicleComponent 172 | 173 | /******************************************************************************/ 174 | -------------------------------------------------------------------------------- /mapedit/veh/macros.pwn: -------------------------------------------------------------------------------- 1 | #define GetVehicleColor(%0,%1,%2) (%1 = g_VehicleColor[%0 - 1][0], %2 = g_VehicleColor[%0 - 1][1]) 2 | #define GetVehiclePaintjob(%0) (g_VehiclePaintjob{%0 - 1}) 3 | --------------------------------------------------------------------------------