Chris!i! Posted August 26, 2014 Share Posted August 26, 2014 Well i found a scrit on the community i need help on it and its kind of abusing for players i want to make it only for admins any help please --Server function grapplewarp ( wallstick, hx, hy, hz, angle, groundshot) local theVehicle = getPedOccupiedVehicle ( source ) if ( theVehicle ) then removePedFromVehicle (source) local carpurpose = (getElementData ( theVehicle, "purpose" )) if (carpurpose == "grapple") then destroyElement(theVehicle) end end setPedRotation ( source, angle ) local grapplegunslot = getPedWeaponSlot ( source ) local px,py,pz = getElementPosition(source) local pedrot = getPedRotation ( source ) local invisithing = createObject ( 1337, px, py, pz, 0, 0, pedrot ) setElementAlpha(invisithing, 0) moveObject ( invisithing, 1000, hx, hy, hz, 0, 0, angle - 180) attachElements ( source, invisithing, 0, 0, 0) setPedAnimation ( source, "PARACHUTE", "FALL_SkyDive_Accel", -1, false, true, true) local theplayer = source setTimer ( wallcling, 1000, 1, theplayer, wallstick, hx, hy, hz, angle, groundshot, grapplegunslot ) setTimer ( destroyElement, 1000, 1, invisithing) if (groundshot == 1) then setTimer ( landingonground, 1000, 1, theplayer) end end addEvent( "ongrapple", true ) addEventHandler( "ongrapple", getRootElement(), grapplewarp ) function wallcling (theplayer, wallstick, hx, hy, hz, angle, groundshot, grapplegunslot) if (groundshot == 2) then wallstick = createVehicle ( 522, hx, hy, hz, 120, 0, angle ) else wallstick = createVehicle ( 522, hx, hy, hz, 30, 0, angle ) end toggleControl ( theplayer, "horn", false ) showPlayerHudComponent ( theplayer, "vehicle_name", false ) setElementData ( wallstick, "purpose", "grapple" ) setVehicleFrozen (wallstick, true) setElementAlpha(wallstick, 0) warpPedIntoVehicle ( theplayer, wallstick ) setVehicleEngineState ( wallstick, false ) setPedDoingGangDriveby (theplayer, false ) setPedWeaponSlot ( theplayer, grapplegunslot ) setTimer ( restartgrapple, 500, 1, theplayer) end function restartgrapple (source) setPedDoingGangDriveby (source, true ) end function exitVehicle ( thePlayer, seat, jacked ) local carpurpose = (getElementData ( source, "purpose" )) if (carpurpose == "grapple") then toggleControl ( thePlayer, "horn", true ) showPlayerHudComponent ( thePlayer, "vehicle_name", true ) removePedFromVehicle (thePlayer) destroyElement(source) end end addEventHandler ( "onVehicleStartExit", getRootElement(), exitVehicle ) function landingonground (theplayer) local theVehicle = getPedOccupiedVehicle ( theplayer ) if ( theVehicle ) then local carpurpose = (getElementData ( theVehicle, "purpose" )) if (carpurpose == "grapple") then toggleControl ( theplayer, "horn", true ) showPlayerHudComponent ( theplayer, "vehicle_name", true ) removePedFromVehicle (theplayer) destroyElement(theVehicle) end end end addEvent( "ongrapplejump", true ) addEventHandler( "ongrapplejump", getRootElement(), landingonground) function getoff () local theVehicle = getPedOccupiedVehicle ( source ) if ( theVehicle ) then local carpurpose = (getElementData ( theVehicle, "purpose" )) if (carpurpose == "grapple") then toggleControl ( source, "horn", true ) showPlayerHudComponent ( source, "vehicle_name", true ) removePedFromVehicle (source) destroyElement(theVehicle) end end end addEventHandler( "onPlayerWasted", getRootElement(), getoff) addEventHandler( "onPlayerQuit", getRootElement(), getoff) function gluePlayer( vehicle, x, y, z, rotX, rotY, rotZ) local theVehicle = getPedOccupiedVehicle ( source ) if ( theVehicle ) then local carpurpose = (getElementData ( theVehicle, "purpose" )) if (carpurpose == "grapple") then attachElementToElement(theVehicle, vehicle, x, y, z, rotX, rotY, rotZ) end end end addEvent("gluePlayer",true) addEventHandler("gluePlayer",getRootElement(),gluePlayer) --Client --SETTINGS grapplegun = 23 --WHICH GUN WILL BE USED AS A GRAPPLE? gunrange = 5000 --HOW FAR WILL THE GRAPPLE RANGE BE? --DO NOT ALTER ANYTHING BELOW HERE if gunrange > 150 then gunrange = 150 end local processingPlayers = {} local root = getRootElement() local keys = getBoundKeys ( "Jump" ) function jumped () local theVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( theVehicle ) then local carpurpose = (getElementData ( theVehicle, "purpose" )) if (carpurpose == "grapple") then triggerServerEvent ( "ongrapplejump", getLocalPlayer(), getLocalPlayer() ) end end end if keys then for i,keyName in ipairs(keys) do bindKey ( keyName, "down", jumped ) end end function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) if weapon == grapplegun then if source == getLocalPlayer() then toggleControl ( "fire", false ) setTimer ( toggleControl, 1200, 1, "fire", true ) toggleControl ( "vehicle_fire", false ) setTimer ( toggleControl, 1200, 1, "vehicle_fire", true ) if (hitElement) then if getElementType(hitElement) == "vehicle" then px = hitX py = hitY pz = hitZ local vx, vy, vz = getElementPosition(hitElement) local sx = px - vx local sy = py - vy local sz = pz - vz local x, y, z, lx, ly, lz = getCameraMatrix() local camangle = ( 360 - math.deg ( math.atan2 ( ( x - lx ), ( y - ly ) ) ) ) % 360 local rotpX = 30 local rotpY = 0 local rotpZ = camangle-180 local rotvX,rotvY,rotvZ = getVehicleRotation(hitElement) local t = math.rad(rotvX) local p = math.rad(rotvY) local f = math.rad(rotvZ) local ct = math.cos(t) local st = math.sin(t) local cp = math.cos(p) local sp = math.sin(p) local cf = math.cos(f) local sf = math.sin(f) local z = ct*cp*sz + (sf*st*cp + cf*sp)*sx + (-cf*st*cp + sf*sp)*sy local x = -ct*sp*sz + (-sf*st*sp + cf*cp)*sx + (cf*st*sp + sf*cp)*sy local y = st*sz - sf*ct*sx + cf*ct*sy local rotX = rotpX - rotvX local rotY = rotpY - rotvY local rotZ = rotpZ - rotvZ setTimer ( triggerServerEvent, 1200, 1,"gluePlayer", source, hitElement, x, y, z, rotX, rotY, rotZ ) end end setRadioChannel (0) local x, y, z = getPedTargetStart(getLocalPlayer()) local lx, ly, lz = getPedTargetEnd(getLocalPlayer()) local camlen = getDistanceBetweenPoints3D(x, y, z, lx, ly, lz) local fromX, fromY, fromZ = getPedBonePosition(getLocalPlayer(), 26) local toX = fromX + (lx - x)/camlen*gunrange local toY = fromY + (ly - y)/camlen*gunrange local toZ = fromZ + (lz - z)/camlen*gunrange local hit, hitX, hitY, hitZ = processLineOfSight(fromX, fromY, fromZ, toX, toY, toZ, true, true, false, true, false, true, true) groundshot = 0 if hit then if fromZ > hitZ then local len = getDistanceBetweenPoints3D(fromX, fromY, fromZ, hitX, hitY, hitZ) local hitX = fromX + (hitX - fromX)/len*(len - .5) local hitY = fromY + (hitY - fromY)/len*(len - .5) local ground = getGroundPosition ( hitX, hitY, hitZ + 1 ) local distance = (getDistanceBetweenPoints3D (hitX, hitY, hitZ, hitX, hitY, ground)) if distance < .3 then hitZ = hitZ + 1 groundshot = 1 end elseif fromZ < hitZ then local len = getDistanceBetweenPoints3D(fromX, fromY, fromZ, hitX, hitY, hitZ) local hitX = fromX + (hitX - fromX)/len*(len - .5) local hitY = fromY + (hitY - fromY)/len*(len - .5) local rooffree = isLineOfSightClear ( hitX, hitY, hitZ, hitX, hitY, hitZ + .4, true, true, false, true, false, true, true ) if not rooffree then groundshot = 2 hitZ = hitZ - .5 end end local len = getDistanceBetweenPoints3D(fromX, fromY, fromZ, hitX, hitY, hitZ) hitX = fromX + (hitX - fromX)/len*(len - .5) hitY = fromY + (hitY - fromY)/len*(len - .5) hitZ = fromZ + (hitZ - fromZ)/len*(len - .5) local angle = math.deg(math.atan2(hitY - fromY, hitX - fromX)) - 90 triggerServerEvent ( "ongrapple", getLocalPlayer(), wallstick, hitX, hitY, hitZ, angle, groundshot ) aplayer = source local thisname = getPlayerName(aplayer) local thisguyschip = createObject ( 1935, hitX, hitY, hitZ, 0, 0, pedrot ) setElementData ( aplayer, "targethook", thisguyschip ) setElementAlpha( thisguyschip, 0) processingPlayers[aplayer] = true setTimer ( stopline, 1000, 1, aplayer ) end else aplayer = source local thisname = getPlayerName(aplayer) local thisguyschip = createObject ( 1935, hitX, hitY, hitZ, 0, 0, pedrot ) setElementData ( aplayer, "targethook", thisguyschip ) setElementAlpha( thisguyschip, 0) processingPlayers[aplayer] = true setTimer ( stopline, 1000, 1, aplayer ) end else local theVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if (source == getLocalPlayer()) and ( theVehicle ) then local carpurpose = (getElementData ( theVehicle, "purpose" )) if (carpurpose == "grapple") then if (getPedWeaponSlot( getLocalPlayer() ) == 3) or (getPedWeaponSlot( getLocalPlayer() ) == 2) or (getPedWeaponSlot( getLocalPlayer() ) == 6) then toggleControl ( "fire", false ) setTimer ( toggleControl, 1200, 1, "fire", true ) toggleControl ( "vehicle_fire", false ) setTimer ( toggleControl, 1200, 1, "vehicle_fire", true ) end end end end end addEventHandler ( "onClientPlayerWeaponFire", getRootElement(), onClientPlayerWeaponFireFunc ) addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) local carpurpose = (getElementData ( source, "purpose" )) if (carpurpose == "grapple") then setElementCollisionsEnabled(source, false) setVehicleEngineState ( source, false ) setVehicleOverrideLights ( source, 1 ) showPlayerHudComponent ( "vehicle_name", false ) if isElementInWater(source) and (thePlayer == getLocalPlayer()) then triggerServerEvent ( "ongrapplejump", getLocalPlayer(), getLocalPlayer() ) end end end ) function stationstop(station) local theVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( theVehicle ) then local carpurpose = (getElementData ( theVehicle, "purpose" )) if (carpurpose == "grapple") then oldslot = getPedWeaponSlot( getLocalPlayer() ) if oldslot == 2 then local ammo = getPedTotalAmmo ( getLocalPlayer(), 3 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 3 ) else local ammo = getPedTotalAmmo ( getLocalPlayer(), 4 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 4 ) else local ammo = getPedTotalAmmo ( getLocalPlayer(), 5 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 5 ) else local ammo = getPedTotalAmmo ( getLocalPlayer(), 6 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 6 ) end end end end elseif oldslot == 3 then local ammo = getPedTotalAmmo ( getLocalPlayer(), 4 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 4 ) else local ammo = getPedTotalAmmo ( getLocalPlayer(), 5 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 5 ) else local ammo = getPedTotalAmmo ( getLocalPlayer(), 6 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 6 ) else local ammo = getPedTotalAmmo ( getLocalPlayer(), 2 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 2 ) end end end end elseif oldslot == 4 then local ammo = getPedTotalAmmo ( getLocalPlayer(), 5 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 5 ) else local ammo = getPedTotalAmmo ( getLocalPlayer(), 6 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 6 ) else local ammo = getPedTotalAmmo ( getLocalPlayer(), 2 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 2 ) else local ammo = getPedTotalAmmo ( getLocalPlayer(), 3 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 3 ) end end end end elseif oldslot == 5 then local ammo = getPedTotalAmmo ( getLocalPlayer(), 6 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 6 ) else local ammo = getPedTotalAmmo ( getLocalPlayer(), 2 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 2 ) else local ammo = getPedTotalAmmo ( getLocalPlayer(), 3 ) if ammo > 0 then setPedWeaponSlot ( getLocalPlayer(), 3 ) else local ammo = getPedTotalAmmo ( getLocalPlayer(), 4 ) if ammo > 0 then Link to comment
Chris!i! Posted August 26, 2014 Author Share Posted August 26, 2014 Yea i knew its isObjectinaclgroup but i tried it gave me errors trigger and shits i didnt knew anything so i deleted all things then i posted here to get help :3 and its urgent i need it soon. Link to comment
Chris!i! Posted August 26, 2014 Author Share Posted August 26, 2014 anyone help me please D: Link to comment
Et-win Posted August 26, 2014 Share Posted August 26, 2014 Try it again with the trigger, then tell us where you placed the trigger (Line numbers) and then people will more likely help you. Link to comment
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