thegost Posted November 19, 2015 Share Posted November 19, 2015 Hey All , I have one spawn panel good , but he bugged people not see the spawn .... people dead and spawn not see, he start and not have erros in /debugscript 3 help please local localPlayer = getLocalPlayer() local resX, resY = guiGetScreenSize() local startX = resX * (2 / 3) local startY = 0 local windowX = resX * (1 / 5) local windowY = resY local xml = xmlLoadFile("spawns.xml") -- open the XML file local cityNodes = xmlNodeGetChildren(xml) -- get all child nodes of the root node () local cities = {} -- create a new global variable to store the welcome messages local GUIEditor_Window = {} local GUIEditor_Button = {} local GUIEditor_Memo = {} local GUIEditor_Label = {} 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]["r"] = xmlNodeGetAttribute(node3, "r") cities[cityname][classname][skinName]["g"] = xmlNodeGetAttribute(node3, "g") cities[cityname][classname][skinName]["b"] = xmlNodeGetAttribute(node3, "b") local skinNodes = xmlNodeGetChildren(node3) cities[cityname][classname][skinName]["skins"] = {} for i4, node4 in ipairs(skinNodes) do local skinID = xmlNodeGetValue(node4) table.insert(cities[cityname][classname][skinName]["skins"], skinID) end 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) function setCamera() setCameraMatrix(1192.3686523438, -2036.3634033203, 69.235496520996, 1191.3736572266, -2036.330078125, 69.141883850098, 0, 70) end function wastedScreenFix() guiSetVisible(GUIEditor_Window[1], true) end ---------------------------------------------- wasted selection GUI function drawWastedSelection() --Make vars cost = math.random(50,5000) --Make GUI GUIEditor_Window[1] = guiCreateWindow(0.25,0.8,0.5,0.3,"RG:RPG - Spawn",true) guiWindowSetMovable(GUIEditor_Window[1], false) guiWindowSetSizable(GUIEditor_Window[1], false) GUIEditor_Button[2] = guiCreateButton(0.2,0.3,0.6,0.2,"Return to the spawn menu",true,GUIEditor_Window[1]) --GUIEditor_Label[4] = guiCreateLabel(0.2,0.2,0.6,0.2,"(c)RG:RPG",true,GUIEditor_Window[1]) showCursor(true) --Button Handlers addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onHospitalbuttonclick ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], drawSpawnScreen ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], hidewastedscreen ) --Make GUI Visable guiSetVisible(GUIEditor_Window[1], false) --Wasted Screen Camera --local ,yD,zD = getElementPosition( source ) --setCameraMatrix(,yD,zD-1,,yD,zD+1,90,110) -- attach camera to players face --fadeCamera( false, 5, 119,0,0 ) --Wasted Screen Sound local sound = playSound("client/wasted.mp3",false) setSoundVolume(sound, 0.75) --Draw GUI setTimer(wastedScreenFix,500,1) end function onHospitalbuttonclick() if source == GUIEditor_Button[1] then if getPlayerMoney(getLocalPlayer()) >= cost then guiSetVisible(GUIEditor_Window[1], false) showCursor(false) triggerServerEvent("SPAWNATHOSIPTAL", getLocalPlayer() ) takePlayerMoney ( cost ) elseif getPlayerMoney(getLocalPlayer()) < cost then has = getPlayerMoney(getLocalPlayer()) take = has - cost --outputChatBox("You respawned at hospital") triggerEvent("SAVE:RPG:addMessage", localPlayer, "You have respawned at the hospital", 255, 0, 0) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) triggerServerEvent("SPAWNATHOSIPTAL", getLocalPlayer() ) takePlayerMoney ( cost ) else outputChatBox("An error occured.", 255, 0, 0) end end end function hidewastedscreen(button) if button == "left" then guiSetVisible(GUIEditor_Window[1], false) guiSetVisible(spawnWindow, true) end end -------------------------------------------- end wasted selection GUI function drawSpawnScreen() if ( spawnWindow or infoWindow ) then guiSetVisible(spawnWindow, false) guiSetVisible(infoWindow, false) end labels = {} spawnWindow = guiCreateWindow(0.005,0.395,0.5,0.6,"RG:RPG Spawn Menu",true) guiWindowSetMovable(spawnWindow, false) guiWindowSetSizable(spawnWindow, false) infoWindow = guiCreateWindow(0.005,0.265,0.5,0.125,"RG:RPG Class Information",true) guiWindowSetMovable(infoWindow,false) guiWindowSetSizable(spawnWindow,false) infoMemo = guiCreateMemo(0.0243,0.1712,0.9533,0.7534,"This server is ran by the Empire",true,infoWindow) guiMemoSetReadOnly(infoMemo, true) image = guiCreateStaticImage(0.0167,0.0387,0.975,0.225,"logo.png",true,spawnWindow) cityGridList = guiCreateGridList(0.025,0.27,0.455,0.5,true,spawnWindow) guiGridListSetSelectionMode(cityGridList,2) guiGridListAddColumn(cityGridList, "City", 0.82) classGridList = guiCreateGridList(0.52,0.27,0.455,0.3,true,spawnWindow) guiGridListSetSelectionMode(classGridList,2) guiGridListAddColumn(classGridList, "Team", 0.82) spawnGridList = guiCreateGridList(0.52,0.585,0.455,0.2995,true,spawnWindow) guiGridListSetSelectionMode(spawnGridList,2) guiGridListAddColumn(spawnGridList, "Class", 0.82) -- (LEFT RIGHT, UP DOWN, WIDTH,HEIGHT) skinPrevButton = guiCreateButton(0.55,0.9,0.125,0.25,"<-",true,spawnWindow) skinNextButton = guiCreateButton(0.82,0.9,0.125,0.25,"->",true,spawnWindow) guiSetProperty(skinPrevButton, "Disabled", "True") guiSetProperty(skinNextButton, "Disabled", "True") skinNumberLabel = guiCreateLabel(0.599,0.925,0.3058,0.0326,"1",true,spawnWindow) guiLabelSetVerticalAlign(skinNumberLabel,"center") guiLabelSetHorizontalAlign(skinNumberLabel,"center",false) spawnScreenOKButton = guiCreateButton(0.025,0.8,0.455,0.6,"Spawn",true,spawnWindow) guiSetProperty(spawnScreenOKButton, "Disabled", "True") for n, v in pairs(cities) do local row = guiGridListAddRow(cityGridList) guiGridListSetItemText(cityGridList, row, 1, n, false, false) end addEventHandler("onClientGUIClick", cityGridList, onCityClick) addEventHandler("onClientGUIClick", classGridList, onClassClick) addEventHandler("onClientGUIClick", spawnGridList, onSkinClick) addEventHandler("onClientGUIClick", spawnScreenOKButton, onSpawnButtonClick) addEventHandler("onClientGUIClick", skinPrevButton, onPrevSkin) addEventHandler("onClientGUIClick", skinNextButton, onNextSkin) fadeCamera(true) setCamera() guiSetVisible(spawnWindow, true) --guiGridListSetSelectedItem(spawnGridList, -1, 0) showCursor(true) end function onCityClick(button) if source == cityGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 then guiGridListClear(classGridList) 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(classGridList) guiGridListSetItemText(classGridList, row, 1, x, false, false) end guiSetProperty(spawnScreenOKButton, "Disabled", "True") guiSetProperty(skinPrevButton, "Disabled", "True") guiSetProperty(skinNextButton, "Disabled", "True") guiSetText(skinNumberLabel, 1) unRenderSkin() end end end function onClassClick(button) if source == classGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 and guiGridListGetSelectedCount(classGridList) > 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( classGridList ); -- get double clicked item in the gridlist local className = guiGridListGetItemText( classGridList, 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) unRenderSkin() end end end function onSkinClick(button) if source == spawnGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 and guiGridListGetSelectedCount(classGridList) > 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 Link to comment
Dealman Posted November 19, 2015 Share Posted November 19, 2015 Player spawning is done via the server, thus you need to post the server-sided script. The event you want to look for is; "onPlayerSpawnButton". Link to comment
thegost Posted November 19, 2015 Author Share Posted November 19, 2015 I have in server: See all script: Client: local localPlayer = getLocalPlayer() local resX, resY = guiGetScreenSize() local startX = resX * (2 / 3) local startY = 0 local windowX = resX * (1 / 5) local windowY = resY local xml = xmlLoadFile("spawns.xml") -- open the XML file local cityNodes = xmlNodeGetChildren(xml) -- get all child nodes of the root node () local cities = {} -- create a new global variable to store the welcome messages local GUIEditor_Window = {} local GUIEditor_Button = {} local GUIEditor_Memo = {} local GUIEditor_Label = {} 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]["r"] = xmlNodeGetAttribute(node3, "r") cities[cityname][classname][skinName]["g"] = xmlNodeGetAttribute(node3, "g") cities[cityname][classname][skinName]["b"] = xmlNodeGetAttribute(node3, "b") local skinNodes = xmlNodeGetChildren(node3) cities[cityname][classname][skinName]["skins"] = {} for i4, node4 in ipairs(skinNodes) do local skinID = xmlNodeGetValue(node4) table.insert(cities[cityname][classname][skinName]["skins"], skinID) end 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) function setCamera() setCameraMatrix(1192.3686523438, -2036.3634033203, 69.235496520996, 1191.3736572266, -2036.330078125, 69.141883850098, 0, 70) end function wastedScreenFix() guiSetVisible(GUIEditor_Window[1], true) end ---------------------------------------------- wasted selection GUI function drawWastedSelection() --Make vars cost = math.random(50,5000) --Make GUI GUIEditor_Window[1] = guiCreateWindow(0.25,0.8,0.5,0.3,"RG:RPG - Spawn",true) guiWindowSetMovable(GUIEditor_Window[1], false) guiWindowSetSizable(GUIEditor_Window[1], false) GUIEditor_Button[2] = guiCreateButton(0.2,0.3,0.6,0.2,"Return to the spawn menu",true,GUIEditor_Window[1]) --GUIEditor_Label[4] = guiCreateLabel(0.2,0.2,0.6,0.2,"(c)RG:RPG",true,GUIEditor_Window[1]) showCursor(true) --Button Handlers addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onHospitalbuttonclick ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], drawSpawnScreen ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], hidewastedscreen ) --Make GUI Visable guiSetVisible(GUIEditor_Window[1], false) --Wasted Screen Camera --local ,yD,zD = getElementPosition( source ) --setCameraMatrix(,yD,zD-1,,yD,zD+1,90,110) -- attach camera to players face --fadeCamera( false, 5, 119,0,0 ) --Wasted Screen Sound local sound = playSound("client/wasted.mp3",false) setSoundVolume(sound, 0.75) --Draw GUI setTimer(wastedScreenFix,500,1) end function onHospitalbuttonclick() if source == GUIEditor_Button[1] then if getPlayerMoney(getLocalPlayer()) >= cost then guiSetVisible(GUIEditor_Window[1], false) showCursor(false) triggerServerEvent("SPAWNATHOSIPTAL", getLocalPlayer() ) takePlayerMoney ( cost ) elseif getPlayerMoney(getLocalPlayer()) < cost then has = getPlayerMoney(getLocalPlayer()) take = has - cost --outputChatBox("You respawned at hospital") triggerEvent("SAVE:RPG:addMessage", localPlayer, "You have respawned at the hospital", 255, 0, 0) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) triggerServerEvent("SPAWNATHOSIPTAL", getLocalPlayer() ) takePlayerMoney ( cost ) else outputChatBox("An error occured.", 255, 0, 0) end end end function hidewastedscreen(button) if button == "left" then guiSetVisible(GUIEditor_Window[1], false) guiSetVisible(spawnWindow, true) end end -------------------------------------------- end wasted selection GUI function drawSpawnScreen() if ( spawnWindow or infoWindow ) then guiSetVisible(spawnWindow, false) guiSetVisible(infoWindow, false) end labels = {} spawnWindow = guiCreateWindow(0.005,0.395,0.5,0.6,"RG:RPG Spawn Menu",true) guiWindowSetMovable(spawnWindow, false) guiWindowSetSizable(spawnWindow, false) infoWindow = guiCreateWindow(0.005,0.265,0.5,0.125,"RG:RPG Class Information",true) guiWindowSetMovable(infoWindow,false) guiWindowSetSizable(spawnWindow,false) infoMemo = guiCreateMemo(0.0243,0.1712,0.9533,0.7534,"This server is ran by the Empire",true,infoWindow) guiMemoSetReadOnly(infoMemo, true) image = guiCreateStaticImage(0.0167,0.0387,0.975,0.225,"logo.png",true,spawnWindow) cityGridList = guiCreateGridList(0.025,0.27,0.455,0.5,true,spawnWindow) guiGridListSetSelectionMode(cityGridList,2) guiGridListAddColumn(cityGridList, "City", 0.82) classGridList = guiCreateGridList(0.52,0.27,0.455,0.3,true,spawnWindow) guiGridListSetSelectionMode(classGridList,2) guiGridListAddColumn(classGridList, "Team", 0.82) spawnGridList = guiCreateGridList(0.52,0.585,0.455,0.2995,true,spawnWindow) guiGridListSetSelectionMode(spawnGridList,2) guiGridListAddColumn(spawnGridList, "Class", 0.82) -- (LEFT RIGHT, UP DOWN, WIDTH,HEIGHT) skinPrevButton = guiCreateButton(0.55,0.9,0.125,0.25,"<-",true,spawnWindow) skinNextButton = guiCreateButton(0.82,0.9,0.125,0.25,"->",true,spawnWindow) guiSetProperty(skinPrevButton, "Disabled", "True") guiSetProperty(skinNextButton, "Disabled", "True") skinNumberLabel = guiCreateLabel(0.599,0.925,0.3058,0.0326,"1",true,spawnWindow) guiLabelSetVerticalAlign(skinNumberLabel,"center") guiLabelSetHorizontalAlign(skinNumberLabel,"center",false) spawnScreenOKButton = guiCreateButton(0.025,0.8,0.455,0.6,"Spawn",true,spawnWindow) guiSetProperty(spawnScreenOKButton, "Disabled", "True") for n, v in pairs(cities) do local row = guiGridListAddRow(cityGridList) guiGridListSetItemText(cityGridList, row, 1, n, false, false) end addEventHandler("onClientGUIClick", cityGridList, onCityClick) addEventHandler("onClientGUIClick", classGridList, onClassClick) addEventHandler("onClientGUIClick", spawnGridList, onSkinClick) addEventHandler("onClientGUIClick", spawnScreenOKButton, onSpawnButtonClick) addEventHandler("onClientGUIClick", skinPrevButton, onPrevSkin) addEventHandler("onClientGUIClick", skinNextButton, onNextSkin) fadeCamera(true) setCamera() guiSetVisible(spawnWindow, true) --guiGridListSetSelectedItem(spawnGridList, -1, 0) showCursor(true) end function onCityClick(button) if source == cityGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 then guiGridListClear(classGridList) 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(classGridList) guiGridListSetItemText(classGridList, row, 1, x, false, false) end guiSetProperty(spawnScreenOKButton, "Disabled", "True") guiSetProperty(skinPrevButton, "Disabled", "True") guiSetProperty(skinNextButton, "Disabled", "True") guiSetText(skinNumberLabel, 1) unRenderSkin() end end end function onClassClick(button) if source == classGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 and guiGridListGetSelectedCount(classGridList) > 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( classGridList ); -- get double clicked item in the gridlist local className = guiGridListGetItemText( classGridList, 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) unRenderSkin() end end end function onSkinClick(button) if source == spawnGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 and guiGridListGetSelectedCount(classGridList) > 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 Link to comment
Addlibs Posted November 20, 2015 Share Posted November 20, 2015 I seriously doubt that you have any rights to the scripts you post on the forum. Your incompetence proves you couldn't have scripted it yourself if you can't fix simple errors. Please contact the author of the script for further assistance. Link to comment
thegost Posted November 20, 2015 Author Share Posted November 20, 2015 Yes this script I not script .... Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now