• Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Madalin2009

  • Rank


  • Gang
    Romanian Country

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. That's when I get now. The categories expand, but when I try to spawn a vehicle by either doubleclicking on it or clicking the 'OK' button, I get the last error/warning shown in the image.
  2. I've made a gridlist panel for spawning vehicles using the tutorial on the Wiki and my personal GUI that I made using the GUI editor. However, when I double-click one of the categories, it doesn't expand. What is wrong? Thank you. You can find the specified clientside scripts (panel.lua, vehicles.xml) in the following package: ------- EDIT: panel.lua: addEventHandler("onClientResourceStart",resourceRoot, function() wdwVehicles = guiCreateWindow(295,166,643,524,"Vehicles - Multi Theft Awesome [v0.01]",false) guiWindowSetSizable(wdwVehicles,false) wdwVehicles_Image = guiCreateStaticImage(9,21,625,494,"images/vehicles.png",false,wdwVehicles) wdwVehicles_objGridlist = guiCreateGridList(51,130,517,296,false,wdwVehicles_Image) -- guiGridListSetSelectionMode(wdwVehicles_objGridlist,2) -- add a "Vehicle" and a "Type" collumn to the gridlist guiGridListAddColumn(wdwVehicles_objGridlist,"Vehicle",0.2) guiGridListAddColumn(wdwVehicles_objGridlist,"Type",0.2) -- set the default width of the columns to roughly half the size of the gridlist (each) guiGridListSetColumnWidth(wdwVehicles_objGridlist,1,0.4,true) guiGridListSetColumnWidth(wdwVehicles_objGridlist,2,0.5,true) wdwVehicles_buttonOk = guiCreateButton(52,440,242,40,"Okay! I've chosen a vehicle.",false,wdwVehicles_Image) guiSetAlpha(wdwVehicles_buttonOk,1) guiSetFont(wdwVehicles_buttonOk,"default-bold-small") wdwVehicles_buttonCancel = guiCreateButton(325,440,242,40,"Sorry, but I don't need a vehicle.",false,wdwVehicles_Image) guiSetAlpha(wdwVehicles_buttonCancel,1) guiSetFont(wdwVehicles_buttonCancel,"default-bold-small") addEventHandler ( "onClientGUIClick", wdwVehicles_buttonCancel, closeVehicleSelection) addEventHandler ( "onClientGUIClick", wdwVehicles_buttonOk, createVehicleHandler, false) guiSetVisible(wdwVehicles, false) -- this will add all the vehicle options onto the gridlist, it is explained later in this tutorial populateGridlist() end ) function closeVehicleSelection() guiSetVisible(wdwVehicles, false) showCursor(false) guiSetInputEnabled(false) end function showVehicleSelection() -- if the window isnt visible, show it if not guiGetVisible(wdwVehicles) then guiSetVisible(wdwVehicles,true) showCursor(true,true) end end function populateGridlist() local rootnode = xmlLoadFile("vehicles.xml") -- create a blank global table to store our imported data vehicleTable = {} if rootnode then for _,group in ipairs(xmlNodeGetChildren(rootnode)) do -- create an entry in the gridlist for every vehicle "group" local row = guiGridListAddRow(wdwVehicles_objGridlist) local name = xmlNodeGetAttribute(group,"type") guiGridListSetItemText(wdwVehicles_objGridlist,row,1,name,false,false) -- add an entry containing the group name into the table vehicleTable[name] = {} -- we will use the custom data "header" to indicate that this entry can be expanded/collapsed guiGridListSetItemData(wdwVehicles_objGridlist,row,1,"header") -- then, for every group that we find, loop all of its children (the vehicle nodes) and store them in a table for _,vehicle in ipairs(xmlNodeGetChildren(group)) do local vname = xmlNodeGetAttribute(vehicle,"name") local id = xmlNodeGetAttribute(vehicle,"id") -- insert both the vehicle id and the vehicle description into the table table.insert(vehicleTable[name],{id,vname}) end end -- set element data on the gridlist so we know which group is currently showing setElementData(wdwVehicles_objGridlist,"expanded","none") -- unload the xml file now that we are finished xmlUnloadFile(rootnode) end end function createVehicleHandler(button,state) if button == "left" and state == "up" then -- get the selected item in the gridlist local row,col = guiGridListGetSelectedItem(wdwVehicles_objGridlist) -- if something is selected if row and col and row ~= -1 and col ~= -1 then -- get the vehicle id data from the gridlist that is selected local selected = guiGridListGetItemData(wdwVehicles_objGridlist,row,col) -- make sure the vehicle id is a number not a string selected = tonumber(selected) -- get the players position and rotation local rotz = getPedRotation(getLocalPlayer()) local x,y,z = getElementPosition(getLocalPlayer()) -- find the position directly infront of the player x = x + ( math.cos ( math.rad ( rotz+90 ) ) * 3) y = y + ( math.sin ( math.rad ( rotz+90 ) ) * 3) if selected and x and y and z then -- trigger the server triggerServerEvent("createVehicleFromGUI",getRootElement(),selected,x,y,z) -- hide the gui and the cursor guiSetVisible(windowVehicleSelection,false) showCursor(false,false) else outputChatBox("Invalid arguments.") end else -- otherwise, output a message to the player outputChatBox("Please select a vehicle.") end end end function createMyVehicle(vehicleid,x,y,z) -- check all the arguments exist if vehicleid and x and y and z then createVehicle(vehicleid,x,y,z) end end function changeGridlistState(group) if group then -- if the group is already expanded, we want to collapse it if getElementData(wdwVehicles_objGridlist,"expanded") == group then -- first, we clear all previous data from the gridlist guiGridListClear(wdwVehicles_objGridlist) -- now, loop all the group entries in the vehicle table that we created earlier for group,_ in pairs(vehicleTable) do -- add each group to the list and mark them with "header" local row = guiGridListAddRow(wdwVehicles_objGridlist) guiGridListSetItemText(wdwVehicles_objGridlist,row,1,group,false,false) guiGridListSetItemData(wdwVehicles_objGridlist,row,1,"header") end -- update the data to indicate that no groups are currently expanded setElementData(wdwVehicles_objGridlist,"expanded","none") -- otherwise, we want to expand it else guiGridListClear(wdwVehicles_objGridlist) local row = guiGridListAddRow(wdwVehicles_objGridlist) guiGridListSetItemText(wdwVehicles_objGridlist,row,1,group,false,false) guiGridListSetItemData(wdwVehicles_objGridlist,row,1,"header") -- loop every vehicle in the specified groups table for _,vehicle in ipairs(vehicleTable[group]) do -- add them to the gridlist and set the vehicle id as data row = guiGridListAddRow(wdwVehicles_objGridlist) -- format a "-" into the string to make it visually easier to distinguish between groups and vehicles guiGridListSetItemText(wdwVehicles_objGridlist,row,1,"- "..vehicle[2],false,false) guiGridListSetItemText(wdwVehicles_objGridlist,row,2,getVehicleType" class="kw2">getVehicleType" class="kw2">getVehicleType(tonumber(vehicle[1])),false,false) guiGridListSetItemData(wdwVehicles_objGridlist,row,1,tostring(vehicle[1])) end -- update the data to indicate which group is currently expanded setElementData(wdwVehicles_objGridlist,"expanded",group) end end end function processDoubleClick(button,state) if button == "left" and state == "up" then local row,col = guiGridListGetSelectedItem(wdwVehicles_objGridlist) -- if something in the gridlist has been selected if row and col and row ~= -1 and col ~= -1 then -- if it is a header if guiGridListGetItemData(wdwVehicles_objGridlist,row,col) == "header" then local selected = guiGridListGetItemText(wdwVehicles_objGridlist,row,col) -- call the function to collapse or expand the menu and pass which section it is as an argument changeGridlistState(selected) end end end end addEvent("createVehicleFromGUI",true) addEventHandler("createVehicleFromGUI",root,createMyVehicle) -- attach the onClientGUIDoubleClick event to the gridlist and set it to call processDoubleClick addEventHandler("onClientGUIDoubleClick",wdwVehicles_objGridlist,processDoubleClick,false) -- add the command /vehicleselection and set it to call the showVehicleSelection function addCommandHandler("v",showVehicleSelection) vehicles.xml: <root> <group type="Bikes"> <vehicle id="581" name="BF-400"/> <vehicle id="463" name="Freeway"/> <vehicle id="481" name="BMX"/> </group> <group type="Boats"> <vehicle id="472" name="Coastguard"/> <vehicle id="452" name="Speeder"/> </group> <group type="Helicopters"> <vehicle id="487" name="Maverick"/> <vehicle id="469" name="Sparrow"/> </group> <group type="Planes"> <vehicle id="593" name="Dodo"/> <vehicle id="513" name="Stuntplane"/> </group> <group type="Sports Cars"> <vehicle id="565" name="Flash"/> <vehicle id="559" name="Jester"/> <vehicle id="477" name="ZR-350"/> </group> <group type="2-Door"> <vehicle id="474" name="Hermes"/> <vehicle id="475" name="Sabre"/> </group> <group type="Emergency"> <vehicle id="416" name="Ambulance"/> <vehicle id="599" name="Police ranger"/> </group> <group type="Industrial"> <vehicle id="573" name="Dune"/> <vehicle id="552" name="Utility van"/> </group> <group type="Misc"> <vehicle id="457" name="Caddy"/> <vehicle id="583" name="Tug"/> </group> </root>
  3. addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Memo = {} GUIEditor_Image = {} MTAWelcome_Window = guiCreateWindow(279,145,717,624,"Welcome to Multi Theft Awesome [v0.01]",false) guiSetAlpha(MTAWelcome_Window,0.80000001192093) GUIEditor_TabPanel[1] = guiCreateTabPanel(13,25,684,558,false,MTAWelcome_Window) WelcomeTab = guiCreateTab("Welcome",GUIEditor_TabPanel[1]) WelcomeTab_Image1 = guiCreateStaticImage(3,6,674,132,"images/logo.png",false,WelcomeTab) WelcomeTab_Image2 = guiCreateStaticImage(0,104,408,207,"images/admhelp.png",false,WelcomeTab) GUIEditor_TabPanel[2] = guiCreateTabPanel(395,125,272,151,false,WelcomeTab) WelcomeTab_DevelopersTab = guiCreateTab("Developers",GUIEditor_TabPanel[2]) DevTab_Memo = guiCreateMemo(6,8,259,110,"TheBetaFox - Owner, scripter, mapper",false,WelcomeTab_DevelopersTab) guiMemoSetReadOnly(DevTab_Memo,true) WelcomeTab_AdminTab = guiCreateTab("Admins",GUIEditor_TabPanel[2]) AdmTab_Memo = guiCreateMemo(7,8,258,112,"WindHedgehog - Administrator\nMorrowind3 - Administrator",false,WelcomeTab_AdminTab) guiMemoSetReadOnly(AdmTab_Memo,true) WelcomeTab_ModTab = guiCreateTab("Moderators",GUIEditor_TabPanel[2]) ModTab_Memo = guiCreateMemo(4,5,262,118,"Mr. Placeholder - Head moderator\nMrs. Wtfhax - Moderator",false,WelcomeTab_ModTab) guiMemoSetReadOnly(ModTab_Memo,true) GUIEditor_TabPanel[3] = guiCreateTabPanel(42,336,254,125,false,WelcomeTab) GUIEditor_Tab[1] = guiCreateTab("General Help",GUIEditor_TabPanel[3]) GUIEditor_Memo[1] = guiCreateMemo(5,5,244,115,"See these commands for help:\n\n/help - shows a list of commands.\n/teles - shows a list of teleports.",false,GUIEditor_Tab[1]) GUIEditor_Image[1] = guiCreateStaticImage(314,296,370,200,"images/genhelp.png",false,WelcomeTab) InfoTab = guiCreateTab("Information/Credits",GUIEditor_TabPanel[1]) InfoTab_Image0 = guiCreateStaticImage(13,12,668,131,"images/logo.png",false,InfoTab) Infotab_Image1 = guiCreateStaticImage(111,78,349,178,"images/credhelp.png",false,InfoTab) GUIEditor_Memo[2] = guiCreateMemo(23,248,635,260,"Credits go to the following people:\n\n\nDevelopers & Admins:\n TheBetaFox\n\nIdeagivers:\n Inku, Morrowind3, WindHedgehog\n\nInspiration:\n [sFSE]luggi, Mave, Zezombia, Andre, robhol, Gamesnert, Morrowind3, WindHedgehog, Inku, MaykoX",false,InfoTab) MTAWelcomeWindow_Progress = guiCreateProgressBar(10,585,647,30,false,MTAWelcome_Window) guiProgressBarSetProgress(MTAWelcomeWindow_Progress,15) MTA_WelcomeWindow_Close = guiCreateButton(659,584,39,31,"X",false,MTAWelcome_Window) guiSetFont(MTA_WelcomeWindow_Close,"default-bold-small") guiSetVisible(MTAWelcome_Window, true) showCursor(true) guiSetInputEnabled(true) end ) function closeWindow() guiSetVisible(MTAWelcome_Window, false) showCursor(false) guiSetInputEnabled(false) end addEventHandler ( "onClientGUIClick", MTA_WelcomeWindow_Close, closeWindow) I made this GUI in the GUI Editor, and then tried to make the close button work, but it still doesn't. What's the problem?
  4. Hello. I have a server on my VPS (if you don't know, read: 'not my computer'). says the ports are open. All the ports are automatically forwarded, anyway. No firewall. Nothing that could block it. I can connect to the server, but anyone else who tries to gets 'Connection timed out'. How can I fix this? What may cause it?
  5. Hey guys! I've made a model in SketchUp and succesfully converted everything, and I have three files, the DFF model, the TXD pack and the COL. All's great, the sun's shinin', but I'd like to know how to put them in MTA (preferably with new object IDs - if not, are there unused objects which I can replace without 'hurting' the main game? - Also, I'd like to be able to use them in MTA Map Editor.) If there is a tutorial on this already, please let me know. I admit I haven't searched - I don't know what keywords to look for exactly. (N00b here.)
  6. So I know how much more of my playerbase I will lose.
  7. Is there any? Sorry that I didn't search, it's night and I'm usually quite lazy at this hour.
  8. If you pay I think some good scripters will come, take the money, steal the scripts and make their own server with them. So you give 'em money for nothing. Just learn, it's not SO hard.
  9. Alex, don't ask in wrong boards I must kill you over MSN. Now.
  10. My head hurts and I can't read the whole topic - can someone explain to me how this works? I've put it on my server. (DP2.3)
  11. Huh. Right now I am waiting and got bored. Jumping from r400 to r600. /me prays for better sync
  12. I am lazy to search and need a fast answer: What is the progress of 1.0 right now? Beacuse.. I need to know. I want to get MadServer Minigames on 1.0 faster. Waiting is boring and old fans of my server are more angry than sh**.
  13. Who asks you to upload server-side scripts? No one, but it automates the process so you dont have to seperate them manually, by going through all files and picking out clientside files. Heh. An yway it is a good idea.
  14. Ok - thanks robhol. But I will just wait to release MadServer Minigames when 1.0 is released...