Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Miika

  1. Miika

    Redirect user

    Yup, make sure you add ’resource.(your resource)’ in admin group. redirectPlayer
  2. function random() local x, y = math.random(-2000, 2000), math.random(-2000, 2000) local z = getGroundPosition(x, y, 200) createObject(9000, x, y, z) --Replace object id with your own end
  3. Hello, I'm using gridlist sections for weapon classes. I have stored my weapon data in table and i have set each weapon it's own class. So my problem is this: It creates section for every weapon, but it should skip if there is already section for class. Here's how it looks now and how it should not look: Code: [Table]: prices = { { name="Shotgun", id=25, ammo=30, price=700, class="Shotguns", type="everyone" }; { name="Sawed-off", id=26, ammo=30, price=650, class="Shotguns", type="everyone" }; { name="Combat Shotgun", id=27, ammo=30, price=800, class="Shotguns", type="everyone" }; { name="Uzi", id=28, ammo=60, price=500, class="Sub-Machine Guns", type="everyone" }; { name="MP5", id=29, ammo=60, price=600, class="Sub-Machine Guns", type="everyone" }; { name="Uzi", id=32, ammo=60, price=500, class="Sub-Machine Guns", type="everyone" }; { name="AK-47", id=30, ammo=60, price=800, class="Assault Rifles", type="everyone" }; { name="M4", id=31, ammo=60, price=1000, class="Assault Rifles", type="everyone" }; { name="Rifle", id=33, ammo=60, price=2000, class="Rifles", type="everyone" }; { name="Sniper", id=34, ammo=60, price=3000, class="Rifles", type="everyone" }; { name="Rocket Launcher", id=35, ammo=20, price=7000, class="Heavy Weapons", type="Vip" }; { name="Heat-Seeking Rocket Launcher", id=36, ammo=20, price=1000, class="Heavy Weapons", type="Vip" }; { name="Minigun", id=38, ammo=2000, price=10000, class="Heavy Weapons", type="Vip" }; } [Client]: function drawWeaponsTable(weapons, isVip, vip_discount) local weapons = fromJSON(weapons) guiGridListClear(gridlist) local t = {} for i=1, #weapons do local value = weapons[i]["class"] if t[value] == nil then table.insert(t, value) local row = guiGridListAddRow(gridlist) guiGridListSetItemText(gridlist, row, 1, value, true, false) end local row = guiGridListAddRow(gridlist) guiGridListSetItemText(gridlist, row, 1, weapons[i]["name"], false, false) end end Hope you understand something
  4. I've always used getRootElement() when triggering serverside event without problems. Make sure you use 'client' instead of source in serverside function.
  5. It means you haven’t set a value to currentFuel
  6. Add this to your script: if not guiGetVisible(aWarpForm) then guiSetVisible(aWarpForm, true) showCursor(true) else guiSetVisible(aWarpForm, false) showCursor(false) end
  7. Hello! I have small script that replaces texture with image using shader and scrolls it from left to right. But i would like that there would be more images scrolling, example: coca cola ad, mcdonalds ad, etc... Would it be possible? I'm quite bad with shaders.. Shader: // // Example shader - uv_scroll.fx // /////////////////////////////////////////////////////////////////////////////// //Global variables /////////////////////////////////////////////////////////////////////////////// float gTime : TIME; /////////////////////////////////////////////////////////////////////////////// // Functions /////////////////////////////////////////////////////////////////////////////// //------------------------------------------- // Returns UV anim transform //------------------------------------------- float3x3 getTextureTransform () { float posU = -fmod( gTime/8 ,1 ); // Scroll Right float posV = 0; return float3x3( 1, 0, 0, 0, 1, 0, posU, posV, 1 ); } /////////////////////////////////////////////////////////////////////////////// // Techniques /////////////////////////////////////////////////////////////////////////////// texture Tex0; technique simple { pass P0 { Texture[0] = Tex0; // Set the UV thingy TextureTransform[0] = getTextureTransform (); // Enable UV thingy TextureTransformFlags[0] = Count2; } } Client-sided script: shader = dxCreateShader("shader.fx") coce = dxCreateTexture("bobo_3.png") dxSetShaderValue(shader, "Tex0", coce) engineApplyShaderToWorldTexture( shader, "buymorejeans")
  8. Hello, I faced a problem while creating resource/mission. I needed to use drug factory in doherty, SF, but the factory looks like this: https://i.imgur.com/ZpcJRGA.jpg Is there any map fixes for this or model ID for that 'interior' ? Thanks
  9. There you go: https://forum.mtasa.com/forum/149-looking-for-staff/
  10. Miika

    Weapon Table

    addEventHandler("onPlayerQuit", root, function() local account = getPlayerAccount(source) if account and not isGuestAccount(account) then local t = {} for i=0, 12 do local weapon = getPedWeapon(source, i) local ammo = getPedTotalAmmo(source, i) table.insert(t, weapon..", "..ammo) end setAccountData(account, "playerweapons", toJSON(t)) end end ) addEventHandler("onPlayerLogin", root, function() local account = getPlayerAccount(source) local t = fromJSON(getAccountData(account, "playerweapons")) for i=0, 12 do local wp = split(t[i+1][1], ", ") giveWeapon(source, wp[1], wp[2], true) setAccountData(account, "playerweapons", false) end end )
  11. You just could have opened admin panel --> resources --> freeroam --> double click to show options and 'showmaponstart' false and 'showmapondeath' false You can also set there; welcome message false, disallowed weapon and vehicle ids, setting time and gravity false, etc..
  12. Miika

    Weapon Ammo

    addEventHandler("onClientWeaponFire", root, function() local weapon = getPedPedWeapon(getLocalPlayer()) if getWeaponAmmo(weapon) == 1 then cancelEvent() end end)
  13. Miika

    Cannot see gui

    Sure, Add this to function, which is triggered when gui opens: Renderobjects = true And this to function which triggers when gui closes: Renderobjects = false Now add this on bottom of your script: Object = createObject(--your argument here) local ox, oy, oz = getElementPosition(Object) Summary = 0.4 -- amount, how much your object goes upwards addEventHandler("onClientRender", root, function() if Renderobjects then local scpos = guiScrollBarGetScrollPosition(scroll) setElementPosition(Object, ox, oy, oz+(scpos*Summary*0.01)) end end )
  14. Miika

    Cannot see gui

    There's many different colshapes. See colShape in wiki. createColSphere or createColTube would be best for replacing marker, personally I like to use createColSphere. colshape createColSphere ( float fX, float fY, float fZ, float fRadius ) So just x, y, z and size. Example, how to use it: local col = createColSphere(-2050.5, 167.39999, 27.9, 1) addEventHandler("onColShapeHit", col, function(hitElement) if getElementType(hitElement) == "player" then outputChatBox(getPlayerName(hitElement) .. " entered colshape.") end end addEventHandler("onColShapeLeave", col, function(hitElement) if getElementType(hitElement) == "player" then outputChatBox(getPlayerName(hitElement) .. " t colshape.") end end
  15. Miika

    Cannot see gui

    Not really needed if you use addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), GUI)
  16. Or just create client sided table and add it to meta so players can't edit it. It would be also fastest because you don't have to request every single word from server. Just create client table like this: languages = { ["Germany"] = { ["edit1"] = "German version of text"; ["edit2"] = "blablablabla"; }; ["English"] = { ["edit1"] = ["English version of text"; ["edit2"] = "blablablabla"; }; } And just use the data like this: if language == "germany" then guiSetText(text-element, languages["Germany"]["edit1"]) guiSetText(button-element, languages["Germany"]["edit2"]) elseif language == "english" then guiSetText(text-element, languages["English"]["edit1"]) guiSetText(button-element, languages["English"]["edit2"]) end Nice, simple and logical.
  17. Miika

    Cannot see gui

    This could help marker = createMarker(-2050.5, 167.39999, 27.9, "cylinder", 1.1, 255, 0, 0, 0) local screenW, screenH = guiGetScreenSize() function GUI() window = guiCreateWindow(10, (screenH - 372) / 2, 836, 372, "GUI", false) guiWindowSetSizable(window, false) closeButton = guiCreateButton(413, 328, 187, 34, "Close", false, window) addEventHandler("onClientMarkerHit", marker, function() guiSetVisible(window, true) showCursor(true) end) addEventHandler("onClientGUIClick", closeButton, function() guiSetVisible(window, false) showCursor(false) end) end Btw, why did you made your marker invisible? It's better to use colshapes then
  18. timer = {} function givepackvip (thePlayer) local account = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup("user." .. account, aclGetGroup("vip")) then if not isTimer(timer[account]) then timer[account] = setTimer(function() timer[account] = false end, 600000, 1) setElementData(thePlayer, "M4A1 CCO SD", 1) setElementData(thePlayer, "M4A1 CCO SD Mag", 150) setElementData(thePlayer, "M4A03", 1) setElementData(thePlayer, "M4A03 Mag", 69) setElementData(thePlayer, "Veteran Backpack", 1) setElementData(thePlayer, "MP5A5", 1) setElementData(thePlayer, "MP5A5 Mag", 150) setElementData(thePlayer, "Binoculars", 1) setElementData(thePlayer, "Burger", 3) setElementData(thePlayer, "Canteen", 3) setElementData(thePlayer, "Morphine", 2) setElementData(thePlayer, "Medical Supplies", 2) setElementData(thePlayer, "Ghillie Suit Ghost", 1) setElementData(thePlayer, "Map", 1) setElementData(thePlayer, "GPS", 1) setElementData(thePlayer, "Toolbox", 1) setElementData(thePlayer, "Infrared Googles", 1) setElementData(thePlayer, "Watch", 1) outputChatBox("#6495ED[DayzLife Romania]#C0C0C0You got the vip pack!", thePlayer, 255, 255, 255, true) else outputChatBox("#6495ED[DayzLife Romania]#C0C0C0You can request vip pack every hour!", thePlayer, 255, 0, 0, true) end end end addCommandHandler("vipitems", givepackvip) Try it and post possible errors.
  • Create New...