SHOW:
|
|
- or go back to the newest paste.
1 | Ped gameped[12]; | |
2 | Group Bgroup; | |
3 | Ped pPlayer = GetPlayerPed(); | |
4 | //This script will only work if using a menu based off Muskelprotze's Stash | |
5 | ||
6 | //This will delete spawned guards one by one | |
7 | void delete_spawnguards(void){ | |
8 | GET_PLAYER_GROUP(GetPlayerIndex(), &Bgroup); | |
9 | uint test,guards; | |
10 | GET_GROUP_SIZE(Bgroup, &test, &guards); | |
11 | if(guards <= 0){ | |
12 | print("No guards exist"); | |
13 | return; | |
14 | } | |
15 | if(DOES_GROUP_EXIST(Bgroup)){ | |
16 | for(i = 0;i <= 11; i++){ | |
17 | if(DOES_CHAR_EXIST(gameped[i])){ | |
18 | DELETE_CHAR(&gameped[i]); | |
19 | print("1 was Guard Deleted"); | |
20 | return; | |
21 | } | |
22 | if((i >= 11) || (i > 10)) return; | |
23 | } | |
24 | print("No guards exist"); | |
25 | return; | |
26 | } | |
27 | return; | |
28 | } | |
29 | ||
30 | // This will spawn guards one by one and label them as gameped[#] | |
31 | // So that they can be indivdually called as gameped[#] (upto 11) | |
32 | // Example usage: | |
33 | // spawnguards(MODEL_IG_DWAYNE, WEAPON_M4); | |
34 | void spawnguards(uint model, uint weapon){ | |
35 | GET_PLAYER_GROUP(GetPlayerIndex(), &Bgroup); | |
36 | if(!DOES_GROUP_EXIST(Bgroup)){ | |
37 | CREATE_GROUP(0, Bgroup, true); | |
38 | SET_GROUP_LEADER(Bgroup, pPlayer); | |
39 | SET_GROUP_SEPARATION_RANGE(Bgroup, 9999.9); | |
40 | SET_GROUP_FORMATION(Bgroup, 2); | |
41 | } | |
42 | uint test,guards; | |
43 | GET_GROUP_SIZE(Bgroup, &test, &guards); | |
44 | if(guards >= 11){ | |
45 | print("Max guards (11) exceeded"); | |
46 | return; | |
47 | } | |
48 | for(i = 0;i <= 11; i++){ | |
49 | if(!DOES_CHAR_EXIST(gameped[i])){ | |
50 | ||
51 | REQUEST_MODEL(model); | |
52 | while (!HAS_MODEL_LOADED(model)) WAIT(0); | |
53 | WAIT(100); | |
54 | ||
55 | GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS(pPlayer, 0, 2, 0, &x, &y, &z); | |
56 | ||
57 | CREATE_CHAR(26, model, x,y,z, &gameped[i], true); | |
58 | WAIT(500); | |
59 | SET_CHAR_RANDOM_COMPONENT_VARIATION(gameped[i]); | |
60 | SET_GROUP_MEMBER(Bgroup, gameped[i]); | |
61 | SET_CHAR_RELATIONSHIP_GROUP(gameped[i], 24); | |
62 | SET_CHAR_RELATIONSHIP(gameped[i], 5, 0); | |
63 | SET_CHAR_NEVER_LEAVES_GROUP(gameped[i], true); | |
64 | SET_CHAR_ACCURACY(gameped[i], 100); | |
65 | SET_CHAR_KEEP_TASK(gameped[i], true); | |
66 | SET_SENSE_RANGE(gameped[i], 100.0); | |
67 | SET_PED_GENERATES_DEAD_BODY_EVENTS(gameped[i], true); | |
68 | SET_CHAR_SHOOT_RATE(gameped[i], 100); | |
69 | SET_CHAR_WILL_DO_DRIVEBYS(gameped[i], true); | |
70 | SET_CHAR_SIGNAL_AFTER_KILL(gameped[i], true); | |
71 | SET_CHAR_WILL_USE_CARS_IN_COMBAT(gameped[i], true); | |
72 | SET_CHAR_WILL_FLY_THROUGH_WINDSCREEN(gameped[i], false); | |
73 | SET_CHAR_INVINCIBLE(gameped[i], true); | |
74 | SET_CHAR_PROVIDE_COVERING_FIRE(gameped[i], true); | |
75 | SET_CHAR_CANT_BE_DRAGGED_OUT(gameped[i], true); | |
76 | SET_CHAR_STAY_IN_CAR_WHEN_JACKED(gameped[i], true); | |
77 | SET_PED_DONT_DO_EVASIVE_DIVES(gameped[i], true); | |
78 | SET_PED_PATH_MAY_DROP_FROM_HEIGHT(gameped[i], true); | |
79 | SET_PED_PATH_MAY_USE_CLIMBOVERS(gameped[i], true); | |
80 | SET_PED_PATH_MAY_USE_LADDERS(gameped[i], true); | |
81 | UpdateWeaponOfPed(gameped[i], weapon); | |
82 | SET_CURRENT_CHAR_WEAPON(gameped[i], weapon, true); | |
83 | SET_CHAR_INVINCIBLE(gameped[i], true); | |
84 | ||
85 | print("Spawned Bodyguard"); | |
86 | return; | |
87 | } | |
88 | } | |
89 | return; | |
90 | } | |
91 | ||
92 | ||
93 | //This is a function that will send all the spawned guards to kill a certain player | |
94 | if(DOES_CHAR_EXIST(players[index].ped)){ | |
95 | GET_PLAYER_GROUP(GetPlayerIndex(), &Bgroup); | |
96 | if(DOES_GROUP_EXIST(Bgroup)){ | |
97 | for(i = 0;i <= 11; i++){ | |
98 | if(DOES_CHAR_EXIST(gameped[i]) && DOES_CHAR_EXIST(players[index].ped)){ | |
99 | TASK_COMBAT(gameped[i], players[index].ped); | |
100 | if((i >= 11) || (i > 10)){ | |
101 | print("Sent all Guards after the Player"); | |
102 | return; | |
103 | } | |
104 | } | |
105 | } | |
106 | } | |
107 | } |