Jump to content

CreateProjectile


SkiZo

Recommended Posts

Hello , i don't know where is the problem .. some help ? 

i'm trying to make this work only in Dimension 1 . 

this's Client Side

function shootProjectile(localPlayer)
if ( getElementDimension ( localPlayer ) == 1 ) then
    local vehicle = getPedOccupiedVehicle(localPlayer)
    if(vehicle)then
        local x, y, z = getElementPosition(vehicle)
        createProjectile(vehicle, 19, x, y, z)
    end
end
end
--bindKey("vehicle_fire", "down", shootProjectile)
bindKey("2", "down", shootProjectile)

did not work . 

Link to comment
3 minutes ago, #BrosS said:

don't define localPlayer

function shootProjectile()

    local vehicle = getPedOccupiedVehicle(localPlayer)
    if ( getElementDimension ( vehicle ) == 1 ) then
    if(vehicle)then
    
        local x, y, z = getElementPosition(vehicle)
        createProjectile(vehicle, 19, x, y, z)
    end
end
end
bindKey("vehicle_fire", "down", shootProjectile)

No Errors.

No Work.

I'm thinking about making server side .. 

ServerSide

function shootProjectileserver()
if ( getElementDimension ( source ) == 1 and seat == 0 ) then
        triggerClientEvent (source, "shootProjectile", source)
end
end
bindKey("vehicle_fire", "down", shootProjectileserver)

Client Side

addEvent ("shootProjectile", true)
addEventHandler ("shootProjectile", getRootElement(),
function()
    local vehicle = getPedOccupiedVehicle(localPlayer)
--    if ( getElementDimension ( vehicle ) == 1 ) then
    if(vehicle)then
    
        local x, y, z = getElementPosition(vehicle)
        createProjectile(vehicle, 19, x, y, z)
    end
--    else cancelEvent()
--end
end)

but Fail To :/ 

Edited by Legend<3
Link to comment
11 minutes ago, Legend<3 said:

function shootProjectile()

    local vehicle = getPedOccupiedVehicle(localPlayer)
    if ( getElementDimension ( vehicle ) == 1 ) then
    if(vehicle)then
    
        local x, y, z = getElementPosition(vehicle)
        createProjectile(vehicle, 19, x, y, z)
    end
end
end
bindKey("vehicle_fire", "down", shootProjectile)

No Errors.

No Work.

wut ?

i've tested it and it worked

Link to comment
32 minutes ago, #BrosS said:

don't define localPlayer

 

13 minutes ago, Legend<3 said:

You test it in wich dimension .. idk why it did not work .. :/ 

 

function shootProjectile()

    vehicle = getPedOccupiedVehicle(Player)
    if ( getElementDimension ( vehicle ) == 1 ) then
    if(vehicle)then
    
        x, y, z = getElementPosition(vehicle)
        createProjectile(vehicle, 19, x, y, z)
    end
end
end
bindKey("vehicle_fire", "down", shootProjectile)

Works now?

Edited by kieran
Oops, local was still there.
Link to comment
4 minutes ago, kieran said:

 

 


function shootProjectile()

    local vehicle = getPedOccupiedVehicle(Player)
    if ( getElementDimension ( vehicle ) == 1 ) then
    if(vehicle)then
    
        local x, y, z = getElementPosition(vehicle)
        createProjectile(vehicle, 19, x, y, z)
    end
end
end
bindKey("vehicle_fire", "down", shootProjectile)

Works now?

YJhENxxjSgebqMrIY7ibpQ.png

No 

  • Like 1
Link to comment
Just now, kieran said:

@Legend<3 idk a thing about projectiles, I will try make script though.

Thank You ... 

Look Here 

function shootProjectile()
	local vehicle = getPedOccupiedVehicle(localPlayer)
	-- Only create projectile if we are inside a vehicle
	if(vehicle)then
		local x, y, z = getElementPosition(vehicle)
		createProjectile(vehicle, 19, x, y, z)
	end
end

bindKey("vehicle_fire", "down", shootProjectile)

this work fine ... but i need it work only in Dimension 1 

Link to comment
function shootProjectile()
	local vehicle = getPedOccupiedVehicle(localPlayer)
	-- Only create projectile if we are inside a vehicle
	if(vehicle)then
        if getElementDimension(vehicle) == 1 then
		   local x, y, z = getElementPosition(vehicle)
		   createProjectile(vehicle, 19, x, y, z)
        end
	end
end

bindKey("vehicle_fire", "down", shootProjectile)

 

