Lergen Posted May 21, 2019 Share Posted May 21, 2019 Hello, I'm fairly new to this. I'm trying to learn to convert the GTWTurf system (https://github.com/404rq/GTW-RPG/tree/master/[resources]/GTWturf) to use Castillo's gang system (https://community.multitheftauto.com×/index.php?p=resources&s=details&id=1514). I think I have it working, but the turf colors won't update to use the exported gang colors. What am I doing wrong? I'm guessing the problem is in this: local playerGang = getElementData (player, "gang" ) if ( playerGang ) then local r, g, b = unpack ( getGangColor ( playerGang ) ) setRadarAreaColor(area, tonumber(r), tonumber(g), tonumber(b), 175) setRadarAreaFlashing(area, false) setElementData(theTurf, "currAttacker", nil) dbExec(db, "UPDATE turfs SET owner=?, red=?, green=?, blue=? WHERE X=? AND Y=?", gang, r, g, b, tonumber(getElementData(colCuboid,"posx")), tonumber(getElementData(colCuboid,"posy"))) end end, time_to_capture*1000, 1) end end I'm using Sasuke's turfsystem, which does use Castillo's gang system, as a reference: function ( player ) if turfElement[source] and source == turfElement[source][1] then local turf,area,id = unpack( turfElement[source] ) local playerGang = getElementData ( player, "gang" ) local turfGang = executeSQLQuery("SELECT GangOwner FROM Turf_System WHERE Turfs=?", "Turf["..tostring(id).."]" ) if ( turfGang[1].GangOwner == playerGang ) then outputChatBox( messages[2]:format( turfGang[1].GangOwner or "None" ), player, 0, 255, 0, false ) else local playerGang = getElementData ( player, "gang" ) setElementData( source, "warTurf", playerGang ) if ( isTimer ( turfTimer[source][1] ) ) then if isTimer( turfTimer[source][2] ) then killTimer( turfTimer[source][2] ) end return end if ( playerGang ) then local r, g, b = unpack ( getGangColor ( playerGang ) ) -- local r, g, b = 255, 255, 255 setRadarAreaFlashing ( area, true ) if turfGang[1].GangOwner ~= "Nadie" then outputChatBox( messages[3]:format( turfGang[1].GangOwner ), player, 0, 255, 0, false ) else outputChatBox( messages[4], player, 0, 255, 0, false ) end turfTimer[source][1] = setTimer ( function ( ) local players = getGangPlayersInTurf ( turf, playerGang ) setRadarAreaColor ( area, tonumber(r), tonumber(g), tonumber(b), 175 ) for _, player in ipairs ( players ) do outputChatBox( messages[5], player, 0, 255, 0, false ) triggerClientEvent(player, "onTakeTurf", player) givePlayerMoney ( player, 4000 ) executeSQLQuery("UPDATE Turf_System SET GangOwner=?,r=?,g=?,b=? WHERE Turfs=?", playerGang, tonumber(r), tonumber(g), tonumber(b), "Turf["..tostring(id).."]" ) -- setElementData ( turf, "getTurfGang", playerGang ) end setRadarAreaFlashing ( area, false ) end ,120000, 1) end end end end In the debug I get badargument at getelementdata [expected element at argument 1, got nil]. I'd greatly appreciate any advice. Link to comment
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