Jump to content

Hosp Respawn Problem


Gastonito

Recommended Posts

client :

function getPositionFromElementOffset(element,offX,offY,offZ) 
    local m = getElementMatrix ( element )  -- Get the matrix
    local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1]  -- Apply transform
    local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2]
    local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3]
    return x, y, z                               -- Return the transformed point
end
 
local localPlayer = getLocalPlayer()
local resX, resY = guiGetScreenSize()
local startX = resX * (2 / 3)
local startY = 0
local windowX = resX * (2 / 3)
local windowY = resY
 
local screenW, screenH = guiGetScreenSize()
 
--[[ TARGET VIEW CLEANER CODE
local invisibles = {}
function removeInvisibles()
    for i,v in ipairs(invisibles) do
        setElementAlpha(v[1], v[2])
        table.remove(invisibles, i)
    end
end--]]
 
local spawnPending = false
 
function initializeEverything(resourceStarted)
    if getResourceName(resourceStarted) == "SAEGmenu" or getResourceName(resourceStarted) == "SAEGmenumap" then
        local xml = xmlLoadFile(":SAEGmenumap/spawns.xml")
        if xml then
            local cityNodes = xmlNodeGetChildren(xml)
            cities = {}
            for i,node in ipairs(cityNodes) do
                cityname = xmlNodeGetAttribute(node, "name")
                local classnodes = xmlNodeGetChildren(node)
                cities[cityname] = {}
                for i2,node2 in ipairs(classnodes) do
                    classname = xmlNodeGetAttribute(node2, "name")
                    local spawnnodes = xmlNodeGetChildren(node2)
                    cities[cityname][classname] = {}
                    for i3, node3 in ipairs(spawnnodes) do
                        skinName = xmlNodeGetAttribute(node3, "name")
                        cities[cityname][classname][skinName] = {}
                        cities[cityname][classname][skinName]["spawnX"] = xmlNodeGetAttribute(node3, "spawnX")
                        cities[cityname][classname][skinName]["spawnY"] = xmlNodeGetAttribute(node3, "spawnY")
                        cities[cityname][classname][skinName]["spawnZ"] = xmlNodeGetAttribute(node3, "spawnZ")
                        cities[cityname][classname][skinName]["rot"] = xmlNodeGetAttribute(node3, "rot")
                        cities[cityname][classname][skinName]["r"] = xmlNodeGetAttribute(node3, "r")
                        cities[cityname][classname][skinName]["g"] = xmlNodeGetAttribute(node3, "g")
                        cities[cityname][classname][skinName]["b"] = xmlNodeGetAttribute(node3, "b")
                        local skinNode = xmlNodeGetAttribute(node3, "skins")
                        cities[cityname][classname][skinName]["skins"] = split(skinNode, ",")
                        cities[cityname][classname][skinName]["dimension"] = xmlNodeGetAttribute(node3, "dimension")
                        cities[cityname][classname][skinName]["interior"] = xmlNodeGetAttribute(node3, "interior")
                       
                        cities[cityname][classname][skinName]["permission"] = xmlNodeGetAttribute(node3, "lock")
                        cities[cityname][classname][skinName]["information"] = xmlNodeGetAttribute(node3, "information")
                        cities[cityname][classname][skinName]["weapons"] = xmlNodeGetAttribute(node3, "weapons")
                    end
                end
            end
            xmlUnloadFile(xml)
            if spawnPending then
                spawnPending = false
                drawSpawnScreen(spawnPending)
            end
        else
            outputDebugString("Weird, you got an error.")
        end
    end
end
addEventHandler("onClientResourceStart", root, initializeEverything)
 
function drawSpawnScreen(houses)
    if cities then
        labels = {}
        --local screenW, screenH = guiGetScreenSize()
       
   
        spawnWindow = guiCreateWindow(0.0000,0.3111,0.4000,0.6862,"Spawn Information & SAEG:RPG",true)
        guiSetProperty(spawnWindow, "CaptionColour", "FFC0152D")
        guiSetFont(spawnWindow, "default-bold-small")
        guiWindowSetMovable(spawnWindow, false)
        guiWindowSetSizable(spawnWindow, false)
       
       
 
   
        infoMemo = guiCreateMemo(0.0563,0.0455,0.8723,0.2239,"",true,spawnWindow)
        guiMemoSetReadOnly(infoMemo, true)
        guiSetFont(infoMemo,"default-bold-small")
       
 
        cityGridList = guiCreateGridList(0.0195,0.3871,0.4372,0.4383,true,spawnWindow)
        guiGridListSetSelectionMode(cityGridList,2)
        guiGridListAddColumn(cityGridList, "City", 0.82)
