Jump to content

any help with arrest script


Recommended Posts

Hi all the marker dont show in here

function arrest(hitElement, weapon) 
    local weap = getWeaponNameFromID(3) 
    local playerTeam = getPlayerTeam(source) 
    if ( playerTeam == "Police" ) then 
        if ( getPlayerWantedLevel(hitElement) > 0 ) then  
            if ( weap ) then 
                arrestMarker = createMarker(1119, 1034, 10, "cylinder", 2.5, 255, 255, 0, source) 
                addEventHandler( "onMarkerHit", arrestMarker, mhit) 
                toggleAllControls( hitElement, false ) 
                local ax, ay, az = getElementPosition ( hitElement ) 
                local cx, cy, cz = getElementPosition ( source ) 
                local d = getDistanceBetweenPoints3D(ax, ay, az, cx, cy, cz) 
                if ( d > 10 ) then 
                    setElementPosition( hitElement, cx-5, cy, cz ) 
                end 
            end 
        end 
    end 
end 
addEventHandler( "onPlayerDamage", root, arrest) 
  
function mhit(hitElement) 
    if ( getPlayerTeam(source) ~= "Police" ) then 
        if ( getPlayerWantedLevel(hitElement) > 0 ) then 
            setElementInterior(hitElement, 6) 
            setElementPosition(hitElement, 264.74969, 77.49036, 1001.03906) 
        end 
    end 
end 

Link to comment

Hello,

You forgot to put the marker's alpha integer over there, here you go, set to 150.

addEventHandler("onPlayerDamage", root, 
    function arrest(attacker, weapon, bodypart, loss) 
        local weap = getWeaponNameFromID(3) 
        local playerTeam = getPlayerTeam(source) 
        if playerTeam == "Police" then 
            if getPlayerWantedLevel(attacker) > 0 then 
                if weap then 
                    arrestMarker = createMarker(1119, 1034, 10, "cylinder", 2.5, 255, 255, 0, 150, source) 
                    addEventHandler("onMarkerHit", arrestMarker, mhit) 
                    toggleAllControls(attacker, false) 
                    local ax, ay, az = getElementPosition(attacker) 
                    local cx, cy, cz = getElementPosition(source) 
                    local d = getDistanceBetweenPoints3D(ax, ay, az, cx, cy, cz) 
                    if d > 10 then 
                        setElementPosition(attacker, cx - 5, cy, cz) 
                    end 
                end 
            end 
        end 
    end 
) 
  
function mhit(player) 
    if getPlayerTeam(source) ~= "Police" then 
        if getPlayerWantedLevel(player) > 0 then 
            setElementInterior(player, 6) 
            setElementPosition(player, 264.74969, 77.49036, 1001.03906) 
        end 
    end 
end 
 
Link to comment
Guest Guest4401
local playerTeam = getPlayerTeam(source) 
    if ( playerTeam == "Police" ) then 

This means:

element:team = string

Use

getTeamName 

Link to comment
local function OnHit( pElement ) 
    if getElementType( pElement ) == 'player' then 
        local pTeam = getPlayerTeam( pElement ) 
        if pTeam and isElement( pTeam ) and getTeamName( pTeam ) ~= 'Police' then 
            if getPlayerWantedLevel( pElement ) > 0 then 
                setElementInterior( pElement, 6 ) 
                setElementPosition( pElement, 264.74969, 77.49036, 1001.03906 ) 
            end 
        end 
    end 
end 
  
addEventHandler( 'onPlayerDamage', root, 
    function( pAttacker, nWeapon ) 
        local pTeam = getPlayerTeam( source ) 
        if pTeam and isElement( pTeam ) and getTeamName( pTeam ) == 'Police' then 
            if  
                getPlayerWantedLevel( pAttacker ) > 0 and 
                nWeapon == 3 
            then 
                local pArrestMarker = createMarker( 1119, 1034, 10, 'cylinder', 2.5, 255, 255, 0, 150, source ) 
                addEventHandler( 'onMarkerHit', pArrestMarker, OnHit ) 
                toggleAllControls( pAttacker, false ) 
                local fX, fY, fZ = getElementPosition( pAttacker ) 
                local fX2, fY2, fZ2 = getElementPosition( source ) 
                if getDistanceBetweenPoints3D( fX, fY, fZ, fX2, fY2, fZ2 ) > 10 then 
                    setElementPosition( pAttacker, fX2 - 5, fY2, fZ2 ) 
                end 
            end 
        end 
    end 
) 

Link to comment

