Jump to content

getPlayerTeam returing userdata


Axel

Recommended Posts

Posted

So, i'm getting a strange error, I'm using getPlayerTeam and it returns a userdata , something like 00001FAC ....

How can i get the actual player team? (getTeamFromName returns a boolean value..)

Posted

getPlayerTeam returns the team element so its correct. If you want the team name, you have to do like this:

getTeamName(getPlayerTeam(thePlayer)) 

Posted

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) 

Posted

TwiX.. it's clear that the source is the colshape.. I'm getting the data i set with the mysql of the colshape.. And i want to get the radar area too, but that's the problem.. I don't know how can i do it.

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