guiSetFont(cityGridList,"default-bold-small")
        claUGridList = guiCreateGridList(0.4827,0.2922,0.4935,0.2979,true,spawnWindow)
        guiGridListSetSelectionMode(claUGridList,2)
        guiGridListAddColumn(claUGridList, "Class", 0.82)
guiSetFont(claUGridList,"default-bold-small")
 
        spawnGridList = guiCreateGridList(0.4877,0.6015,0.4935,0.2979,true,spawnWindow)
        guiGridListSetSelectionMode(spawnGridList,2)
        guiGridListAddColumn(spawnGridList, "Spawn", 0.82)
        guiSetFont(spawnGridList,"default-bold-small")
 
        locationGridList = guiCreateGridList(0.4000,0.7777,0.1625,0.2161,true)
        guiGridListSetSelectionMode(locationGridList,2)
        guiGridListAddColumn(locationGridList, "Proprites", 0.82)
        guiSetAlpha(locationGridList,0.60000002384186)
        guiSetFont(locationGridList,"default-bold-small")
 
        local noneRow = guiGridListAddRow(locationGridList)
        guiGridListSetItemText(locationGridList, noneRow, 1, "Default Spawn", false, false)
        guiGridListSetItemData(locationGridList, noneRow, 1, false)
        guiGridListSetSelectedItem(locationGridList, noneRow, 1)
 
        labels[6] = guiCreateLabel(0.0541,0.8349,0.3593,0.0247,"Select alternative model :",true,spawnWindow)
        guiLabelSetVerticalAlign(labels[6],"center")
        skinPrevButton = guiCreateButton(0.0844,0.8937,0.0866,0.055,"<<-",true,spawnWindow)
        skinNextButton = guiCreateButton(0.2532,0.8937,0.0866,0.055,"->>",true,spawnWindow)
guiSetFont(labels[6],"default-bold-small")
 
        guiSetProperty(skinPrevButton, "Disabled", "True")
        guiSetProperty(skinNextButton, "Disabled", "True")
 
        skinNumberLabel = guiCreateLabel(0.1861,0.9013,0.0541,0.0398,"N/A",true,spawnWindow)
        guiLabelSetVerticalAlign(skinNumberLabel,"center")
        guiLabelSetHorizontalAlign(skinNumberLabel,"center",false)
 
        spawnScreenOKButton = guiCreateButton(0.5758,0.9108,0.2965,0.0664,"Spawn",true,spawnWindow)
       
        guiSetFont(spawnScreenOKButton,"default-bold-small")
        guiSetProperty(spawnScreenOKButton, "Disabled", "True")
       
pic = guiCreateStaticImage(0.05,0.288,0.32,0.1, "logo.png", true, spawnWindow)
     guiSetProperty(pic, "Disabled", "True")
 
function enterButtons()
 if (getElementType(source) == "gui-button") then
  playSound("hover.wav", false)
 end
end
addEventHandler("onClientMouseEnter", guiRoot, enterButtons)
 
        for n, v in pairs(cities) do
            local row = guiGridListAddRow(cityGridList)
            guiGridListSetItemText(cityGridList, row, 1, n, false, false)
        end
       
        if houses then
            for n, v in ipairs(houses) do
                local row = guiGridListAddRow(locationGridList)
                guiGridListSetItemText(locationGridList, row, 1, v[1], false, false)
                guiGridListSetItemData(locationGridList, row, 1, {v[2], v[3], v[4]})
            end
        end
 
 
        addEventHandler("onClientGUIClick", cityGridList, onCityClick)
        addEventHandler("onClientGUIClick", claUGridList, onClassClick)
        addEventHandler("onClientGUIClick", spawnGridList, onSkinClick)
        addEventHandler("onClientGUIClick", spawnScreenOKButton, onSpawnButtonClick)
       
        addEventHandler("onClientGUIClick", skinPrevButton, onPrevSkin)
        addEventHandler("onClientGUIClick", skinNextButton, onNextSkin)
       
        fadeCamera(true)
        guiSetVisible(spawnWindow, true)
        guiGridListSetSelectedItem(spawnGridList, -1, 0)
        showCursor(true,true)
 
    else
        spawnPending = houses
    end
