Jump to content

[REL] Turf system


Mr_Moose

Recommended Posts

Ever searched for a turf system in the community with the hope to find what you're actually looking for? Well this is your lucky day, this is a turf system based on open source which uses an SQLite database to create radar/map areas (colored squares) to fight about, even thought I was against this idea of colored squares in a limited area, I soon realized that this is exactly what people expect from a turf system. This one is even better than that.

Download link:

https://community.multitheftauto.com/index.php?p=resources&s=details&id=9056

Help and support:

Bug reports

Related questions

Demo server

But why should we stop in a limited area, well I can't answer that question by myself so due to that you will find turfs in all three city's (around 50 in total). To provoke a turf you need to either be in the team "Criminals" or "Gangsters", you need to create these teams manually in order to make this work. Another requirement is to be a member of a group or gang.

By default this system uses the exported function "outputTopBar" from ac-message which can be found here:

https://community.multitheftauto.com/index.php?p=resources&s=details&id=8620, if you don't want to use that you can simply replace "outputTopBar" with "outputChatBox".

setElementData(player,"Group","any_name_here") 
 

This can also be solved by using a group system and for that I recommend this: https://community.multitheftauto.com/index.php?p=resources&s=details&id=8291 since it's also open source.

Below is a part from the "data.lua" file which is used to configure the system "for dummies"

 members_in_turf = {{ }}                                 -- Counts the amount of players in each group in each turf 
capturing       = { }                                   -- Boolean to check whenever someone is trying to capture a specific turf  
cooldown        = { }                                   -- Cooldown timer to prevent spam kills for stats farming 
time_syncer     = { }                                   -- Timers to update the client status text with information about how much time is left to capture a turf 
db              = dbConnect("sqlite", "/turfs.db")      -- Database connection (SQLLite), mysql is supported as well, see syntax for dbConnect here: 
                                                        -- [url=https://wiki.multitheftauto.com/wiki/DbConnect]https://wiki.multitheftauto.com/wiki/DbConnect[/url] 
payout_time_interval        = 10800                     -- Time interval between payments for owned turfs (seconds). 
turf_payments_max           = 400                       -- Maximum payments for 1 single turf during payouts. Multiplyed by turfs count divided by gangmembers count   
turf_payments_min           = 200                       -- Minimum payments for 1 single turf during payouts. (See above) 
lowest_amount_to_display    = 50                        -- Specify the lowest amount of money which is worth to notice the players about during payouts. 
  
group_system_name           = "GTWgroups"             -- Used for exported functions in the group system in case you want a different name of the resource file 
top_bar_messages            = "GTWtopbar"              -- (See above) 
  
team_criminals              = "Criminals"               -- Specify teams that are allowed to turf 
team_gangsters              = "Gangsters"               -- (See above) 
  
money_pickpocket_max        = 1000                      -- Specify how much (or less) money the gangmembers will pickpocket from their enemies during a kill inside a turf  
money_pickpocket_min        = 50                        -- (See above) 
armor_max                   = 35                        -- The maximum amount of armor the killer will get after killing an enemy 
armor_min                   = 5                         -- The minimum amount of armor the killer will get after killing an enemy 
weapon_stats_max            = 50                        -- The maximum amount of stats for the current weapon the killer will gain after killing an enemy 
weapon_stats_min            = 5                         -- The minimum amount of stats for the current weapon the killer will gain after killing an enemy 
turf_capture_payment_max    = 3000                      -- Maximum payment for capturing a turf 
turf_capture_payment_min    = 1000                      -- Minimum payment for capturing a turf 
time_to_capture_max         = 360                       -- Maximum time before a gang captures a turf (seconds) 
time_to_capture_min         = 180                       -- Minimum time before a gang captures a turf (seconds) 
 

Also note that line 12 and 13 are useful to set the name of the two exported functions globally in case you want to use a different filename.

Installation:

1. Check the file names of your resources, top bar messages and a group system on line 12 and 13 in data.lua. It's important that those names match exactly.

2. The group system you use must have support for turf colors, and a exported function that can pass these colors to this turf system, to solve that simply add the above function in your group system server file.

function getGroupTurfColor(group) 
    if (not groupTable[group]) then return 255, 255, 255 end 
    local color = fromJSON(groupTable[group][6]) 
    return color[1], color[2], color[3] 
end 
 

3. Make sure your group system has exported the getGroupTurfColor function by looking at it's meata.xml file where this line should exist:

<export function="getGroupTurfColor" type="server"/> 
 

Further questions can be asked within this thread.

Edited by Mr_Moose
Updated dead links
  • Like 1
Link to comment

I wouldn't recommend that group system purely because it uses element data, which is very (network) resource heavy and easily exploited. I'm writing my own that uses tables, but it's not quite ready yet. ;) Otherwise, this looks like a really good resource, nice work. Also, it's SQLite, not SQL Light.

Link to comment

Thanks, I know something was misspelled, corrected ;) anyway if I or anyone else makes a better group system for this I'm ready to modify it to work better from the beginning, currently it's still some stuff to fix no matter what group system that is used but as long it's open source I hope it shouldn't bee too hard.

Link to comment
  • 2 weeks later...
  • 1 year later...

Turfs must be added manually into attached database, either you use MySQL by altering GTWcore/data/settings.xml or you just start GTWturf without changing anything to use a local SQLite database. After that you can add or remove turfs with these commands:

/addturf

/removeturf

Assuming that you are standing in the location where you want the south western corner of the new turf to be. Only players in ACL group "Admin" can use these commands by default.

Link to comment
  • 2 years later...

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