Jump to content

HandBuzz

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by HandBuzz

  1. For the past few days, I've been trying to improve the vehicles on my server. This included the desire of changing some vehicle handling flags. So I got working and wrote up this little "test script": function vhandling ( theVehicle ) if getElementModel(theVehicle) == 598 then if setVehicleHandling(theVehicle, "modelFlags", 0x40002000) then outputDebugString("model set") end if setVehicleHandling(theVehicle, "handlingFlags", 0x00404400) then outputDebugString("handling set") end end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), vhandling ) Now, this is executed server-side with the mention that both functions return true, which is bizzare since the modelFlags get applied while the handlingFlags don't apply. I've tried multiple hex combinations, none of them seemed to be working. If there are some of you who managed to customize said handlingFlags, I would appreciate to hear from you on this topic. I have tried multiple vehicle models with the same flag (for example SWING_CHASSIS) and none of them were actually affected.
  2. I wanted to say something that wouldn't cause so much CPU usage, I know some methods may load all the mods at the time and are very laggy for that server as well as the players I am not very good at efficient scripting, help is welcome
  3. I wanted to say something that wouldn't cause so much CPU usage, I know some methods may load all the mods at the time and are very laggy for that server as well as the players I am not very good at efficient scripting, help is welcome
  4. Hey guys, so I created a script for my server so that players can download mod files from a HTTP server. I have a considerable amount of files and this is a more comfortable way of downloading them. Now, I figured it out so players can download a single file, with the following structure (stripped down): function downloadMod ( name ) --name is correspondent to a clientside list if ( name and moddinglist[name] ) then local dff = moddinglist[name][1] local txd = moddinglist[name][2] if ( fileExists ( "mods/"..dff ) ) then --overwrite old files fileDelete ( "mods/"..dff ) end if ( fileExists ( "mods/"..txd ) ) then --overwrite old files fileDelete ( "mods/"..txd ) end downloadingFiles[name] = true -- a little output so i let the player know what he downloads local f = fetchRemote ( httpModDirectory.."/"..dff, function ( data, err, name, dff, txd ) if ( err == 0 ) then local f = fileCreate ( "mods/"..dff ) fileWrite ( f, data ) fileClose ( f ) if ( moddinglist[name][4] ) then fetchRemote ( httpModDirectory.."/"..txd, function ( data, err, name, name2 ) if ( err == 0 ) then local f = fileCreate ( "mods/"..txd ) fileWrite ( f , data ) fileClose ( f ) -- some more error handling code here, unnecesary -- and so on Now, as you can figure out i use an external file index with all the values and all that, so that a list can be created with each individual name and file names, and looks something like this moddinglist = { -- ["Name"] = { "file", "txdfile", vehID, isTXD } } Finally, I have a question. I want to setup the script so that players could download all the files listed all at once, how could I do that, without eating out all my server's resources?
  5. yes I do, but it's just a reskin, and it works fine with the hardcoded blip (i.e. where I have the parameters in a list). I don't think that is faulty
  6. So, first of all greetings. These days, i was trying to make a script that would allow you to create custom blips and save them to a database. The creation and saving (in the DB) part went well, but i am having problems when trying to load them back into the game. Here's part of the code that handles that: function loadOneBlip( ) local result = mysql:query_fetch_assoc("SELECT x AS x1, y AS y1, z AS z1, icon AS icons, size AS sizes FROM `blip`") --loading the data from the DB if result then while true do local row = mysql:fetch_assoc(result) --make it so i can select the data from a string if not row then break end --if there is no result end the operation local blip = createBlip( row.x1 , row.y1 , row.z1 , row.icons , row.sizes, 255, 0, 0, 0, 0, visibleDistance) --creating the actual blip outputChatBox("loading one blip (#"..blips..")", thePlayer, 255,255,255) --count them ingame to see if it loads completely blips = blips + 1 end mysql:free_result(result) else outputDebugString("blip failed",1) --something went wrong end end addCommandHandler("loadblip",loadOneBlip,false,false) addEventHandler("onResourceStart",root, loadOneBlip) And for more thoughts, yes, the connection to the DB is running good. The script is made serverside. And i also think i did something very wrong here, that being in when i execute the command, neither the blip gets created nor the error message display.
  7. So, first of all greetings. These days, i was trying to make a script that would allow you to create custom blips and save them to a database. The creation and saving (in the DB) part went well, but i am having problems when trying to load them back into the game. Here's part of the code that handles that: function loadOneBlip( ) local result = mysql:query_fetch_assoc("SELECT x AS x1, y AS y1, z AS z1, icon AS icons, size AS sizes FROM `blip`") --loading the data from the DB if result then while true do local row = mysql:fetch_assoc(result) --make it so i can select the data from a string if not row then break end --if there is no result end the operation local blip = createBlip( row.x1 , row.y1 , row.z1 , row.icons , row.sizes, 255, 0, 0, 0, 0, visibleDistance) --creating the actual blip outputChatBox("loading one blip (#"..blips..")", thePlayer, 255,255,255) --count them ingame to see if it loads completely blips = blips + 1 end mysql:free_result(result) else outputDebugString("blip failed",1) --something went wrong end end addCommandHandler("loadblip",loadOneBlip,false,false) addEventHandler("onResourceStart",root, loadOneBlip) And for more thoughts, yes, the connection to the DB is running good. The script is made serverside. And i also think i did something very wrong here, that being in when i execute the command, neither the blip gets created nor the error message display.
  8. Hello, I am trying to start a roleplay server but it seem i am not able to do something essential, that being replacing specific police car models and textures. When i go into the game the cars are purely stock, and i can't seem to be able to change them. I tried using pre-built mod-loaders, and building my own script, here it is, sorry for it being so long. function applyPDModels() -- tags tag4 = engineLoadTXD("copcarla.txd") -- files are in the same folder as the .lua and meta.xml engineImportTXD(tag4, 596) -- using the game ids for the car tag5 = engineLoadDFF("copcarla.dff") engineReplaceModel(tag5, 596) tag6 = engineLoadTXD("copcarsf.txd") engineImportTXD(tag6, 597) tag7 = engineLoadDFF("copcarsf.dff") engineReplaceModel(tag7, 597) tag8 = engineLoadTXD("copcarvg.txd") engineImportTXD(tag8, 598) tag9 = engineLoadDFF("copcarvg.dff") engineReplaceModel(tag9, 598) end addEvent(applyPDModels, true) addEventHandler("onClientResourceStart", getResourceRootElement(), applyPDModels) So, what should I do? So far my research has led to nothing, because these are the only client side commands that can do the job, but they don't function, please help me. P.S. the files are added in the meta.xml, and also the script.
×
×
  • Create New...