Jump to content

isElementWithinColShape Error


Karuzo

Recommended Posts

Hey Guys,

So i have a problem with isElementWithinColShape.

I tried to check if the player is in the colshape using source.

But it always returns me bad Argument.

My Code:

    addEventHandler("onClientColShapeHit",root, 
        function(p) 
            if p == localPlayer then 
                local g 
                local t =  getPlayerTeam(p) 
                if t then  
                    g = getTeamName(getPlayerTeam(p)) 
                end 
                local gangr = getElementData(source,"Gang") 
                setElementData(p,"GangName",gangr) 
                if not g then outputChatBox("Gang da degilsin!",180,180,0,false) end  
                if g ~= gangr and g then 
                    outputChatBox("Düsman base'ye girdin! Dikkatli ol! Gang: "..tostring(gangr),180,0,0,false) 
                    addEventHandler("onClientRender",root,DrawInfos) 
                    setElementData(p,"showHud",false) 
                    timer = setTimer( 
                        function() 
                            outputChatBox("lol") 
                            if isElementWithinColShape(p,source) then 
                                setRadarAreaFlashing(r,true) 
                                count = count + 1 
                                if count == 200 then 
                                    removeEventHandler("onClientRender",root,DrawInfos) 
                                end 
                            end 
                        end 
                    ,1000,0) 
                elseif g == gangr then 
                    outputChatBox("Gang Base'yi girdin!",0,180,0,false) 
                    addEventHandler("onClientRender",root,DrawInfos) 
                    setElementData(p,"showHud",false) 
                end 
            end 
        end 
    ) 

Link to comment

Try This ..

timer = setTimer ( 
    function ( col ) 
        outputChatBox("lol") 
        if ( isElementWithinColShape ( localPlayer, col ) ) then 
            setRadarAreaFlashing ( r, true ) 
            count = count + 1 
            if ( count == 200 ) then 
                removeEventHandler("onClientRender",root,DrawInfos) 
            end 
        end 
    end 
, 1000, 0, source ) 

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