Jump to content

Addlibs

Members
  • Posts

    1,060
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by Addlibs

  1. You can't load vehicles from MySQL. However, you can load vehicle data and create vehicles based on that data. You would need to save data, such as vehicle model, colour, upgrades and position, to database, and then load that data, create a vehicle of such model, in such position, add such upgrades, change colour et cetera.
  2. I guess your problem is Lua Parsing fail. Lua doesn't recognise markup-style comments. If you enter XML-comments, be sure to mark them as Lua comments by adding double hyphen (--) in front. Check Line 9.
  3. team = createTeam ( "Crim", 255, 0, 0) pick = createPickup ( 2737.56470, -1760.36755, 44.14845, 3, 1240, 1 ) function pickupr(player) if getTeamName(getPlayerTeam(player)) == "Crim" then setElementHealth(player, 100) else cancelEvent(true) return end end addEventHandler("onPickupHit", getRootElement(), pickupr)
  4. Try cancelEvent(true) instead of return
  5. Addlibs

    help

    Add guiSetVisible(GUI.window[1], false) at the end of the onClientResourceStart event's function (right between line 14 and 15)
  6. Addlibs

    Help with GUI.

    Example usage: Server: --onMarketHit (serverside): triggerClientEvent(source, "teleport openGUIpanel", source) --trigger client side event that opens up the GUI addEvent("teleport teleportMe", true) --register event and make it remotely trigger-able (so the client can trigger it server side with a response) addEventHandler("teleport teleportMe", root, function() --warp end) Client: addEvent("teleport openGUIpanel", true) --register event and make it remotely trigger-able (so the server can trigger it client side) addEventHandler("teleport openGUIpanel", localPlayer, function() guiSetVisible(guiWindow, true) --open the GUI end) --onClientGUIClick (clientside): guiSetVisible(guiWindow, false) --hide the GUI if source==acceptBtn then triggerServerEvent("teleport teleportMe", localPlayer) --send a response end --don't sent any response if No button was clicked. Just hide the GUI
  7. Addlibs

    ACL problem

    You are confusing ACLs with ACL groups. You can't remove a right from an ACL group, you can remove right from an ACL. Try aclGet() instead of aclGetGroup() I've also fixed the example on aclRemoveRight cause it was wrong.
  8. Addlibs

    Table

    Are you sure that loggedAccounts and loggedAccounts[id] are both table values? You can't index loggedAccounts[id] if it's not a table. Try adding loggedAccounts[id] = {} before the first line
  9. Splitting the string: local songname = "Someone ft Someone else - Song name" local beforeHyphen = gettok(songname, 1, " - ") local afterHyphen = gettok(songname, 2, " - ")
  10. onElementModelChange (Server side)
  11. In IPB, a user can choose to use a different email for gravatar than the account email, but yeah, Thomas' post is quite accurate.
  12. prefix = "Your gamemode name | " addEventHandler("onResourceStart", resourceRoot, function() if getResourceName(source):sub(1, #prefix) == prefix then else cancelEvent(true, "Incorrect name prefix - Expected '"..prefix.."', got '"..getResourceName(source):sub(1, #prefix).."'") end end )
  13. Your messages does not make much sense... Two values for "weapon" and two values for "ammo"? Explain a bit more. Edit: Do you want to have all weapons listed in a comma separated list? Then try local _weapons = {} for k, v in ipairs(the_table) do table.insert(weapons, getWeaponNameFromID(v[1])) end "Weapons: "..table.concat(weapons, ", ")
  14. There is not comparison on line 26. You must have trimmed the code. Please check what is line 26 in your original file, and and tell us which line it is on the code you've sent.
  15. Open the script, Ctrl+F > "delay", and change the line accordingly.
  16. Addlibs

    Tyres

    Well, you can't rotate a col-cuboid, so a sphere is definitely the best alternative.
  17. You probably installed the wrong version of MTA. You have a x64 bit version of MTA on a x32 bit system.
  18. Addlibs

    bindKey

    bindKey("lshift", "both", function(key, keyState) setControlState("special_control_up", keyState=="down" and true or false) end ) Client side
  19. vehicles.lua function unbindKeysVehicle() if isKeyBound(source, "num_add", "up", toggleEngine) then unbindKey(source, "LALT", "up", toggleEngine) unbindKey(source, "num_add", "up", toggleLights) end end addEventHandler("onPlayerWasted", root, unbindKeysVehicle) medic.lua function playerDeath() local posX, posY, posZ = getElementPosition(source) local interior = getElementInterior(source) local dimension = getElementDimension(source) local ammo = getPedTotalAmmo(source) local skin = getElementData(source, "rpPlayerSkin") local uniform = getElementData(source, "rpPlayerUniform") if getElementData(source, "rpPlayerWorking") == 1 and uniform ~= 0 and getElementData(source, "rpPlayerPoliceName") == false then skin = uniform end if ammo > 1 then local weapon = getPedWeapon(source) local model = exports.functions:getWeaponModel(weapon) local weaponObject = createObject(model, posX, posY, posZ-0.95, 90.0, 0.0, 0.0, true) local query = dbQuery(connectionHandle, "INSERT INTO weapons (posX, posY, posZ, weapon, ammo, model, interior, dimension) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", posX, posY, posZ, weapon, ammo, model, interior, dimension) local result, num_affected_rows, last_insert_id = dbPoll(query, -1) takeWeapon(source, weapon) setElementInterior(weaponObject, interior) setElementDimension(weaponObject, dimension) droppedWeapon = createElement("droppedweapon") setElementData(droppedWeapon, "weapons.wId", last_insert_id) setElementData(droppedWeapon, "weapons.wType", weapon) setElementData(droppedWeapon, "weapons.wAmmo", ammo) setElementData(droppedWeapon, "weapons.wInterior", interior) setElementData(droppedWeapon, "weapons.wDimension", dimension) setElementData(droppedWeapon, "weapons.wObject", weaponObject) end setElementData(source, "rpPlayerKilled", killerWeapon) spawnPlayer(source, posX, posY, posZ, 0, skin, interior, dimension) end addEventHandler("onPlayerWasted", root, playerDeath) Code unchanged right now, just fixed formatting and indenting to make the code clearer
  20. Addlibs

    Vehicle lock

    source is the element that triggered the event (the vehicle that was being entered) By default, all scripts have a predefined root. It is almost as if every script had root = getRootElement() on the top. The root element is the element that is the parent of everything. Read more on Wiki: Element_tree Executing a function on root will execute it on all (possible) elements. Eg, setVehicleLocked(root, true) will lock ALL vehicles.
  21. This should work, however, you can remove lines 72 to 75. That function gets overridden, so its just an unnecessary couple of bytes of file size to the script.
  22. Uploaded images are downloaded by IPB. They will appear under pp_main_photo I believe. Gravatar images, however, are linked this way: "http://www.gravatar.com/avatar/"..md5( pp_gravatar ) pp_gravatar column is found in the ipb_profile_portal table. Check pp_photo_type if it matches "gravatar", then attempt to fetch the gravatar image using the above URL.
  23. That's called Indenting, maky55. And nope, not indenting won't cause problems in the script itself, but cause problems for you as it's a lot harder to see what's going on.
×
×
  • Create New...