Jump to content

Problem with tables


Recommended Posts

Posted

Hello everybody! I tried to make a code which is works with tables. The half of it works, the objects are in the right place. My problem is that it only reacts with the last coordinate.

Server:

fa =  
{ 
    {2519.341796875, -870.623046875, 89.903861999512}, 
    {2525.1142578125, -859.0009765625, 89.275253295898}, 
    {2508.7119140625, -856.7333984375, 91.828628540039}, 
    {2517.02734375, -844.8046875, 90.762664794922}, 
    {2526.58984375, -852.5849609375, 89.149307250977}, 
    {2536.1171875, -861.0224609375, 87.53157043457}, 
    {2536.021484375, -877.345703125, 86.958862304688}, 
    {2512.4482421875, -842.5302734375, 91.216598510742}, 
    {2491.5361328125, -834.8134765625, 96.069061279297}, 
    {2484.13671875, -847.6982421875, 98.095672607422}, 
    {2489.521484375, -855.0185546875, 96.606590270996}, 
    {2511.796875, -862.701171875, 91.227981567383}, 
    {2558.0673828125, -867.3876953125, 84.526206970215}, 
    {2556.9765625, -885.7880859375, 84.542434692383}, 
    {2502.5419921875, -829.2978515625, 92.203872680664}, 
    {2517.974609375, -830.791015625, 89.668228149414}, 
    {2530.0830078125, -831.0751953125, 88.806869506836}, 
    {2545.7919921875, -867.85546875, 86.048957824707}, 
    {2562.96484375, -845.9423828125, 83.80574798584}, 
    {2552.6064453125, -835.3076171875, 85.780395507812}, 
    {2542.2685546875, -817.583984375, 87.962028503418}, 
    {2540.6240234375, -836.060546875, 87.394958496094}, 
    {2550.8251953125, -856.67578125, 85.351554870605}, 
    {2525.2470703125, -822.474609375, 89.558639526367}, 
    {2502.2529296875, -844.2607421875, 93.483367919922}, 
    {2578.599609375, -863.74609375, 81.747901916504}, 
    {2568.83203125, -879.9853515625, 83.429077148438}, 
    {2482.986328125, -877.1015625, 97.112419128418} 
} 
  
for i = 1, #fa do 
    faobj = createObject(771, fa[i][1], fa[i][2], fa[i][3]-4, 0, 0, math.random(0,360)) --673, 660, 618 
    faCol = createMarker(fa[i][1], fa[i][2], fa[i][3]-1, "cylinder", 2, 255, 255, 255, 255) 
end 

So I have a part where it checks if a player is in the "faCol" marker:

elseif (itemID==173) then 
            if (isElementWithinMarker ( source, faCol )) then 
                if (itemValue > 0) then 
                    if (hasSpaceForItem(source, 170, 1)) then 
                        takeItemFromSlot(source, itemSlot) 
                        giveItem(source, itemID, itemValue - 1)  
                        exports.global:applyAnimation(source, "BOMBER", "BOM_Plant_Loop", 2570, true, false, true) 
                        exports.global:sendLocalMeAction(source, "test") 
                        giveItem(source, 170, 1) 
                        triggerClientEvent("hideInventory", source) 
                    else 
                        outputChatBox( "test2", source, 255, 0, 0 ) 
                    end 
                else 
                    outputChatBox( "test3", source, 255, 0, 0 ) 
                end 
            else 
                outputChatBox("test4", source, 255, 50, 0) 
            end 
            triggerClientEvent("hideInventory", source) 

And if I'm not in the marker which is at the last position ( {2482.986328125, -877.1015625, 97.112419128418} ) then it reacts like when I'm not in a marker. But I'm in a marker, but not the last. So when I try to use item 173 then it outputs test4. What's the problem? Help me please! Everything is server side.

Posted

Available for download or not, this doesn't change anything from the fact it's still leaked.

Posted
Available for download or not, this doesn't change anything from the fact it's still leaked.

But I'm just asking for help with the tables, and why doesn't it work in the right way. Why the item only reacts with the marker in the last position.

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...