Hello, I've got lots of shooter maps which have no shooting script. The thing is that they are so much it would take more than a day work to add the script to every map. I wrote something but for some reason it's not working, I am new into scripting and I need some help.
Client:
local shootingAllowed = true
function playerSpawn()
shootingAllowed = true
end
addEventHandler("onClientPlayerSpawn", getLocalPlayer(), playerSpawn)
function doShoot()
if isShooterMap then
if shootingAllowed == true then
if not isPlayerDead(getLocalPlayer()) then
shootingAllowed = false
local theVehicle = getPedOccupiedVehicle(getLocalPlayer())
local x,y,z = getElementPosition(theVehicle)
local rX,rY,rZ = getVehicleRotation(theVehicle)
local x = x+4*math.cos(math.rad(rZ+90))
local y = y+4*math.sin(math.rad(rZ+90))
createProjectile(theVehicle, 19, x, y, z, 1.0, nil)
setTimer(allowShooting, 3000, 1)
end
end
end
function allowShooting()
shootingAllowed = true
end
for keyName, state in pairs(getBoundKeys("fire")) do
bindKey(keyName, "down", doShoot)
end
Server:
function isMapShooter()
return string.find(g_MapInfo.name,"Shooter")
end
Any help is appreciated!