Jump to content

Help spawn police


VenomOG

Recommended Posts

Posted

onPlayerWasted

getZoneName (enable the 4th argument "citiesonly")

For the spawn locations, I recommend using a table with cities as key with their respective coordinates.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

Something like this:

local copSpawnLocs = {
	["Los Santos"] = { x, y, z, rot },
	["Las venturas"] = { x, y, z, rot },
	["San fierro"] = { x, y, z, rot }
}
addEventHandler( "onPlayerWasted", getRootElement( ),
	function()
		if getPlayerTeam(source) and getPlayerTeam(source) == "SAPD" then
			local px,py = getElementPosition(source)
			local tpos = copSpawnLocs[ getZoneName( px, py, 0, true ) ]
			if tpos then
				setTimer( function(player)
					local sx, sy, sz, srot = unpack(tpos)
					spawnPlayer( player, sx, sy, sz, srot )
				end, 2000, 1, source )
			end
		end
	end
)

And of course, you need edit the table with all the cities of San Andreas and the spawn coordinates.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

Okay, Thanks

if i did

Spoiler

local copTeams = {
		             ["Government"]
		             ["Law Enforcement"]				
			

how can i make the script check for tose teams when player dies

Posted
local copTeams = {
	["Government"] = true,
	["Law Enforcement"] = true
}

local team = getPlayerTeam(player)
if copTeams[getTeamName(team)] then

end

 

Please do not PM me with scripting related question nor support, use the forums instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...