HunT Posted May 28, 2011 Posted May 28, 2011 (edited) local sorry = sorry for my patetic eng. findPlayer = namepart ------------------------- hi guys i have problem for stop function createProjectile This script give granate to player with command.But give granate for ever and no one time (one map) serverside : function granate (thePlayer, commandName, ...) player = findPlayer(...) if not player then outputChatBox("* /givegran: player not found", thePlayer) elseif isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) local x, y, z = getElementPosition ( vehicle ) local rx, ry, rz = getVehicleRotation ( vehicle ) local shark = createObject ( 1608, x, y, z, rx, ry, rz ) attachElements ( shark, vehicle, 0, -3.5, 0, 0, 0, 0) setElementAlpha(vehicle, 0) setElementAlpha(player, 0) triggerClientEvent ("shark_key", getRootElement (), object) end end addCommandHandler("givegran", granate) client side : addEvent ("shark_key", true) function fire_rocket () local x, y, z = getElementPosition (getPedOccupiedVehicle (getLocalPlayer())) createProjectile ( getLocalPlayer(), 16, x, y, z + 1, 1.0, 0, rx, ry, rz) end function bind_key_function () bindKey ("mouse2", "down", fire_rocket) local attachedElements = getAttachedElements ( getPedOccupiedVehicle (getLocalPlayer()) ) for ElementKey, ElementValue in ipairs ( attachedElements ) do setElementCollisionsEnabled (ElementValue, false) end end addEventHandler ("shark_key", getLocalPlayer(), bind_key_function) help please and "sorry" Edited May 28, 2011 by Guest @Huntone_
karlis Posted May 28, 2011 Posted May 28, 2011 please use tags! it helps a lot seeing isn't there a syntax error, etc.rx,ry,rz is not defined,and theres no object defined, use triggerClientEvent ("shark_key", getRootElement (),player) [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
HunT Posted May 28, 2011 Author Posted May 28, 2011 please use tags! it helps a lot seeing isn't there a syntax error, etc.rx,ry,rz is not defined,and theres no object defined, use triggerClientEvent ("shark_key", getRootElement (),player)The script work with and without rx,ry,rz.getRootElement (),player)orgetRootElement (),object)Player have granate for ever @Huntone_
karlis Posted May 28, 2011 Posted May 28, 2011 player obviously, object doesn't have a client -.- [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
HunT Posted May 28, 2011 Author Posted May 28, 2011 getRootElement (),player) no work and setTimer (destroyElement no work The Player have always granate why? @Huntone_
karlis Posted May 28, 2011 Posted May 28, 2011 1)your now talking about code we don't see, show it 2)use [ /code] or i refuse to help you. [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
HunT Posted May 28, 2011 Author Posted May 28, 2011 1)your now talking about code we don't see, show it2)use [ /code] or i refuse to help you.Karlis i edit the code in lua This script work.The problem is stop function on nextmap in race mode.createObject stopsetElementAlpha stopcreateProjectile no stopwhy createProjectile is client? @Huntone_
karlis Posted May 29, 2011 Posted May 29, 2011 omg, then POST the script theres no timer in that code [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
HunT Posted May 29, 2011 Author Posted May 29, 2011 omg, then POST the scripttheres no timer in that code timer ?? I have more commands with minigun ramp etc.. and automatic remove the mg or ramp on nextmap. @Huntone_
Moderators Citizen Posted June 3, 2011 Moderators Posted June 3, 2011 Hi, Try this ( not tested ): Server: function granate (thePlayer, commandName, ...) local player = findPlayer(...) if not player then outputChatBox("* /givegran: player not found", thePlayer) elseif isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) local x, y, z = getElementPosition ( vehicle ) local rx, ry, rz = getVehicleRotation ( vehicle ) local shark = createObject ( 1608, x, y, z, rx, ry, rz ) attachElements ( shark, vehicle, 0, -3.5, 0, 0, 0, 0) setElementAlpha(vehicle, 0) setElementAlpha(player, 0) triggerClientEvent (player, "shark_key", getRootElement ()) end end addCommandHandler("givegran", granate) Client: addEvent ("shark_key", true) function fire_rocket () -- is it a rocket or a grenade ??? local x, y, z = getElementPosition (getPedOccupiedVehicle (getLocalPlayer())) local rx, ry, rz = getElementRotation(getPedOccupiedVehicle (getLocalPlayer())) createProjectile ( getLocalPlayer(), 16, x, y, z + 1, 1.0, 0, rx, ry, rz) end function bind_key_function () bindKey ("mouse2", "down", fire_rocket) local attachedElements = getAttachedElements ( getPedOccupiedVehicle (getLocalPlayer()) ) for ElementKey, ElementValue in ipairs ( attachedElements ) do setElementCollisionsEnabled (ElementValue, false) end end addEventHandler ("shark_key", getLocalPlayer(), bind_key_function) The rEvolution is coming ...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now