Jump to content

que esta mal ?


iFoReX

Recommended Posts

  
-- mul_LAS:5020, imy_la_door:3109, container:3062, warehouse:3037, md_lockdoor:3033, garage:2885, rusty_garage:1508
-- vault:2634, burb:3352, garage:5779, big-garage:8378, lockup_garage:8948, modshop:10575, hangar_door:16773
-- hangar_door2:16775, motel_door:2987, warehouse_door:2904, lockupdoor:5302, spraydoor:5422
 
-- metal_fence:970, mesh-fence:4100, tall_metal_fence:8674, paul_gate:2933, electric_gate:969, subway_gate:971,
-- columbian_gate:975, compound:976, airport:980, pink_barrier:991, no_parking:2990, wood_gate:2988, house:2909
 
 
 
 
local localPlayer = getLocalPlayer()
local guiWindow = {}
local gui = {}
local screenX,screenY = guiGetScreenSize()
local xSpacer = screenX/10
local ySpacer = screenY/10
local tempX,tempY,tempZ,rotX,rotY,rotZ
local gateClosed = {}
local gateOpen = {}
local gateOwner = localPlayer
local tempGate = nil
local selectedGate = 1
local gateMarker = nil
local gates = { 2978, 5020, 3109, 3062, 3037, 3033, 2855, 1508,1383, 2634, 3352,1392, 5779, 8378, 7657, 8948, 10575, 16773, 16755, 2987, 2904, 5302, 5422, 970, 4100, 8674, 2933, 969, 971, 975, 976, 980, 991, 2990, 2988, 2909, 1219, 3243 }
local gateID = gates[selectedGate]
local tempPass = nil
 
function clientStart()
 
    buildGUI()
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), clientStart)
 
