Jump to content

No deathmatch help


-Doc-

Recommended Posts

try

function centerWindow(center_window) 
    local screenW,screenH=guiGetScreenSize() 
    local windowW,windowH=guiGetSize(center_window,false) 
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
    guiSetPosition(center_window,x,y,false) 
end 
  
GUIEditor = { 
    checkbox = {}, 
    staticimage = {}, 
    label = {}, 
    button = {}, 
    window = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(542, 254, 348, 92, "No Deathmatch Mode", false) 
        centerWindow ( GUIEditor.window[1] ) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        GUIEditor.label[1] = guiCreateLabel(10, 25, 283, 15, "You can enable or disable 'No Deathmatch' mode.", false, GUIEditor.window[1]) 
        GUIEditor.staticimage[1] = guiCreateStaticImage(10, 50, 34, 26, "icon.png", false, GUIEditor.window[1]) 
        GUIEditor.checkbox[1] = guiCreateCheckBox(49, 52, 234, 24, "Enable / Disable No Deathmatch Mode", false, false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.checkbox[1], "default-bold-small") 
        GUIEditor.button[1] = guiCreateButton(303, 52, 31, 25, "X", false, GUIEditor.window[1])     
        guiSetVisible(GUIEditor.window[1], false) 
        addEventHandler("onClientGUIClick", GUIEditor.button[1], onGuiClick,false) 
        addEventHandler("onClientGUIClick",GUIEditor.checkbox[1], checkBox, false) 
    end 
) 
  
  
addCommandHandler("nodm", 
function() 
    guiSetVisible(GUIEditor.window[1], true) 
    showCursor(true) 
end 
) 
  
function onGuiClick() 
    guiSetVisible(GUIEditor.window[1], false) 
    showCursor(false) 
end 
  
  
function checkBox() 
        if ( guiCheckBoxGetSelected(GUIEditor.checkbox[1])) then 
        setElementData(localPlayer, "invincible", true) 
        addEventHandler("onClientRender", root, dxRectangle) 
        else 
        setElementData(localPlayer, "invincible", false) 
        removeEventHandler( "onClientRender", root, dxRectangle ) 
    end 
end 
  
  
addEventHandler ( "onClientPlayerDamage",localPlayer, 
    function () 
        if getElementData(source,"invincible") then 
           cancelEvent() 
      end 
  end 
) 
  
  
  
function dxRectangle() 
         dxDrawRectangle(84, 475, 220, 32, tocolor(0, 0, 0, 153), false) 
         dxDrawImage(90, 479, 27, 24, "icon.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
         dxDrawText("No Deathmatch Mode Enabled", 123, 485, 294, 497, tocolor(255, 255, 255, 255), 1.00, "arial", "left", "top", false, false, false, false, false) 
    end 
  
function disableWeaponOnGodMod (prev,new) 
    if getElementData(localPlayer, "invincible") then 
       setPedWeaponSlot(localPlayer, 0) 
       toggleControl ( "aim_weapon", false) 
       toggleControl ( "vehicle_fire", false) 
       toggleControl ( "fire", false) 
  else 
       toggleControl ( "aim_weapon", true) 
       toggleControl ( "vehicle_fire", true) 
       toggleControl ( "fire", true) 
    end 
 end 
addEventHandler ( "onClientRender", root, disableWeaponOnGodMod ) 

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