• Problem with getting cerain var from table.
    4 replies, posted
function praca1check(namepraca)for id, jobTable inpairs(RPExtraTeams) doif jobTable.name == namepraca thenreturn id end jedynka_wiezienie = id endendfunction praca2check(namepraca)for id, jobTable inpairs(RPExtraTeams) doif jobTable.name == namepraca thenreturn id end dwojka_wiezienie = id endendfunction ENT:Use(ply, caller)localrandom = math.random(1,2) local praca1 = praca1check("Hobo") local praca2 = praca2check("Medic") local ids = ply:getJobTable() returns table, when I want to read only one value from key It didn't work! I tried something like print(ids[11]) - nothing, even ids[name] didn't work. When I printed as table, ids structure was like table.GetKeys output. If someone want's more clear code: hastebin Any help is appreciated!
Can u please your old thread instead of creating a new one? Your Old Thread depending on this
This is diffrent issue.
Anyway you want to return the id... but rpextrateams just have name,cmd, sortOrder and so on.. you need to store the thing in a table i guess like table.insert id = {} function praca1check(namepraca) for k,v in pairs(RPExtraTeams) do if v.name == namepraca then table.insert(id, v.name) end end end PrintTable(id) Output is: 1 = Citizen It would be helpful if you write what u want to do.. i just see a ENT:Use Function I guess you want to make some whitelist so that just Medics can Use this Entity you have...
ply:getDarkRPVar("job") == "whatever" just works. xD Sorry for trouble.
Sorry, you need to Log In to post a reply to this thread.