Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local screenWidth, screenHeight = guiGetScreenSize()
- local currentWidth, currentHeight = 250, 125
- local currentOutline = 4
- local gapBetween = 32
- local left = (screenWidth/2) - (currentWidth/2)
- local top = (screenHeight/2) - (currentHeight/2)
- local controls = { "aim_weapon","radio_next","radio_previous", "fire", "vehicle_fire", "vehicle_secondary_fire" }
- local kepszam = 0
- local weaponUpper = 0
- local weaponLower = 0
- local mutat = false
- local weaponslot = 0
- local nextAmmo = nil
- local currentAmmo = nil
- local previousAmmo = nil
- function getNextWeapon(cSlot)
- local tempSlot = {}
- local curSlot
- if cSlot then
- curSlot = cSlot
- else
- curSlot = getPedWeaponSlot(localPlayer)
- end
- if (curSlot == 0) and (getPedWeapon(localPlayer) == 0 or getPedWeapon(localPlayer) == 1) then
- curSlot = 13
- end
- tempSlot["ID"] = 13
- repeat
- tempSlot["ID"] = tempSlot["ID"]-1
- until (tempSlot["ID"] < curSlot) and not (tempSlot["ID"] ~= 0 and getPedWeapon(localPlayer, tempSlot["ID"]) == 0)
- return getPedWeapon(localPlayer, tempSlot["ID"])
- end
- function getPreviousWeapon(cSlot)
- local tempSlot = {}
- local curSlot
- if cSlot then
- curSlot = cSlot
- else
- curSlot = getPedWeaponSlot(localPlayer)
- end
- if (curSlot == 12) then
- curSlot = - 1
- end
- tempSlot["ID"] = - 1
- repeat
- tempSlot["ID"] = tempSlot["ID"] + 1
- if tempSlot["ID"] == 13 then
- tempSlot["ID"] = -1
- curSlot = -1
- end
- until (tempSlot["ID"] > curSlot) and not (tempSlot["ID"] ~= 0 and getPedWeapon(localPlayer, tempSlot["ID"]) == 0)
- return getPedWeapon(localPlayer, tempSlot["ID"])
- end
- local isRendered
- local weaps = {
- ["old"] = "",
- ["curr"] = "",
- ["next"] = "",
- ["prev"] = ""
- }
- function selectWeapon()
- weaps["next"] = getNextWeapon(getSlotFromWeapon(weaps["curr"]))
- weaps["prev"] = getPreviousWeapon(getSlotFromWeapon(weaps["curr"]))
- local textx = left + (currentWidth / 2)
- local texty = (top + (currentHeight / 2))
- dxDrawText( "Fegyvereid",textx, texty - 215, textx, texty - 215, tocolor(200,0,100,255), 2, "default", "center", "center", false,false,true)
- if weaps["old"] == weaps["curr"] then
- dxDrawRectangle ( left - currentOutline, top - currentOutline, currentWidth + currentOutline*2, currentHeight + currentOutline*2, tocolor ( 200, 0, 100, 180 ) )
- end
- dxDrawRectangle ( left, top, currentWidth, currentHeight, tocolor ( 0, 0, 0, 180 ) )
- dxDrawRectangle ( left + 26, top + 48 - currentHeight - gapBetween, currentWidth - 52, currentHeight - 32, tocolor ( 0, 0, 0, 180 ) )
- dxDrawRectangle ( left + 26, top - 16 + currentHeight + gapBetween, currentWidth - 52, currentHeight - 32, tocolor ( 0, 0, 0, 180 ) )
- dxDrawImage(left + 26, top - currentHeight + gapBetween, 256-128, 128-64, "weap/".. weaps["next"] ..".png", 0, 0, 0, tocolor(255, 255, 255, 100), true)
- --nextAmmo = getPedTotalAmmo(getLocalPlayer(), getSlotFromWeapon(nextWeap)) - getPedAmmoInClip(getLocalPlayer(), getSlotFromWeapon(nextWeap)) .. " #FFFFFF/ " .. getPedAmmoInClip(getLocalPlayer(), getSlotFromWeapon(nextWeapon))
- if nextAmmo then --and weaponslot > 0 then
- dxDrawText( "".. nextAmmo .."",textx, texty - 156, textx, texty - 156, tocolor(200,0,100,100), 1, "default", "center", "center", false,false,true,true)
- end
- dxDrawImage(left, top, 256, 128, "weap/".. weaps["curr"] ..".png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
- --currentAmmo = getPedTotalAmmo ( getLocalPlayer(), weaponslot ) - getPedAmmoInClip(getLocalPlayer(), weaponslot) .. " #FFFFFF/ " .. getPedAmmoInClip(getLocalPlayer(), weaponslot)
- if currentAmmo then --and weaponslot > 0 then
- dxDrawText( "".. currentAmmo .."",textx, texty + 48, textx, texty + 48, tocolor(200,0,100,255), 1.5, "default", "center", "center", false,false,true,true)
- end
- dxDrawImage(left + 26, top + currentHeight + gapBetween, 256-128, 128-64, "weap/".. weaps["prev"] ..".png", 0, 0, 0, tocolor(255, 255, 255, 100), true)
- --previousAmmo = getPedTotalAmmo(getLocalPlayer(), getSlotFromWeapon(prevWeap)) - getPedAmmoInClip(getLocalPlayer(), getSlotFromWeapon(prevWeap)) .. " #FFFFFF/ " .. getPedAmmoInClip(getLocalPlayer(), getSlotFromWeapon(previousWeapon))
- if previousAmmo then --and weaponslot > 0 then
- dxDrawText( "".. previousAmmo .."",textx, texty + 156, textx, texty + 156, tocolor(200,0,100,100), 1, "default", "center", "center", false,false,true,true)
- end
- end
- addEventHandler("onClientResourceStart", resourceRoot, function()
- end)
- addEventHandler( "onClientResourceStart", getRootElement( ),
- function ( )
- toggleControl ( "next_weapon", false )
- toggleControl ( "previous_weapon", false )
- end
- );
- function changeNextWeapon()
- if weaps["curr"] == "" then
- weaps["old"] = getPedWeapon(getLocalPlayer())
- weaps["curr"] = weaps["old"]
- else
- weaps["curr"] = getNextWeapon(getSlotFromWeapon(weaps["curr"]))
- end
- if not isRendered then
- addEventHandler("onClientRender", root, selectWeapon)
- isRendered = not isRendered
- toggleControl("fire", false)
- toggleControl("aim", false)
- end
- end
- function changePrevWeapon()
- if weaps["curr"] == "" then
- weaps["old"] = getPedWeapon(getLocalPlayer())
- weaps["curr"] = weaps["old"]
- else
- weaps["curr"] = getPreviousWeapon(getSlotFromWeapon(weaps["curr"]))
- end
- if not isRendered then
- addEventHandler("onClientRender", root, selectWeapon)
- isRendered = not isRendered
- toggleControl("fire", false)
- toggleControl("aim", false)
- end
- end
- function changeWeap()
- setPedWeaponSlot(localPlayer, getSlotFromWeapon(weaps["curr"]))
- toggleControl("fire", true)
- toggleControl("aim", true)
- removeEventHandler("onClientRender", root, selectWeapon)
- isRendered = not isRendered
- weaps["curr"] = ""
- end
- bindKey("mouse_wheel_up", "both", changeNextWeapon)
- bindKey("mouse_wheel_down", "both", changePrevWeapon)
- bindKey("mouse1", "up", changeWeap)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement