Jump to content

luskanek

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by luskanek

  1. -- This piece of code in located in the 'onPlayerQuit' event handler. It saves the player's weapons and ammo if he has any, this is all working correctly local weapons = {} for slot = 1, 12 do local weapon = getPedWeapon(source, slot) if weapon > 0 then local ammo = getPedTotalAmmo(source, slot) if ammo > 0 then table.insert(weapons, {weapon, ammo}) end end end -- This is what appears under the 'weapons' column in the player's account table entry [ [ [ 30, 176 ] ] ] -- Which means the player left the server and had an AK-47 with total 176 ammo left -- And this is the part which loads the SQL weapons data for weapon, ammo in ipairs(fromJSON(accountData.weapons)) do giveWeapon(player, tonumber(weapon), tonumber(ammo)) end -- The problem is, the player doesn't get the weapons he has saved, instead, he'll be given a brassknuckle everytime and the SQL entry is reset Any ideas why it is not working properly? I'm using SQLite not MySQL. The weapons are saved correctly, so it would seem that the problems stems in the loading part.
  2. luskanek

    Fixed

    *boop* got a new problem with my script for i, colshape in ipairs(getElementsByType("colshape")) do if isElementWithinColShape(player, colshape) then for o, object in ipairs(getElementsByType("object")) do if isElementWithinColShape(object, colshape) then for _, object in ipairs(getElementsByType("object")) do GUIEditor.row[1] = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], GUIEditor.row[1], column, getElementModel(object), false, false) end end end end end Hey guys I got a problem with my function. I have 3 objects within a colshape and I want their model IDs to be added to a gridlist GUI. The problem is, there are 3 objects, but about 15 rows get added to the gridlist with duplicated IDs. The rows should look like this: 1 2 3 But what happens is: 1 2 3 3 3 1 2 3 3 3 and this goes on until it loops 3 times. How do I fix it?
  3. luskanek

    Fixed

    Nevermind fixed it
  4. The way it works is, that you post a script here and we fix it for you. You can ask someone to make a script for money.
  5. It is not that easy to detect if someone has been killed by a hydra, hunter or any rocket at all. It is doable but requires advanced knowledge of the language. You should focus on something easier first and try it later, when you learn more advanced things.
  6. Whoops, was in a hurry and forgot about that one, fixed. Thanks for pointing it out!
  7. lv = createColRectangle(901.67871, 601.66272, 2050, 2400) theTeam = createTeam("Criminal") addEventHandler("onColShapeLeave", getRootElement(), function(hitElement) if getElementType(hitElement) == 'player' then if source == lv then setPlayerTeam(hitElement, anotherTeam) end end end )
  8. luskanek

    Help

    Well ofcourse someone else should kill you in order for the message to appear. Are you killed by an another player or not?
  9. Whoops, my bad, sorry! Try this: lv = createColRectangle(901.67871, 601.66272, 2050, 2400) theTeam = createTeam("Gangsters") addEventHandler("onColShapeHit", getRootElement(), function(hitElement) -- forgot hitElement if getElementType(hitElement) == 'player' then if source == lv then outputChatBox("test") setPlayerTeam(hitElement, theTeam) end end end )
  10. luskanek

    Help

    function player_Wasted(_, attacker) if attacker then if getElementType(attacker) == "player" then outputChatBox(getPlayerName(attacker).. " killed " ..getPlayerName(source),getRootElement(),255,255,255) end end end addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted )
  11. lv = createColRectangle(901.67871, 601.66272, 2050, 2400) theTeam = createTeam("Gangsters") addEventHandler("onColShapeHit", getRootElement(), function() if getElementType(hitElement) == 'player' then if source == lv then outputChatBox("test") setPlayerTeam(hitElement, theTeam) end end end )
  12. addEventHandler("onResourceStart", getRootElement(), handl) function handl() for _, v in ipairs(getElementsByType("vehicle")) do if getElementModel(v) == 601 then setVehicleHandling(v, "mass", 15000.0) setVehicleHandling(v, "turnMass", 15000) setVehicleHandling(v, "maxVelocity", 70.0) setVehicleHandling(v, "engineAcceleration", 5.0 ) setVehicleHandling(v, "engineInertia", 25.0) setVehicleHandling(v, "steeringLock", 25.0 ) setVehicleHandling(v, "seatOffsetDistance", 1.0) end end end No need to make another topic if you already have one.
  13. addEventHandler("onResourceStart", getRootElement(), function() setModelHandling(601, "mass", 15000.0) setModelHandling(601, "turnMass", 15000) setModelHandling(601, "maxVelocity", 70.0) setModelHandling(601, "engineAcceleration", 5.0 ) setModelHandling(601, "engineInertia", 25.0) setModelHandling(601, "steeringLock", 25.0 ) setModelHandling(601, "seatOffsetDistance", 1.0) end ) Use this instead, it's alot better.
  14. Well just use the variables in dxDrawText and you're good to go
  15. addEventHandler("onClientRender", root, function() if isPlayerInVehicle(getLocalPlayer()) local vehicle = getPedOccupiedVehicle(getLocalPlayer() local cnt = 0 for _, occupant in pairs(getVehicleOccupants(vehicle)) do if occupant then if getElementType(occupant) == 'player' then cnt = cnt + 1 end end end end end ) What do you need the names of the player and vehicle for?
  16. Client: addCommandHandler("mycommand", function() setElementData(getLocalPlayer(), "shaderEnabled", 1) engineApplyShaderToWorldTexture(...) end ) addEvent("applyShader", true) addEventHandler("applyShader", getRootElement(), function() engineApplyShaderToWorldTexture(...) end ) Server: addEventHandler("onPlayerLogin", getRootElement(), function() setAccountData(acc, "isShaderEnabled", 0) end ) addEventHandler("onPlayerLogout", getRootElement(), function() local value = getElementData(source, "shaderEnabled") local acc = getPlayerAccount(source) setAccountData(acc, "isShaderEnabled", value) end ) addEventHandler("onPlayerSpawn", getRootElement(), function() local acc = getPlayerAccount(source) local value = getAccountData(acc, "isShaderEnabled") if value == 1 then triggerClientEvent(source, "applyShader", source) end end ) Ofcourse you have to edit it yourself. May contain erros because it was written out of my mind.
  17. You can use a bool variable which you'll set to true when the player uses the command. Then when he leave you'll save the variable's value to his account and when he logs in the value will be loaded again. Then you can use onPlayerSpawn and check if the variable's value is true, if yes, you'll apply the shader and if not then not.
  18. lv = createColRectangle(901.67871, 601.66272, 2050, 2400) LV colshape
  19. local locs = { { 1072.6, -1385.51, 13.88, 139 } } local peds = { } for i, v in ipairs ( locs ) do local x, y, z, rot = unpack ( v ) peds[i] = createPed ( 57, x, y, z, rot ) exports.SAEGJobs:create3DText ( "Lottery", { x, y, z }, { 255, 255, 0 }, nil, { } ) setElementFrozen ( peds[i], true ) addEventHandler ( "onClientPedDamage", peds[i], cancelEvent ) end function onPedClick(button, state, absX, absY, wx, wy, wz, element) if (element and getElementType(element) == "ped" and state=="down") then local x, y, z = getElementPosition(localPlayer) wx, wy, wz = getElementPosition(element) if (element == peds[i]) then if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz) < 5 then guiSetVisible(GUIEditor.window[1], true) showCursor (true) end end end end addEventHandler("onClientClick", root, onPedClick)
  20. Does debugscript 3 show any errors?
  21. addEventHandler("onResourceStart", getRootElement(), function() for _, v in ipairs(getElementsByType("vehicle")) do if getElementModel(v) == 601 then setVehicleHandling(v, "mass", 15000.0) setVehicleHandling(v, "turnMass", 15000) setVehicleHandling(v, "maxVelocity", 70.0) setVehicleHandling(v, "engineAcceleration", 5.0 ) setVehicleHandling(v, "engineInertia", 25.0) setVehicleHandling(v, "steeringLock", 25.0 ) setVehicleHandling(v, "seatOffsetDistance", 1.0) end end end )
  22. function btr90 ( ) for _,v in pairs(getElementsByType("vehicle")) do if getElementModel(v) == 601 then setVehicleHandling (v, "mass", 15000.0) setVehicleHandling(v, "turnMass", 15000) setVehicleHandling(v, "maxVelocity", 70.0) setVehicleHandling(v, "engineAcceleration", 5.0 ) setVehicleHandling(v, "engineInertia", 25.0) setVehicleHandling(v, "steeringLock", 25.0 ) setVehicleHandling(v, "seatOffsetDistance", 1.0) end end end addEventHandler( "onResourceStart", getResourceRootElement( ), btr90 ) setVehicleHandling() is a server-only function
  23. Still does the same thing even If I'm facing north.. I've tried to use getElementMatrix, which worked too but the projectile would turn into the opposite direction it was flying and flew back. Then edited it a bit and the same happened as is happening now.. I hope there is a way
  24. Great, thanks The projectile now shoots from the sides, however, another problem: If i shoot while my vehicle is facing north, everything is well, however, as soon as my vehicle is facing West, East or South, the projectile is fired, flies straight for a while and then it's trajectory changes and it changes the direction it flies to to the East, how do I fix?
×
×
  • Create New...