Help with player tables and such...

Hello FP,

I’m wondering if anyone could help me with tables on players, specifically doing a inventory sorta thing. My idea is that, when a player gets a arrested ( darkrp ) their weapons will be removed and put into a box, but they shouldn’t conflict with anyone elses weapons or items, let me explain…

So lets say we arrest 2 people, one with a crowbar and the other guy has a pistol. When one of them is released and he is ready to go get his weapons back he should only see his own weapons in the box and not the other guys.

How should I store things on an entity doing the ideas above?

Sorry, not exactly good at doing explanations…

Help us much appreciated, thank you.

This should cover everything you need to know.

You also might need to look at darkrp’s functions for arresting.

Yeah, but it’s more or less how should i store these things.

From what i’ve read maybe i should do i.e

I’m not entirely sure if this is the best way to approch this, but storing the players steamid as the tables index, that a bad idea?



playersWeapons = {}

function playerArrested() -- example, when a player is arrested
    if ply:GetWeapons() > 0 then
        playerWeapon[ply:SteamID] = {weapons = ply:GetWeapons()}
    end
end