Jump to content

Glizzy.

Members
  • Posts

    2
  • Joined

  • Last visited

Details

  • Gang
    CIG

Glizzy.'s Achievements

I ordered some spaghetti with marinara sauce and I got egg noodles and ketchup. I'm an average nobody.

I ordered some spaghetti with marinara sauce and I got egg noodles and ketchup. I'm an average nobody. (2/54)

0

Reputation

  1. Yeah I've already installed that groupsystem, but when I type /turfcolor R G B, Nothing apear on my screen, So idk if the turfcolor is changed or no, Now please tell me how do i fix it? Give me a code or something I can't find anything same as my problem in your forum, There is alot of bugs in that topics, wheree is mine? if you can give me the code here please
  2. Hello Can anyone help me please? I've installed this turf system, with a groupsystem has /turfcolor R G B, When I choose a random color (ex: 255 0 0), I went to the turf after the turf has been taken it still white like all of the turfs (White turfs), When I restart the resourse of that script It became Black the turf I've took became black, Idk why, It's supposed to be when I take a turf automaticly became red because I've choose 255 0 0, without restarting the resource, thanks for reading. client: -- Time before a player capture the turf function showTimeLeft( ) if getElementData( localPlayer, "isInTurf" ) then local time = tonumber( getElementData( localPlayer, "captureTime" )) local sx, sy = guiGetScreenSize( ) if time and time > 0 then dxDrawText ( "Time before your gang capture the turf: "..tostring(time).." seconds", (sx/2)-250, sy-50, 0, 0, tocolor( 200, 200, 200, 255 ), 0.8, "bankgothic" ) end end end addEventHandler( "onClientRender", root, showTimeLeft ) server: capturing = { } cooldown = { } members_in_turf = {{ }} time_syncer = { } local db = dbConnect("sqlite", "/turfs.db") addEventHandler("onResourceStart", getResourceRootElement(), function() dbExec(db, "CREATE TABLE IF NOT EXISTS turfs (X NUMERIC, Y NUMERIC, Z NUMERIC, sizeX NUMERIC, sizeY NUMERIC, red NUMERIC, green NUMERIC, blue NUMERIC, owner TEXT)") dbQuery(loadTurfs, db, "SELECT * FROM turfs") end) -- Gets all members in team function getGroupMembers(player) local teamMembers = {} for w,gangmember in ipairs(getElementsByType("player")) do if getElementData(gangmember,"Group") == getElementData(player,"Group") then table.insert(teamMembers,gangmember) end end return teamMembers end function onTurfEnter(hitElement) if hitElement and isElement(hitElement) and getElementType(hitElement) == "player" and getElementData( hitElement, "Group" ) and getElementData( hitElement, "Group" ) ~= "None" then local owner = getElementData( source, "owner") if getPedOccupiedVehicle(hitElement) then exports["ac-message"]:outputTopBar( "TURFS: This turf belongs to: "..owner, hitElement, 255, 200, 0 ) return end local area = getElementData( source, "area" ) if ( getPlayerTeam(hitElement) == getTeamFromName("Criminals") or getPlayerTeam(hitElement) == getTeamFromName("Gangsters")) then setElementData(hitElement,"isInTurf",true) local group = getElementData( hitElement, "Group" ) if not members_in_turf[group] then members_in_turf[group] = { } end if not members_in_turf[group][area] then members_in_turf[group][area] = 0 end members_in_turf[group][area] = members_in_turf[group][area] + 1 local gangmems = getGroupMembers(hitElement) local px,py,pz = getElementPosition(hitElement) local currturf = getZoneName(px,py,pz) for w,mem in ipairs(gangmems) do if mem ~= hitElement and not getElementData(hitElement,"isInTurf") and members_in_turf[group][area] > 1 then exports["ac-message"]:outputTopBar( "TURFS: Your gang received backup at: "..currturf..", good luck! ("..tostring(members_in_turf[group][area]).." members)", mem, 0, 255, 0 ) end end local iR, iG, iB = exports["ac-groupsys"]:getGroupTurfColor(group) local rR, gG, bB = getRadarAreaColor( area ) local colCuboid = source local time_to_capture = math.random(180,300)*1000 if group == owner then exports["ac-message"]:outputTopBar( "TURFS: This turf belongs to: "..owner, hitElement, 0, 255, 0 ) else setRadarAreaFlashing( area, true ) exports["ac-message"]:outputTopBar( "TURFS: This turf belongs to: "..owner.." hold it for "..tostring(math.floor(time_to_capture/60000)+1).." minutes to capture it", hitElement, 0, 255, 0 ) for w,mem in ipairs(gangmems) do if mem ~= hitElement and not getElementData(hitElement,"isInTurf") and members_in_turf[group][area] > 1 then exports["ac-message"]:outputTopBar( "TURFS: Your gang is attacking a turf at: "..currturf..", go there and help them! ("..tostring(members_in_turf[group][area]).." members)", mem, 255, 200, 0 ) end end if not isTimer(capturing[source]) then -- Start a timer that calls the capturing function local player_turfer = hitElement capturing[source] = setTimer( function( ) setElementData( colCuboid, "owner", group ) setElementData( area, "owner", group ) for w,mem in ipairs(gangmems) do if getElementData(mem,"isInTurf") then givePlayerMoney( mem, math.random( 1000, 3000 )) end end setRadarAreaColor( area, iR, iG, iB, 130 ) setRadarAreaFlashing( area, false ) dbExec(db, "UPDATE turfs SET owner=?, red=?, green=?, blue=? WHERE X=? AND Y=?", group, iR, iG, iB, tonumber(getElementData(colCuboid,"posx")), tonumber(getElementData(colCuboid,"posy"))) end, time_to_capture, 1) end if not isTimer(time_syncer[hitElement]) and isTimer(capturing[source]) then -- Start a timer that shows the time left to capture local timer_to_check = capturing[source] local player_time_req = hitElement time_syncer[hitElement] = setTimer( function() local i1,i2,i3 = 0,0,0 if isTimer(timer_to_check) then i1,i2,i3 = getTimerDetails( timer_to_check ) end if isElement(player_time_req) and i1 then setElementData( player_time_req, "captureTime", math.floor( i1/1000 )) end end, 1000, (time_to_capture/1000)) end end elseif getElementData( hitElement, "Group" ) == "None" and getPlayerTeam(hitElement) == getTeamFromName("Criminals") then exports["ac-message"]:outputTopBar( "Only gang members can capture turfs, (see F6)", hitElement, 255, 0, 0 ) end end end function onTurfLeave(hitElement) if hitElement and isElement(hitElement) and getElementType(hitElement) == "player" and getElementData( hitElement, "Group" ) and getElementData( hitElement, "Group" ) ~= "None" and ( getPlayerTeam(hitElement) == getTeamFromName("Criminals") or getPlayerTeam(hitElement) == getTeamFromName("Gangsters")) then -- Leave a turf local owner = getElementData(source, "owner") local area = getElementData( source, "area" ) local group = getElementData( hitElement, "Group" ) if not members_in_turf[group] then members_in_turf[group] = {} end if not members_in_turf[group][area] then members_in_turf[group][area] = 0 end members_in_turf[group][area] = members_in_turf[group][area] - 1 if members_in_turf[group][area] > 0 then exports["ac-message"]:outputTopBar( "TURFS: Go back and help your gang members! ("..tostring(members_in_turf[group][area]).." members left)", hitElement, 255, 0, 0 ) else local gangmems = getGroupMembers(hitElement) local px,py,pz = getElementPosition(hitElement) local currturf = getZoneName(px,py,pz) for w,mem in ipairs(gangmems) do if getElementData(source,"owner") ~= group then exports["ac-message"]:outputTopBar( "TURFS: Gang war was interrupted at: "..currturf..", due to lack of members!", mem, 255, 0, 0 ) end end end setElementData(hitElement,"isInTurf",false) if members_in_turf[group][area] == 0 then setRadarAreaFlashing( area, false ) if isTimer(capturing[source]) then killTimer(capturing[source]) end end if isTimer(time_syncer[hitElement]) then killTimer(time_syncer[hitElement]) end end end function changeTurfColor(plr, cmd, r, g, b) local r, g, b = r or 255, g or 255, b or 255 local group = exports["ac-groupsys"]:getPlayerGroup(plr) if (not group) then return end if (not exports["ac-groupsys"]:checkGroupAccess(plr, 13)) then return end dbExec(db, "UPDATE turfs SET red=?, green=?, blue=? WHERE owner=?", r, g, b, group ) for w,area in ipairs(getElementsByType("radararea")) do if getElementData(area,"owner") == group then setRadarAreaColor( area, r, g, b, 130 ) end end end addCommandHandler("turfcolor", changeTurfColor) function addTurf(x,y,z,sizeX,sizeY,red,green,blue,owner) -- Load all turfs if not owner then owner = "None" end local colCuboid = createColCuboid( x, y, z-30, sizeX, sizeY, z+30 ) local radArea = createRadarArea( x, y, sizeX, sizeY, red, green, blue, 130 ) addEventHandler( "onColShapeHit", colCuboid, onTurfEnter ) addEventHandler( "onColShapeLeave", colCuboid, onTurfLeave ) setElementData( colCuboid, "owner", owner ) setElementData( radArea, "owner", owner ) setElementData( colCuboid, "posx", x ) setElementData( colCuboid, "posy", y ) setElementData( colCuboid, "area", radArea ) end function loadTurfs(query) local result = dbPoll( query, 0 ) if result then for _, row in ipairs( result ) do addTurf(row["X"], row["Y"], row["Z"], row["sizeX"], row["sizeY"], row["red"], row["green"], row["blue"], row["owner"]) end end end function player_Wasted( ammo, attacker, weapon, bodypart ) if isElement( source ) and isElement( attacker ) and getElementType( attacker ) == "player" then if ( getPlayerTeam( source ) == getTeamFromName( "Criminals" ) or getPlayerTeam( source ) == getTeamFromName( "Gangsters" )) and ( getPlayerTeam( attacker ) == getTeamFromName( "Criminals" ) or getPlayerTeam( attacker ) == getTeamFromName( "Gangsters" )) and getElementData( source, "Group" ) ~= getElementData( attacker, "Group" ) and not isTimer( cooldown[attacker] ) and getElementData(source,"isInTurf") then local victim_money = getPlayerMoney( source ) if victim_money > 1000 then victim_money = 1000 elseif victim_money < 50 then victim_money = 50 end local money = math.floor(victim_money*(math.random(1,50)/25)) -- Advantages takePlayerMoney( source, math.floor( money )) givePlayerMoney( attacker, math.floor( money )) -- Move victim to gangsters team if inside turf local gangsterTeam = getTeamFromName("Gangsters") setPlayerTeam(source,gangsterTeam) setPlayerNametagColor(source,255,0,255) -- Health (armor) local armor = 0 if getPedArmor ( attacker ) < 50 then armor = math.random(5,35) setPedArmor( attacker, getPedArmor( attacker )+armor) end -- Status message local gangmems = getGroupMembers(hitElement) local px,py,pz = getElementPosition(hitElement) local currturf = getZoneName(px,py,pz) for w,mem in ipairs(gangmems) do exports["ac-message"]:outputTopBar( "TURFS: One of your members died in the turf at: "..currturf.."!", mem, 255, 0, 0 ) end -- Weapon stats local wepSlot = getSlotFromWeapon( weapon ) local stats = 0 if getPedStat( attacker, wepSlot+68 ) < 950 then stats = math.random( 1,50 ) setPedStat( attacker, wepSlot+68, getPedStat( attacker, wepSlot+68 )+stats) end -- Status outputChatBox( "#007700(GangInfo) #bbbbbbMoney: #eeeeee+"..tostring(money)..", #bbbbbbArmor:#eeeeee +".. tostring(armor)..", #bbbbbbStats: #eeeeee+"..tostring(stats), attacker, 0, 255, 0, true ) cooldown[attacker] = setTimer( function() end, 15000, 1 ) end end end addEventHandler( "onPlayerWasted", getRootElement(), player_Wasted ) -- Adds a new turf function createTurf( player, cmd, sx, sy ) local acc = getPlayerAccount( player ) if isObjectInACLGroup("user."..getAccountName(acc), aclGetGroup( "Admin" )) then if not sx then sx = math.random(50,250) end if not sy then sy = math.random(50,250) end local x,y,z = getElementPosition(player) dbExec(db, "INSERT INTO turfs VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", math.floor(x), math.floor(y), math.floor(z), math.floor(sx), math.floor(sy), 255, 255, 255, "None") addTurf(x,y,z,sx,sy,255,255,255,"None") exports["ac-message"]:outputTopBar( "TURFS: A new turf was added syccessfully", player, 0, 255, 0 ) end end
×
×
  • Create New...