|
| 1 | +#include <natives.h> |
| 2 | +#include <common.h> |
| 3 | +#include <strings.h> |
| 4 | +#include <types.h> |
| 5 | +#include <consts.h> |
| 6 | + |
| 7 | +void main(void) |
| 8 | +{ |
| 9 | + float offsetX = 0.0F; |
| 10 | + float offsetY = 0.0F; |
| 11 | + float offsetZ = 0.0F; |
| 12 | + int r = 255; |
| 13 | + int g = 0; |
| 14 | + int b = 0; |
| 15 | + int a = 100; |
| 16 | + bool drawCircleAroundPlayer = true; |
| 17 | + |
| 18 | + // Calling this allows the script to actually create widget groups and all the other debugging related stuff |
| 19 | + DEBUG_ON(); |
| 20 | + |
| 21 | + // Widget Group Tests |
| 22 | + CREATE_WIDGET_GROUP("GROUPED WIDGET WINDOW"); // Creates a new widget group (A new window) |
| 23 | + |
| 24 | + CREATE_WIDGET_GROUP("Checkpoint"); // We already called CREATE_WIDGET_GROUP before, |
| 25 | + // so this time this creates a tab called "Checkpoint" within the "GROUPED WIDGET WINDOW" widget group |
| 26 | + |
| 27 | + ADD_WIDGET_TOGGLE("drawCircleAroundPlayer", &drawCircleAroundPlayer); |
| 28 | + |
| 29 | + ADD_WIDGET_FLOAT_SLIDER("X", &offsetX, -1000.0F, 1000.0F, 1.0F); |
| 30 | + ADD_WIDGET_FLOAT_SLIDER("Y", &offsetY, -1000.0F, 1000.0F, 1.0F); |
| 31 | + ADD_WIDGET_FLOAT_SLIDER("Z", &offsetZ, -1000.0F, 1000.0F, 1.0F); |
| 32 | + |
| 33 | + ADD_WIDGET_SLIDER("R", &r, 0, 255, 1.0F); |
| 34 | + ADD_WIDGET_SLIDER("G", &g, 0, 255, 1.0F); |
| 35 | + ADD_WIDGET_SLIDER("B", &b, 0, 255, 1.0F); |
| 36 | + ADD_WIDGET_SLIDER("A", &a, 0, 255, 1.0F); |
| 37 | + |
| 38 | + END_WIDGET_GROUP(); // Ends the "Checkpoint" widget group |
| 39 | + |
| 40 | + CREATE_WIDGET_GROUP("Another tab item"); // Creates another tab called "Another tab item" within the "GROUPED WIDGET WINDOW" widget group |
| 41 | + ADD_WIDGET_STRING("With just some text in it"); |
| 42 | + END_WIDGET_GROUP(); // Ends the "Another tab item" widget group |
| 43 | + |
| 44 | + CREATE_WIDGET_GROUP("Yet another tab item"); // Creates another tab called "Yet another tab item" within the "GROUPED WIDGET WINDOW" widget group |
| 45 | + |
| 46 | + CREATE_WIDGET_GROUP("Test1"); // AND This now creates a tab within the "Yet another tab item" tab |
| 47 | + ADD_WIDGET_STRING("Text within the Test1 tab"); |
| 48 | + END_WIDGET_GROUP(); // Ends the "Test1" widget group |
| 49 | + |
| 50 | + CREATE_WIDGET_GROUP("Test2"); // And this also creates a tab within the "Yet another tab item" tab |
| 51 | + ADD_WIDGET_STRING("Text within the Test2 tab"); |
| 52 | + |
| 53 | + END_WIDGET_GROUP(); // Ends the "Test2" widget group |
| 54 | + |
| 55 | + END_WIDGET_GROUP(); // Ends the "Yet another tab item" widget group |
| 56 | + |
| 57 | + END_WIDGET_GROUP(); // Now we end the "GROUPED WIDGET WINDOW" widget group. |
| 58 | + // After this, when we call CREATE_WIDGET_GROUP again this will then create a whole new widget group (window) |
| 59 | + |
| 60 | + |
| 61 | + // Let's create another widget group but this time it wont be a grouped one |
| 62 | + CREATE_WIDGET_GROUP("NON-GROUPED WIDGET GROUP"); |
| 63 | + |
| 64 | + ADD_WIDGET_STRING("Hello World!"); |
| 65 | + |
| 66 | + END_WIDGET_GROUP(); // Ends the "NON-GROUPED WIDGET GROUP" widget group |
| 67 | + |
| 68 | + |
| 69 | + // Debug file test |
| 70 | + //OPEN_DEBUG_FILE(); |
| 71 | + |
| 72 | + //SAVE_FLOAT_TO_DEBUG_FILE(offsetX); |
| 73 | + //SAVE_INT_TO_DEBUG_FILE(r); |
| 74 | + //SAVE_NEWLINE_TO_DEBUG_FILE(); |
| 75 | + //SAVE_STRING_TO_DEBUG_FILE("TEST STRING!"); |
| 76 | + //SAVE_STRING_TO_DEBUG_FILE(" another test to see the text be written on the same line"); |
| 77 | + |
| 78 | + //CLOSE_DEBUG_FILE(); |
| 79 | + |
| 80 | + while (TRUE) |
| 81 | + { |
| 82 | + |
| 83 | + // Get latest IV-SDK .NET console command |
| 84 | + char* consoleCmd[32]; |
| 85 | + GET_LATEST_CONSOLE_COMMAND(&consoleCmd); |
| 86 | + |
| 87 | + if (COMPARE_STRING(consoleCmd, "kill_player")) |
| 88 | + { |
| 89 | + TASK_DIE(GetPlayerPed()); |
| 90 | + RESET_LATEST_CONSOLE_COMMAND(); |
| 91 | + } |
| 92 | + |
| 93 | + if (drawCircleAroundPlayer) |
| 94 | + { |
| 95 | + float pX, pY, pZ; |
| 96 | + GET_CHAR_COORDINATES(GetPlayerPed(), &pX, &pY, &pZ); |
| 97 | + DRAW_CHECKPOINT_WITH_ALPHA(pX + offsetX, pY + offsetY, pZ + offsetZ, 1.0F, r, g, b, a); |
| 98 | + } |
| 99 | + |
| 100 | + WAIT(0); |
| 101 | + } |
| 102 | +} |
0 commit comments