Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cFunc["build_gangarenas"] = function()
- local result, numrows = dbPoll(dbQuery(dbhandler, "SELECT * FROM gang_arenas;"), dbpTime)
- if(numrows > 0) then
- for index, row in pairs(result) do
- local x1, y1 = row['X1'], row['X2']
- local x2, y2 = row['X3'], row['X4']
- local xs = math.abs(x1-x2)
- local ys = math.abs(y1-y2)
- local color = mtGetFactionColor(row['OWNER'])
- cSetting["gang_arena"][row['GID']] = createRadarArea(x1, y1, xs, ys, color[1], color[2], color[3], 200, getRootElement())
- for index, data in pairs(row) do
- mtSetElementData(cSetting["gang_arena"][row['GID']], index, data)
- end
- cSetting["gang_arena"]['COL'] = createColRectangle(x1, y1, xs, ys)
- addEventHandler("onColShapeHit", cSetting["gang_arena"]['COL'], function(hi)
- if(getElementType(hi) == "player") then
- if(mtGetElementData(hi, "fraktion") == "lscivilian") then
- outputInfobox(hi, "Warning: Entering this area may be dangerous, because it's owned by a gang!", 50, 200, 50)
- return
- end
- if(mtGetElementData(hi, "fraktion") ~= row['OWNER']) then
- outputInfobox(hi, "Use /startgangwar to attack this area.", 0, 255, 255)
- cSetting["player_area"][hi] = cSetting["gang_arena"][row['GID']]
- end
- end
- end)
- end
- outputDebugString(#cSetting["gang_arena"].." gang arenas created.")
- else
- outputDebugString("No gang arenas found.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement