Darkrp RPExtraTeams

hey i’m trying to use RPExtraTeams to display a teams model


 for k,v in pairs(RPExtrateams) do    if k = TEAM_POLICE then local policemodel = v.model; end end

but v.model returns a tabel id not the model string. so is there a command for getting the string for model? i tryed v.strmodel and it just returns nil

is there even a way to get the model string like this?

ok so there is not a str model in rpextrateams does any one know a way to get the teams model string

What exactly are you trying to do though? This may work:
[lua]
ExtraTeamModels = {}
ExtraTeamModels[1] = “model.mdl”
ExtraTeamModels[2] = “model2.mdl”
– etc.

for k,v in pairs(RPExtrateams) do if k = TEAM_POLICE then local policemodel = ExtraTeamModels[2]; end end[/lua]

the models are an table.
just try http://wiki.garrysmod.com/page/table/GetFirstValue and http://wiki.garrysmod.com/page/Global/istable. ON v.models, not on v

edit://Ronan. he gets the keys and values from RPExtraTeams and that is where he pulled v.models.


local Panel = vgui.Create( "DPanel" )
Panel:SetPos( 10, 10 )
Panel:SetSize( 200, 200 )

local icon = vgui.Create( "DModelPanel", Panel )
icon:SetSize( 200, 200 )
icon:SetModel( LocalPlayer():GetModel() )

i want to make a penel to show the model like on a f4 menu

[lua]
local x = 0
local spacing = 90
for k,v in pairs(RPExtrateams)
AddIcon(x, v.model)
x = x + spacing
end

function AddIcon(x,mdl)
local icon = vgui.Create( “DModelPanel”, Panel )
icon:SetSize( 200, 200 )
icon:SetPos(x, 20)
if istable(mdl) then
local mdl2 = table.GetFirstValue(mdl)
icon:SetModel(mdl2)
else
icon:SetModel(mdl)
end
[/lua]
and now reverse my code, understand it and use it correctly (alias find the 2 errors i build in to get you thinking about code).

no problem my man
[lua]dne
)ldm(ledoMteS:noci
esle
)2ldm(ledoMteS:noci
)ldm(eulaVtsriFteG.elbat = 2ldm lacol
neht )ldm(elbatsi fi
)02 ,x(soPteS:noci
) 002 ,002 (eziSteS:noci
) lenaP ,“lenaPledoMD” (etaerC.iugv = noci lacol
)ldm,x(nocIddA noitcnuf

dne
gnicaps + x = x
)ledom.v ,x(nocIddA
)smaetartxEPR(sriap ni v,k rof
09 = gnicaps lacol
0 = x lacol[/lua]

lol thanks for reversing it. now i know how to code like a god!

[editline]16th October 2014[/editline]

OH SWEET BABY JESUS TY IT WORKS! u left out a end and the function needs to be defined before u call it

Maybe i lied mwhahaha

also except that i spoonfeeded you, you could done exactly that with the wiki links i gave you 2 hours before.

ima man baby i like the spoon. also i looked at the wiki links but reading it on there was confusing as to reading it with the syntax i need it for. also i find for me reading other peoples code to find things i need is really really really hard for me, unless i know the exact words im looking for i could read the same code for hours and now have a clue what im looking at.