Bzz335 Posted February 6, 2014 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. Police job script progress: 100% Courier job script progress::7%
manawydan Posted February 6, 2014 Posted February 6, 2014 you can use for and ipairs "Querer não é poder, mas tentar é avançar"!
Moderators IIYAMA Posted February 6, 2014 Moderators Posted February 6, 2014 First of all: you made a typo: "OnPlayerSpawn" . "onPlayerSpawn" Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Bzz335 Posted February 7, 2014 Author Posted February 7, 2014 IIyama,just miss print. Thanks,manawydan. Police job script progress: 100% Courier job script progress::7%
Bzz335 Posted February 7, 2014 Author Posted February 7, 2014 UP. How I can use ipairs? Give me example,please. Police job script progress: 100% Courier job script progress::7%
Moderators IIYAMA Posted February 7, 2014 Moderators 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. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Bzz335 Posted February 8, 2014 Author Posted February 8, 2014 Thank you very much,man. Police job script progress: 100% Courier job script progress::7%
Moderators IIYAMA Posted February 8, 2014 Moderators Posted February 8, 2014 np. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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