View difference between Paste ID: W0cPdNT8 and Hy6p9ajN
SHOW: | | - or go back to the newest paste.
1
local SWATteam = {}
2
3
local lastTick = 0
4-
	local playerPed = PLAYER.PLAYER_PED_ID()
4+
5-
	local player = PLAYER.GET_PLAYER_PED(playerPed)
5+
6-
	local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)
6+
	if lastTick + 1 > os.time() then
7-
	if(PLAYER.IS_PLAYER_ONLINE() and playerExists) then
7+
		lastTick = os.time()
8-
		if(get_key_pressed(114)) then
8+
		local playerPed = PLAYER.PLAYER_PED_ID()
9-
			local veh = PED.GET_VEHICLE_PED_IS_IN(playerPed,true)
9+
		local player = PLAYER.GET_PLAYER_PED(playerPed)
10-
			local SWATskinID = GAMEPLAY.GET_HASH_KEY("s_m_y_swat_01")
10+
		local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)
11-
			local coords = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0);
11+
		if(PLAYER.IS_PLAYER_ONLINE() and playerExists) then
12-
			STREAMING.REQUEST_MODEL(SWATskinID)
12+
			if(get_key_pressed(114)) then
13-
			local SWAT = PED.CREATE_PED( 26,SWATskinID,coords.x, coords.y, coords.z,0,false,true)
13+
				local veh = PED.GET_VEHICLE_PED_IS_IN(playerPed,true)
14-
			local group = PLAYER.GET_PLAYER_GROUP(PLAYER.PLAYER_ID());
14+
				local SWATskinID = GAMEPLAY.GET_HASH_KEY("s_m_y_swat_01")
15-
			PED.SET_PED_AS_GROUP_MEMBER(SWAT, group);
15+
				local coords = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0);
16-
			AI.TASK_COMBAT_HATED_TARGETS_AROUND_PED(SWAT, 5000, 0);
16+
				STREAMING.REQUEST_MODEL(SWATskinID)
17-
			PED.SET_PED_KEEP_TASK(SWAT, true);
17+
				local SWAT = PED.CREATE_PED( 26,SWATskinID,coords.x, coords.y, coords.z,0,false,true)
18-
			WEAPON.GIVE_DELAYED_WEAPON_TO_PED(SWAT, GAMEPLAY.GET_HASH_KEY("weapon_specialcarbine"), 5, true);
18+
				local group = PLAYER.GET_PLAYER_GROUP(PLAYER.PLAYER_ID());
19-
			ENTITY.SET_ENTITY_INVINCIBLE(SWAT, false);
19+
				PED.SET_PED_AS_GROUP_MEMBER(SWAT, group);
20-
			
20+
				AI.TASK_COMBAT_HATED_TARGETS_AROUND_PED(SWAT, 5000, 0);
21
				PED.SET_PED_KEEP_TASK(SWAT, true);
22
				WEAPON.GIVE_DELAYED_WEAPON_TO_PED(SWAT, GAMEPLAY.GET_HASH_KEY("weapon_specialcarbine"), 5, true);
23
				ENTITY.SET_ENTITY_INVINCIBLE(SWAT, false);
24
				
25
			end	
26
		end
27
	end
28
end
29
30
return SWATteam