Limit # of Tents to Player

TorturedChunk

Valued Member!
I am so tired of seeing camps with like 30 tents. Its ridiculous. I was having a look at the tent_pitch.sqf and was wondering if there is a check I can add to see if that player already has a certain number of tents placed based on their PlayerID, then deny anymore tents from being placed by that player.

Any help on this would be awesome!
 
There's got to be a way to count tents assigned to the playerUID, and if greater then an allowed number, it won't deploy and gives a unique response so they know they're over limit.
 
I know this is a bad workaround, but you could set the column owner_id to be a unique index. this would cause all inserts where owner_id already exists to fail.

That or you could just have a stored proc run every day or so that deletes all but the newest X tents per player ID.

One thing I did was to delete tents that were empty. Also, the db_spawnvehicles.pl script has a clean function that you can modify to delete tents belonging to dead people x days after they die.

Here's a little script to show you how many deployables each id has
Code:
SELECT
  IDP.owner_id AS `Owner`
  ,COUNT(IDP.owner_id) AS `Deployables`  
  FROM instance_deployable IDP  
  GROUP BY IDP.owner_id
  ORDER BY `Deployables` DESC
 
Yea I use the Clean All but I dont want people to have more than like 1-2-3 tents at the most.

With my new servers and update coming, I want to implement something. Still simmering on this for now.
 
You could add a new row to the database in the character's table called TentCount, and then have it update the count every time a tent is placed... your code would check tent placement against this statistic, and if the value is more then say "3", it doesn't allow for the tent to be placed. That's what I'd try to do anyway.
 
Back
Top