end
 
function onCityClick(button)
 
    if source == cityGridList and button == "left" then
        if guiGridListGetSelectedCount(cityGridList) > 0 then
            guiGridListClear(claUGridList)
            local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist
            local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text
            local cityClasses = cities[cityName]
            for x, y in pairs(cityClasses) do
                local row = guiGridListAddRow(claUGridList)
                guiGridListSetItemText(claUGridList, row, 1, x, false, false)
            end
            guiSetProperty(spawnScreenOKButton, "Disabled", "True")
            guiSetProperty(skinPrevButton, "Disabled", "True")
            guiSetProperty(skinNextButton, "Disabled", "True")
            guiSetText(skinNumberLabel, 1)
           
        end
    end
end
 
function onClassClick(button)
    if source == claUGridList and button == "left" then
        if guiGridListGetSelectedCount(cityGridList) > 0 and guiGridListGetSelectedCount(claUGridList) > 0 then
            guiGridListClear(spawnGridList)
 
            local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist
            local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text
 
            local selectedRow, selectedCol = guiGridListGetSelectedItem( claUGridList ); -- get double clicked item in the gridlist
            local className = guiGridListGetItemText( claUGridList, selectedRow, selectedCol ) -- get its text
 
            local classSkins = cities[cityName][className]
            for x, y in pairs(classSkins) do
                local row = guiGridListAddRow(spawnGridList)
 
                guiGridListSetItemText(spawnGridList, row, 1, x, false, false)
            end
            guiSetProperty(spawnScreenOKButton, "Disabled", "True")
            guiSetProperty(skinPrevButton, "Disabled", "True")
            guiSetProperty(skinNextButton, "Disabled", "True")
            guiSetText(skinNumberLabel, 1)
           
        end
    end
end
 
function onSkinClick(button)
    if source == spawnGridList and button == "left" then
        if guiGridListGetSelectedCount(cityGridList) > 0 and guiGridListGetSelectedCount(claUGridList) > 0 and guiGridListGetSelectedCount( spawnGridList ) > 0 then
            local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist
            local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text
 
            local selectedRow, selectedCol = guiGridListGetSelectedItem( claUGridList ); -- get double clicked item in the gridlist
            local className = guiGridListGetItemText( claUGridList, selectedRow, selectedCol ) -- get its text
 
            local selectedRow, selectedCol = guiGridListGetSelectedItem( spawnGridList ); -- get double clicked item in the gridlist
            local skinName = guiGridListGetItemText( spawnGridList, selectedRow, selectedCol ) -- get its text
 
            guiSetProperty(spawnScreenOKButton, "Disabled", "False")
            guiSetProperty(skinPrevButton, "Disabled", "False")
            guiSetProperty(skinNextButton, "Disabled", "False")
            guiSetText(infoMemo, cities[cityName][className][skinName]["information"])
            guiSetText(skinNumberLabel, 1)
            renderSkin()
        end
    end
end
 
function onSpawnButtonClick(button)
    if source == spawnScreenOKButton and button == "left" then
        if guiGridListGetSelectedCount( cityGridList ) > 0 and guiGridListGetSelectedCount( claUGridList ) > 0 and guiGridListGetSelectedCount( spawnGridList ) > 0 then
Edited by Guest
Link to comment
So ... I can't help you on this script ... It's ... Really hard ...

You gave me all the gamemode ... I just want the bugged script :lol:

Is it your script ?

Yes it is mine, i didn't do it, my scripter did, but he also didn't know what's the problem !! I just know it is somewhere in the menu script, and i don't know what's the bugged thing, so can u help ?

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