Jump to content

IIYAMA

Moderators
  • Posts

    6,063
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. IIYAMA

    helppp!!!

    Even is the "setWeaponOwner" does not work very well(sync damage), you can get the player with "getWeaponOwner".
  2. yes, that is true, it is because when you reconnect your userdata got changed. To safe this per-ma, you have to use account data(mysql lite) or mysql. Account data is easier, my mysql gives more performance at bigger data bases, but is harder to script. https://wiki.multitheftauto.com/wiki/SetAccountData https://wiki.multitheftauto.com/wiki/GetAccountData
  3. yes, see my sample. (tostring is making sure that when I put it the chatbox, it won't give any errors. Userdata have to be a string to output.) function Perennial_buy () local Perennial = createVehicle(404, -2600, 2268, -- s8) --> setElementData(Perennial, "save", "save")--for the save script takePlayerMoney(source, 2000) --take money setTimer(warpPedIntoVehicle, 50, 1, source, Perennial)--warp player in vehicle setElementData(source, "owner", source)--set the owner outputServerLog("[AUTOHÄNDLER] "..getPlayerName(source).." kaufte einen Perennial")--server log end function lockcar ( player ) local posX, posY, posZ = getElementPosition ( player ) local lockSphere = createColSphere ( posX, posY, posZ, 20 ) for index,nearbyVehicle in pairs(getElementsWithinColShape ( lockSphere, 'vehicle' )) do -- just use pairs instead of ipairs if getElementData ( nearbyVehicle, 'owner') == player then setVehicleLocked ( nearbyVehicle, true ) end end destroyElement ( lockSphere ) end addEventHandler ( 'onPlayerLogin', root, function () bindKey ( source, 'L', 'down', lockcar ) end) BTW to many element data will start lagging, it is recommended to learn working with tables. Like: vehicleOwnGroup = {} vehicleOwnGroup[player]= { , , , } Why is element data laggy? Because when you create it it will be send to all the players in the game. (only client element data have an option that disallow the server to share it.)
  4. You already have the user data and that is the player. local vehicle = createVehicle ( 270, 0, 0, 0) -- create a vehicle, when you create an element it will returns a userdata. outputChatBox(tostring(vehicle)) A player does also have a user data. addCommandHandler ( "myUserData", function ( player) outputChatBox(tostring(player)) end)
  5. You should not store the player name or the serial, just use the player userdata. Elements can't have the same userdata..... -_-"
  6. IIYAMA

    helppp!!!

    The weapon fire should be elementdata or it have to be registered at server side which weapon is firing. and no the code isn't yet fully synced. It took me 6 hours to create the perfect lagg free code.
  7. You can't scale gta san world-objects. You should copy them with the world-object-select-tool and then scale them.
  8. You can try: https://wiki.multitheftauto.com/wiki/SetCursorPosition
  9. It is the same as Cadu12 said, only it is already complete.
  10. GO for performance!!! muhahaha ok I am not funny... for index,vehicle in pairs ( { -- table and will be gone in a few sec's ! createVehicle(462, -2458.33398, 779.5, 34.842, 0, 0, 90, "1"), createVehicle(462, -2463, 774.5, 34.842, 0, 0, 0, "2"), createVehicle(462, -2464.5, 774.5, 34.842, 0, 0, 0, "3"), createVehicle(462, -2466, 774.5, 34.842, 0, 0, 0, "4"), createVehicle(462, -2472, 774.5, 34.842, 0, 0, 0, "5"), createVehicle(462, -2473.5, 774.5, 34.842, 0, 0, 0, "6"), createVehicle(462, -2467.5, 774.5, 34.842, 0, 0, 0, "7"), createVehicle(462, -2478, 774.5, 34.842, 0, 0, 0, "8"), createVehicle(462, -2470.5, 774.5, 34.842, 0, 0, 0, "9"), createVehicle(462, -2476.5, 774.5, 34.842, 0, 0, 0, "10"), createVehicle(462, -2475, 774.5, 34.842, 0, 0, 0, "11"), createVehicle(462, -2469, 774.5, 34.842, 0, 0, 0, "12"), createVehicle(462, -2479.5, 774.5, 34.842, 0, 0, 0, "13"), createVehicle(462, -2481, 774.5, 34.842, 0, 0, 0, "14"), createVehicle(462, -2482.5, 774.5, 34.842, 0, 0, 0, "15"), createVehicle(462, -2484, 774.5, 34.842, 0, 0, 0, "16"), createVehicle(462, -2485.5, 774.5, 34.842, 0, 0, 0, "17"), createVehicle(462, -2458.33398, 790, 34.842, 0, 0, 90, "18"), createVehicle(462, -2458.33398, 785.5, 34.842, 0, 0, 90, "19"), createVehicle(462, -2458.33398, 784, 34.842, 0, 0, 90, "20"), createVehicle(462, -2458.33398, 781, 34.842, 0, 0, 90, "21"), createVehicle(462, -2458.33398, 782.5, 34.842, 0, 0, 90, "22"), createVehicle(462, -2458.33398, 787, 34.842, 0, 0, 90, "23"), createVehicle(462, -2458.33398, 788.5, 34.842, 0, 0, 90, "24"), createVehicle(462, -2458.33398, 791.5, 34.842, 0, 0, 90, "25"), createVehicle(462, -2458.33398, 793, 34.842, 0, 0, 90, "26"), createVehicle(462, -2458.33398, 794.5, 34.842, 0, 0, 90, "27"), createVehicle(462, -2458.33398, 796, 34.842, 0, 0, 90, "28"), createVehicle(462, -2495.17603, 779, 34.842, 0, 0, 270, "29"), createVehicle(462, -2495.17603, 780.5, 34.842, 0, 0, 270, "30"), createVehicle(462, -2495.17603, 782, 34.842, 0, 0, 270, "31"), createVehicle(462, -2495.17603, 783.5, 34.842, 0, 0, 270, "32"), createVehicle(462, -2495.17603, 785, 34.842, 0, 0, 270, "33"), createVehicle(462, -2495.17603, 786.5, 34.842, 0, 0, 270, "34"), createVehicle(462, -2495.17603, 788, 34.842, 0, 0, 270, "35"), createVehicle(462, -2495.17603, 789.5, 34.842, 0, 0, 270, "36"), createVehicle(462, -2495.17603, 791, 34.842, 0, 0, 270, "37"), createVehicle(462, -2495.17603, 792.5, 34.842, 0, 0, 270, "38"), createVehicle(462, -2495.17603, 794, 34.842, 0, 0, 270, "39"), createVehicle(462, -2492.5, 796, 34.842, 0, 0, 180, "40"), createVehicle(462, -2491, 796, 34.842, 0, 0, 180, "41"), createVehicle(462, -2489.5, 796, 34.842, 0, 0, 180, "42"), createVehicle(462, -2488, 796, 34.842, 0, 0, 180, "43"), createVehicle(462, -2486.5, 796, 34.842, 0, 0, 180, "44"), createVehicle(462, -2485, 796, 34.842, 0, 0, 180, "45"), createVehicle(462, -2483.5, 796, 34.842, 0, 0, 180, "46"), createVehicle(462, -2482, 796, 34.842, 0, 0, 180, "47"), createVehicle(462, -2480.5, 796, 34.842, 0, 0, 180, "48"), createVehicle(462, -2479, 796, 34.842, 0, 0, 180, "49") } ) do setVehiclePaintjob(vehicle, 3) toggleVehicleRespawn (vehicle, true) setVehicleRespawnDelay (vehicle, 300000) setVehicleIdleRespawnDelay (vehicle, 600000) setElementData (vehicle, "freeCar", true) end and btw, this does not work: for i = 1, 49, 1 do noobnoobcars[tostring("noobcar"..i)] = true end After you create a car it will returns a user data, not a string with the data name.
  11. I am very far with building my gamemode and I was thinking about testing the performance on it. I am not sure if this is the right section, but it is quiet related to scripting. Also scripters may test their scripts and may know the answers. I did the testing with the performance stats, I am at the moment the only player in game. Name: SPY-vs-SPY change: 0 current: 178 kb max: 178 kb XMLFiles: nil refs: 20 Timers: 0 (timers only running when needed and there aren't much timers) Elements: 10 TextDisplays: nil TextItems: nil DB Queries: nil DB Connections: nil Is this a good score?(just for the core running)
  12. The only thing that worked for me was creating double objects. So one normal object and a lowlod. I am not sure if they work with interiors. I created this, but it wasn't very successfully when I use to many objects in the map. But you can always try to make it better then mines local LODMODEL_T = {} local objectLoaderCol = createColCircle ( 0, 0, 200) local objectUnLoaderCol = createColCircle ( 0, 0, 300) attachElements ( objectLoaderCol, localPlayer) attachElements (objectUnLoaderCol, localPlayer) addEventHandler("onClientRender",root, function () for i, LOD_OB in pairs (LODMODEL_T) do if isElement(LOD_OB[2]) then if getElementDimension (LOD_OB[1]) == 0 then if isElementWithinColShape ( LOD_OB[2], objectLoaderCol ) then setElementDimension ( LOD_OB[1], 6 ) setElementDimension ( LOD_OB[2], 0 ) end else if not isElementWithinColShape ( LOD_OB[2], objectLoaderCol ) and isElementWithinColShape ( LOD_OB[2], objectUnLoaderCol ) then setElementDimension ( LOD_OB[1], 0 ) setElementDimension ( LOD_OB[2], 6 ) end end else LODMODEL_T[i] = nil end end -- checking (not required) local amount = 0 -- When starting the command, we don't have any objects looped. for k,v in pairs ( LODMODEL_T ) do -- Looping all the objects in the server if isElement(v[2]) then if isElementStreamedIn ( v[2] ) then -- If the object is streamed in amount = amount + 1 -- It's an object more streamed in end end end dxDrawText (amount,5,10) -- end checking end)
  13. Nope, that isn't going to work. First of all when you get damage, there is most of the time a weapon, and gta will see that was weapon 16. "if not weapon then return end" and next to that gta/mta does have a very annoying bug. If you set a player his health at the same time he got damaged, his event won't be cancelled. This works, but I won't say it is the best solution. addEventHandler("onClientPlayerDamage", getLocalPlayer(), function (attacker, weapon) if weapon == 16 then setTimer(setMyHealth,50,1) cancelEvent() end end ) function setMyHealth () local health= getElementHealth(localPlayer) if health-20 > 0 then setElementHealth(localPlayer, health-20) else setElementHealth(localPlayer, 0) end end
  14. You can't, you can only make that if you are very good in scripting. That is more like, creating your own damage system.
  15. O_O aha I got it, extreme big list of objects without a search bar in txd editor...... thank you for your help.
  16. yes and how do I get them? I don't even know in what file they are.
  17. I can't find peds in gta3.img. (txd editor) Does any body knows where I can find the peds? (all the peds) or is there a handy tool for to get them all?
  18. as far I know an explosion isn't a weapon.
  19. I use it on Client. Well I solved it by disable it again after re-spawning. But it should not be enabled.
  20. Is it true that after you spawn a player all his controls turn on? toggleControl or is it a bug in my gamemode?
  21. You forgot a function! (fixed) You can also try to center it, instead of scaling it. (as your title says) -- for picture. local X, Y = guiGetScreenSize() local hX, hY = (X/2)-(1920/2), (Y/2)-(1080/2) addEventHandler("onClientRender",getRootElement(), function( ) dxDrawImage(hX, hY,1920,1080,"img/lobby-bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) end ) --------------------------------------------------------------------
  22. why relative? it will only strech and most of the time in the wrong way. pls fill in the size. rX,rY
  23. well vc isn't that small.
  24. Why you set these files with a type client? Without it works for me too.
  25. script.lua function replaceModel() engineImportTXD(engineLoadTXD( "elegy.txd"), 562) engineReplaceModel(engineLoadDFF( "elegy.dff", 0 ), 562) engineReplaceModel(engineLoadDFF( "exh_a_l.dff", 0 ), 1034) engineReplaceModel(engineLoadDFF( "exh_c_l.dff", 0 ), 1037) engineReplaceModel(engineLoadDFF( "fbmp_a_l.dff", 0 ), 1171) engineReplaceModel(engineLoadDFF( "fbmp_c_l.dff", 0 ), 1172) engineReplaceModel(engineLoadDFF( "rbmp_a_l.dff", 0 ), 1149) engineReplaceModel(engineLoadDFF( "rbmp_c_l.dff", 0 ), 1148) engineReplaceModel(engineLoadDFF( "rf_a_l.dff", 0 ), 1038) engineReplaceModel(engineLoadDFF( "rf_c_l.dff", 0 ), 1035) engineReplaceModel(engineLoadDFF( "spl_a_l_b.dff", 0 ), 1147) engineReplaceModel(engineLoadDFF( "spl_c_l_b.dff", 0 ), 1146) engineReplaceModel(engineLoadDFF( "wg_l_a_l.dff", 0 ), 1036) engineReplaceModel(engineLoadDFF( "wg_l_c_l.dff", 0 ), 1039) engineReplaceModel(engineLoadDFF( "wg_r_a_l.dff", 0 ), 1040) engineReplaceModel(engineLoadDFF( "wg_r_c_l.dff", 0 ), 1041) end addEventHandler ( "onClientResourceStart", resourceRoot, replaceModel) addCommandHandler ( "reloadcar", replaceModel ) If I haven't found it, try /debugscript 3 (login with admin)
×
×
  • Create New...