Axel Posted June 18, 2012 Posted June 18, 2012 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..)
arezu Posted June 18, 2012 Posted June 18, 2012 getPlayerTeam returns the team element so its correct. If you want the team name, you have to do like this: getTeamName(getPlayerTeam(thePlayer))
myonlake Posted June 18, 2012 Posted June 18, 2012 If getTeamFromName returns false, then something's wrong with your script. Please show me/us the script part. If I helped you, please click the like button on the right Thanks!
Axel Posted June 18, 2012 Author Posted June 18, 2012 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)
Castillo Posted June 18, 2012 Posted June 18, 2012 I don't understand what do you need. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
TwiX! Posted June 18, 2012 Posted June 18, 2012 learn arguments what its 'source' in https://wiki.multitheftauto.com/wiki/OnColShapeHit source in your code - its player? or object thePlayer too - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
Axel Posted June 18, 2012 Author Posted June 18, 2012 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now