Bzz335 Posted February 6, 2014 Share Posted February 6, 2014 Hm,see the IDs of weapon in table?(5,24,25,28,30,33,44) So,when player will spawn if he's in team "Killers" then local positionsofthespawn={ [1]={x,y,z,5,24,25,28,30,33,44}, --Spawn o_O } local killers = createTeam("Killers",255,204,153) addEventHandler("OnPlayerSpawn",root, function() local playerTeam = getPlayerTeam ( source ) local team = getTeamName ( playerTeam ) if team=="Killers" then giveWeapon(source,here,myammo) end end ) I must get IDs , but how?Please,help.Thanks. Link to comment
manawydan Posted February 6, 2014 Share Posted February 6, 2014 you can use for and ipairs Link to comment
Moderators IIYAMA Posted February 6, 2014 Moderators Share Posted February 6, 2014 First of all: you made a typo: "OnPlayerSpawn" . "onPlayerSpawn" Link to comment
Bzz335 Posted February 7, 2014 Author Share Posted February 7, 2014 IIyama,just miss print. Thanks,manawydan. Link to comment
Bzz335 Posted February 7, 2014 Author Share Posted February 7, 2014 UP. How I can use ipairs? Give me example,please. Link to comment
Moderators IIYAMA Posted February 7, 2014 Moderators Share Posted February 7, 2014 local positionsofthespawn={ [1]={x,y,z,["weapons"]={5,24,25,28,30,33,44}}, --Spawn o_O } First of all, tables are working with an index. Since you didn't save it's spawn location, you don't know what weapons he must use. I normally give the weapons when I spawn him, not sure if that is a bad habit, except personally I have never had any problems with that. so: local spawnTable = positionsofthespawn[math.random(#positionsofthespawn)] spawnPlayer(player,spawnTable[1],spawnTable[2],spawnTable[3]) local weaponTable = spawnTable["weapons"] -- {5,24,25,28,30,33,44} for i=1,#weaponTable do giveWeapon(player,weaponTable[i]) end That is how it works. Link to comment
Bzz335 Posted February 8, 2014 Author Share Posted February 8, 2014 Thank you very much,man. Link to comment
Moderators IIYAMA Posted February 8, 2014 Moderators Share Posted February 8, 2014 np. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now