thund3rbird23

Members
  • Content Count

    30
  • Joined

  • Last visited

Community Reputation

0 Neutral

About thund3rbird23

  • Rank
    Rat

Recent Profile Visitors

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

  1. Yes, I make the call after the resource has been started. I think the call code is wrong but don't know why. addEvent("useItem", true) addEventHandler("useItem", getRootElement(), function(dbID, use) if isElement(source) and dbID then local item = false for k, v in pairs(itemsTable[source]) do if v.dbID == dbID then item = v break end end if item then local playerInterior = getElementInterior(source) local playerDimension = getElementDimension(source) local itemId = item.itemId if itemId == 71 if use then exports["s_phone"]:showPhoneFunction()
  2. It doesn't seem to work. I stored steeringLock for all vehicles and I want to set to attach to the vehicles when they are loaded. I did print the vehicle id and the steeringLock from the database and it's correct: print("Load vehicle [" .. vehicleID .. "] for characterId: " .. data.owner) print(data.steeringLock) then I did setElementData to the vehicles but nothing changes. Keeps the default steeringLock for the vehicles.... setElementData(vehicle, "vehicle.steeringLock", data.steeringLock) setVehicleHandling(vehicle, "steeringLock", data.steeringLock) Or set the handling when players enter the vehicle.
  3. I need to use tables. I don't know how to do that... because I wants to get data from database as JSON: local tunings = fromJSON(data.tunings) if tunings == nil then return elseif tunings[1] == 2 then local handling = getVehicleHandling(vehicle) setVehicleHandling(vehicle, "engineAcceleration", handling + 0.4) setVehicleHandling(vehicle, "maxVelocity", handling + 19) end So in the tunings table have this value: [ [ 2, 4, 4, 4 ] ] as you see if the tunings table first value is 2 then I want to add some values to the current handling. How can I do that?
  4. I want to add values to the current handling. How can I do that? This gives me an error: "attempt to perform arithmetic on local 'handling' (a table value)" local handling = getVehicleHandling(vehicle) setVehicleHandling(vehicle, "engineAcceleration", handling + 0.4) setVehicleHandling(vehicle, "maxVelocity", handling + 19)
  5. It isn't possible to do with dx? I don't want toggle, I want to close the panel when clicked to close button
  6. I want to do, if I click to the close dxdrawrectangle then close the panel. What's wrong with this code?: local screenW, screenH = guiGetScreenSize() function renderPanel() dxDrawRectangle(screenW * 0.3324, screenH * 0.2799, screenW * 0.3609, screenH * 0.3581, tocolor(0, 0, 0, 205), false) closebutton = dxDrawRectangle(screenW * 0.6428, screenH * 0.2513, screenW * 0.0483, screenH * 0.0208, tocolor(254, 23, 23, 205), false) dxDrawText("Close", screenW * 0.6420, screenH * 0.2513, screenW * 0.6911, screenH * 0.2721, tocolor(255, 255, 255, 205), 1.00, "default", "center", "top", false, false, false, false, false) end function panel() addEventHandler("onClientRender", root, renderPanel) addEventHandler("onClientGUIClick", root, function (button, state) if button == "left" and state == up then if (source == closebutton) then removeEventHandler("onClientRender", getRootElement(), renderPanel) end end end) end addCommandHandler("openpanel", panel)
  7. Okay, so if I join to the server as "Jeff" then I need to use Jeff? if so where I need to use the name Jeff? in client side where I trigger server events like this: triggerServerEvent("alapAK", resourceRoot, "Jeff") triggerServerEvent("removealapAK", resourceRoot, "Jeff") and server side like this?: function AKalap(thePlayer) local x, y, z = getElementPosition(thePlayer) local alapak = createObject(1254, x, y, z) setAttachedWeaponForPlayer ("Jeff", alapak) exports['bone_attach']:attachElementToBone(alapak, thePlayer, 12, 0, 0, 0, 0, -90, 0) end addEvent("alapAK", true) addEventHandler("alapAK", resourceRoot, AKalap) function removeAKalap(thePlayer) local alapak = getAttachedWeaponForPlayer ("Jeff") if alapak then outputDebugString(thePlayer) iprint(thePlayer) if isElement(alapak) then exports['bone_attach']:detachElementFromBone(alapak) moveObject(alapak, 1 ,0 ,0 ,0) else destroyAttachedWeaponForPlayer ("Jeff") end end end addEvent("removealapAK", true) addEventHandler("removealapAK", getRootElement(), removeAKalap) Or I'm totally lost? Sorry... it's too much for me but I really want to make works this.
  8. am I need to specify the player for event alapAK too or use localPlayer?: triggerServerEvent("alapAK", resourceRoot, thePlayer) if I do specify the player I get errors in debug.
  9. And what do you have to do when there is no error and still figure out what is going on? got nil for local alapak = getAttachedWeaponForPlayer (thePlayer) -- here outputDebugString(alapak)
  10. Do you mean that?: triggerServerEvent("removealapAK", resourceRoot, thePlayer) Anyways don't works or I doing something wrong... it's get attached but can't detach and no error in debugscript.
  11. Huh, I never used tables so this is like the Chinese language for me, lol. Can't you substitute my code with those functions please? I just need that last deatach thing
  12. what do you mean? I wrote before your comment that's isn't good? Because that's attach the object but a bit buggy (?) when got attached to 2 player's hand in the same time and one of them detach then the other can't detach.
  13. Ok, I did it, but now if I attach weapon and my friend too in the same time and I detach the weapon then my friend can't detach... it's just keep displaying in his hand why? function AKalap(thePlayer) x, y, z = getElementPosition(thePlayer) alapak = createObject(1254, x, y, z) exports['bone_attach']:attachElementToBone(alapak, thePlayer, 12, 0, 0, 0, 0, -90, 0) end addEvent("alapAK", true) addEventHandler("alapAK", resourceRoot, AKalap) function removeAKalap() exports.bone_attach:detachElementFromBone(alapak) moveObject(alapak, 1 ,0 ,0 ,0) end addEvent("removealapAK", true) addEventHandler("removealapAK", getRootElement(), removeAKalap)
  14. How can I make visible the created weapon to all players? I'm trying to figure out but doesn't works, I got errors in debugscript. --- client side --- local x, y, z = getElementPosition(localPlayer) local default = createWeapon("ak-47", x, y, z) local new = createObject(2965, x, y, z) triggerServerEvent("newWeapon", resourceRoot, default, new) --- server side --- function weap(thePlayer, default, new) attachElements(default, new) exports['bone_attach']:attachElementToBone(new[thePlayer], localPlayer, 12, 0, 0, 0, 0, -90, 0) end addEvent("newWeapon", true) addEventHandler("newWeapon", resourceRoot, weap) Debugscript errors: clientside element 'object' at argument 4 @ 'triggerServerEvent' clientside element 'weapon' at argument 3 @ 'triggerServerEvent'