i alredy make this but marker dont show

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Image = {} 
getSetVisble(GUIEditor_Window[2], false ) 
GUIEditor_Window[2] = guiCreateWindow(629,219,481,301,"Police Station",false) 
guiWindowSetMovable(GUIEditor_Window[2],false) 
GUIEditor_Label[1] = guiCreateLabel(158,172,166,16,"Move To Police Station ?",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[1],255,255,0) 
guiSetFont(GUIEditor_Label[1],"clear-normal") 
GUIEditor_Button[1] = guiCreateButton(18,199,205,93,"Yes",false,GUIEditor_Window[2]) 
guiSetFont(GUIEditor_Button[1],"clear-normal") 
GUIEditor_Button[2] = guiCreateButton(297,201,175,91,"Exit",false,GUIEditor_Window[2]) 
guiSetFont(GUIEditor_Button[2],"clear-normal") 
GUIEditor_Image[1] = guiCreateStaticImage(69,24,338,136,"images/mtalogo.png",false,GUIEditor_Window[2]) 
  
  
Marker = createMarker(1119,1034,10,"cylinder",2,0,255,0) 
addEventHandler('onClientMarkerHit', Marker, 
function (hit) 
if ( hit == localPlayer ) then 
getSetVisble(GUIEditor_Window[2], true ) 
showCursor(true) 
elseif (hit == GUIEditor_Button[1] ) then 
toggleAllControls( hit, true ) 
setElementInterior( hit, 6 ) 
setElementPosition( hit, 264.74969, 77.49036, 1001.03906 ) 
elseif(hit == GUIEditor_Button[2]) then 
getSetVisble(GUIEditor_Window[2], false ) 
showCursor(false) 
toggleAllControls( hit, false ) 
end 
end) 

Link to comment

Try it. You wrote "guiSetVisble", missing letter "i"

    GUIEditor_Window = {} 
    GUIEditor_Button = {} 
    GUIEditor_Label = {} 
    GUIEditor_Image = {} 
    getSetVisible(GUIEditor_Window[2], false ) 
    GUIEditor_Window[2] = guiCreateWindow(629,219,481,301,"Police Station",false) 
    guiWindowSetMovable(GUIEditor_Window[2],false) 
    GUIEditor_Label[1] = guiCreateLabel(158,172,166,16,"Move To Police Station ?",false,GUIEditor_Window[2]) 
    guiLabelSetColor(GUIEditor_Label[1],255,255,0) 
    guiSetFont(GUIEditor_Label[1],"clear-normal") 
    GUIEditor_Button[1] = guiCreateButton(18,199,205,93,"Yes",false,GUIEditor_Window[2]) 
    guiSetFont(GUIEditor_Button[1],"clear-normal") 
    GUIEditor_Button[2] = guiCreateButton(297,201,175,91,"Exit",false,GUIEditor_Window[2]) 
    guiSetFont(GUIEditor_Button[2],"clear-normal") 
    GUIEditor_Image[1] = guiCreateStaticImage(69,24,338,136,"images/mtalogo.png",false,GUIEditor_Window[2]) 
      
      
    Marker = createMarker(1119,1034,10,"cylinder",2,0,255,0) 
    addEventHandler('onClientMarkerHit', Marker, 
    function (hit) 
    if ( hit == localPlayer ) then 
    getSetVisible(GUIEditor_Window[2], true ) 
    showCursor(true) 
    elseif (hit == GUIEditor_Button[1] ) then 
    toggleAllControls( hit, true ) 
    setElementInterior( hit, 6 ) 
    setElementPosition( hit, 264.74969, 77.49036, 1001.03906 ) 
    elseif(hit == GUIEditor_Button[2]) then 
    getSetVisible(GUIEditor_Window[2], false ) 
    showCursor(false) 
    toggleAllControls( hit, false ) 
    end 
    end) 

Link to comment

@StanleySathler, you changed it to get instead of gui.

try this:

   GUIEditor_Window = {} 
    GUIEditor_Button = {} 
    GUIEditor_Label = {} 
    GUIEditor_Image = {} 
    guiSetVisible(GUIEditor_Window[2], false ) 
    GUIEditor_Window[2] = guiCreateWindow(629,219,481,301,"Police Station",false) 
    guiWindowSetMovable(GUIEditor_Window[2],false) 
    GUIEditor_Label[1] = guiCreateLabel(158,172,166,16,"Move To Police Station ?",false,GUIEditor_Window[2]) 
    guiLabelSetColor(GUIEditor_Label[1],255,255,0) 
    guiSetFont(GUIEditor_Label[1],"clear-normal") 
    GUIEditor_Button[1] = guiCreateButton(18,199,205,93,"Yes",false,GUIEditor_Window[2]) 
    guiSetFont(GUIEditor_Button[1],"clear-normal") 
    GUIEditor_Button[2] = guiCreateButton(297,201,175,91,"Exit",false,GUIEditor_Window[2]) 
    guiSetFont(GUIEditor_Button[2],"clear-normal") 
    GUIEditor_Image[1] = guiCreateStaticImage(69,24,338,136,"images/mtalogo.png",false,GUIEditor_Window[2]) 
      
      
Marker = createMarker(1119,1034,10,"cylinder",2,0,255,0) 
addEventHandler('onClientMarkerHit', Marker,function(hit) 
    if ( hit == localPlayer ) then 
        guiSetVisible(GUIEditor_Window[2], true ) 
        showCursor(true) 
    elseif (hit == GUIEditor_Button[1] ) then 
        toggleAllControls( hit, true ) 
        setElementInterior( hit, 6 ) 
        setElementPosition( hit, 264.74969, 77.49036, 1001.03906 ) 
    elseif(hit == GUIEditor_Button[2]) then 
        guiSetVisible(GUIEditor_Window[2], false ) 
        showCursor(false) 
        toggleAllControls( hit, false ) 
    end 
end) 

Link to comment

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