Do_De<3 Posted September 5, 2013 Share Posted September 5, 2013 السسلآم عليكم ورحمة الله وبركاتهه اخبآركمم ؟ بغيت كودد يخلي الشرطي اول مايخشش الماركر ومعاه حرامي يجيهه فلوسس + مثال على الكود وششكرآ مقدمآ Link to comment
|~| ALCKASER |~| Posted September 5, 2013 Share Posted September 5, 2013 المود خااص بجراند العرب ويالخوو هذا يحتااج بس سهل انشاء الله يفيدونك الشباب لأني مصخن وعايف نفسي ورشحةة والله يعين مرتفعه الحرارة ومحزن ربوعكم تبن استغفر الله Goodbey Link to comment
Do_De<3 Posted September 5, 2013 Author Share Posted September 5, 2013 (edited) مآتششوف شر يآلكآسر ترى اليوم خميس + مصبحين على الجمعه ضض2 Edited September 5, 2013 by Guest Link to comment
jafar Posted September 5, 2013 Share Posted September 5, 2013 هذا الكود لازم تضبطه مع الكود حق الإعتقال Link to comment
кιηg-αвα∂у Posted September 5, 2013 Share Posted September 5, 2013 https://wiki.multitheftauto.com/wiki/OnMarkerHit givePlayerMoney getElementType getPlayerTeam getTeamName getAttachedElements Link to comment
Do_De<3 Posted September 5, 2013 Author Share Posted September 5, 2013 في مثآل يآحلوو Link to comment
#DRAGON!FIRE Posted September 5, 2013 Share Posted September 5, 2013 في مثآل يآحلوو # المثال يبيله وقت __-" # لأنه نظام مشوار , افتح كل فنكشن وشوف ... ذذ Link to comment
jafar Posted September 5, 2013 Share Posted September 5, 2013 اذا كود الإعتقال حقك مضبطنه بـ attachElements استخدم ذولا الأكواد : https://wiki.multitheftauto.com/wiki/OnMarkerHit givePlayerMoney getElementType getPlayerTeam getTeamName getAttachedElements اذا بطريقة ثانية يلزم تضبطها مع الفنكشن Link to comment
Do_De<3 Posted September 5, 2013 Author Share Posted September 5, 2013 كلينت coptargets = 0 --ADDS BLIPS AND MARKERS FOR POLICE STATIONS addEvent("copdirections", true) function copshops() if coptargets == 0 then coptargets = 1 blip1 = createBlip ( 2246.1008300781, 2453.1953125, 9.8203125, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker1 = createMarker ( 2246.1008300781, 2453.1953125, 9.8203125, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape1 = createColSphere ( 2246.1008300781, 2453.1953125, 9.8203125, 6 ) setElementData ( colshape1, "purpose", "copshop" ) blip2 = createBlip ( -1406.9072265625, 2655.0927734375, 55.6875, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker2 = createMarker ( -1406.9072265625, 2655.0927734375, 55.6875, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape2 = createColSphere ( -1406.9072265625, 2655.0927734375, 55.6875, 6 ) setElementData ( colshape2, "purpose", "copshop" ) blip3 = createBlip ( -209.9542, 977.7558, 18.188976, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker3 = createMarker ( -209.9542, 977.7558, 18.188976, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape3 = createColSphere (-209.9542, 977.7558, 18.188976, 6 ) setElementData ( colshape3, "purpose", "copshop" ) blip4 = createBlip ( -1628.2619628906, 676.62005615234, 6.1901206970215, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker4 = createMarker ( -1628.2619628906, 676.62005615234, 6.1901206970215, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape4 = createColSphere ( -1628.2619628906, 676.62005615234, 6.1901206970215, 6 ) setElementData ( colshape4, "purpose", "copshop" ) blip5 = createBlip ( 624.66278076172, -605.72027587891, 15.923292160034, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker5 = createMarker ( 624.66278076172, -605.72027587891, 15.923292160034, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape5 = createColSphere ( 624.66278076172, -605.72027587891, 15.923292160034, 6 ) setElementData ( colshape5, "purpose", "copshop" ) blip6 = createBlip ( 1565.3386230469, -1628.5202636719, 12.382812, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker6 = createMarker ( 1565.3386230469, -1628.5202636719, 12.382812, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape6 = createColSphere ( 1565.3386230469, -1628.5202636719, 12.382812, 6 ) setElementData ( colshape6, "purpose", "copshop" ) blip7 = createBlip ( -2164.3779296875, -2389.533203125, 29.617206573486, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker7 = createMarker ( -2164.3779296875, -2389.533203125, 29.617206573486, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape7 = createColSphere ( -2164.3779296875, -2389.533203125, 29.617206573486, 6 ) setElementData ( colshape7, "purpose", "copshop" ) end end addEventHandler("copdirections", getRootElement(), copshops) --TRIGGERED WHEN A COP STATION IS REACHED function copshophit (theshape) if isElement(theshape) then if (getElementData(theshape, "purpose") == "copshop" ) then if ( getElementType( source ) == "player" ) then if (getElementData ( source, "currentstatus" ) == "underarrest") then local thecaptor = (getElementData ( source, "captor" )) local mx, my, mz = getElementPosition(theshape) local clientprisonercheck = setTimer ( clientcheckforprisoners, 1500, 1, thecaptor ) triggerServerEvent ("lockemup", getLocalPlayer (), source, mx, my, mz ) end end end end end addEventHandler ( "onClientElementColShapeHit", getRootElement(), copshophit) function clientcheckforprisoners(thecop) if isElement(thecop) then local prisoners = 0 local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do if (getElementData ( thePlayer, "captor" ) == thecop ) then prisoners = prisoners+1 end end if prisoners == 0 then setElementData ( thecop, "currentarrests", "none" ) clearcopshops() elseif prisoners == 1 then setElementData ( thecop, "currentarrests", "single" ) elseif prisoners == 2 then setElementData ( thecop, "currentarrests", "double" ) end end end --REMOVES POLICE STATION BLIPS FROM COPS RADAR AND THE MARKERS addEvent("clearcopdirections", true) function clearcopshops() if coptargets == 1 then coptargets = 0 destroyElement ( blip1 ) destroyElement ( marker1 ) destroyElement ( colshape1 ) destroyElement ( blip2 ) destroyElement ( marker2 ) destroyElement ( colshape2 ) destroyElement ( blip3 ) destroyElement ( marker3 ) destroyElement ( colshape3 ) destroyElement ( blip4 ) destroyElement ( marker4 ) destroyElement ( colshape4 ) destroyElement ( blip5 ) destroyElement ( marker5 ) destroyElement ( colshape5 ) destroyElement ( blip6 ) destroyElement ( marker6 ) destroyElement ( colshape6 ) destroyElement ( blip7 ) destroyElement ( marker7 ) destroyElement ( colshape7 ) end end addEventHandler("clearcopdirections", getRootElement(), clearcopshops) سيرفر kingCOP = createElement( "Pgroup", "cops" ) kingCIV = createElement( "Pgroup", "civs" ) kingNONE = createElement( "Pgroup", "none" ) function legalstartup(startedresource) if startedresource == getThisResource() then WantedWatch = setTimer (wantedlevelmonitor, 1000, 0) local allplayers = getElementsByType ( "player" ) local detectmethod = get("legalsystem.Copmethod") for playerKey,thePlayer in ipairs(allplayers) do if detectmethod == "team" then local copteam = get("legalsystem.Copteam") local thisTeam = getPlayerTeam(thePlayer) if thisTeam ~= false then if thisTeam == getTeamFromName(copteam) then setElementParent ( thePlayer, kingCOP ) else setElementParent ( thePlayer, kingCIV ) end end elseif detectmethod == "skin" then local thisSkin = getPedSkin(thePlayer) setElementData(getRootElement(),"Copskins",get("legalsystem.Copskins")) local copskins = getElementData(getRootElement(),"Copskins") if type(copskins) == "table" and #copskins > 0 then for k,skinID in ipairs(copskins) do copskins[skinID] = true end end local isacop = 0 for ElementKey, ElementValue in ipairs ( copskins ) do if thisSkin == ElementValue then isacop = 1 end end if isacop == 1 then setElementParent ( thePlayer, kingCOP ) else setElementParent ( thePlayer, kingCIV ) end end end end end addEventHandler( "onResourceStart", getRootElement(), legalstartup) function copSpawnCheck() local detectmethod = get("legalsystem.Copmethod") if detectmethod == "team" then local copteam = get("legalsystem.Copteam") local thisTeam = getPlayerTeam(source) if thisTeam ~= false then if thisTeam == getTeamFromName(copteam) then setElementParent ( source, kingCOP ) else setElementParent ( source, kingCIV ) end end elseif detectmethod == "skin" then local thisSkin = getPedSkin(source) setElementData(getRootElement(),"Copskins",get("legalsystem.Copskins")) local copskins = getElementData(getRootElement(),"Copskins") if type(copskins) == "table" and #copskins > 0 then for k,skinID in ipairs(copskins) do copskins[skinID] = true end end local isacop = 0 for ElementKey, ElementValue in ipairs ( copskins ) do if thisSkin == ElementValue then isacop = 1 end end if isacop == 1 then setElementParent ( source, kingCOP ) else setElementParent ( source, kingCIV ) end end end addEventHandler ( "onPlayerSpawn", getRootElement(), copSpawnCheck ) --ARREST PLAYERS BY SMACKING WITH A NIGHTSTICK function rodneykingcheck ( attacker, weapon, bodypart, loss ) if (attacker) and (weapon == 3) then if getElementParent(attacker) == kingCOP then local thecop = attacker local theprisoner = source local wlevel = getPlayerWantedLevel( source ) if (getElementData ( theprisoner, "currentstatus" ) ~= "underarrest") and (wlevel > 0) then if (getElementData ( attacker, "currentarrests" ) ~= "single" ) and (getElementData ( attacker, "currentarrests" ) ~= "double" ) then setElementData ( thecop, "currentarrests", "single" ) triggerClientEvent(thecop,"copdirections",thecop) elseif (getElementData ( attacker, "currentarrests" ) == "single" ) then setElementData ( thecop, "currentarrests", "double" ) end setElementData ( theprisoner, "currentstatus", "underarrest" ) setElementData ( theprisoner, "captor", thecop ) showCursor ( source, true ) toggleAllControls ( source, false, true, false ) walktheprisoner ( thecop, theprisoner ) setElementData ( theprisoner, "arrestTimeout", setTimer ( freetheguy, 180000, 1, theprisoner )) end end end end addEventHandler ( "onPlayerDamage", getRootElement(), rodneykingcheck ) --ARREST PLAYERS BY HOLDING THEM AT GUNPOINT IF THEY HAVE LOW HP function sightscheck ( element ) if isElement(element) then if ( getElementType ( element ) == "player" ) then if ( getControlState ( source, "aim_weapon" ) ) then local currentgun = getPlayerWeapon ( source ) local wlevel = getPlayerWantedLevel( element ) if (currentgun > 19) and (currentgun < 39) and (wlevel > 0) then if getElementParent(source) == kingCOP then local thecop = source local theprisoner = element local cx, cy, cz = getElementPosition ( source ) local px, py, pz = getElementPosition ( element ) if ( getElementHealth ( element ) < 15 ) and ( getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz ) < 3 ) then if (getElementData ( theprisoner, "currentstatus" ) ~= "underarrest" ) then if (getElementData ( thecop, "currentarrests" ) ~= "single" ) and (getElementData ( thecop, "currentarrests" ) ~= "double" ) then triggerClientEvent(thecop,"copdirections",thecop) setElementData ( thecop, "currentarrests", "single" ) elseif (getElementData ( thecop, "currentarrests" ) == "single" ) then setElementData ( thecop, "currentarrests", "double" ) end setElementData ( theprisoner, "currentstatus", "underarrest" ) setElementData ( theprisoner, "captor", thecop ) showCursor ( theprisoner, true ) toggleAllControls ( theprisoner, false, true, false ) walktheprisoner ( thecop, theprisoner ) setElementData ( theprisoner, "arrestTimeout", setTimer ( freetheguy, 180000, 1, theprisoner )) -- local arresttoolong = setTimer ( freetheguy, 180000, 1, theprisoner ) end end end end end end end end addEventHandler ( "onPlayerTarget", getRootElement(), sightscheck ) --ARREST PLAYERS BY PULLING THEM OUT OF A VEHICLE function yankhimout(player, seat, jacker) if isElement(jacker) then if getElementParent(jacker) == kingCOP then local wlevel = getPlayerWantedLevel( player ) if wlevel > 0 then if (getElementData ( jacker, "currentarrests" ) ~= "single" ) and (getElementData ( jacker, "currentarrests" ) ~= "double" ) then local thecop = jacker local theprisoner = player setElementData ( theprisoner, "currentstatus", "underarrest" ) setElementData ( theprisoner, "captor", thecop ) setElementData ( thecop, "currentarrests", "single" ) triggerClientEvent(thecop,"copdirections",thecop) showCursor ( theprisoner, true ) toggleAllControls ( theprisoner, false, true, false ) walktheprisoner ( thecop, theprisoner ) setElementData ( theprisoner, "arrestTimeout", setTimer ( freetheguy, 180000, 1, theprisoner )) elseif (getElementData ( jacker, "currentarrests" ) == "single" ) then local thecop = jacker local theprisoner = player setElementData ( theprisoner, "currentstatus", "underarrest" ) setElementData ( theprisoner, "captor", thecop ) setElementData ( thecop, "currentarrests", "double" ) showCursor ( theprisoner, true ) toggleAllControls ( theprisoner, false, true, false ) walktheprisoner ( thecop, theprisoner ) setElementData ( theprisoner, "arrestTimeout", setTimer ( freetheguy, 180000, 1, theprisoner )) end end end end end addEventHandler ( "onVehicleExit", getRootElement(), yankhimout ) --FORCES A PRISONER TO FOLLOW THE COP function walktheprisoner(thecop, theprisoner) if (getElementData ( theprisoner, "currentstatus" ) == "underarrest") and (getPedOccupiedVehicle ( theprisoner ) == false ) then local copx, copy, copz = getElementPosition ( thecop ) local prisonerx, prisonery, prisonerz = getElementPosition ( theprisoner ) copangle = ( 360 - math.deg ( math.atan2 ( ( copx - prisonerx ), ( copy - prisonery ) ) ) ) % 360 setPedRotation ( theprisoner, copangle ) setCameraTarget ( theprisoner, theprisoner ) local dist = getDistanceBetweenPoints2D ( copx, copy, prisonerx, prisonery ) if ( dist > 16 ) then freetheguy ( theprisoner ) --FREES PRISONER IF HE GETS FAR AWAY elseif ( dist > 12 ) then setControlState ( theprisoner, "sprint", true ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", true ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) elseif ( dist > 6 ) then setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", true ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) elseif ( dist > 1.5 ) then setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", true ) setControlState ( theprisoner, "forwards", true ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) elseif ( dist < 1.5 ) then setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", false ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) end end end --FREES A PLAYER (RESETS THEIR CONTROLS AND STATUS) function freetheguy (theprisoner) local thecaptor = (getElementData ( theprisoner, "captor" )) setElementData ( theprisoner, "currentstatus", "none" ) setElementData ( theprisoner, "captor", "none" ) showCursor ( theprisoner, false ) setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", false ) toggleAllControls (theprisoner, true) local prisonercheck = setTimer ( checkforprisoners, 1500, 1, thecaptor ) TimoutTimer = (getElementData ( theprisoner, "arrestTimeout" )) if isTimer(TimoutTimer) then killTimer(TimoutTimer) setElementData ( theprisoner, "arrestTimeout", nil) TimeoutTimer = nil end end function checkforprisoners(thecop) if isElement(thecop) then local prisoners = 0 local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do if (getElementData ( thePlayer, "captor" ) == thecop ) then prisoners = prisoners+1 end end if prisoners == 0 then setElementData ( thecop, "currentarrests", "none" ) triggerClientEvent( thecop,"clearcopdirections",thecop) elseif prisoners == 1 then setElementData ( thecop, "currentarrests", "single" ) elseif prisoners == 2 then setElementData ( thecop, "currentarrests", "double" ) end Link to comment
xFace[B]ook Posted September 6, 2013 Share Posted September 6, 2013 كلينت coptargets = 0 --ADDS BLIPS AND MARKERS FOR POLICE STATIONS addEvent("copdirections", true) function copshops() if coptargets == 0 then coptargets = 1 blip1 = createBlip ( 2246.1008300781, 2453.1953125, 9.8203125, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker1 = createMarker ( 2246.1008300781, 2453.1953125, 9.8203125, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape1 = createColSphere ( 2246.1008300781, 2453.1953125, 9.8203125, 6 ) setElementData ( colshape1, "purpose", "copshop" ) blip2 = createBlip ( -1406.9072265625, 2655.0927734375, 55.6875, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker2 = createMarker ( -1406.9072265625, 2655.0927734375, 55.6875, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape2 = createColSphere ( -1406.9072265625, 2655.0927734375, 55.6875, 6 ) setElementData ( colshape2, "purpose", "copshop" ) blip3 = createBlip ( -209.9542, 977.7558, 18.188976, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker3 = createMarker ( -209.9542, 977.7558, 18.188976, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape3 = createColSphere (-209.9542, 977.7558, 18.188976, 6 ) setElementData ( colshape3, "purpose", "copshop" ) blip4 = createBlip ( -1628.2619628906, 676.62005615234, 6.1901206970215, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker4 = createMarker ( -1628.2619628906, 676.62005615234, 6.1901206970215, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape4 = createColSphere ( -1628.2619628906, 676.62005615234, 6.1901206970215, 6 ) setElementData ( colshape4, "purpose", "copshop" ) blip5 = createBlip ( 624.66278076172, -605.72027587891, 15.923292160034, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker5 = createMarker ( 624.66278076172, -605.72027587891, 15.923292160034, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape5 = createColSphere ( 624.66278076172, -605.72027587891, 15.923292160034, 6 ) setElementData ( colshape5, "purpose", "copshop" ) blip6 = createBlip ( 1565.3386230469, -1628.5202636719, 12.382812, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker6 = createMarker ( 1565.3386230469, -1628.5202636719, 12.382812, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape6 = createColSphere ( 1565.3386230469, -1628.5202636719, 12.382812, 6 ) setElementData ( colshape6, "purpose", "copshop" ) blip7 = createBlip ( -2164.3779296875, -2389.533203125, 29.617206573486, 30, 3, 0, 0, 255, 255, 50, getLocalPlayer() ) marker7 = createMarker ( -2164.3779296875, -2389.533203125, 29.617206573486, "cylinder", 6, 0, 0, 255, 55, getLocalPlayer() ) colshape7 = createColSphere ( -2164.3779296875, -2389.533203125, 29.617206573486, 6 ) setElementData ( colshape7, "purpose", "copshop" ) end end addEventHandler("copdirections", getRootElement(), copshops) --TRIGGERED WHEN A COP STATION IS REACHED function copshophit (theshape) if isElement(theshape) then if (getElementData(theshape, "purpose") == "copshop" ) then if ( getElementType( source ) == "player" ) then if (getElementData ( source, "currentstatus" ) == "underarrest") then local thecaptor = (getElementData ( source, "captor" )) local mx, my, mz = getElementPosition(theshape) local clientprisonercheck = setTimer ( clientcheckforprisoners, 1500, 1, thecaptor ) triggerServerEvent ("lockemup", getLocalPlayer (), source, mx, my, mz ) end end end end end addEventHandler ( "onClientElementColShapeHit", getRootElement(), copshophit) function clientcheckforprisoners(thecop) if isElement(thecop) then local prisoners = 0 local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do if (getElementData ( thePlayer, "captor" ) == thecop ) then prisoners = prisoners+1 end end if prisoners == 0 then setElementData ( thecop, "currentarrests", "none" ) clearcopshops() elseif prisoners == 1 then setElementData ( thecop, "currentarrests", "single" ) elseif prisoners == 2 then setElementData ( thecop, "currentarrests", "double" ) end end end --REMOVES POLICE STATION BLIPS FROM COPS RADAR AND THE MARKERS addEvent("clearcopdirections", true) function clearcopshops() if coptargets == 1 then coptargets = 0 destroyElement ( blip1 ) destroyElement ( marker1 ) destroyElement ( colshape1 ) destroyElement ( blip2 ) destroyElement ( marker2 ) destroyElement ( colshape2 ) destroyElement ( blip3 ) destroyElement ( marker3 ) destroyElement ( colshape3 ) destroyElement ( blip4 ) destroyElement ( marker4 ) destroyElement ( colshape4 ) destroyElement ( blip5 ) destroyElement ( marker5 ) destroyElement ( colshape5 ) destroyElement ( blip6 ) destroyElement ( marker6 ) destroyElement ( colshape6 ) destroyElement ( blip7 ) destroyElement ( marker7 ) destroyElement ( colshape7 ) end end addEventHandler("clearcopdirections", getRootElement(), clearcopshops) سيرفر kingCOP = createElement( "Pgroup", "cops" ) kingCIV = createElement( "Pgroup", "civs" ) kingNONE = createElement( "Pgroup", "none" ) function legalstartup(startedresource) if startedresource == getThisResource() then WantedWatch = setTimer (wantedlevelmonitor, 1000, 0) local allplayers = getElementsByType ( "player" ) local detectmethod = get("legalsystem.Copmethod") for playerKey,thePlayer in ipairs(allplayers) do if detectmethod == "team" then local copteam = get("legalsystem.Copteam") local thisTeam = getPlayerTeam(thePlayer) if thisTeam ~= false then if thisTeam == getTeamFromName(copteam) then setElementParent ( thePlayer, kingCOP ) else setElementParent ( thePlayer, kingCIV ) end end elseif detectmethod == "skin" then local thisSkin = getPedSkin(thePlayer) setElementData(getRootElement(),"Copskins",get("legalsystem.Copskins")) local copskins = getElementData(getRootElement(),"Copskins") if type(copskins) == "table" and #copskins > 0 then for k,skinID in ipairs(copskins) do copskins[skinID] = true end end local isacop = 0 for ElementKey, ElementValue in ipairs ( copskins ) do if thisSkin == ElementValue then isacop = 1 end end if isacop == 1 then setElementParent ( thePlayer, kingCOP ) else setElementParent ( thePlayer, kingCIV ) end end end end end addEventHandler( "onResourceStart", getRootElement(), legalstartup) function copSpawnCheck() local detectmethod = get("legalsystem.Copmethod") if detectmethod == "team" then local copteam = get("legalsystem.Copteam") local thisTeam = getPlayerTeam(source) if thisTeam ~= false then if thisTeam == getTeamFromName(copteam) then setElementParent ( source, kingCOP ) else setElementParent ( source, kingCIV ) end end elseif detectmethod == "skin" then local thisSkin = getPedSkin(source) setElementData(getRootElement(),"Copskins",get("legalsystem.Copskins")) local copskins = getElementData(getRootElement(),"Copskins") if type(copskins) == "table" and #copskins > 0 then for k,skinID in ipairs(copskins) do copskins[skinID] = true end end local isacop = 0 for ElementKey, ElementValue in ipairs ( copskins ) do if thisSkin == ElementValue then isacop = 1 end end if isacop == 1 then setElementParent ( source, kingCOP ) else setElementParent ( source, kingCIV ) end end end addEventHandler ( "onPlayerSpawn", getRootElement(), copSpawnCheck ) --ARREST PLAYERS BY SMACKING WITH A NIGHTSTICK function rodneykingcheck ( attacker, weapon, bodypart, loss ) if (attacker) and (weapon == 3) then if getElementParent(attacker) == kingCOP then local thecop = attacker local theprisoner = source local wlevel = getPlayerWantedLevel( source ) if (getElementData ( theprisoner, "currentstatus" ) ~= "underarrest") and (wlevel > 0) then if (getElementData ( attacker, "currentarrests" ) ~= "single" ) and (getElementData ( attacker, "currentarrests" ) ~= "double" ) then setElementData ( thecop, "currentarrests", "single" ) triggerClientEvent(thecop,"copdirections",thecop) elseif (getElementData ( attacker, "currentarrests" ) == "single" ) then setElementData ( thecop, "currentarrests", "double" ) end setElementData ( theprisoner, "currentstatus", "underarrest" ) setElementData ( theprisoner, "captor", thecop ) showCursor ( source, true ) toggleAllControls ( source, false, true, false ) walktheprisoner ( thecop, theprisoner ) setElementData ( theprisoner, "arrestTimeout", setTimer ( freetheguy, 180000, 1, theprisoner )) end end end end addEventHandler ( "onPlayerDamage", getRootElement(), rodneykingcheck ) --ARREST PLAYERS BY HOLDING THEM AT GUNPOINT IF THEY HAVE LOW HP function sightscheck ( element ) if isElement(element) then if ( getElementType ( element ) == "player" ) then if ( getControlState ( source, "aim_weapon" ) ) then local currentgun = getPlayerWeapon ( source ) local wlevel = getPlayerWantedLevel( element ) if (currentgun > 19) and (currentgun < 39) and (wlevel > 0) then if getElementParent(source) == kingCOP then local thecop = source local theprisoner = element local cx, cy, cz = getElementPosition ( source ) local px, py, pz = getElementPosition ( element ) if ( getElementHealth ( element ) < 15 ) and ( getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz ) < 3 ) then if (getElementData ( theprisoner, "currentstatus" ) ~= "underarrest" ) then if (getElementData ( thecop, "currentarrests" ) ~= "single" ) and (getElementData ( thecop, "currentarrests" ) ~= "double" ) then triggerClientEvent(thecop,"copdirections",thecop) setElementData ( thecop, "currentarrests", "single" ) elseif (getElementData ( thecop, "currentarrests" ) == "single" ) then setElementData ( thecop, "currentarrests", "double" ) end setElementData ( theprisoner, "currentstatus", "underarrest" ) setElementData ( theprisoner, "captor", thecop ) showCursor ( theprisoner, true ) toggleAllControls ( theprisoner, false, true, false ) walktheprisoner ( thecop, theprisoner ) setElementData ( theprisoner, "arrestTimeout", setTimer ( freetheguy, 180000, 1, theprisoner )) -- local arresttoolong = setTimer ( freetheguy, 180000, 1, theprisoner ) end end end end end end end end addEventHandler ( "onPlayerTarget", getRootElement(), sightscheck ) --ARREST PLAYERS BY PULLING THEM OUT OF A VEHICLE function yankhimout(player, seat, jacker) if isElement(jacker) then if getElementParent(jacker) == kingCOP then local wlevel = getPlayerWantedLevel( player ) if wlevel > 0 then if (getElementData ( jacker, "currentarrests" ) ~= "single" ) and (getElementData ( jacker, "currentarrests" ) ~= "double" ) then local thecop = jacker local theprisoner = player setElementData ( theprisoner, "currentstatus", "underarrest" ) setElementData ( theprisoner, "captor", thecop ) setElementData ( thecop, "currentarrests", "single" ) triggerClientEvent(thecop,"copdirections",thecop) showCursor ( theprisoner, true ) toggleAllControls ( theprisoner, false, true, false ) walktheprisoner ( thecop, theprisoner ) setElementData ( theprisoner, "arrestTimeout", setTimer ( freetheguy, 180000, 1, theprisoner )) elseif (getElementData ( jacker, "currentarrests" ) == "single" ) then local thecop = jacker local theprisoner = player setElementData ( theprisoner, "currentstatus", "underarrest" ) setElementData ( theprisoner, "captor", thecop ) setElementData ( thecop, "currentarrests", "double" ) showCursor ( theprisoner, true ) toggleAllControls ( theprisoner, false, true, false ) walktheprisoner ( thecop, theprisoner ) setElementData ( theprisoner, "arrestTimeout", setTimer ( freetheguy, 180000, 1, theprisoner )) end end end end end addEventHandler ( "onVehicleExit", getRootElement(), yankhimout ) --FORCES A PRISONER TO FOLLOW THE COP function walktheprisoner(thecop, theprisoner) if (getElementData ( theprisoner, "currentstatus" ) == "underarrest") and (getPedOccupiedVehicle ( theprisoner ) == false ) then local copx, copy, copz = getElementPosition ( thecop ) local prisonerx, prisonery, prisonerz = getElementPosition ( theprisoner ) copangle = ( 360 - math.deg ( math.atan2 ( ( copx - prisonerx ), ( copy - prisonery ) ) ) ) % 360 setPedRotation ( theprisoner, copangle ) setCameraTarget ( theprisoner, theprisoner ) local dist = getDistanceBetweenPoints2D ( copx, copy, prisonerx, prisonery ) if ( dist > 16 ) then freetheguy ( theprisoner ) --FREES PRISONER IF HE GETS FAR AWAY elseif ( dist > 12 ) then setControlState ( theprisoner, "sprint", true ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", true ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) elseif ( dist > 6 ) then setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", true ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) elseif ( dist > 1.5 ) then setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", true ) setControlState ( theprisoner, "forwards", true ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) elseif ( dist < 1.5 ) then setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", false ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) end end end --FREES A PLAYER (RESETS THEIR CONTROLS AND STATUS) function freetheguy (theprisoner) local thecaptor = (getElementData ( theprisoner, "captor" )) setElementData ( theprisoner, "currentstatus", "none" ) setElementData ( theprisoner, "captor", "none" ) showCursor ( theprisoner, false ) setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", false ) toggleAllControls (theprisoner, true) local prisonercheck = setTimer ( checkforprisoners, 1500, 1, thecaptor ) TimoutTimer = (getElementData ( theprisoner, "arrestTimeout" )) if isTimer(TimoutTimer) then killTimer(TimoutTimer) setElementData ( theprisoner, "arrestTimeout", nil) TimeoutTimer = nil end end function checkforprisoners(thecop) if isElement(thecop) then local prisoners = 0 local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do if (getElementData ( thePlayer, "captor" ) == thecop ) then prisoners = prisoners+1 end end if prisoners == 0 then setElementData ( thecop, "currentarrests", "none" ) triggerClientEvent( thecop,"clearcopdirections",thecop) elseif prisoners == 1 then setElementData ( thecop, "currentarrests", "single" ) elseif prisoners == 2 then Link to comment
./BlackBird# Posted September 6, 2013 Share Posted September 6, 2013 المود في الكمنتري و مافيه اخطاء ليه تبي تعدل عليه؟ 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