Jump to content

BiteeeMe

Members
  • Posts

    6
  • Joined

  • Last visited

BiteeeMe's Achievements

Vic

Vic (3/54)

0

Reputation

  1. BiteeeMe

    SQL error

    Evening, I'm having this annoying problem with this SQL code - it's affected a vast amount of my script and if someone could fix this for me, it would be much appreciated. When attempting to execute a command, nothing happens in game of course because a shit load of errors come up, fortunately they all seem to lead to the same problem which means a little fix could result in fixing the whole problem. The errors: http://gyazo.com/5ef2f5a59cc709a96eda2576bf9a1215 The code the errors lead too: function escape_string(str) return mysql_escape_string(MySQLConnection, str) end Note: this is all the same line. local insertid = mysql:query_insert_free("INSERT INTO vehicles SET job='" .. mysql:escape_string(job) .. "', model='" .. mysql:escape_string(id) .. "', x='" .. mysql:escape_string(x) .. "', y='" .. mysql:escape_string(y) .. "', z='" .. mysql:escape_string(z) .. "', rotx='" .. mysql:escape_string(rx) .. "', roty='" .. mysql:escape_string(ry) .. "', rotz='" .. mysql:escape_string(rz) .. "', color1='[ 0, 0, 0 ]', color2='[ 0, 0, 0 ]', color3='[ 0, 0, 0 ]', color4='[ 0, 0, 0 ]', faction='-1', owner='-2', plate='" .. mysql:escape_string(plate) .. "', currx='" .. mysql:escape_string(x) .. "', curry='" .. mysql:escape_string(y) .. "', currz='" .. mysql:escape_string(z) .. "', currrx='0', currry='0', currrz='" .. mysql:escape_string(r) .. "', interior='" .. mysql:escape_string(interior) .. "', currinterior='" .. mysql:escape_string(interior) .. "', dimension='" .. mysql:escape_string(dimension) .. "', currdimension='" .. mysql:escape_string(dimension) .. "',variant1="..var1..",variant2="..var2) Thanks in advance!
  2. I have a weird problem. I am new to LUA and have decided to add in a custom interior. This is purely a test and only has two doors I want to implement. I am having trouble actually doing so. Here is the code. local objects = { createObject (1491,1260.4200439453,-805.79998779297,1083,0,0,90,5), createObject (1491,1260.4000244141,-802.79998779297,1083,0,0,270,5) } local col = createColSphere(1260.5799560547,-785.30999755859,1090.9599609375, 50) local function watchChanges( ) if getElementDimension( getLocalPlayer( ) ) > 0 and getElementDimension( getLocalPlayer( ) ) ~= getElementDimension( objects[1] ) and getElementInterior( getLocalPlayer( ) ) == getElementInterior( objects[1] ) then for key, value in pairs( objects ) do setElementDimension( value, getElementDimension( getLocalPlayer( ) ) ) end elseif getElementDimension( getLocalPlayer( ) ) == 0 and getElementDimension( objects[1] ) ~= 65535 then for key, value in pairs( objects ) do setElementDimension( value, 65535 ) end end end addEventHandler( "onClientColShapeHit", col, function( element ) if element == getLocalPlayer( ) then addEventHandler( "onClientRender", root, watchChanges ) end end ) addEventHandler( "onClientColShapeLeave", col, function( element ) if element == getLocalPlayer( ) then removeEventHandler( "onClientRender", root, watchChanges ) end end ) -- Put them standby for now. for key, value in pairs( objects ) do local x, y, z = getElementPosition( value ) setElementPosition( value, x, y, z + 40 ) setElementDimension( value, 65535 ) end ="custom/maddogs.lua" type="client"/> { 5, 1260.579, -785.309, 1090.95, 0 } -- 135 Madd Dogs (custom-interior) I mean, other custom-interiors (that have already been scripted) work just fine. I don't know where I am going wrong, I would appreciate it a lot if you could point me in the right direction and fix this error! Thanks in advance. Regards, BiteeeMe!
  3. function isPlayerInFaction(targetPlayer, factionID) return tonumber( getElementData(targetPlayer, "faction") ) == factionID end function fetchAvailablePackages( targetPlayer ) local availablePackages = { } for index, factionTable in ipairs ( factionDuty ) do -- Loop all the factions if isPlayerInFaction(targetPlayer, factionTable["factionID"]) then for index, factionPackage in ipairs ( factionTable["packages"] ) do -- Loop all the faction packages local found = false for index, packageColShape in ipairs ( factionPackage["colShape"] ) do -- Loop all the colshapes of the factionpackage if isElementWithinColShape( targetPlayer, packageColShape ) then found = true break -- We found this package already, no need to search the other colshapes end end if factionPackage.vehicle and getPedOccupiedVehicle( targetPlayer ) and factionPackage.vehicle[ getElementModel( getPedOccupiedVehicle( targetPlayer ) ) ] then found = true end if found and canPlayerUseDutyPackage(targetPlayer, factionPackage) then table.insert(availablePackages, factionPackage) end end end end return availablePackages end function fetchAllPackages( ) local availablePackages = { } for index, factionTable in ipairs ( factionDuty ) do -- Loop all the factions table.insert(availablePackages, factionPackage) end return availablePackages end function canPlayerUseDutyPackage(targetPlayer, factionPackage) local playerPackagePermission = getElementData(targetPlayer, "factionPackages") if playerPackagePermission then for index, permissionID in ipairs(playerPackagePermission) do if (permissionID == factionPackage["grantID"]) then return true end end end return false end function getFactionPackages( factionID ) if not factionID or not tonumber( factionID ) then return factionDuty end for index, factionTable in ipairs ( factionDuty ) do -- Loop all the factions if tonumber(factionTable["factionID"]) == tonumber( factionID ) then return factionTable["packages"] end end return {} end addEvent("onPlayerDuty", true) Here is some more code - why lock it? You can just ask for more code and I would happily give it to you. Help would be much appreciated, if I have gave you the wrong code, or you need anything more - please tell me.
  4. Please? Can someone give me a hand and see what's going on here?
  5. Fair enough, I completely understand. I didn't 'steal' the script though, it was given to me by a friend - I wasn't planning on opening a server either, I just figured that the script is advance so I wanted to study into it. /duty is an important command so I thought I could get some help as this is purely local host - but fair enough I guess you have a point.
  6. I have this weird problem - I try and change the co-ordinates to a new location and attempt to execute the command /duty. It pops up with the message "There is no duty available for you at this spot!. Here is the code - if you guys can 'explain' the problem and fix it for me, that would be much appreciated as I'm attempting to learn LUA and I'm learning more and more everyday. Here is the code. c_duty - local thePlayer = getLocalPlayer() function openDutyWindow() local availablePackages = fetchAvailablePackages( thePlayer ) if #availablePackages > 0 then local dutyLevel = getElementData( thePlayer, "duty") if not dutyLevel or dutyLevel == 0 then selectPackageGUI_open(availablePackages) else triggerServerEvent("duty:offduty", thePlayer) end else outputChatBox("There is no duty available for you at this spot!") end end addCommandHandler("duty", openDutyWindow) g_duty function createDutyColShape(posX, posY, posZ, size, interior, dimension) tempShape = createColSphere(posX, posY, posZ, size) --exports.pool:allocateElement(tempShape) setElementDimension(tempShape, dimension) setElementInterior(tempShape, interior) return tempShape end local swatVehicles = { [427] = true } local fcpdColShapes = { } table.insert(fcpdColShapes, createDutyColShape( 323.7744140625, 305.857421875, 999.1484375, 3, 5, 1) ) --table.insert(spdColShapes, createDutyColShape( 1751.3662109375, -2523.8876953125, 15.936504364014, 6, 1, 1006) ) --table.insert(spdColShapes, createDutyColShape( 1772.8642578125, -2523.73828125, 15.936504364014, 6, 1, 1006) ) local lsesColShapes = { } --table.insert(lsesColShapes, createDutyColShape( 867.8193359375, -1679.8251953125, -36.163124084473, 5, 1, 161) ) -- LS Hospital Duty room table.insert(lsesColShapes, createDutyColShape( 1444.8486328125, 1400.0615234375, 11.159375190735, 6, 1, 2279) ) -- EMS County general room local lsfdColShapes = { } table.insert(lsfdColShapes, createDutyColShape( 2230.4912109375, -1164.0619140625, 929.00006103516, 6, 3, 10631) ) -- local courtColShapes = { } table.insert(courtColShapes, createDutyColShape(343.2958984375, 194.7607421875, 1014.5885620117, 5, 3, 100) ) -- local hexColShapes = { } table.insert(hexColShapes, createDutyColShape(2206.3935546875, 1646.646484375, 991.11834716797, 15, 1, 1472) ) -- If you need any more code, please let me know! Thanks in advance, BiteeeMe!
×
×
  • Create New...