Jump to content

MTA PROBLEM -Expected string at argument 1, got nil


Recommended Posts

Hy i have a little problem:

there is error : 

WARNING: shop-system/s_generalshop_system.lua:1047: Bad argument @ 'triggerEvent' [Expected element at argument 2, got nil]

This is code :

 function delNearbyGeneralshops(thePlayer, commandName)
    if (exports.integration:isPlayerTrialAdmin(thePlayer)) then
        local posX, posY, posZ = getElementPosition(thePlayer)
        outputChatBox("Deleting Nearby Shop NPC(s):", thePlayer, 255, 126, 0)
        local count = 0
        
        local dimension = getElementDimension(thePlayer)
        
        for k, thePed in ipairs(getElementsByType("ped", resourceRoot)) do
            local pedType = getElementData(thePed, "ped:type")
            if (pedType) then
                if (pedType=="shop") then
                    local x, y = getElementPosition(thePed)
                    local distance = getDistanceBetweenPoints2D(posX, posY, x, y)
                    local cdimension = getElementDimension(thePed)
                    if (distance<=10) and (dimension==cdimension) then
                        local dbid = getElementData(thePed, "dbid")
                        local shoptype = getElementData(thePed, "shoptype")
                        if deleteGeneralShop(thePlayer, "delshop" , dbid) then
                            --outputChatBox("   Deleted Shop with ID #" .. dbid .. " and type "..shoptype..".", thePlayer, 255, 126, 0)
                            count = count + 1
                        end
                    end
                end
            end
        end
        
        if (count==0) then
            outputChatBox("   Deleted None.", thePlayer, 255, 126, 0)
        else
            outputChatBox("   Deleted "..count.." None.", thePlayer, 255, 126, 0)
        end
    end
end
addCommandHandler("delnearbyshops", delNearbyGeneralshops, false, false)
addCommandHandler("delnearbynpcs", delNearbyGeneralshops, false, false) 

Link to comment

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