Jump to content

Addlibs

Members
  • Posts

    1,060
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by Addlibs

  1. Could the issue be that you've used a Standard material in 3Ds (according to the screenshots) as opposed to a GTA Material (Kam's script)?
  2. You could try running inspect(engineGetModelTextureNames(1237)) via runcode client-run (/crun) to see whether the DFF actually loaded the texture "cam".
  3. As the error message suggests, local variable 'mmx' is has a nil value and you're attempting to use it for arithmetic (basic math operations like addition). You probably never defined mmx, or defined it out of scope.
  4. If you're talking about a dxDraw image, you simply need to increase the rotation of the image (6th argument in dxDrawImage), based on tick count or frames or whatever.
  5. local zed = getElementModel ( ped ) if id == 105 or id == 107 then Don't you mean local id = getElementModel( source ) -- source is the ped that was killed, killer is the ped/client that killed it if id == 105 or id == 107 then Also, afterwards you're checking whether zed == true but you don't define zed (well, you did, now I changed it, but you nevertheless loaded an integer into it [the model id] (or false if the function failed). It would never be equal to true)
  6. You can do it yourself, and learn some trigonometry along the way maybe. x = centreX + (distance * math.cos(angle)) y = centreY + (distance * math.sin(angle)) Note that angle is given in radians. Convert degrees to radians by math.rad(degrees).
  7. local result = mysql:singleQuery("SELECT COUNT(*) as cnt FROM vehicles WHERE VehicleOwnerAccountID=? AND Slot=1", getElementData(source, "Player:AccountID")) local count = result.cnt or result[1].cnt -- depending on whether singleQuery returns a list of rows or the first row, but this code should work for both situations (?) if count >= 1 then -- slot occupied else -- slot free end
  8. What do you want "easier" about it? It simply returns the 3 floats representing the camera positiom, followed by 3 floats representing the point towards which the camera is facing, followed by camera roll and field of view. That's pretty easy imo.
  9. timers[player_] = setTimer( function(player) -- collect the player_ sent over through the callback local type_ = getElementData(player, "CreditType") -- player_ is now referred as player in this scope if type_ == "house" then -- ... end end, tim, 1, player_ ) Send player_ to the callback function through a callback argument and collect it in the parameters list of the callback function.
  10. The code you showed does not seem to contain createBlip. There are two options - either do not create a blip on the localPlayer, or edit the following line in the code you posted -- this will ignore rendering of blips which are attached to the local player: -- original if actualDist <= maxDist and getElementDimension(value)==getElementDimension(localPlayer) and getElementInterior(value)==getElementInterior(localPlayer) then -- new if getElementAttachedTo(value) ~= localPlayer and actualDist <= maxDist and getElementDimension(value)==getElementDimension(localPlayer) and getElementInterior(value)==getElementInterior(localPlayer) then
  11. I'd also point out that string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "") won't remove double nested colour codes such as ##000000ff0000 but instead only remove the inner code #000000 and the output will contain #ff0000 which, if colour coding is enabled, will turn the subsequent text red. A better alternative would be to do a while-do loop which would keep doing string.gsub while colour codes are still present (string.find), or if preferable, add some code which would disallow colour codes in names, freeing the need to filter such colour codes from names every time someone says something.
  12. Can confirm it's an issue of concatenation. Lua interprets math.floor(remaining/1000) into a number, and then it thinks you're using a short hand function calling notation without brackets ( e.g. print"hello world!"; ). This means Lua interprets the result of math.floor and then uses that as if it was a function but it's a number value. You should use the concatenation operator (..) between math.floor and the string " #640000seconds" as Mohamed Nightmare pointed out above.
  13. sWidth(310/1024), sHeight(250/768), sWidth(1221/1280), sHeight(92/720) Lua interprets this as if you were trying to call functions named sWidth, sHeight. You should add a multiplication operator between these: sWidth*(310/1024), sHeight*(250/768), sWidth*(1221/1280), sHeight*(92/720)
  14. Addlibs

    Problem in code

    You need to add those events. If you can't do it yourself, there's no reason for you to be here, as we are not here to code for you.
  15. As far as I'm aware, functions do not get removed without first becoming obsolete for a pretty long period of time, designed to allow developers to move to a new function before the server/client no longer recognises it.
  16. Wouldn't it be easier by checking whether the given XYZ within the field of view (on screen)? getScreenFromWorldPosition will return false if the XYZ is not on screen (or within n-pixels from the edge controlled by the edgeTolerance parameter). You should combine it with isLineOfSightClear or processLineOfSight to check whether the flashbang wasn't occluded by an object or wall.
  17. If you're not willing to do this yourself, you should employ a paid scripter to do stuff for you. We're not here to script for you and have you just take the finished product not learning anything.
  18. Try passing the player element as an argument to the setTimer callback. timer1 = setTimer(function(plr) setElementAlpha(plr, 0) setElementData(plr,'food',100) setElementData(plr,'thirst',50) setElementData(plr,'temperature',36.5) setElementData(plr,'blood', 12000) setElementData(plr,'pain',false) setElementData(plr,'brokenbone',false) setElementData(plr,'bleeding',0) setElementData(plr,'cold',false) setElementData(plr, 'playerOnDuty', true) if theVehicle and getVehicleController ( theVehicle ) == plr then fixVehicle (spawnVeh) end end,50,0,player)
  19. You're gonna have to use getVehicleAddonInfos in that situation. If your script is in an external resource, add <export function="getVehicleAddonInfos" type="server"/> to DayZ/meta.xml (if its not already there) and try the following code local tires,engine,parts = exports.DayZ:getVehicleAddonInfos(getElementModel(vehicle)) -- remove "exports.DayZ:" if your script will be inside the DayZ resource local col = getElementData(vehicle, "parent") setElementData(col,"Tire_inVehicle", tires) setElementData(col,"Engine_inVehicle", engine) setElementData(col,"Parts_inVehicle", parts)
  20. local tires = getElementData(vehicle, "needtires") local engines = getElementData(vehicle, "needengines") local rotaries = getElementData(vehicle, "needrotary") local parts = getElementData(vehicle, "needparts") local col = getElementData(vehicle, "parent") setElementData(col, "Tire_inVehicle", tires) setElementData(col, "Engine_inVehicle", engines) setElementData(col, "Rotary_inVehicle", rotaries) setElementData(col, "Parts_inVehicle", parts) -- Should work but untested. -- Based on latest version of the gamemode. https://github.com/NullSystemWorks/mtadayz/blob/master/DayZ/handlers/vehicles/server/actions_vehicles.lua#L16-L40
  21. This section is not for asking others to make scripts for you or to find them for you.
  22. -- server-side addCommandHandler("sms", function(player, cmd, sms, ...) newSMS = table.concat({...}, " ") sms = string.gsub(newSMS, "\\n", "\n") -- replace user input \n into actual linebreak triggerClientEvent("onSMSTrigger", player, sms) end )
  23. Have you tried getElementPosition(getCamera())
  24. That is basically an inline-if statement based on ternary operators (similar to : ? in many other languages including PHP, C, C++, etc) See more: https://en.wikipedia.org/wiki/%3F:, https://en.wikipedia.org/wiki/%3F:#Lua Here's my attempt at explaining it: AND: If the left operand is a logical true, and returns the RIGHT operand. If the left operand is a logical false, and returns the LEFT operand. OR: If the left operand is a logical true, or returns the LEFT operand. If the left operand is a logical false, or returns the RIGHT operand. Following these laws, the statement is executed in this way: where itemTable does equal "large": itemTable[i] == "large" evaluates true; true and lW -- left operand evaluates into a logical true, and therefore and returns the right operand, lW; lW or sW -- left operand evaluates into a logical true, and therefore or returns the left operand, lW; -- The result of this evaluation is lW. where itemTable does NOT equal "large": itemTable[i] == "large" --evaluates false; false and lW -- left operand evaluates into a logical false, and therefore and returns the left operand, false; false or sW -- left operand evaluates into a logical false, and therefore or returns the right operand, sW; --The result of this evaluation is sW. Basically, function iif(a, b, c) return a and b or c end --equivalent to function iif(a, b, c) if a then return b else return c end end returns b if a is true, otherwise c.
  25. Exports: int getBankID(string bankName/marker bankMarker) --Returns ID of the specified bank. marker getBankMarker(string bankName/int bankID) --Gets bank marker by ID or name. table getBankMarkers() --Returns a table containing all bank markers. marker getBankEntranceMarker(string bankName/int bankID/marker bankMarker) --Gets bank's entrance marker. marker getBankExitMarker(string bankName/int bankID/marker bankMarker) --Gets bank's exit marker. int countBanks() --Returns number of banks. bool/int setBankAccountBalance(string accountName/player playerElement, int/string newbalance [, table SQLData ]) --Sets bank account new balance. Returns new balance is set successfully, false otherwise. bool/int getBankAccountBalance(string accountName/player playerElement [, table SQLData ]) --Gets the specified account balance. bool isPlayerInBank(player playerElement [, int bankID/marker bankMarker ]) --Checks if player is in a bank. table getPlayersInBank(int bankID/marker bankMarker/string bankName) --Returns a table containing players who are in specific bank. marker getPlayerBank(player playerElement) --Gets bank marker in which specified player is standing. bool withdrawPlayerMoney(player playerElement, int amount [, table SQLData ]) --Withdraws money from specific player's account. bool depositPlayerMoney(player playerElement, int amount [, table SQLData ]) --Deposits specified player's specific amount of money. So simply do exports["bank-reloaded"]:getBankAccountBalance(playerElement)
×
×
  • Create New...