Jump to content

getPlayerTeam returing userdata


Axel

Recommended Posts

Worked, thanks arezu, now how can i get the radar area turf when the player hits the colshape.. from this:

mysql = exports.mysql 
  
addEventHandler( "onResourceStart", getResourceRootElement( ), 
function( ) 
local result = mysql:query("SELECT id, gang, c1, c2, c3, alpha, x, y, sx, sy FROM turfs") 
    if (result) then 
    local continue = true 
    while continue do 
    row = mysql:fetch_assoc(result) 
    if not (row) then 
       break 
    end 
    local id = tonumber(row["id"])         
    local gang = row["gang"] 
    local x = tonumber(row["x"])         
    local y = tonumber(row["y"]) 
    local sx = tonumber(row["sx"]) 
    local sy = tonumber(row["sy"])                               
    local c1 = tonumber(row["c1"]) 
    local c2 = tonumber(row["c2"]) 
    local c3 = tonumber(row["c3"])         
    local alpha = tonumber(row["alpha"]) 
    local shape = createColRectangle(x, y, sx, sy) 
    local turf = createRadarArea(x,y,sx,sy,c1,c2,c3,alpha) 
    exports['armour']:changeProtectedElementDataEx(shape, "gang", gang) 
    exports['armour']:changeProtectedElementDataEx(turf, "gang", gang) 
    exports['armour']:changeProtectedElementDataEx(shape, "dbid", id) 
    exports['armour']:changeProtectedElementDataEx(turf, "dbid", id) 
    end 
    mysql:free_result(result) 
    end 
end 
) 
  
function onEnter (thePlayer, matchingDimension) 
local shape = getElementData(source,"dbid") 
local gang = getElementData(source,"gang") 
    if shape then 
        if (getTeamName(getPlayerTeam(thePlayer)) == gang) then 
            outputChatBox("Ai intrat pe teritoriul gangului "..gang.." ",thePlayer) 
        else  
            outputChatBox("Nu ai intrat",thePlayer) 
        end 
    end 
end    
addEventHandler("onColShapeHit", getRootElement(), onEnter) 

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