Jump to content

LiOneLMeSsIShoT

Members
  • Posts

    609
  • Joined

  • Last visited

Everything posted by LiOneLMeSsIShoT

  1. ah...yes..the error is: client: :68: Bad argument @ setElementData [expected element at argument 1, got nil]
  2. Error now: :68: Bad argument @ 'setElementData' [expected element at argument 1, got nil]
  3. Tried it man...but when i try to fly..nothing happen..and no error.
  4. Yeah...asked myself where's the if statment too...but i've downloaded the script from here https://community.multitheftauto.com/index.php?p= ... ls&id=5477 and did the steps to make the players which in acl admin only who can to fly...so you may check the Descriptions..and you will understand.
  5. when the player pick up the bag then the element data set...and after he hit the marker the set element data be falsed...so he don't be able to get the money before he get the bag to marker..
  6. oh..yes man..i think in this script it should be for player? or what ..
  7. Alright i've edited it but got error now..see serveR: function flyman() (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Admin"))) end addEvent ("flyman", true) addEventHandler ("flyman", getRootElement(), flyman) local function canFly() return triggerServerEvent (localPlayer, "flyman", localplayer) end error: :60: syntax error near 'end' :60: is in server side.
  8. Alright. can you Defined it? Alright i've Defined it..but still not work.. and now when i hit the marker with the bag it says the "else" message...if i haven't the bag it says the 'else message too'.. help please. local pbags = { { 2293.154296875, 561.470703125, 7.78125 }, } local marker = createMarker ( 2291.1999511719, 537, 0.80000001192093, "cylinder", 1.5, 255, 0, 0 ) local x, y, z = unpack ( pbags [ math.random ( #pbags ) ] ) local baga = createPickup ( x, y, z, 3, 1210 ) function onPickupHit (thePlayer) if (isPedInVehicle (thePlayer)) then return end if (isPedDead( thePlayer )) then return end local bagb = createObject ( 1210, 0, 0, 0 ) setElementData ( source, "baga", true) setElementData ( source, "bagb", true) exports.bone_attach:attachElementToBone(bagb,thePlayer,12,0,0.1,0.3,0,180,0) end addEventHandler ("onPickupHit", baga, onPickupHit ) function onMarkerHit (thePlayer) if (getElementData (source, "baga") == true) and (getElementData (source, "bagb") == true) then setElementData (source, "baga",false) setElementData (source, "bagb",false) givePlayerMoney (thePlayer, math.random (1000, 2000)) outputChatBox ("You've Earned" ..getPlayerMoney(thePlayer).."", thePlayer, 0, 255, 0, false) exports.bone_attach:detachElementFromBone(bagb) else outputChatBox ("ERROR: ERROR: Script.", thePlayer, 255, 0, 0) cancelEvent() end end addEventHandler ("onMarkerHit", marker, onMarkerHit) function onPlayerQuit () exports.bone_attach:detachElementFromBone(bagb) setElementData (source, "baga", false) setElementData (source, "bagb", false) end addEventHandler ("onPlayerQuit", baga, onPlayerQuit) function onResourceStop () setElementData (source, "baga", false) setElementData (source, "bagb", false) end addEventHandler ("onResourceStop", getRootElement(), onResourceStop) function onResourceStart () setElementData (source, "baga", false) setElementData (source, "bagb", false) end addEventHandler("onResourceStart", getRootElement(),onResourceStart)
  9. I've downloaded "superman" resource from the community..and edited who can to fly to admin group in 68: line..but got error...may you help please. client: -- Copyright (c) 2008, Alberto Alonso -- -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without modification, -- are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, this -- list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright notice, this -- list of conditions and the following disclaimer in the documentation and/or other -- materials provided with the distribution. -- * Neither the name of the superman script nor the names of its contributors may be used -- to endorse or promote products derived from this software without specific prior -- written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. local Superman = {} function canceldamage() cancelEvent() end addEventHandler("onClientPedDamage", getRootElement(), canceldamage) -- Settings local ZERO_TOLERANCE = 0.00001 local MAX_ANGLE_SPEED = 6 -- In degrees per frame local MAX_SPEED = 1.0 local EXTRA_SPEED_FACTOR = 1.85 local LOW_SPEED_FACTOR = 0.40 local ACCELERATION = 0.025 local EXTRA_ACCELERATION_FACTOR = 1.8 local LOW_ACCELERATION_FACTOR = 0.85 local TAKEOFF_VELOCITY = 1.75 local TAKEOFF_FLIGHT_DELAY = 750 local SMOKING_SPEED = 1.25 local GROUND_ZERO_TOLERANCE = 0.18 local LANDING_DISTANCE = 3.2 local FLIGHT_ANIMLIB = "swim" local FLIGHT_ANIMATION = "Swim_Dive_Under" local FLIGHT_ANIM_LOOP = false local IDLE_ANIMLIB = "cop_ambient" local IDLE_ANIMATION = "Coplook_loop" local IDLE_ANIM_LOOP = true local MAX_Y_ROTATION = 55 local ROTATION_Y_SPEED = 3.8 -- Static global variables local thisResource = getThisResource() local rootElement = getRootElement() local localPlayer = getLocalPlayer() local serverGravity = getGravity() -- -- Check for admin privileges -- local function canFly() return (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Admin"))) end -- -- Utility functions -- local function isPlayerFlying(player) local data = getElementData(player, "superman:flying") if not data or data == false then return false else return true end end local function setPlayerFlying(player, state) if state == true then state = true else state = false end setElementData(player, "superman:flying", state) end local function iterateFlyingPlayers() local current = 1 local allPlayers = getElementsByType("player") return function() local player repeat player = allPlayers[current] current = current + 1 until not player or (isPlayerFlying(player) and isElementStreamedIn(player)) return player end end function Superman:restorePlayer(player) setPlayerFlying(player, false) setPedAnimation(player, false) setElementVelocity(player, 0, 0, 0) setElementRotation(player, 0, 0, 0) --setPedRotation(player, getPedRotation(player)) setElementCollisionsEnabled(player, true) self:destroySmokeGenerators(player) self.rotations[player] = nil self.previousVelocity[player] = nil end function Superman:createSmokeGenerator(player) local generator = createObject(2780, getElementPosition(player)) setElementCollisionsEnabled(generator, false) setObjectScale(generator, 0) return generator end function Superman:createSmokeGenerators(player) if not self.smokeGenerators[player] then local smokeGenerators = {} smokeGenerators[1] = self:createSmokeGenerator(player) attachElements(smokeGenerators[1], player, 0.75, -0.2, -0.4, -40, 0, 60) smokeGenerators[2] = self:createSmokeGenerator(player) attachElements(smokeGenerators[2], player, -0.75, -0.2, -0.4, -40, 0, -60) self.smokeGenerators[player] = smokeGenerators end end function Superman:destroySmokeGenerators(player) if self.smokeGenerators[player] then for k, v in ipairs(self.smokeGenerators[player]) do destroyElement(v) end self.smokeGenerators[player] = nil end end function angleDiff(angle1, angle2) angle1, angle2 = angle1 % 360, angle2 % 360 local diff = (angle1 - angle2) % 360 if diff <= 180 then return diff else return -(360 - diff) end end local function isElementInWater(ped) local pedPosition = Vector3D:new(getElementPosition(ped)) if pedPosition.z <= 0 then return true end local waterLevel = getWaterLevel(pedPosition.x, pedPosition.y, pedPosition.z) if not isElementStreamedIn(ped) or not waterLevel or waterLevel < pedPosition.z then return false else return true end end local function isnan(x) math.inf = 1/0 if x == math.inf or x == -math.inf or x ~= x then return true end return false end local function getVector2DAngle(vec) if vec.x == 0 and vec.y == 0 then return 0 end local angle = math.deg(math.atan(vec.x / vec.y)) + 90 if vec.y < 0 then angle = angle + 180 end return angle end -- -- Initialization and shutdown functions -- function Superman.Start() local self = Superman -- Register events addEventHandler("onClientResourceStop", getResourceRootElement(thisResource), Superman.Stop, false) addEventHandler("onPlayerJoin", rootElement, Superman.onJoin) addEventHandler("onPlayerQuit", rootElement, Superman.onQuit) addEventHandler("onClientRender", rootElement, Superman.processControls) addEventHandler("onClientRender", rootElement, Superman.processFlight) addEventHandler("onClientPlayerDamage", localPlayer, Superman.onDamage, false) addEventHandler("onClientElementDataChange", rootElement, Superman.onDataChange) addEventHandler("onClientElementStreamIn", rootElement, Superman.onStreamIn) addEventHandler("onClientElementStreamOut", rootElement, Superman.onStreamOut) -- Bind keys bindKey("jump", "down", Superman.onJump) -- Register commands addCommandHandler("superman", Superman.cmdSuperman) -- Initializate attributes self.smokeGenerators = {} self.rotations = {} self.previousVelocity = {} end addEventHandler("onClientResourceStart", getResourceRootElement(thisResource), Superman.Start, false) function Superman.Stop() local self = Superman setGravity(serverGravity) -- Restore all players animations, collisions, etc for player in iterateFlyingPlayers() do self:restorePlayer(player) end end -- -- Join/Quit -- function Superman.onJoin(player) local self = Superman local player = player or source setPlayerFlying(player, false) end function Superman.onQuit(reason, player) local self = Superman local player = player or source if isPlayerFlying(player) then self:restorePlayer(player) end end -- -- onDamage: superman is invulnerable -- function Superman.onDamage() local self = Superman
  10. whatever i did exports.bone_attach:detachElementFromBone(bagb) to remove the object from the bone..but not work. in onMarkerHit
  11. Alright..i understand now removed that element data from the function...anyway now the bone attach don't be destroyed when i hit the marker...and no errors...can you help me with this?
  12. Anyway i've fixed it...but now i get error here :41: bad argument @ 'setElementData' element at argument 1, got resource-data script now: local pbags = { { 2293.154296875, 561.470703125, 7.78125 }, } local marker = createMarker ( 2291.1999511719, 537, 0.80000001192093, "cylinder", 1.5, 255, 0, 0 ) local x, y, z = unpack ( pbags [ math.random ( #pbags ) ] ) local baga = createPickup ( x, y, z, 3, 1210 ) function onPickupHit ( thePlayer ) if ( isPedInVehicle ( thePlayer ) ) then return end if ( isPedDead ( thePlayer ) ) then return end local bagb = createObject ( 1210, 0, 0, 0 ) setElementData ( thePlayer, "baga", true ) exports.bone_attach:attachElementToBone(bagb,thePlayer,12,0,0.1,0.3,0,180,0) end addEventHandler ("onPickupHit", baga, onPickupHit ) function onMarkerHit (thePlayer) if getElementData (thePlayer, "baga") and getElementData (thePlayer,"baga") == true then givePlayerMoney (thePlayer, math.random (1000, 2000)) outputChatBox ("You have Earned your Rewards", thePlayer, 0, 255, 0, false) setElementData (thePlayer, "baga", false) exports.bone_attach:detachElementFromBone(bagb) else outputChatBox ("get The Bag First", thePlayer, 255, 0, 0) cancelEvent() end end addEventHandler ("onMarkerHit", marker, onMarkerHit) function onPlayerQuit (thePlayer) exports.bone_attach:detachElementFromBone(bagb) setElementData (thePlayer, "baga", false) end addEventHandler ("onPlayerQuit", baga, onPlayerQuit) function onResourceStop (thePlayer) exports.bone_attach:detachElementFromBone(bagb) setElementData (thePlayer, "baga", false) end addEventHandler ("onResourceStop", getRootElement(), onResourceStop)
  13. Dude...The x, y, z was For the TAble i made for the spawns....understand what i mean? check the script in up.
  14. If you tell me what's wrong, yes. Same error? Different error? Same Errors now + :6: bad Argument @ 'createPickup'
  15. as you words.. i have moved the pickup out from the function to create it out...but got Error now on it...and YEs i have notebad++ local pbags = { { 2293.154296875, 561.470703125, 7.78125 }, } local marker = createMarker ( 2291.1999511719, 537, 0.80000001192093, "cylinder", 1.5, 255, 0, 0 ) local baga = createPickup ( x, y, z, 3, 1210 ) function createBags ( thePlayer ) local x, y, z = unpack ( pbags [ math.random ( #pbags ) ] ) end addEventHandler ( "onResourceStart", getRootElement(), createBags ) function onPickupHit ( thePlayer ) if ( isPedInVehicle ( thePlayer ) ) then return end if ( isPedDead ( thePlayer ) ) then return end local bagb = createObject ( 1210, 0, 0, 0 ) setElementData ( thePlayer, "baga", true ) exports.bone_attach:attachElementToBone(bagb,thePlayer,12,0,0.1,0.3,0,180,0) end addEventHandler ("onPickupHit", baga, onPickupHit ) function onMarkerHit (thePlayer) if getElementData (thePlayer, "baga") and getElementData (thePlayer,"baga") == true then givePlayerMoney (thePlayer, math.random (1000, 2000)) outputChatBox ("You have Earned your Rewards", thePlayer, 0, 255, 0, false) setElementData (thePlayer, "baga", false) exports.bone_attach:detachElementFromBone(bagb) else outputChatBox ("get The Bag First", thePlayer, 255, 0, 0) cancelEvent() end end addEventHandler ("onMarkerHit", marker, onMarkerHit) function onPlayerQuit (thePlayer) exports.bone_attach:detachElementFromBone(bagb) setElementData (thePlayer, "baga", false) end addEventHandler ("onPlayerQuit", baga, onPlayerQuit) function onResourceStop (thePlayer) exports.bone_attach:detachElementFromBone(bagb) setElementData (thePlayer, "baga", false) end addEventHandler ("onResourceStop", getRootElement(), onResourceStop) what the problem now?
  16. Alright when i out the functions i get Errors :24: Bad Argument @ 'addEventHandler', argument 2 got nil :41: bad argument 'addEventHandler' argument 2 got nil ... i think all functions will get the same because h must add them to onResourceStart...or what do you think?
  17. I got script error when i start the resource.... serverSide: local pbags = { { 2293.154296875, 561.470703125, 7.78125 }, } local marker = createMarker ( 2291.1999511719, 537, 0.80000001192093, "cylinder", 1.5, 255, 0, 0 ) function createBags ( thePlayer ) local x, y, z = unpack ( pbags [ math.random ( #pbags ) ] ) local baga = createPickup ( x, y, z, 3, 1210 ) addEventHandler ("onPickupHit", baga, onPickupHit ) addEventHandler ("onPlayerQuit", baga, onPlayerQuit) addEventHandler ("onMarkerHit", marker, onMarkerHit) addEventHandler ("onResourceStop", getRootElement(), onResourceStop) end addEventHandler ( "onResourceStart", getRootElement(), createBags ) function onPickupHit ( thePlayer ) if ( isPedInVehicle ( thePlayer ) ) then return end if ( isPedDead ( thePlayer ) ) then return end local bagb = createObject ( 1210, 0, 0, 0 ) setElementData ( thePlayer, "baga", true ) exports.bone_attach:attachElementToBone(bagb,thePlayer,12,0,0.1,0.3,0,180,0) end function onMarkerHit (thePlayer) if getElementData (thePlayer, "baga") and getElementData (thePlayer,"baga") == true then givePlayerMoney (thePlayer, math.random (1000, 2000)) outputChatBox ("You have Earned your Rewards", thePlayer, 0, 255, 0, false) setElementData (thePlayer, "baga", false) exports.bone_attach:detachElementFromBone(bagb) else outputChatBox ("get The Bag First", thePlayer, 255, 0, 0) cancelEvent() end end function onPlayerQuit (thePlayer) exports.bone_attach:detachElementFromBone(bagb) setElementData (thePlayer, "baga", false) end function onResourceStop (thePlayer) exports.bone_attach:detachElementFromBone(bagb) setElementData (thePlayer, "baga", false) end Also the bone attached don't be removed when i hit the marker ..help please! Errors: :46: Bad arguemnt @ 'setElementData' [Expected element at argument 1, got resource-data]
  18. Alright so what sohuld i do on this. check the wiki Check the wiki? can you help me with fixing the script man???
  19. Alright so what sohuld i do on this.
  20. so i do onMarkerHit? Tried..not works too.
×
×
  • Create New...