Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ped gameped[12];
- Group Bgroup;
- Ped pPlayer = GetPlayerPed();
- //This script will only work if using a menu based off Muskelprotze's Stash
- //This will delete spawned guards one by one
- void delete_spawnguards(void){
- GET_PLAYER_GROUP(GetPlayerIndex(), &Bgroup);
- uint test,guards;
- GET_GROUP_SIZE(Bgroup, &test, &guards);
- if(guards <= 0){
- print("No guards exist");
- return;
- }
- if(DOES_GROUP_EXIST(Bgroup)){
- for(i = 0;i <= 11; i++){
- if(DOES_CHAR_EXIST(gameped[i])){
- DELETE_CHAR(&gameped[i]);
- print("1 was Guard Deleted");
- return;
- }
- if((i >= 11) || (i > 10)) return;
- }
- print("No guards exist");
- return;
- }
- return;
- }
- // This will spawn guards one by one and label them as gameped[#]
- // So that they can be indivdually called as gameped[#] (upto 11)
- // Example usage:
- // spawnguards(MODEL_IG_DWAYNE, WEAPON_M4);
- void spawnguards(uint model, uint weapon){
- GET_PLAYER_GROUP(GetPlayerIndex(), &Bgroup);
- if(!DOES_GROUP_EXIST(Bgroup)){
- CREATE_GROUP(0, Bgroup, true);
- SET_GROUP_LEADER(Bgroup, pPlayer);
- SET_GROUP_SEPARATION_RANGE(Bgroup, 9999.9);
- SET_GROUP_FORMATION(Bgroup, 2);
- }
- uint test,guards;
- GET_GROUP_SIZE(Bgroup, &test, &guards);
- if(guards >= 11){
- print("Max guards (11) exceeded");
- return;
- }
- for(i = 0;i <= 11; i++){
- if(!DOES_CHAR_EXIST(gameped[i])){
- REQUEST_MODEL(model);
- while (!HAS_MODEL_LOADED(model)) WAIT(0);
- WAIT(100);
- GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS(pPlayer, 0, 2, 0, &x, &y, &z);
- CREATE_CHAR(26, model, x,y,z, &gameped[i], true);
- WAIT(500);
- SET_CHAR_RANDOM_COMPONENT_VARIATION(gameped[i]);
- SET_GROUP_MEMBER(Bgroup, gameped[i]);
- SET_CHAR_RELATIONSHIP_GROUP(gameped[i], 24);
- SET_CHAR_RELATIONSHIP(gameped[i], 5, 0);
- SET_CHAR_NEVER_LEAVES_GROUP(gameped[i], true);
- SET_CHAR_ACCURACY(gameped[i], 100);
- SET_CHAR_KEEP_TASK(gameped[i], true);
- SET_SENSE_RANGE(gameped[i], 100.0);
- SET_PED_GENERATES_DEAD_BODY_EVENTS(gameped[i], true);
- SET_CHAR_SHOOT_RATE(gameped[i], 100);
- SET_CHAR_WILL_DO_DRIVEBYS(gameped[i], true);
- SET_CHAR_SIGNAL_AFTER_KILL(gameped[i], true);
- SET_CHAR_WILL_USE_CARS_IN_COMBAT(gameped[i], true);
- SET_CHAR_WILL_FLY_THROUGH_WINDSCREEN(gameped[i], false);
- SET_CHAR_INVINCIBLE(gameped[i], true);
- SET_CHAR_PROVIDE_COVERING_FIRE(gameped[i], true);
- SET_CHAR_CANT_BE_DRAGGED_OUT(gameped[i], true);
- SET_CHAR_STAY_IN_CAR_WHEN_JACKED(gameped[i], true);
- SET_PED_DONT_DO_EVASIVE_DIVES(gameped[i], true);
- SET_PED_PATH_MAY_DROP_FROM_HEIGHT(gameped[i], true);
- SET_PED_PATH_MAY_USE_CLIMBOVERS(gameped[i], true);
- SET_PED_PATH_MAY_USE_LADDERS(gameped[i], true);
- UpdateWeaponOfPed(gameped[i], weapon);
- SET_CURRENT_CHAR_WEAPON(gameped[i], weapon, true);
- print("Spawned Bodyguard");
- return;
- }
- }
- return;
- }
- //This is a function that will send all the spawned guards to kill a certain player
- if(DOES_CHAR_EXIST(players[index].ped)){
- GET_PLAYER_GROUP(GetPlayerIndex(), &Bgroup);
- if(DOES_GROUP_EXIST(Bgroup)){
- for(i = 0;i <= 11; i++){
- if(DOES_CHAR_EXIST(gameped[i]) && DOES_CHAR_EXIST(players[index].ped)){
- TASK_COMBAT(gameped[i], players[index].ped);
- if((i >= 11) || (i > 10)){
- print("Sent all Guards after the Player");
- return;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement