Jump to content

Dogfighting script failing...


Recommended Posts

Posted

I am plum out of revision ideas on this one, guys... any help would be greatly appreciated. I'm adding missile functionality to the Rustler using projectile 19 (non-heatseeking rocket), and limiting the ammo to 4 shots, one per function per onVehicleEnter (I hope, the counter involved and all that are far from my mind at this phase). For some reason, I can't get this damned clientside script to parse no matter what I change. This is what I have so far for beta...

function rustlerMissile1 (player)
theRustler = getPedOccupiedVehicle (player)
if (theRustler) then
local x, y, z = getElementPosition (theRustler)
local rx, ry, rz = getElementRotation (theRustler)
if getElementID(theRustler) ~= 476 then return else
createProjectile (getLocalPlayer(), 19, x-2, y, z-4, 1.0, nil, rx, ry, rz)
outputChatBox ( "* " .. getPlayerName(player) .. ", fox-1.", player, 255, 0, 0 )
end
end
end
 
addCommandHandler ("fox1", rustlerMissile1)
 
 
function rustlerMissile2 (player)
theRustler = getPedOccupiedVehicle (player)
if (theRustler) then
local x, y, z = getElementPosition (theRustler)
local rx, ry, rz = getElementRotation (theRustler)
if getElementID(theRustler) ~= 476 then return else
createProjectile (getLocalPlayer(), 19, x+2, y, z-4, 1.0, nil, rx, ry, rz)
outputChatBox ( "* " .. getPlayerName(player) .. ", fox-2.", player, 255, 0, 0 )
end
end
end
 
addCommandHandler ("fox2", rustlerMissile2)
 
 
function rustlerMissile3 (player)
theRustler = getPedOccupiedVehicle (player)
if (theRustler) then
local x, y, z = getElementPosition (theRustler)
local rx, ry, rz = getElementRotation (theRustler)
if getElementID(theRustler) ~= 476 then return else
createProjectile (getLocalPlayer(), 19, x-5, y, z-4, 1.0, nil, rx, ry, rz)
outputChatBox ( "* " .. getPlayerName(player) .. ", fox-3.", player, 255, 0, 0 )
end
end
end
 
addCommandHandler ("fox3", rustlerMissile3)
 
 
function rustlerMissile4 (player)
theRustler = getPedOccupiedVehicle (player)
if (theRustler) then
local x, y, z = getElementPosition (theRustler)
local rx, ry, rz = getElementRotation (theRustler)
if getElementID(theRustler) ~= 476 then return else
createProjectile (getLocalPlayer(), 19, x+5, y, z-4, 1.0, nil, rx, ry, rz)
outputChatBox ( "* " .. getPlayerName(player) .. ", fox-4.", player, 255, 0, 0 )
end
end
end
 
addCommandHandler ("fox4", rustlerMissile4)

Any ideas? I get no errors in console, no outputs to the chatbox, no missile, nothing. Resource is recognized, refreshed each time, console confirms all that.

"Don't try and be a great man, just be a man; and let history make the call."

Posted

put some outputDebugString every few lines (after new function, "if", etc) and try to find your bug

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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