├── Design sem nome.gif ├── README.md ├── lockpick.inc └── lockpick_open_mp.inc /Design sem nome.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devbluen/lockpick-samp/394999e84e9829e776f61f736bf31d2f43e16325/Design sem nome.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🫧 LOCK-PICK 2 | This is a fully dynamic lockpick include for your SAMP server. You can configure the layout and how it will function. If you encounter any issues or have any questions, please open an issue. 3 | 4 | # Dependencies 5 | ⚠️ [YSI-Includes](https://github.com/pawn-lang/YSI-Includes) 6 | 7 | # Functions 8 | ```pawn 9 | CreateLockPick(playerid, const callback[], seconds); 10 | CancelLockPick(playerid); 11 | IsPlayerInLockPick(playerid); 12 | ``` 13 | ### Status 14 | ``` 15 | E_LOCKPICK_SUCCESS 16 | E_LOCKPICK_ERROR 17 | ``` 18 | 19 | # Usage Example 20 | ```pawn 21 | forward lockpick(playerid, E_LOCKPICK_STATUS:status); 22 | public lockpick(playerid, E_LOCKPICK_STATUS:status) { 23 | 24 | if(status == E_LOCKPICK_SUCCESS) SendClientMessage(playerid, -1, "LOCKPICK: Success"); 25 | else if(status == E_LOCKPICK_ERROR) SendClientMessage(playerid, -1, "LOCKPICK: Error"); 26 | return true; 27 | } 28 | 29 | CMD:lockpick(playerid, params[]) { 30 | 31 | new time; 32 | if(sscanf(params, "d", time)) 33 | return true; 34 | 35 | CreateLockPick(playerid, "lockpick", time); 36 | return true; 37 | } 38 | ``` 39 | 40 | # 📼 Gif 41 | ![](https://github.com/devbluen/lockpick-samp/blob/main/Design%20sem%20nome.gif) 42 | -------------------------------------------------------------------------------- /lockpick.inc: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Status: 5 | E_LOCKPICK_SUCCESS 6 | E_LOCKPICK_ERROR 7 | 8 | */ 9 | 10 | 11 | 12 | // Definers 13 | #define MAX_LOCKPICK_PINS (8) 14 | 15 | // Includes 16 | #include 17 | 18 | // Forwards 19 | forward OnLockPick_Tick(playerid); 20 | forward OnLockPick_PinAnimation(playerid); 21 | 22 | enum E_LOCKPICK_STATUS { 23 | E_LOCKPICK_SUCCESS, 24 | E_LOCKPICK_ERROR 25 | }; 26 | 27 | static const 28 | e_LockPick_Pinos[MAX_LOCKPICK_PINS][2] = { 29 | 30 | /* 31 | [0] - Pin Limit 32 | [1] - Pin 33 | */ 34 | {1, 2}, 35 | {3, 4}, 36 | {5, 6}, 37 | {7, 8}, 38 | {9, 10}, 39 | {11, 12}, 40 | {13, 14}, 41 | {15, 16} 42 | }, 43 | 44 | // configurations 45 | updateTicks = 50, 46 | Float:pinTicks = 1.0, // steps pin 47 | Float:dynamicPinSteps = 5.0, // steps up 48 | Float:pinDistance = 10.0; // steps for pin limit 49 | 50 | static enum E_LOCKPICK { 51 | E_LOCKPICK_CALLBACK[30 + 1], 52 | E_LOCKPICK_TIMER, 53 | E_LOCKPICK_TIMER_ANIM, 54 | E_LOCKPICK_PINTICK, 55 | E_LOCKPICK_PINTYPE, 56 | E_LOCKPICK_SECONDS, 57 | E_LOCKPICK_PROGRESS, 58 | Float:E_LOCKPICK_POS_Y, // backup y pos 59 | bool:E_LOCKPICK_PINS[MAX_LOCKPICK_PINS], 60 | bool:E_LOCKPICK_ANIM_PIN, 61 | bool:E_LOCKPICK_BACKWARD 62 | }; 63 | 64 | static enum E_TEXTDRAW_DATA { 65 | E_TEXTDRAW_DATA_TEXTO[68 + 1], 66 | Float:E_TEXTDRAW_DATA_POS[2], 67 | Float:E_TEXTDRAW_DATA_SIZE[2], 68 | E_TEXTDRAW_DATA_ALIGN, 69 | E_TEXTDRAW_DATA_COLOR, 70 | E_TEXTDRAW_DATA_SHADOW, 71 | E_TEXTDRAW_DATA_OUTLINE, 72 | E_TEXTDRAW_DATA_BACKCOLOR, // BackgroundColor 73 | E_TEXTDRAW_DATA_FONT, 74 | E_TEXTDRAW_DATA_PROPOR // Proportional 75 | }; 76 | 77 | static 78 | e_Lockpick[MAX_PLAYERS][E_LOCKPICK], 79 | e_TextdrawData[MAX_PLAYERS][MAX_PLAYER_TEXT_DRAWS][E_TEXTDRAW_DATA], 80 | PlayerText:tLockpick[MAX_PLAYERS][24]; 81 | 82 | hook OnPlayerDisconnect(playerid, reason) { 83 | 84 | Lockpick_Reset(playerid); 85 | return Y_HOOKS_CONTINUE_RETURN_1; 86 | } 87 | 88 | hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { 89 | 90 | if(newkeys == KEY_YES && IsPlayerInLockPick(playerid) && !e_Lockpick[playerid][E_LOCKPICK_TIMER_ANIM]) { 91 | Lockpick_CheckPins(playerid); 92 | return Y_HOOKS_BREAK_RETURN_1; 93 | } 94 | return Y_HOOKS_CONTINUE_RETURN_1; 95 | } 96 | 97 | 98 | 99 | /* 100 | 101 | ooooooooo. ooooo ooo oooooooooo. ooooo ooooo .oooooo. 102 | `888 `Y88. `888' `8' `888' `Y8b `888' `888' d8P' `Y8b 103 | 888 .d88' 888 8 888 888 888 888 888 104 | 888ooo88P' 888 8 888oooo888' 888 888 888 105 | 888 888 8 888 `88b 888 888 888 106 | 888 `88. .8' 888 .88P 888 o 888 `88b ooo 107 | o888o `YbodP' o888bood8P' o888ooooood8 o888o `Y8bood8P' 108 | 109 | */ 110 | 111 | public OnLockPick_Tick(playerid) { 112 | 113 | // progress 114 | e_Lockpick[playerid][E_LOCKPICK_SECONDS]++; 115 | PlayerTextDrawTextSize(playerid, tLockpick[playerid][21], 119.000 - ((119.000 / e_Lockpick[playerid][E_LOCKPICK_PROGRESS]) * e_Lockpick[playerid][E_LOCKPICK_SECONDS]), 7.0); 116 | PlayerTextDrawShow(playerid, tLockpick[playerid][21]); 117 | 118 | if(e_Lockpick[playerid][E_LOCKPICK_SECONDS] >= e_Lockpick[playerid][E_LOCKPICK_PROGRESS]) { 119 | Lockpick_Response(playerid, E_LOCKPICK_ERROR); 120 | return true; 121 | } 122 | 123 | // wait for anim pin 124 | if(e_Lockpick[playerid][E_LOCKPICK_ANIM_PIN]) 125 | return true; 126 | 127 | new Float:position[2]; 128 | TextDraw_GetPosition(playerid, tLockpick[playerid][23], position[0], position[1]); 129 | 130 | if(e_Lockpick[playerid][E_LOCKPICK_BACKWARD]) position[0] -= pinTicks; 131 | else position[0] += pinTicks; 132 | 133 | new Float:mainBoxPos, Float:mainBoxSize; 134 | TextDraw_GetPosition(playerid, tLockpick[playerid][0], mainBoxPos); 135 | TextDraw_GetTextSize(playerid, tLockpick[playerid][0], mainBoxSize); 136 | 137 | if(position[0] <= mainBoxPos) e_Lockpick[playerid][E_LOCKPICK_BACKWARD] = false; // min limit 138 | else if(position[0] >= (mainBoxPos + mainBoxSize)) e_Lockpick[playerid][E_LOCKPICK_BACKWARD] = true; // max limit 139 | 140 | SetLockPick_Pin(playerid, position[0], position[1]); 141 | return true; 142 | } 143 | 144 | public OnLockPick_PinAnimation(playerid) { 145 | 146 | new Float:position[2], Float:position_y = e_Lockpick[playerid][E_LOCKPICK_POS_Y]; 147 | TextDraw_GetPosition(playerid, tLockpick[playerid][23], position[0], position[1]); 148 | 149 | switch(e_Lockpick[playerid][E_LOCKPICK_PINTYPE]) { 150 | case 0: // pin up 151 | { 152 | if(position[1] <= (position_y - pinDistance)) 153 | e_Lockpick[playerid][E_LOCKPICK_PINTYPE] = 1; 154 | 155 | position[1] -= pinTicks; 156 | } 157 | 158 | case 1: // checkpin and move 159 | { 160 | new pin_index = e_Lockpick[playerid][E_LOCKPICK_PINTICK]; 161 | if(pin_index != -1 && !e_Lockpick[playerid][E_LOCKPICK_PINS][pin_index]) 162 | { 163 | // get positions 164 | new Float:dynamicPosition[2], Float:dynamicLimitPos[2]; 165 | TextDraw_GetPosition(playerid, tLockpick[playerid][e_LockPick_Pinos[pin_index][0]], dynamicLimitPos[0], dynamicLimitPos[1]); 166 | TextDraw_GetPosition(playerid, tLockpick[playerid][e_LockPick_Pinos[pin_index][1]], dynamicPosition[0], dynamicPosition[1]); 167 | 168 | // set up pin animation 169 | dynamicPosition[1] -= dynamicPinSteps; 170 | TextDraw_SetPosition(playerid, tLockpick[playerid][e_LockPick_Pinos[pin_index][1]], dynamicPosition[0], dynamicPosition[1]); 171 | 172 | e_Lockpick[playerid][E_LOCKPICK_PINS][pin_index] = true; // set pin finish 173 | } 174 | 175 | e_Lockpick[playerid][E_LOCKPICK_PINTYPE] = 2; 176 | } 177 | 178 | case 2: // back pin main 179 | { 180 | if(position[1] >= position_y) { 181 | e_Lockpick[playerid][E_LOCKPICK_PINTYPE] = 3; 182 | position[1] = position_y; 183 | } 184 | else position[1] += pinTicks; 185 | } 186 | 187 | case 3: // check and continue anims 188 | { 189 | KillTimer(e_Lockpick[playerid][E_LOCKPICK_TIMER_ANIM]); 190 | e_Lockpick[playerid][E_LOCKPICK_TIMER_ANIM] = 0; 191 | e_Lockpick[playerid][E_LOCKPICK_PINTYPE] = 0; 192 | e_Lockpick[playerid][E_LOCKPICK_ANIM_PIN] = false; 193 | 194 | new bool:hasPin; 195 | for(new i = 0; i < MAX_LOCKPICK_PINS; i++) { 196 | if(e_Lockpick[playerid][E_LOCKPICK_PINS][i]) 197 | continue; 198 | 199 | hasPin = true; 200 | break; 201 | } 202 | 203 | if(!hasPin) 204 | Lockpick_Response(playerid, E_LOCKPICK_SUCCESS); 205 | } 206 | } 207 | 208 | SetLockPick_Pin(playerid, position[0], position[1]); 209 | return true; 210 | } 211 | 212 | 213 | 214 | /* 215 | 216 | .oooooo..o ooooooooooooo .oooooo. .oooooo. oooo oooo .oooooo..o 217 | d8P' `Y8 8' 888 `8 d8P' `Y8b d8P' `Y8b `888 .8P' d8P' `Y8 218 | Y88bo. 888 888 888 888 888 d8' Y88bo. 219 | `"Y8888o. 888 888 888 888 88888[ `"Y8888o. 220 | `"Y88b 888 888 888 888 888`88b. `"Y88b 221 | oo .d8P 888 `88b d88' `88b ooo 888 `88b. oo .d8P 222 | 8""88888P' o888o `Y8bood8P' `Y8bood8P' o888o o888o 8""88888P' 223 | 224 | */ 225 | 226 | stock CreateLockPick(playerid, const callback[], seconds) { 227 | 228 | // Block 229 | if(IsPlayerInLockPick(playerid)) 230 | return false; 231 | 232 | ShowLockPick(playerid); 233 | SetLockPick_Pin(playerid, 252.000, 249.000); 234 | 235 | format(e_Lockpick[playerid][E_LOCKPICK_CALLBACK], 30, callback); 236 | e_Lockpick[playerid][E_LOCKPICK_PROGRESS] = (seconds * 1000) / 100; 237 | e_Lockpick[playerid][E_LOCKPICK_TIMER] = SetTimerEx("OnLockPick_Tick", updateTicks, true, "i", playerid); 238 | return true; 239 | } 240 | 241 | stock CancelLockPick(playerid) { 242 | 243 | if(!IsPlayerInLockPick(playerid)) 244 | return false; 245 | 246 | Lockpick_Reset(playerid); 247 | return true; 248 | } 249 | 250 | stock IsPlayerInLockPick(playerid) 251 | return e_Lockpick[playerid][E_LOCKPICK_TIMER] != 0; 252 | 253 | static stock Lockpick_CheckPins(playerid) { 254 | 255 | new 256 | Float:dynamicPosition, 257 | Float:dynamicPositionSize, 258 | Float:position[2], 259 | pinFound = -1; 260 | 261 | e_Lockpick[playerid][E_LOCKPICK_ANIM_PIN] = true; 262 | TextDraw_GetPosition(playerid, tLockpick[playerid][23], position[0], position[1]); 263 | 264 | for(new i = 0; i < sizeof e_LockPick_Pinos; i++) { 265 | TextDraw_GetPosition(playerid, tLockpick[playerid][e_LockPick_Pinos[i][1]], dynamicPosition); 266 | TextDraw_GetTextSize(playerid, tLockpick[playerid][e_LockPick_Pinos[i][1]], dynamicPositionSize); 267 | 268 | if(position[0] >= dynamicPosition && position[0] <= dynamicPosition + dynamicPositionSize) { 269 | pinFound = i; 270 | break; 271 | } 272 | } 273 | 274 | e_Lockpick[playerid][E_LOCKPICK_PINTYPE] = 0; 275 | e_Lockpick[playerid][E_LOCKPICK_PINTICK] = pinFound; 276 | e_Lockpick[playerid][E_LOCKPICK_POS_Y] = position[1]; 277 | e_Lockpick[playerid][E_LOCKPICK_TIMER_ANIM] = SetTimerEx("OnLockPick_PinAnimation", 50, true, "i", playerid); 278 | } 279 | 280 | static stock SetLockPick_Pin(playerid, Float:x, Float:y) { 281 | 282 | // Distance between of point pin 283 | TextDraw_SetPosition(playerid, tLockpick[playerid][22], x - 45.0, y); 284 | TextDraw_SetPosition(playerid, tLockpick[playerid][23], x, y); 285 | } 286 | 287 | static stock Lockpick_Response(playerid, E_LOCKPICK_STATUS:status) { 288 | 289 | new callback[30 + 1]; 290 | strcat(callback, e_Lockpick[playerid][E_LOCKPICK_CALLBACK]); 291 | 292 | Lockpick_Reset(playerid); 293 | CallLocalFunction(callback, "ii", playerid, _:status); 294 | } 295 | 296 | static stock Lockpick_Reset(playerid) { 297 | 298 | if(e_Lockpick[playerid][E_LOCKPICK_TIMER_ANIM]) 299 | KillTimer(e_Lockpick[playerid][E_LOCKPICK_TIMER_ANIM]); 300 | 301 | if(e_Lockpick[playerid][E_LOCKPICK_TIMER]) 302 | KillTimer(e_Lockpick[playerid][E_LOCKPICK_TIMER]); 303 | 304 | HideLockPick(playerid); 305 | 306 | static const e_Clear[E_LOCKPICK]; 307 | e_Lockpick[playerid] = e_Clear; 308 | } 309 | 310 | 311 | 312 | /* 313 | 314 | ooooo .o. oooooo oooo .oooooo. ooooo ooo ooooooooooooo 315 | `888' .888. `888. .8' d8P' `Y8b `888' `8' 8' 888 `8 316 | 888 .8"888. `888. .8' 888 888 888 8 888 317 | 888 .8' `888. `888.8' 888 888 888 8 888 318 | 888 .88ooo8888. `888' 888 888 888 8 888 319 | 888 o .8' `888. 888 `88b d88' `88. .8' 888 320 | o888ooooood8 o88o o8888o o888o `Y8bood8P' `YbodP' o888o 321 | 322 | */ 323 | 324 | static stock ShowLockPick(playerid) { 325 | 326 | tLockpick[playerid][0] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 252.000, 186.000, "LD_SPAC:white"); 327 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][0], 119.000, 76.000); 328 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][0], 1); 329 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][0], 303174399); 330 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][0], 0); 331 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][0], 0); 332 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][0], 255); 333 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][0], 4); 334 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][0], 1); 335 | 336 | tLockpick[playerid][1] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 270.000, 196.000, "LD_SPAC:white"); 337 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][1], 6.000, 3.000); 338 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][1], 1); 339 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][1], 1211993087); 340 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][1], 0); 341 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][1], 0); 342 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][1], 255); 343 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][1], 4); 344 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][1], 1); 345 | 346 | tLockpick[playerid][2] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 270.000, 204.000, "LD_SPAC:white"); 347 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][2], 6.000, 33.000); 348 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][2], 1); 349 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][2], 2070474495); 350 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][2], 0); 351 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][2], 0); 352 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][2], 255); 353 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][2], 4); 354 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][2], 1); 355 | 356 | tLockpick[playerid][3] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 281.000, 196.000, "LD_SPAC:white"); 357 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][3], 6.000, 3.000); 358 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][3], 1); 359 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][3], 1211993087); 360 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][3], 0); 361 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][3], 0); 362 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][3], 255); 363 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][3], 4); 364 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][3], 1); 365 | 366 | tLockpick[playerid][4] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 281.000, 204.000, "LD_SPAC:white"); 367 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][4], 6.000, 33.000); 368 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][4], 1); 369 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][4], 2070474495); 370 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][4], 0); 371 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][4], 0); 372 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][4], 255); 373 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][4], 4); 374 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][4], 1); 375 | 376 | tLockpick[playerid][5] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 292.000, 196.000, "LD_SPAC:white"); 377 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][5], 6.000, 3.000); 378 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][5], 1); 379 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][5], 1211993087); 380 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][5], 0); 381 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][5], 0); 382 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][5], 255); 383 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][5], 4); 384 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][5], 1); 385 | 386 | tLockpick[playerid][6] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 292.000, 204.000, "LD_SPAC:white"); 387 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][6], 6.000, 33.000); 388 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][6], 1); 389 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][6], 2070474495); 390 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][6], 0); 391 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][6], 0); 392 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][6], 255); 393 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][6], 4); 394 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][6], 1); 395 | 396 | tLockpick[playerid][7] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 303.000, 196.000, "LD_SPAC:white"); 397 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][7], 6.000, 3.000); 398 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][7], 1); 399 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][7], 1211993087); 400 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][7], 0); 401 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][7], 0); 402 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][7], 255); 403 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][7], 4); 404 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][7], 1); 405 | 406 | tLockpick[playerid][8] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 303.000, 204.000, "LD_SPAC:white"); 407 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][8], 6.000, 33.000); 408 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][8], 1); 409 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][8], 2070474495); 410 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][8], 0); 411 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][8], 0); 412 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][8], 255); 413 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][8], 4); 414 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][8], 1); 415 | 416 | tLockpick[playerid][9] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 314.000, 196.000, "LD_SPAC:white"); 417 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][9], 6.000, 3.000); 418 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][9], 1); 419 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][9], 1211993087); 420 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][9], 0); 421 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][9], 0); 422 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][9], 255); 423 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][9], 4); 424 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][9], 1); 425 | 426 | tLockpick[playerid][10] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 314.000, 204.000, "LD_SPAC:white"); 427 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][10], 6.000, 33.000); 428 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][10], 1); 429 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][10], 2070474495); 430 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][10], 0); 431 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][10], 0); 432 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][10], 255); 433 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][10], 4); 434 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][10], 1); 435 | 436 | tLockpick[playerid][11] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 325.000, 196.000, "LD_SPAC:white"); 437 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][11], 6.000, 3.000); 438 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][11], 1); 439 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][11], 1211993087); 440 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][11], 0); 441 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][11], 0); 442 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][11], 255); 443 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][11], 4); 444 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][11], 1); 445 | 446 | tLockpick[playerid][12] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 325.000, 204.000, "LD_SPAC:white"); 447 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][12], 6.000, 33.000); 448 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][12], 1); 449 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][12], 2070474495); 450 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][12], 0); 451 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][12], 0); 452 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][12], 255); 453 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][12], 4); 454 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][12], 1); 455 | 456 | tLockpick[playerid][13] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 336.000, 196.000, "LD_SPAC:white"); 457 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][13], 6.000, 3.000); 458 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][13], 1); 459 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][13], 1211993087); 460 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][13], 0); 461 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][13], 0); 462 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][13], 255); 463 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][13], 4); 464 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][13], 1); 465 | 466 | tLockpick[playerid][14] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 336.000, 204.000, "LD_SPAC:white"); 467 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][14], 6.000, 33.000); 468 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][14], 1); 469 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][14], 2070474495); 470 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][14], 0); 471 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][14], 0); 472 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][14], 255); 473 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][14], 4); 474 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][14], 1); 475 | 476 | tLockpick[playerid][15] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 347.000, 196.000, "LD_SPAC:white"); 477 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][15], 6.000, 3.000); 478 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][15], 1); 479 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][15], 1211993087); 480 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][15], 0); 481 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][15], 0); 482 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][15], 255); 483 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][15], 4); 484 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][15], 1); 485 | 486 | tLockpick[playerid][16] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 347.000, 204.000, "LD_SPAC:white"); 487 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][16], 6.000, 33.000); 488 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][16], 1); 489 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][16], 2070474495); 490 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][16], 0); 491 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][16], 0); 492 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][16], 255); 493 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][16], 4); 494 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][16], 1); 495 | 496 | tLockpick[playerid][17] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 252.000, 160.000, "LD_SPAC:white"); 497 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][17], 119.000, 24.000); 498 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][17], 1); 499 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][17], 303174399); 500 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][17], 0); 501 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][17], 0); 502 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][17], 255); 503 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][17], 4); 504 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][17], 1); 505 | 506 | tLockpick[playerid][18] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 257.000, 164.000, "LOCKPICK"); 507 | PlayerTextDrawLetterSize(playerid, tLockpick[playerid][18], 0.200, 0.999); 508 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][18], 1); 509 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][18], -1); 510 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][18], 0); 511 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][18], 0); 512 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][18], 150); 513 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][18], 1); 514 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][18], 1); 515 | 516 | tLockpick[playerid][19] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 257.000, 173.000, "Aperte Y para empurrar os pinos para cima"); 517 | PlayerTextDrawLetterSize(playerid, tLockpick[playerid][19], 0.129, 0.699); 518 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][19], 1); 519 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][19], 1768516095); 520 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][19], 0); 521 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][19], 0); 522 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][19], 150); 523 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][19], 1); 524 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][19], 1); 525 | 526 | tLockpick[playerid][20] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 252.000, 264.000, "LD_SPAC:white"); 527 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][20], 119.000, 7.000); 528 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][20], 1); 529 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][20], 303174399); 530 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][20], 0); 531 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][20], 0); 532 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][20], 255); 533 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][20], 4); 534 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][20], 1); 535 | 536 | tLockpick[playerid][21] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 252.000, 264.000, "LD_SPAC:white"); 537 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][21], 24.000, 7.000); 538 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][21], 1); 539 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][21], 1784335871); 540 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][21], 0); 541 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][21], 0); 542 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][21], 255); 543 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][21], 4); 544 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][21], 1); 545 | 546 | tLockpick[playerid][22] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 218.000, 249.000, "LD_SPAC:white"); 547 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][22], 47.000, 3.000); 548 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][22], 1); 549 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][22], -1); 550 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][22], 0); 551 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][22], 0); 552 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][22], 255); 553 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][22], 4); 554 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][22], 1); 555 | 556 | tLockpick[playerid][23] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 263.000, 249.000, "LD_SPAC:white"); 557 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][23], 2.000, -8.000); 558 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][23], 1); 559 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][23], -1); 560 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][23], 0); 561 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][23], 0); 562 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][23], 255); 563 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][23], 4); 564 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][23], 1); 565 | 566 | for(new i = 0; i < sizeof tLockpick[]; i++) 567 | PlayerTextDrawShow(playerid, tLockpick[playerid][i]); 568 | } 569 | 570 | static stock HideLockPick(playerid) { 571 | 572 | for(new i = 0; i < sizeof tLockpick[]; i++) { 573 | PlayerTextDrawDestroy(playerid, tLockpick[playerid][i]); 574 | tLockpick[playerid][i] = PlayerText:INVALID_TEXT_DRAW; 575 | } 576 | } 577 | 578 | 579 | 580 | /* 581 | 582 | ooo ooooo .o. .oooooo. ooooooooo. .oooooo. .oooooo..o 583 | `88. .888' .888. d8P' `Y8b `888 `Y88. d8P' `Y8b d8P' `Y8 584 | 888b d'888 .8"888. 888 888 .d88' 888 888 Y88bo. 585 | 8 Y88. .P 888 .8' `888. 888 888ooo88P' 888 888 `"Y8888o. 586 | 8 `888' 888 .88ooo8888. 888 888`88b. 888 888 `"Y88b 587 | 8 Y 888 .8' `888. `88b ooo 888 `88b. `88b d88' oo .d8P 588 | o8o o888o o88o o8888o `Y8bood8P' o888o o888o `Y8bood8P' 8""88888P' 589 | 590 | */ 591 | 592 | static stock TextDraw_SetPosition(playerid, &PlayerText:playertextid, Float:x, Float:y) { 593 | 594 | if(playertextid == INVALID_PLAYER_TEXT_DRAW) 595 | return; 596 | 597 | new data[E_TEXTDRAW_DATA]; 598 | data = e_TextdrawData[playerid][playertextid]; // create data backup 599 | 600 | PlayerTextDrawDestroy(playerid, playertextid); // destroy current textdraw 601 | 602 | new PlayerText:textid = CreatePlayerTextDraw(playerid, x, y, data[E_TEXTDRAW_DATA_TEXTO]); 603 | PlayerTextDrawTextSize(playerid, textid, data[E_TEXTDRAW_DATA_SIZE][0], data[E_TEXTDRAW_DATA_SIZE][1]); 604 | PlayerTextDrawAlignment(playerid, textid, data[E_TEXTDRAW_DATA_ALIGN]); 605 | PlayerTextDrawColor(playerid, textid, data[E_TEXTDRAW_DATA_COLOR]); 606 | PlayerTextDrawSetShadow(playerid, textid, data[E_TEXTDRAW_DATA_SHADOW]); 607 | PlayerTextDrawSetOutline(playerid, textid, data[E_TEXTDRAW_DATA_OUTLINE]); 608 | PlayerTextDrawBackgroundColor(playerid, textid, data[E_TEXTDRAW_DATA_COLOR]); 609 | PlayerTextDrawFont(playerid, textid, data[E_TEXTDRAW_DATA_FONT]); 610 | PlayerTextDrawSetProportional(playerid, textid, data[E_TEXTDRAW_DATA_PROPOR]); 611 | PlayerTextDrawShow(playerid, textid); 612 | 613 | e_TextdrawData[playerid][textid] = data; // Rebuild data 614 | e_TextdrawData[playerid][textid][E_TEXTDRAW_DATA_POS][0] = x; // Set new offsets 615 | e_TextdrawData[playerid][textid][E_TEXTDRAW_DATA_POS][1] = y; // Set new offsets 616 | playertextid = textid; 617 | } 618 | 619 | static stock TextDraw_GetPosition(playerid, PlayerText:playertextid, &Float:x, &Float:y = 0.0) { 620 | 621 | x = e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_POS][0]; 622 | y = e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_POS][1]; 623 | } 624 | 625 | static stock TextDraw_GetTextSize(playerid, PlayerText:playertextid, &Float:x, &Float:y = 0.0) { 626 | 627 | x = e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_SIZE][0]; 628 | y = e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_SIZE][1]; 629 | } 630 | 631 | static stock TextDraw_ResetData(playerid, PlayerText:playertextid) { 632 | 633 | static const e_Clear[E_TEXTDRAW_DATA]; 634 | e_TextdrawData[playerid][playertextid] = e_Clear; 635 | } 636 | 637 | static stock Lock_CreatePlayerTextDraw(playerid, Float:x, Float:y, const text[]) { 638 | new PlayerText:playertextid = CreatePlayerTextDraw(playerid, x, y, text); 639 | 640 | TextDraw_ResetData(playerid, playertextid); 641 | 642 | format(e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_TEXTO], 68, text); 643 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_POS][0] = x; 644 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_POS][1] = y; 645 | return _:playertextid; 646 | } 647 | 648 | static stock Lock_PlayerTextDrawTextSize(playerid, PlayerText:playertextid, Float:x, Float:y) { 649 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_SIZE][0] = x; 650 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_SIZE][1] = y; 651 | PlayerTextDrawTextSize(playerid, playertextid, x, y); 652 | } 653 | 654 | static stock Lock_PlayerTextDrawAlignment(playerid, PlayerText:playertextid, alignment) { 655 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_ALIGN] = alignment; 656 | PlayerTextDrawAlignment(playerid, playertextid, alignment); 657 | } 658 | 659 | static stock Lock_PlayerTextDrawColor(playerid, PlayerText:playertextid, color) { 660 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_COLOR] = color; 661 | PlayerTextDrawColor(playerid, playertextid, color); 662 | } 663 | 664 | static stock Lock_PlayerTextDrawSetShadow(playerid, PlayerText:playertextid, size) { 665 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_SHADOW] = size; 666 | PlayerTextDrawSetShadow(playerid, playertextid, size); 667 | } 668 | 669 | static stock Lock_PlayerTextDrawSetOutline(playerid, PlayerText:playertextid, size) { 670 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_OUTLINE] = size; 671 | PlayerTextDrawSetOutline(playerid, playertextid, size); 672 | } 673 | 674 | static stock Lock_PlayerTextDrawBackgColor(playerid, PlayerText:playertextid, color) { 675 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_BACKCOLOR] = color; 676 | PlayerTextDrawBackgroundColor(playerid, playertextid, color); 677 | } 678 | 679 | static stock Lock_PlayerTextDrawFont(playerid, PlayerText:playertextid, font) { 680 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_FONT] = font; 681 | PlayerTextDrawFont(playerid, playertextid, font); 682 | } 683 | 684 | static stock Lock_PlayerTextDrawProp(playerid, PlayerText:playertextid, set) { 685 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_PROPOR] = set; 686 | PlayerTextDrawSetProportional(playerid, playertextid, set); 687 | } 688 | -------------------------------------------------------------------------------- /lockpick_open_mp.inc: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Status: 5 | E_LOCKPICK_SUCCESS 6 | E_LOCKPICK_ERROR 7 | 8 | */ 9 | 10 | 11 | 12 | // Definers 13 | #define MAX_LOCKPICK_PINS (8) 14 | 15 | // Includes 16 | #include <..\YSI-Includes\YSI_Coding\y_hooks> 17 | 18 | // Forwards 19 | forward OnLockPick_Tick(playerid); 20 | forward OnLockPick_PinAnimation(playerid); 21 | 22 | enum E_LOCKPICK_STATUS { 23 | E_LOCKPICK_SUCCESS, 24 | E_LOCKPICK_ERROR 25 | }; 26 | 27 | static const 28 | e_LockPick_Pinos[MAX_LOCKPICK_PINS][2] = { 29 | 30 | /* 31 | [0] - Pin Limit 32 | [1] - Pin 33 | */ 34 | {1, 2}, 35 | {3, 4}, 36 | {5, 6}, 37 | {7, 8}, 38 | {9, 10}, 39 | {11, 12}, 40 | {13, 14}, 41 | {15, 16} 42 | }, 43 | 44 | // configurations 45 | updateTicks = 50, 46 | Float:pinTicks = 1.0, // steps pin 47 | Float:dynamicPinSteps = 5.0, // steps up 48 | Float:pinDistance = 10.0; // steps for pin limit 49 | 50 | static enum E_LOCKPICK { 51 | E_LOCKPICK_CALLBACK[30 + 1], 52 | E_LOCKPICK_TIMER, 53 | E_LOCKPICK_TIMER_ANIM, 54 | E_LOCKPICK_PINTICK, 55 | E_LOCKPICK_PINTYPE, 56 | E_LOCKPICK_SECONDS, 57 | E_LOCKPICK_PROGRESS, 58 | Float:E_LOCKPICK_POS_Y, // backup y pos 59 | bool:E_LOCKPICK_PINS[MAX_LOCKPICK_PINS], 60 | bool:E_LOCKPICK_ANIM_PIN, 61 | bool:E_LOCKPICK_BACKWARD 62 | }; 63 | 64 | static enum E_TEXTDRAW_DATA { 65 | E_TEXTDRAW_DATA_TEXTO[68 + 1], 66 | Float:E_TEXTDRAW_DATA_POS[2], 67 | Float:E_TEXTDRAW_DATA_SIZE[2], 68 | E_TEXTDRAW_DATA_ALIGN, 69 | E_TEXTDRAW_DATA_COLOR, 70 | E_TEXTDRAW_DATA_SHADOW, 71 | E_TEXTDRAW_DATA_OUTLINE, 72 | E_TEXTDRAW_DATA_BACKCOLOR, // BackgroundColor 73 | E_TEXTDRAW_DATA_FONT, 74 | bool:E_TEXTDRAW_DATA_PROPOR // Proportional 75 | }; 76 | 77 | static 78 | e_Lockpick[MAX_PLAYERS][E_LOCKPICK], 79 | e_TextdrawData[MAX_PLAYERS][MAX_PLAYER_TEXT_DRAWS][E_TEXTDRAW_DATA], 80 | PlayerText:tLockpick[MAX_PLAYERS][24]; 81 | 82 | hook OnPlayerDisconnect(playerid, reason) { 83 | 84 | Lockpick_Reset(playerid); 85 | return Y_HOOKS_CONTINUE_RETURN_1; 86 | } 87 | 88 | hook OnPlayerKeyStateChange(playerid, KEY:newkeys, KEY:oldkeys) { 89 | 90 | if(newkeys == KEY_YES && IsPlayerInLockPick(playerid) && !e_Lockpick[playerid][E_LOCKPICK_TIMER_ANIM]) { 91 | Lockpick_CheckPins(playerid); 92 | return Y_HOOKS_BREAK_RETURN_1; 93 | } 94 | return Y_HOOKS_CONTINUE_RETURN_1; 95 | } 96 | 97 | 98 | 99 | /* 100 | 101 | ooooooooo. ooooo ooo oooooooooo. ooooo ooooo .oooooo. 102 | `888 `Y88. `888' `8' `888' `Y8b `888' `888' d8P' `Y8b 103 | 888 .d88' 888 8 888 888 888 888 888 104 | 888ooo88P' 888 8 888oooo888' 888 888 888 105 | 888 888 8 888 `88b 888 888 888 106 | 888 `88. .8' 888 .88P 888 o 888 `88b ooo 107 | o888o `YbodP' o888bood8P' o888ooooood8 o888o `Y8bood8P' 108 | 109 | */ 110 | 111 | public OnLockPick_Tick(playerid) { 112 | 113 | // progress 114 | e_Lockpick[playerid][E_LOCKPICK_SECONDS]++; 115 | PlayerTextDrawTextSize(playerid, tLockpick[playerid][21], 119.000 - ((119.000 / e_Lockpick[playerid][E_LOCKPICK_PROGRESS]) * e_Lockpick[playerid][E_LOCKPICK_SECONDS]), 7.0); 116 | PlayerTextDrawShow(playerid, tLockpick[playerid][21]); 117 | 118 | if(e_Lockpick[playerid][E_LOCKPICK_SECONDS] >= e_Lockpick[playerid][E_LOCKPICK_PROGRESS]) { 119 | Lockpick_Response(playerid, E_LOCKPICK_ERROR); 120 | return true; 121 | } 122 | 123 | // wait for anim pin 124 | if(e_Lockpick[playerid][E_LOCKPICK_ANIM_PIN]) 125 | return true; 126 | 127 | new Float:position[2]; 128 | TextDraw_GetPosition(playerid, tLockpick[playerid][23], position[0], position[1]); 129 | 130 | if(e_Lockpick[playerid][E_LOCKPICK_BACKWARD]) position[0] -= pinTicks; 131 | else position[0] += pinTicks; 132 | 133 | new Float:mainBoxPos, Float:mainBoxSize; 134 | TextDraw_GetPosition(playerid, tLockpick[playerid][0], mainBoxPos); 135 | TextDraw_GetTextSize(playerid, tLockpick[playerid][0], mainBoxSize); 136 | 137 | if(position[0] <= mainBoxPos) e_Lockpick[playerid][E_LOCKPICK_BACKWARD] = false; // min limit 138 | else if(position[0] >= (mainBoxPos + mainBoxSize)) e_Lockpick[playerid][E_LOCKPICK_BACKWARD] = true; // max limit 139 | 140 | SetLockPick_Pin(playerid, position[0], position[1]); 141 | return true; 142 | } 143 | 144 | public OnLockPick_PinAnimation(playerid) { 145 | 146 | new Float:position[2], Float:position_y = e_Lockpick[playerid][E_LOCKPICK_POS_Y]; 147 | TextDraw_GetPosition(playerid, tLockpick[playerid][23], position[0], position[1]); 148 | 149 | switch(e_Lockpick[playerid][E_LOCKPICK_PINTYPE]) { 150 | case 0: // pin up 151 | { 152 | if(position[1] <= (position_y - pinDistance)) 153 | e_Lockpick[playerid][E_LOCKPICK_PINTYPE] = 1; 154 | 155 | position[1] -= pinTicks; 156 | } 157 | 158 | case 1: // checkpin and move 159 | { 160 | new pin_index = e_Lockpick[playerid][E_LOCKPICK_PINTICK]; 161 | if(pin_index != -1 && !e_Lockpick[playerid][E_LOCKPICK_PINS][pin_index]) 162 | { 163 | // get positions 164 | new Float:dynamicPosition[2], Float:dynamicLimitPos[2]; 165 | TextDraw_GetPosition(playerid, tLockpick[playerid][e_LockPick_Pinos[pin_index][0]], dynamicLimitPos[0], dynamicLimitPos[1]); 166 | TextDraw_GetPosition(playerid, tLockpick[playerid][e_LockPick_Pinos[pin_index][1]], dynamicPosition[0], dynamicPosition[1]); 167 | 168 | // set up pin animation 169 | dynamicPosition[1] -= dynamicPinSteps; 170 | TextDraw_SetPosition(playerid, tLockpick[playerid][e_LockPick_Pinos[pin_index][1]], dynamicPosition[0], dynamicPosition[1]); 171 | 172 | e_Lockpick[playerid][E_LOCKPICK_PINS][pin_index] = true; // set pin finish 173 | } 174 | 175 | e_Lockpick[playerid][E_LOCKPICK_PINTYPE] = 2; 176 | } 177 | 178 | case 2: // back pin main 179 | { 180 | if(position[1] >= position_y) { 181 | e_Lockpick[playerid][E_LOCKPICK_PINTYPE] = 3; 182 | position[1] = position_y; 183 | } 184 | else position[1] += pinTicks; 185 | } 186 | 187 | case 3: // check and continue anims 188 | { 189 | KillTimer(e_Lockpick[playerid][E_LOCKPICK_TIMER_ANIM]); 190 | e_Lockpick[playerid][E_LOCKPICK_TIMER_ANIM] = 0; 191 | e_Lockpick[playerid][E_LOCKPICK_PINTYPE] = 0; 192 | e_Lockpick[playerid][E_LOCKPICK_ANIM_PIN] = false; 193 | 194 | new bool:hasPin; 195 | for(new i = 0; i < MAX_LOCKPICK_PINS; i++) { 196 | if(e_Lockpick[playerid][E_LOCKPICK_PINS][i]) 197 | continue; 198 | 199 | hasPin = true; 200 | break; 201 | } 202 | 203 | if(!hasPin) 204 | Lockpick_Response(playerid, E_LOCKPICK_SUCCESS); 205 | } 206 | } 207 | 208 | SetLockPick_Pin(playerid, position[0], position[1]); 209 | return true; 210 | } 211 | 212 | 213 | 214 | /* 215 | 216 | .oooooo..o ooooooooooooo .oooooo. .oooooo. oooo oooo .oooooo..o 217 | d8P' `Y8 8' 888 `8 d8P' `Y8b d8P' `Y8b `888 .8P' d8P' `Y8 218 | Y88bo. 888 888 888 888 888 d8' Y88bo. 219 | `"Y8888o. 888 888 888 888 88888[ `"Y8888o. 220 | `"Y88b 888 888 888 888 888`88b. `"Y88b 221 | oo .d8P 888 `88b d88' `88b ooo 888 `88b. oo .d8P 222 | 8""88888P' o888o `Y8bood8P' `Y8bood8P' o888o o888o 8""88888P' 223 | 224 | */ 225 | 226 | stock CreateLockPick(playerid, const callback[], seconds) { 227 | 228 | // Block 229 | if(IsPlayerInLockPick(playerid)) 230 | return false; 231 | 232 | ShowLockPick(playerid); 233 | SetLockPick_Pin(playerid, 252.000, 249.000); 234 | 235 | format(e_Lockpick[playerid][E_LOCKPICK_CALLBACK], 30, callback); 236 | e_Lockpick[playerid][E_LOCKPICK_PROGRESS] = (seconds * 1000) / 100; 237 | e_Lockpick[playerid][E_LOCKPICK_TIMER] = SetTimerEx("OnLockPick_Tick", updateTicks, true, "i", playerid); 238 | return true; 239 | } 240 | 241 | stock CancelLockPick(playerid) { 242 | 243 | if(!IsPlayerInLockPick(playerid)) 244 | return false; 245 | 246 | Lockpick_Reset(playerid); 247 | return true; 248 | } 249 | 250 | stock IsPlayerInLockPick(playerid) 251 | return e_Lockpick[playerid][E_LOCKPICK_TIMER] != 0; 252 | 253 | static stock Lockpick_CheckPins(playerid) { 254 | 255 | new 256 | Float:dynamicPosition, 257 | Float:dynamicPositionSize, 258 | Float:position[2], 259 | pinFound = -1; 260 | 261 | e_Lockpick[playerid][E_LOCKPICK_ANIM_PIN] = true; 262 | TextDraw_GetPosition(playerid, tLockpick[playerid][23], position[0], position[1]); 263 | 264 | for(new i = 0; i < sizeof e_LockPick_Pinos; i++) { 265 | TextDraw_GetPosition(playerid, tLockpick[playerid][e_LockPick_Pinos[i][1]], dynamicPosition); 266 | TextDraw_GetTextSize(playerid, tLockpick[playerid][e_LockPick_Pinos[i][1]], dynamicPositionSize); 267 | 268 | if(position[0] >= dynamicPosition && position[0] <= dynamicPosition + dynamicPositionSize) { 269 | pinFound = i; 270 | break; 271 | } 272 | } 273 | 274 | e_Lockpick[playerid][E_LOCKPICK_PINTYPE] = 0; 275 | e_Lockpick[playerid][E_LOCKPICK_PINTICK] = pinFound; 276 | e_Lockpick[playerid][E_LOCKPICK_POS_Y] = position[1]; 277 | e_Lockpick[playerid][E_LOCKPICK_TIMER_ANIM] = SetTimerEx("OnLockPick_PinAnimation", 50, true, "i", playerid); 278 | } 279 | 280 | static stock SetLockPick_Pin(playerid, Float:x, Float:y) { 281 | 282 | // Distance between of point pin 283 | TextDraw_SetPosition(playerid, tLockpick[playerid][22], x - 45.0, y); 284 | TextDraw_SetPosition(playerid, tLockpick[playerid][23], x, y); 285 | } 286 | 287 | static stock Lockpick_Response(playerid, E_LOCKPICK_STATUS:status) { 288 | 289 | new callback[30 + 1]; 290 | strcat(callback, e_Lockpick[playerid][E_LOCKPICK_CALLBACK]); 291 | 292 | Lockpick_Reset(playerid); 293 | CallLocalFunction(callback, "ii", playerid, _:status); 294 | } 295 | 296 | static stock Lockpick_Reset(playerid) { 297 | 298 | if(e_Lockpick[playerid][E_LOCKPICK_TIMER_ANIM]) 299 | KillTimer(e_Lockpick[playerid][E_LOCKPICK_TIMER_ANIM]); 300 | 301 | if(e_Lockpick[playerid][E_LOCKPICK_TIMER]) 302 | KillTimer(e_Lockpick[playerid][E_LOCKPICK_TIMER]); 303 | 304 | HideLockPick(playerid); 305 | 306 | static const e_Clear[E_LOCKPICK]; 307 | e_Lockpick[playerid] = e_Clear; 308 | } 309 | 310 | 311 | 312 | /* 313 | 314 | ooooo .o. oooooo oooo .oooooo. ooooo ooo ooooooooooooo 315 | `888' .888. `888. .8' d8P' `Y8b `888' `8' 8' 888 `8 316 | 888 .8"888. `888. .8' 888 888 888 8 888 317 | 888 .8' `888. `888.8' 888 888 888 8 888 318 | 888 .88ooo8888. `888' 888 888 888 8 888 319 | 888 o .8' `888. 888 `88b d88' `88. .8' 888 320 | o888ooooood8 o88o o8888o o888o `Y8bood8P' `YbodP' o888o 321 | 322 | */ 323 | 324 | static stock ShowLockPick(playerid) { 325 | 326 | tLockpick[playerid][0] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 252.000, 186.000, "LD_SPAC:white"); 327 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][0], 119.000, 76.000); 328 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][0], 1); 329 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][0], 303174399); 330 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][0], 0); 331 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][0], 0); 332 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][0], 255); 333 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][0], TEXT_DRAW_FONT_SPRITE_DRAW); 334 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][0], true); 335 | 336 | tLockpick[playerid][1] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 270.000, 196.000, "LD_SPAC:white"); 337 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][1], 6.000, 3.000); 338 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][1], 1); 339 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][1], 1211993087); 340 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][1], 0); 341 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][1], 0); 342 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][1], 255); 343 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][1], TEXT_DRAW_FONT_SPRITE_DRAW); 344 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][1], true); 345 | 346 | tLockpick[playerid][2] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 270.000, 204.000, "LD_SPAC:white"); 347 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][2], 6.000, 33.000); 348 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][2], 1); 349 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][2], 2070474495); 350 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][2], 0); 351 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][2], 0); 352 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][2], 255); 353 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][2], TEXT_DRAW_FONT_SPRITE_DRAW); 354 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][2], true); 355 | 356 | tLockpick[playerid][3] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 281.000, 196.000, "LD_SPAC:white"); 357 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][3], 6.000, 3.000); 358 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][3], 1); 359 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][3], 1211993087); 360 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][3], 0); 361 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][3], 0); 362 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][3], 255); 363 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][3], TEXT_DRAW_FONT_SPRITE_DRAW); 364 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][3], true); 365 | 366 | tLockpick[playerid][4] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 281.000, 204.000, "LD_SPAC:white"); 367 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][4], 6.000, 33.000); 368 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][4], 1); 369 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][4], 2070474495); 370 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][4], 0); 371 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][4], 0); 372 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][4], 255); 373 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][4], TEXT_DRAW_FONT_SPRITE_DRAW); 374 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][4], true); 375 | 376 | tLockpick[playerid][5] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 292.000, 196.000, "LD_SPAC:white"); 377 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][5], 6.000, 3.000); 378 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][5], 1); 379 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][5], 1211993087); 380 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][5], 0); 381 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][5], 0); 382 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][5], 255); 383 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][5], TEXT_DRAW_FONT_SPRITE_DRAW); 384 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][5], true); 385 | 386 | tLockpick[playerid][6] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 292.000, 204.000, "LD_SPAC:white"); 387 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][6], 6.000, 33.000); 388 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][6], 1); 389 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][6], 2070474495); 390 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][6], 0); 391 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][6], 0); 392 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][6], 255); 393 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][6], TEXT_DRAW_FONT_SPRITE_DRAW); 394 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][6], true); 395 | 396 | tLockpick[playerid][7] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 303.000, 196.000, "LD_SPAC:white"); 397 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][7], 6.000, 3.000); 398 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][7], 1); 399 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][7], 1211993087); 400 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][7], 0); 401 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][7], 0); 402 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][7], 255); 403 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][7], TEXT_DRAW_FONT_SPRITE_DRAW); 404 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][7], true); 405 | 406 | tLockpick[playerid][8] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 303.000, 204.000, "LD_SPAC:white"); 407 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][8], 6.000, 33.000); 408 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][8], 1); 409 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][8], 2070474495); 410 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][8], 0); 411 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][8], 0); 412 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][8], 255); 413 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][8], TEXT_DRAW_FONT_SPRITE_DRAW); 414 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][8], true); 415 | 416 | tLockpick[playerid][9] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 314.000, 196.000, "LD_SPAC:white"); 417 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][9], 6.000, 3.000); 418 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][9], 1); 419 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][9], 1211993087); 420 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][9], 0); 421 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][9], 0); 422 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][9], 255); 423 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][9], TEXT_DRAW_FONT_SPRITE_DRAW); 424 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][9], true); 425 | 426 | tLockpick[playerid][10] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 314.000, 204.000, "LD_SPAC:white"); 427 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][10], 6.000, 33.000); 428 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][10], 1); 429 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][10], 2070474495); 430 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][10], 0); 431 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][10], 0); 432 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][10], 255); 433 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][10], TEXT_DRAW_FONT_SPRITE_DRAW); 434 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][10], true); 435 | 436 | tLockpick[playerid][11] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 325.000, 196.000, "LD_SPAC:white"); 437 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][11], 6.000, 3.000); 438 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][11], 1); 439 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][11], 1211993087); 440 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][11], 0); 441 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][11], 0); 442 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][11], 255); 443 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][11], TEXT_DRAW_FONT_SPRITE_DRAW); 444 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][11], true); 445 | 446 | tLockpick[playerid][12] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 325.000, 204.000, "LD_SPAC:white"); 447 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][12], 6.000, 33.000); 448 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][12], 1); 449 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][12], 2070474495); 450 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][12], 0); 451 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][12], 0); 452 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][12], 255); 453 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][12], TEXT_DRAW_FONT_SPRITE_DRAW); 454 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][12], true); 455 | 456 | tLockpick[playerid][13] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 336.000, 196.000, "LD_SPAC:white"); 457 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][13], 6.000, 3.000); 458 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][13], 1); 459 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][13], 1211993087); 460 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][13], 0); 461 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][13], 0); 462 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][13], 255); 463 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][13], TEXT_DRAW_FONT_SPRITE_DRAW); 464 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][13], true); 465 | 466 | tLockpick[playerid][14] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 336.000, 204.000, "LD_SPAC:white"); 467 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][14], 6.000, 33.000); 468 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][14], 1); 469 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][14], 2070474495); 470 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][14], 0); 471 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][14], 0); 472 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][14], 255); 473 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][14], TEXT_DRAW_FONT_SPRITE_DRAW); 474 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][14], true); 475 | 476 | tLockpick[playerid][15] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 347.000, 196.000, "LD_SPAC:white"); 477 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][15], 6.000, 3.000); 478 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][15], 1); 479 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][15], 1211993087); 480 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][15], 0); 481 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][15], 0); 482 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][15], 255); 483 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][15], TEXT_DRAW_FONT_SPRITE_DRAW); 484 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][15], true); 485 | 486 | tLockpick[playerid][16] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 347.000, 204.000, "LD_SPAC:white"); 487 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][16], 6.000, 33.000); 488 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][16], 1); 489 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][16], 2070474495); 490 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][16], 0); 491 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][16], 0); 492 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][16], 255); 493 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][16], TEXT_DRAW_FONT_SPRITE_DRAW); 494 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][16], true); 495 | 496 | tLockpick[playerid][17] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 252.000, 160.000, "LD_SPAC:white"); 497 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][17], 119.000, 24.000); 498 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][17], 1); 499 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][17], 303174399); 500 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][17], 0); 501 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][17], 0); 502 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][17], 255); 503 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][17], TEXT_DRAW_FONT_SPRITE_DRAW); 504 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][17], true); 505 | 506 | tLockpick[playerid][18] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 257.000, 164.000, "LOCKPICK"); 507 | PlayerTextDrawLetterSize(playerid, tLockpick[playerid][18], 0.200, 0.999); 508 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][18], 1); 509 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][18], -1); 510 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][18], 0); 511 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][18], 0); 512 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][18], 150); 513 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][18], TEXT_DRAW_FONT_1); 514 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][18], true); 515 | 516 | tLockpick[playerid][19] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 257.000, 173.000, "Aperte Y para empurrar os pinos para cima"); 517 | PlayerTextDrawLetterSize(playerid, tLockpick[playerid][19], 0.129, 0.699); 518 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][19], 1); 519 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][19], 1768516095); 520 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][19], 0); 521 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][19], 0); 522 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][19], 150); 523 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][19], TEXT_DRAW_FONT_1); 524 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][19], true); 525 | 526 | tLockpick[playerid][20] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 252.000, 264.000, "LD_SPAC:white"); 527 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][20], 119.000, 7.000); 528 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][20], 1); 529 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][20], 303174399); 530 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][20], 0); 531 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][20], 0); 532 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][20], 255); 533 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][20], TEXT_DRAW_FONT_SPRITE_DRAW); 534 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][20], true); 535 | 536 | tLockpick[playerid][21] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 252.000, 264.000, "LD_SPAC:white"); 537 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][21], 24.000, 7.000); 538 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][21], 1); 539 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][21], 1784335871); 540 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][21], 0); 541 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][21], 0); 542 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][21], 255); 543 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][21], TEXT_DRAW_FONT_SPRITE_DRAW); 544 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][21], true); 545 | 546 | tLockpick[playerid][22] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 218.000, 249.000, "LD_SPAC:white"); 547 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][22], 47.000, 3.000); 548 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][22], 1); 549 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][22], -1); 550 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][22], 0); 551 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][22], 0); 552 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][22], 255); 553 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][22], TEXT_DRAW_FONT_SPRITE_DRAW); 554 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][22], true); 555 | 556 | tLockpick[playerid][23] = PlayerText:Lock_CreatePlayerTextDraw(playerid, 263.000, 249.000, "LD_SPAC:white"); 557 | Lock_PlayerTextDrawTextSize(playerid, tLockpick[playerid][23], 2.000, -8.000); 558 | Lock_PlayerTextDrawAlignment(playerid, tLockpick[playerid][23], 1); 559 | Lock_PlayerTextDrawColor(playerid, tLockpick[playerid][23], -1); 560 | Lock_PlayerTextDrawSetShadow(playerid, tLockpick[playerid][23], 0); 561 | Lock_PlayerTextDrawSetOutline(playerid, tLockpick[playerid][23], 0); 562 | Lock_PlayerTextDrawBackgColor(playerid, tLockpick[playerid][23], 255); 563 | Lock_PlayerTextDrawFont(playerid, tLockpick[playerid][23], TEXT_DRAW_FONT_SPRITE_DRAW); 564 | Lock_PlayerTextDrawProp(playerid, tLockpick[playerid][23], true); 565 | 566 | for(new i = 0; i < sizeof tLockpick[]; i++) 567 | PlayerTextDrawShow(playerid, tLockpick[playerid][i]); 568 | } 569 | 570 | static stock HideLockPick(playerid) { 571 | 572 | for(new i = 0; i < sizeof tLockpick[]; i++) { 573 | PlayerTextDrawDestroy(playerid, tLockpick[playerid][i]); 574 | tLockpick[playerid][i] = PlayerText:INVALID_TEXT_DRAW; 575 | } 576 | } 577 | 578 | 579 | 580 | /* 581 | 582 | ooo ooooo .o. .oooooo. ooooooooo. .oooooo. .oooooo..o 583 | `88. .888' .888. d8P' `Y8b `888 `Y88. d8P' `Y8b d8P' `Y8 584 | 888b d'888 .8"888. 888 888 .d88' 888 888 Y88bo. 585 | 8 Y88. .P 888 .8' `888. 888 888ooo88P' 888 888 `"Y8888o. 586 | 8 `888' 888 .88ooo8888. 888 888`88b. 888 888 `"Y88b 587 | 8 Y 888 .8' `888. `88b ooo 888 `88b. `88b d88' oo .d8P 588 | o8o o888o o88o o8888o `Y8bood8P' o888o o888o `Y8bood8P' 8""88888P' 589 | 590 | */ 591 | 592 | static stock TextDraw_SetPosition(playerid, &PlayerText:playertextid, Float:x, Float:y) { 593 | 594 | if(playertextid == INVALID_PLAYER_TEXT_DRAW) 595 | return; 596 | 597 | new data[E_TEXTDRAW_DATA]; 598 | data = e_TextdrawData[playerid][playertextid]; // create data backup 599 | 600 | PlayerTextDrawDestroy(playerid, playertextid); // destroy current textdraw 601 | 602 | new PlayerText:textid = CreatePlayerTextDraw(playerid, x, y, data[E_TEXTDRAW_DATA_TEXTO]); 603 | PlayerTextDrawTextSize(playerid, textid, data[E_TEXTDRAW_DATA_SIZE][0], data[E_TEXTDRAW_DATA_SIZE][1]); 604 | PlayerTextDrawAlignment(playerid, textid, TEXT_DRAW_ALIGN:data[E_TEXTDRAW_DATA_ALIGN]); 605 | PlayerTextDrawColour(playerid, textid, data[E_TEXTDRAW_DATA_COLOR]); 606 | PlayerTextDrawSetShadow(playerid, textid, data[E_TEXTDRAW_DATA_SHADOW]); 607 | PlayerTextDrawSetOutline(playerid, textid, data[E_TEXTDRAW_DATA_OUTLINE]); 608 | PlayerTextDrawBackgroundColour(playerid, textid, data[E_TEXTDRAW_DATA_COLOR]); 609 | PlayerTextDrawFont(playerid, textid, TEXT_DRAW_FONT:data[E_TEXTDRAW_DATA_FONT]); 610 | PlayerTextDrawSetProportional(playerid, textid, data[E_TEXTDRAW_DATA_PROPOR]); 611 | PlayerTextDrawShow(playerid, textid); 612 | 613 | e_TextdrawData[playerid][textid] = data; // Rebuild data 614 | e_TextdrawData[playerid][textid][E_TEXTDRAW_DATA_POS][0] = x; // Set new offsets 615 | e_TextdrawData[playerid][textid][E_TEXTDRAW_DATA_POS][1] = y; // Set new offsets 616 | playertextid = textid; 617 | } 618 | 619 | static stock TextDraw_GetPosition(playerid, PlayerText:playertextid, &Float:x, &Float:y = 0.0) { 620 | 621 | x = e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_POS][0]; 622 | y = e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_POS][1]; 623 | } 624 | 625 | static stock TextDraw_GetTextSize(playerid, PlayerText:playertextid, &Float:x, &Float:y = 0.0) { 626 | 627 | x = e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_SIZE][0]; 628 | y = e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_SIZE][1]; 629 | } 630 | 631 | static stock TextDraw_ResetData(playerid, PlayerText:playertextid) { 632 | 633 | static const e_Clear[E_TEXTDRAW_DATA]; 634 | e_TextdrawData[playerid][playertextid] = e_Clear; 635 | } 636 | 637 | static stock Lock_CreatePlayerTextDraw(playerid, Float:x, Float:y, const text[]) { 638 | new PlayerText:playertextid = CreatePlayerTextDraw(playerid, x, y, text); 639 | 640 | TextDraw_ResetData(playerid, playertextid); 641 | 642 | format(e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_TEXTO], 68, text); 643 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_POS][0] = x; 644 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_POS][1] = y; 645 | return _:playertextid; 646 | } 647 | 648 | static stock Lock_PlayerTextDrawTextSize(playerid, PlayerText:playertextid, Float:x, Float:y) { 649 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_SIZE][0] = x; 650 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_SIZE][1] = y; 651 | PlayerTextDrawTextSize(playerid, playertextid, x, y); 652 | } 653 | 654 | static stock Lock_PlayerTextDrawAlignment(playerid, PlayerText:playertextid, alignment) 655 | { 656 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_ALIGN] = alignment; 657 | PlayerTextDrawAlignment(playerid, playertextid, TEXT_DRAW_ALIGN:alignment); 658 | } 659 | 660 | static stock Lock_PlayerTextDrawColor(playerid, PlayerText:playertextid, color) { 661 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_COLOR] = color; 662 | PlayerTextDrawColour(playerid, playertextid, color); 663 | } 664 | 665 | static stock Lock_PlayerTextDrawSetShadow(playerid, PlayerText:playertextid, size) { 666 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_SHADOW] = size; 667 | PlayerTextDrawSetShadow(playerid, playertextid, size); 668 | } 669 | 670 | static stock Lock_PlayerTextDrawSetOutline(playerid, PlayerText:playertextid, size) { 671 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_OUTLINE] = size; 672 | PlayerTextDrawSetOutline(playerid, playertextid, size); 673 | } 674 | 675 | static stock Lock_PlayerTextDrawBackgColor(playerid, PlayerText:playertextid, color) { 676 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_BACKCOLOR] = color; 677 | PlayerTextDrawBackgroundColour(playerid, playertextid, color); 678 | } 679 | 680 | static stock Lock_PlayerTextDrawFont(playerid, PlayerText:playertextid, font) { 681 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_FONT] = font; 682 | PlayerTextDrawFont(playerid, playertextid, TEXT_DRAW_FONT:font); 683 | } 684 | 685 | static stock Lock_PlayerTextDrawProp(playerid, PlayerText:playertextid, bool:set) { 686 | e_TextdrawData[playerid][playertextid][E_TEXTDRAW_DATA_PROPOR] = set; 687 | PlayerTextDrawSetProportional(playerid, playertextid, set); 688 | } 689 | --------------------------------------------------------------------------------