Link to comment
2 minutes ago, Dimos7 said:

function shootProjectile()
	local vehicle = getPedOccupiedVehicle(localPlayer)
	-- Only create projectile if we are inside a vehicle
	if(vehicle)then
        if getElementDimension(vehicle) == 1 then
		   local x, y, z = getElementPosition(vehicle)
		   createProjectile(vehicle, 19, x, y, z)
        end
	end
end

bindKey("vehicle_fire", "down", shootProjectile)

 

I Don't know how but Thanks it's Work :D 

The Question Is 

How can I add Timer ? 

Shot missel 1 TIME every 3 econds .. because i shout about 10 shots in 2 seconds .. 

Link to comment
  • Moderators
function shootProjectile()
	if ( getElementDimension(localPlayer) ~= 1 or isTimer(SpamTimer) ) then return end
	local vehicle = getPedOccupiedVehicle(localPlayer)
	if ( vehicle ) then
		createProjectile(vehicle, 19, getElementPosition(vehicle))
		SpamTimer = setTimer(function ()  end,3 * 1000,1)
	end
end
bindKey("vehicle_fire", "down", shootProjectile)

 

Link to comment
7 minutes ago, !#NssoR_) said:

function shootProjectile()
	if ( getElementDimension(localPlayer) ~= 1 or isTimer(SpamTimer) ) then return end
	local vehicle = getPedOccupiedVehicle(localPlayer)
	if ( vehicle ) then
		createProjectile(vehicle, 19, getElementPosition(vehicle))
		SpamTimer = setTimer(function ()  end,3 * 1000,1)
	end
end
bindKey("vehicle_fire", "down", shootProjectile)

 

Thank You Working <3 .. one more question .. if i need it only for sit == 0 

function shootProjectile(seat, jacked)
    if ( getElementDimension(localPlayer) ~= 1 or isTimer(SpamTimer) or seat ~= 0 ) then return end
    local vehicle = getPedOccupiedVehicle(localPlayer)
    if ( vehicle ) then
        createProjectile(vehicle, 19, getElementPosition(vehicle))
        SpamTimer = setTimer(function ()  end,3 * 1000,1)
    end
end
bindKey("vehicle_fire", "down", shootProjectile)

it will be like this .. right ?? 

Link to comment
  • Moderators
function shootProjectile()
	if ( getElementDimension(localPlayer) ~= 1 or isTimer(SpamTimer) or getPedOccupiedVehicleSeat(localPlayer) ~= 0 ) then return end
	local vehicle = getPedOccupiedVehicle(localPlayer)
	if ( vehicle ) then
		createProjectile(vehicle, 19, getElementPosition(vehicle))
		SpamTimer = setTimer(function ()  end,3 * 1000,1)
	end
end
bindKey("vehicle_fire", "down", shootProjectile)

 

Link to comment
11 minutes ago, Legend<3 said:

Thank You Working <3 .. one more question .. if i need it only for sit == 0 


function shootProjectile(seat, jacked)
    if ( getElementDimension(localPlayer) ~= 1 or isTimer(SpamTimer) or seat ~= 0 ) then return end
    local vehicle = getPedOccupiedVehicle(localPlayer)
    if ( vehicle ) then
        createProjectile(vehicle, 19, getElementPosition(vehicle))
        SpamTimer = setTimer(function ()  end,3 * 1000,1)
    end
end
bindKey("vehicle_fire", "down", shootProjectile)

it will be like this .. right ?? 

Nope , remove seat, jacked and use

getPedOccupiedVehicleSeat

 

i posted that before Nssor my internet is so :~ty

Link to comment
13 minutes ago, !#NssoR_) said:

function shootProjectile()
	if ( getElementDimension(localPlayer) ~= 1 or isTimer(SpamTimer) or getPedOccupiedVehicleSeat(localPlayer) ~= 0 ) then return end
	local vehicle = getPedOccupiedVehicle(localPlayer)
	if ( vehicle ) then
		createProjectile(vehicle, 19, getElementPosition(vehicle))
		SpamTimer = setTimer(function ()  end,3 * 1000,1)
	end
end
bindKey("vehicle_fire", "down", shootProjectile)

 

Thank You So Much <3 ^_^:)  

13 minutes ago, #BrosS said:

Nope , remove seat, jacked and use


getPedOccupiedVehicleSeat

 

i posted that before Nssor my internet is so :~ty

Thank You ! ^_^ Working :D 

Link to comment

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...