function buildGUI()
 
    guiWindow[1] = guiCreateWindow(screenX/2 - xSpacer,screenY/2 - ySpacer,100,300,"Create Gates",false)
    gui[1] = guiCreateButton(0.05,0.10,0.9,0.25,"Create",true,guiWindow[1])
    gui[2] = guiCreateButton(0.05,0.40,0.9,0.25,"Save",true,guiWindow[1])
    gui[3] = guiCreateButton(0.05,0.70,0.9,0.25,"Close",true,guiWindow[1])
    addEventHandler("onClientGUIClick", gui[1], createtempGate,false)
    addEventHandler("onClientGUIClick", gui[2], savetempGate,false)
    addEventHandler("onClientGUIClick", gui[3], closeGUI,false)
    guiSetVisible(guiWindow[1],false)
 
    guiWindow[2] = guiCreateWindow(screenX/2 - xSpacer,screenY - 300,300,300,"Create Gates",false)
    gui[11] = guiCreateButton(0.4,0.1,0.2,0.2,"^",true,guiWindow[2])
    gui[12] = guiCreateButton(0.05,0.32,0.2,0.2,"<",true,guiWindow[2])
    gui[13] = guiCreateButton(0.75,0.32,0.2,0.2,">",true,guiWindow[2])
    gui[14] = guiCreateButton(0.4,0.55,0.2,0.2,"v",true,guiWindow[2])
 
    gui[15] = guiCreateButton(0.05,0.1,0.2,0.2,"",true,guiWindow[2])
    gui[16] = guiCreateButton(0.75,0.1,0.2,0.2,"",true,guiWindow[2])
    gui[17] = guiCreateButton(0.05,0.55,0.2,0.2,"",true,guiWindow[2])
    gui[18] = guiCreateButton(0.75,0.55,0.2,0.2,"",true,guiWindow[2])
    gui[19] = guiCreateButton(0.4,0.32,0.2,0.2,"",true,guiWindow[2])
 
    gui[20] = guiCreateButton(0.05,0.8,0.3,0.15,"Save Closed",true,guiWindow[2])
    gui[21] = guiCreateButton(0.65,0.8,0.3,0.15,"Save Open",true,guiWindow[2])
    gui[22] = guiCreateEdit(0.4,0.8,0.2,0.15,"0.1",true,guiWindow[2])
 
    addEventHandler("onClientGUIClick", gui[11], gateUp,false)
    addEventHandler("onClientGUIClick", gui[12], gateLeft,false)
    addEventHandler("onClientGUIClick", gui[13], gateRight,false)
    addEventHandler("onClientGUIClick", gui[14], gateDown,false)
    addEventHandler("onClientGUIClick", gui[15], gateForwards,false)
    addEventHandler("onClientGUIClick", gui[16], gateBackwards,false)
    addEventHandler("onClientGUIClick", gui[17], gateRotRight,false)
    addEventHandler("onClientGUIClick", gui[18], gateRotLeft,false)
    addEventHandler("onClientGUIClick", gui[19], gateSwap,false)
 
    addEventHandler("onClientGUIClick", gui[20], saveClosedPos,false)
    addEventHandler("onClientGUIClick", gui[21], saveOpenPos,false)
 
    guiSetVisible(guiWindow[2],false)
 
 
    guiWindow[3] = guiCreateWindow(screenX/2 - xSpacer*1,screenY - 300,250,280,"",false)
 
    gui[30] = guiCreateEdit  (0.35,0.14,0.6,0.18,"",true,guiWindow[3])
    gui[33] = guiCreateButton(0.05,0.34,0.9,0.18,"Change Code",true,guiWindow[3])
    gui[31] = guiCreateButton(0.05,0.54,0.9,0.18,"Submit Code",true,guiWindow[3])
    gui[32] = guiCreateButton(0.05,0.74,0.9,0.18,"Cancel",true,guiWindow[3])
    gui[34] = guiCreateLabel (0.05,0.2,0.6,0.18,"Code:",true,guiWindow[3])
 
    addEventHandler("onClientGUIClick", gui[31], submitPass,false)
    addEventHandler("onClientGUIClick", gui[32], hideLogin,false)
    addEventHandler("onClientGUIClick", gui[33], updatePass,false)
    guiSetVisible(guiWindow[3],false)
    guiEditSetMaxLength(gui[30],10)
    guiWindowSetSizable(guiWindow[3],false)
 
 
end
 
 
function submitPass()
 
    local pass = guiGetText(gui[30])
    if pass then
        triggerServerEvent("submitPass",localPlayer,localPlayer,gateMarker,pass)
    else
        outputChatBox("Error: Please Supply The Gate Pass Code",255,0,0)
    end
end
 
 
function updatePass()
 
    local pass = guiGetText(gui[30])
    if pass and pass ~= "" then
        triggerServerEvent("changePass",localPlayer,localPlayer,gateMarker,pass)
    else
        outputChatBox("Error: Please Supply A New Pass Code",255,0,0)
    end
end
 
addEvent("showLogin",true)
function showLogin(player,marker,owner)
 
    if owner == getPlayerName(player) then
        guiSetVisible(gui[33],true)
    else
        guiSetVisible(gui[33],false)
    end
    guiSetText(guiWindow[3],"Gate Owner: " .. owner)
    guiSetVisible(guiWindow[3],true)
    showCursor(true)
    guiSetInputMode("no_binds_when_editing")
    gateMarker = marker
 
end
addEventHandler("showLogin",root,showLogin)
 
 
addEvent("hideLogin",true)
function hideLogin()
 
    guiSetVisible(guiWindow[3],false)
    showCursor(false)
end
addEventHandler("hideLogin",root,hideLogin)
 
 
function toggleCursor(key,state)
 
    if isCursorShowing() then
        showCursor(false)
    else
        showCursor(true)
    end
end
 
 
function closeGUI()
 
    guiSetVisible(guiWindow[1],false)
    guiSetVisible(guiWindow[2],false)
    if tempGate then
        destroyElement(tempGate)
        tempGate = nil
    end
    showCursor(false)
    unbindKey("mouse2","both",toggleCursor)
