
Exile
Members-
Posts
6 -
Joined
-
Last visited
Details
-
Gang
Criminal
Exile's Achievements

Vic (3/54)
0
Reputation
-
CODE REMOVED BY Solidsnake14
-
Hello everyone,I want to know how to lock specific scripts to classes/teams Like say,I only want a headshot script useable for only a couple of teams/classes. Or jut one... Can anyone tell me how to do so? Is there any code that I can put before every scripts that only these certain teams/classes can use the script Similar to local team = getPlayerTeam(localPlayer) if team and getTeamName(team) == "NAME HERE" then Like only a team can use this FPSLimit = 37 FPSMax = 1 function onClientResourceStart ( resource ) if ( guiFPSLabel == nil ) then FPSLimit = 255 / FPSLimit guiFPSLabel = guiCreateLabel ( 0.03, 0.97, 0.1, 0.1, "FPS: 0", true ) FPSCalc = 0 FPSTime = getTickCount() + 1000 addEventHandler ( "onClientRender", getRootElement (), onClientRender ) end end addEventHandler ( "onClientResourceStart", getRootElement (), onClientResourceStart ) function onClientRender ( ) if ( getTickCount() < FPSTime ) then FPSCalc = FPSCalc + 1 else if ( FPSCalc > FPSMax ) then FPSLimit = 255 / FPSCalc FPSMax = FPSCalc end guiSetText ( guiFPSLabel, "FPS: "..FPSCalc.." Max: "..FPSMax ) guiLabelSetColor ( guiFPSLabel, 255 - math.ceil ( FPSCalc * FPSLimit ), math.ceil ( FPSCalc * FPSLimit ), 0 ) FPSCalc = 0 FPSTime = getTickCount() + 1000 end end Can anyone give me a code/snippet to do so?
-
fixed
-
GUI dosent disappear
-
I have a working spawn system,it spawns and everything but the GUI dosen't disappear after I press spawn,here's the spawn_client
-
I get a error saying : "triggerd serverside event on onPlayerSpawnButton but event is not added serverside" 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 (<messages>) local cities = {} -- create a new global variable to store the welcome messages 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 GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} cost = math.random(50,5000) --Make GUI GUIEditor_Window[1] = guiCreateWindow(0.25,0.8,0.5,0.3,"Testing ServerRPG - 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)Testing ServerRPG",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,"Testing ServerRPG Spawn Menu",true) guiWindowSetMovable(spawnWindow, false) guiWindowSetSizable(spawnWindow, false) infoWindow = guiCreateWindow(0.005,0.265,0.5,0.125,"Testing ServerRPG 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 Testing Server",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 local selectedRow, selectedCol = guiGridListGetSelectedItem( classGridList ); -- get double clicked item in the gridlist