Jump to content

Recommended Posts

I have a problem, I tried to make a local blip for each player, that is, if you are a business owner on the server (in my case), then only you have a note of where your business is.
Errors in the console are not any no, it's completely clean.

-----------------------------------------------------

this is server.lua 

function dbCreateBusinessesCallback(queryHandle)
    local sql = dbPoll(queryHandle, 0)
    if sql and #sql > 0 then
        for index, sqlRow in ipairs(sql) do
            local pos = split(sqlRow["bPos"], ",")
            local bMarker = createMarker(pos[1], pos[2], pos[3], "corona", 1.5, settings["business.markerColor"][1], settings["business.markerColor"][2], settings["business.markerColor"][3], settings["business.markerColor"][4])
            setElementInterior(bMarker, pos[4])
            setElementDimension(bMarker, pos[5])
            local timer = setTimer(businessPayout, sqlRow["bPayoutCurTime"] , 1, bMarker)
            setElementData(bMarker, "bData", {sqlRow["bID"], sqlRow["bName"], sqlRow["bOwner"], sqlRow["bCost"], sqlRow["bPayout"], sqlRow["bPayoutTime"], sqlRow["bPayoutOTime"], sqlRow["bPayoutUnit"], sqlRow["bBank"], timer})
            local bData = getElementData(bMarker, "bData")
            local id, name, owner, cost, payout, payoutTime, payoutOTime, payoutUnit, bank, timer = unpack(bData)
            if settings["business.blip"] ~= false then
                if sqlRow["bOwner"] == "For Sale" then
                addEventHandler( 'onPlayerLogin', root, function(getPlayerAccount)
                setElementData( source, 'account', getAccountName(getPlayerAccount(player)));
                triggerClientEvent(source,"createBizBlips", source)
                end);
            end
            end
            addEventHandler("onMarkerHit", bMarker, onBusinessMarkerHit)
            addEventHandler("onMarkerLeave", bMarker, onBusinessMarkerLeave)
            local timer = setTimer(businessPayout, sqlRow["bPayoutCurTime"] , 1, bMarker)
            setElementData(bMarker, "bData", {sqlRow["bID"], sqlRow["bName"], sqlRow["bOwner"], sqlRow["bCost"], sqlRow["bPayout"], sqlRow["bPayoutTime"], sqlRow["bPayoutOTime"], sqlRow["bPayoutUnit"], sqlRow["bBank"], timer})
        end
    end
end

----------------------------------------------------

this is client.lua

---------------this is bind
bindKey( 'i', 'both', function( key, keyState )
  if keyState == 'down' then
    for k, v in ipairs ( getElementsByType( 'marker', getResourceRootElement() ) ) do
      if getElementData( v, 'bOwner' ) and getElementData( v, 'bOwner' )[7] then
        if getElementData( v, 'bOwner' )[7] ~= '' then
        else
          createBlipAttachedTo( v, 52 );
        end;
      end;
    end;
  else
    for k, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do
      if getElementData( v, 'bOwner' ) then
        for k, elem in ipairs( getAttachedElements( v ) ) do
          if getElementType( elem ) == 'bBlip' then
            destroyElement( elem );
          end;
        end;
      end;
    end;
    createBlips()
  end;
end );
------------------------ And this is the second part
function getPlayerByAccountName( name )
  for i, v in ipairs( getElementsByType( 'player' ) ) do
    if getElementData( v, 'account' ) == name then
      return v;
    end;
  end;
  return false;
end;
function creatbBlips()
local account = getAccount(owner)
  for k, v in ipairs ( getElementsByType( 'marker', getResourceRootElement() ) ) do
  if getElementData( v, 'bOwner' ) and getElementData( v, 'bOwner' )[7] then
      if getElementData( v, 'bOwner' )[7] == getElementData( localPlayer, account) then
        createBlipAttachedTo( v, 52 );
      end;
    end;
  end;
end
addEvent("createBizBlips",true)
addEventHandler("createBizBlips",root,createBlips)
createBlips()

help me pleas :3  so, then I'm a terrible perplexity

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...