end
 
 
function showGUI(cmd,name,pass)
 
    if pass then
        tempPass = pass
    else
        tempPass = nil
    end
    if getPlayerName(localPlayer) == "BKZ|ElMota" then
        if not name then
            name = "none"
        end
        guiSetVisible(guiWindow[1],true)
        showCursor(true)
        gateOwner = name
    end
end
addCommandHandler("creategate",showGUI)
 
 
function savetempGate()
 
    outputDebugString("Saving Gate Info")
    triggerServerEvent("saveGateDetails",localPlayer,gateOwner,gateID,gateClosed[1],gateClosed[2],gateClosed[3],gateClosed[4],gateClosed[5],gateClosed[6],gateOpen[1],gateOpen[2],gateOpen[3],gateOpen[4],gateOpen[5],gateOpen[6],tempPass)
end
 
 
function createtempGate()
 
    showCursor(false)
    bindKey("mouse2","both",toggleCursor)
    guiSetVisible(guiWindow[1],false)
    guiSetVisible(guiWindow[2],true)
    tempX,tempY,tempZ = getElementPosition(localPlayer)
    tempX = tempX + 3
    tempY = tempY + 3
    rotX,rotY,rotZ = 0,0,0
    tempGate = createObject(gateID,tempX,tempY,tempZ,rotX,rotY,rotZ)
    guiSetVisible(gui[20],true)
    guiSetVisible(gui[21],true)
 
end
 
function gateUp()
   
    tempZ = tempZ + tonumber(guiGetText(gui[22]))
    setElementPosition(tempGate,tempX,tempY,tempZ,rotX,rotY,rotZ)
end
 
 
function gateDown()
   
    tempZ = tempZ - tonumber(guiGetText(gui[22]))
    setElementPosition(tempGate,tempX,tempY,tempZ,rotX,rotY,rotZ)
end
 
 
function gateLeft()
   
    tempX = tempX - tonumber(guiGetText(gui[22]))
    setElementPosition(tempGate,tempX,tempY,tempZ,rotX,rotY,rotZ)
end
 
 
function gateRight()
   
    tempX = tempX + tonumber(guiGetText(gui[22]))
    setElementPosition(tempGate,tempX,tempY,tempZ,rotX,rotY,rotZ)
end
 
 
function gateForwards()
   
    tempY = tempY - tonumber(guiGetText(gui[22]))
    setElementPosition(tempGate,tempX,tempY,tempZ,rotX,rotY,rotZ)
end
 
function gateBackwards()
   
    tempY = tempY + tonumber(guiGetText(gui[22]))
    setElementPosition(tempGate,tempX,tempY,tempZ,rotX,rotY,rotZ)
end
 
 
function gateRotRight()
 
Link to comment

man no me refiero a eso a esto me refiero mira : aqui es donde no me aparece el cursor porfas ayudame :D

function showGUI(cmd,name,pass) 
  
    if pass then 
        tempPass = pass 
    else 
        tempPass = nil 
    end 
    if getPlayerName(localPlayer) == "BKZ|ElMota" then 
        if not name then 
            name = "none" 
        end 
        guiSetVisible(guiWindow[1],true) 
        showCursor(true) 
        gateOwner = name 
    end 
end 
addCommandHandler("creategate",showGUI) 

Link to comment

Solid me aparece esto en el debugging :

[2012-03-24 11:57:00] ERROR: Client triggered serverside event saveGateDetails, but event is not added serverside 
[2012-03-24 11:57:01] ERROR: Client triggered serverside event saveGateDetails, but event is not added serverside 
[2012-03-24 11:57:02] ERROR: Client triggered serverside event saveGateDetails, but event is not added serverside 
[2012-03-24 11:57:02] ERROR: Client triggered serverside event saveGateDetails, but event is not added serverside 

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...