damien111 Posted August 17, 2012 Share Posted August 17, 2012 (edited) I am trying to make a panel that spawns objects and deletes them I cant get it to work, it is suppose to work on /stpanel here is my code CLIENT: GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(550,134,249,462,"State Trooper Panel",false) GUIEditor_TabPanel[1] = guiCreateTabPanel(9,19,231,434,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Basic Controls",GUIEditor_TabPanel[1]) GUIEditor_Button[1] = guiCreateButton(14,9,200,36,"Turn On Blipless",false,GUIEditor_Tab[1]) GUIEditor_Button[2] = guiCreateButton(14,51,199,35,"Turn Off Blipless",false,GUIEditor_Tab[1]) GUIEditor_Button[3] = guiCreateButton(16,149,200,36,"Locate Player",false,GUIEditor_Tab[1]) GUIEditor_Edit[1] = guiCreateEdit(14,116,200,31,"",false,GUIEditor_Tab[1]) GUIEditor_Tab[2] = guiCreateTab("Road Block Tools",GUIEditor_TabPanel[1]) GUIEditor_Button[4] = guiCreateButton(8,17,215,38,"Small Roadblock",false,GUIEditor_Tab[2]) GUIEditor_Button[5] = guiCreateButton(7,61,219,37,"Large Roadblock",false,GUIEditor_Tab[2]) GUIEditor_Button[6] = guiCreateButton(5,102,221,37,"Yellow Roadblock",false,GUIEditor_Tab[2]) GUIEditor_Button[7] = guiCreateButton(9,144,216,40,"Detour Sign",false,GUIEditor_Tab[2]) GUIEditor_Button[8] = guiCreateButton(7,188,219,42,"Traffic Cone",false,GUIEditor_Tab[2]) GUIEditor_Button[9] = guiCreateButton(11,233,213,45,"Warning Fence",false,GUIEditor_Tab[2]) GUIEditor_Button[10] = guiCreateButton(11,280,212,47,"Stinger",false,GUIEditor_Tab[2]) GUIEditor_Button[11] = guiCreateButton(10,346,211,53,"Delete All",false,GUIEditor_Tab[2]) addEventHandler("onClientGUIClick", GUIEditor_Button[1] , turnOnBlipless, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1] , turnOffBlipless, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1] , locPlayer, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1] , RBSMALL, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1] , RBLARGE, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1] , RBYELLOW, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1] , RBSIGN, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1] , RBCONE, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1] , RBSTINGER, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1] , RBFENCE, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1] , RBDEL, false) function showgui ( ) guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end addCommandHandler("stpanel", showgui) rbs = { } function RBDEL(source,command) for index, roadb in ipairs( rbs ) do destroyElement( roadb ) end outputChatBox("*ROADBLOCK* Deleted all roadblocks.",source,255,255,0) end function RBSMALL(source) local x,y,z = getElementPosition(source) local rotX,rotY,rotZ = getElementRotation(source) table.insert(rbs, createObject(978,x,y,z-0.15,0,0,rotZ) ) setElementPosition ( source, x, y, z+1 ) outputChatBox("*ROADBLOCK* Added.",source,255,255,0) end function RBLARGE(source) local x,y,z = getElementPosition(source) local rotX,rotY,rotZ = getElementRotation(source) table.insert(rbs, createObject(981,x,y,z,0,0,rotZ+180) ) setElementID ( roadblockobject, rbo ) setElementPosition ( source, x, y, z+1 ) outputChatBox("*ROADBLOCK* Added.",source,255,255,0) end function RBYELLOW(source) local x,y,z = getElementPosition(source) local rotX,rotY,rotZ = getElementRotation(source) table.insert(rbs, createObject(3578,x,y,z-0.2,0,0,rotZ) ) setElementID ( roadblockobject, rbo ) setElementPosition ( source, x, y, z+1 ) outputChatBox("*ROADBLOCK* Added.",source,255,255,0) end function RBSIGN(source) local x,y,z = getElementPosition(source) local rotX,rotY,rotZ = getElementRotation(source) table.insert(rbs, createObject(3091,x,y,z-0.38,0,0,rotZ+180) ) setElementID ( roadblockobject, rbo ) setElementPosition ( source, x, y, z+1 ) outputChatBox("*ROADBLOCK* Added.",source,255,255,0) end function RBCONE(source) local x,y,z = getElementPosition(source) local rotX,rotY,rotZ = getElementRotation(source) table.insert(rbs, createObject(1238,x,y,z-0.65,0,0,rotZ) ) setElementID ( roadblockobject, rbo ) setElementPosition ( source, x, y, z+1 ) outputChatBox("*ROADBLOCK* Added.",source,255,255,0) end function fence(source,command) local x,y,z = getElementPosition(source) local rotX,rotY,rotZ = getElementRotation(source) table.insert(rbs, createObject(1459,x,y,z-0.4,0,0,rotZ) ) setElementID ( roadblockobject, rbo ) setElementPosition ( source, x, y, z+1 ) outputChatBox("*ROADBLOCK* Added.",source,255,255,0) end function line(source,command) local x,y,z = getElementPosition(source) local rotX,rotY,rotZ = getElementRotation(source) table.insert(rbs, createObject(2957,x,y,z-2.6,0,0,rotZ) ) setElementID ( roadblockobject, rbo ) setElementPosition ( source, x, y, z+1 ) outputChatBox("*ROADBLOCK* Added.",source,255,255,0) end function turnOnBlipless ( thePlayer ) for index, element in ipairs ( getAttachedElements ( thePlayer ) ) do if ( getElementType ( element ) == "blip" ) then destroyElement ( element ) end end end function turnOffBlipless ( thePlayer ) for index, element in ipairs ( getAttachedElements ( thePlayer ) ) do if ( getElementType ( element ) == "blip" ) then setElementVisibleTo ( element, root, ( not isElementVisibleTo ( element ) ) ) end end end function locPlayer( ) local myPlayer = GUIEditor_Edit[1] ( ) outputChatBox ( getPlayerName ( myPlayer ).." is now being tracked!" ) createBlipAttachedTo ( myPlayer, [ 23, 2, 255, 0, 0, 255, 0, 99999.0] ) end and no server code Edited August 17, 2012 by Guest Link to comment
Castillo Posted August 17, 2012 Share Posted August 17, 2012 function turnOffBlipless Missing ( ) and the 'thePlayer' argument. Link to comment
damien111 Posted August 17, 2012 Author Share Posted August 17, 2012 What Do You Mean Link to comment
Castillo Posted August 17, 2012 Share Posted August 17, 2012 function turnOffBlipless Should be: function turnOffBlipless ( thePlayer ) Link to comment
damien111 Posted August 17, 2012 Author Share Posted August 17, 2012 ah, also how can i restrict resources to teams, or ACL Groups Link to comment
damien111 Posted August 17, 2012 Author Share Posted August 17, 2012 also, it did not work its not activating the panel Link to comment
Castillo Posted August 17, 2012 Share Posted August 17, 2012 Maybe because you don't even have the command? where's: addCommandHandler? Link to comment
damien111 Posted August 17, 2012 Author Share Posted August 17, 2012 line 44. i accidently didnt copy the hole code again > Link to comment
Castillo Posted August 17, 2012 Share Posted August 17, 2012 1: This does not make any sense: function locPlayer( ) local myPlayer = GUIEditor_Edit[1] ( ) outputChatBox ( getPlayerName ( myPlayer ).." is now being tracked!" ) createBlipAttachedTo ( myPlayer, [ 23, 2, 255, 0, 0, 255, 0, 99999.0] ) end 2: setElementVisibleTo is a server side only function, your script is client side. Link to comment
damien111 Posted August 22, 2012 Author Share Posted August 22, 2012 Ok the firt thing, i was trying to make it so the Edit = a Variable, then made the getPlayerName get it from that. so it will place a blip on them. and 2.idk what line of code Link to comment
Castillo Posted August 22, 2012 Share Posted August 22, 2012 To get the player element you must get first the text of the gui-edit and then use: getPlayerFromName. 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