Xperia Posted January 19, 2013 Share Posted January 19, 2013 I have this, weapon for weapon, and the problem it's that when i spawn, only i have one charger, who can i fix it? local ammo = { [1] = {1}, [4] = {1}, [22] = {100}, [24] = {100}, [27] = {60}, [30] = {150}, [31] = {150}, [34] = {50}, [17] = {5}, [44] = {1}, [29] = {300} } addEvent ( "onPlayerChooseWeapon" , true ) addEventHandler ( "onPlayerChooseWeapon" , root , function() local playerTeam = getPlayerTeam ( source ) if (playerTeam) then if ( getTeamName ( playerTeam ) == "Ruso") then giveWeapon(source,1,ammo[1],true) giveWeapon(source,4,ammo[2],true) giveWeapon(source,22,ammo[3],true) end if ( getTeamName ( playerTeam ) == "Soldado Ruso") then giveWeapon(source,24,ammo[4],true) giveWeapon(source,27,ammo[5],true) giveWeapon(source,30,ammo[6],true) giveWeapon(source,34,ammo[8],true) end if ( getTeamName ( playerTeam ) == "Escuadron Ruso") then giveWeapon(source,24,ammo[4],true) giveWeapon(source,27,ammo[5],true) giveWeapon(source,29,ammo[11],true) giveWeapon(source,30,ammo[6],true) giveWeapon(source,34,ammo[8],true) giveWeapon(source,17,ammo[9],true) giveWeapon(source,44,ammo[10],true) end if ( getTeamName ( playerTeam ) == "Ciudadano E.E.U.U") then giveWeapon(source,1,ammo[1],true) giveWeapon(source,4,ammo[2],true) giveWeapon(source,22,ammo[3],true) end if ( getTeamName ( playerTeam ) == "Ejercito E.E.U.U") then giveWeapon(source,24,ammo[4],true) giveWeapon(source,27,ammo[5],true) giveWeapon(source,30,ammo[6],true) giveWeapon(source,34,ammo[8],true) end if ( getTeamName ( playerTeam ) == "Escuadron E.E.U.U") then giveWeapon(source,24,ammo[4],true) giveWeapon(source,27,ammo[5],true) giveWeapon(source,29,ammo[11],true) giveWeapon(source,30,ammo[6],true) giveWeapon(source,34,ammo[8],true) giveWeapon(source,17,ammo[9],true) giveWeapon(source,44,ammo[10],true) end if ( getTeamName ( playerTeam ) == "Ciudadano Japones") then giveWeapon(source,1,ammo[1],true) giveWeapon(source,4,ammo[2],true) giveWeapon(source,22,ammo[3],true) end if ( getTeamName ( playerTeam ) == "Ejercito Japones") then giveWeapon(source,24,ammo[4],true) giveWeapon(source,27,ammo[5],true) giveWeapon(source,30,ammo[6],true) giveWeapon(source,34,ammo[8],true) end if ( getTeamName ( playerTeam ) == "Escuadron Japones") then giveWeapon(source,24,ammo[4],true) giveWeapon(source,27,ammo[5],true) giveWeapon(source,29,ammo[11],true) giveWeapon(source,30,ammo[6],true) giveWeapon(source,34,ammo[8],true) giveWeapon(source,17,ammo[9],true) giveWeapon(source,44,ammo[10],true) end end end ) Link to comment
3NAD Posted January 19, 2013 Share Posted January 19, 2013 ammo = { [1] = {1}, [4] = {1}, [22] = {100}, [24] = {100}, [27] = {60}, [30] = {150}, [31] = {150}, [34] = {50}, [17] = {5}, [44] = {1}, [29] = {300} } addEvent ( "onPlayerChooseWeapon" , true ) addEventHandler ( "onPlayerChooseWeapon" , root , function ( ) local playerTeam = getPlayerTeam ( source ) if playerTeam then if playerTeam == getTeamFromName ("Ruso") then giveWeapon(source,1, tonumber ( ammo[1] ),true) giveWeapon(source,4,tonumber ( ammo[2] ),true) giveWeapon(source,22,tonumber ( ammo[3] ),true) elseif playerTeam == getTeamFromName ("Soldado Ruso") then giveWeapon(source,24,tonumber ( ammo[4] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,30,tonumber ( ammo[6] ),true) giveWeapon(source,34,tonumber ( ammo[8] ),true) elseif playerTeam == getTeamFromName ("Escuadron Ruso") then giveWeapon(source,24,tonumber ( ammo[4] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,29,tonumber ( ammo[11] ),true) giveWeapon(source,30,tonumber ( ammo[6] ),true) giveWeapon(source,34,tonumber ( ammo[8] ),true) giveWeapon(source,17,tonumber ( ammo[9] ),true) giveWeapon(source,44,tonumber ( ammo[10] ),true) elseif playerTeam == getTeamFromName ("Ciudadano E.E.U.U") then giveWeapon(source,1,tonumber ( ammo[1] ),true) giveWeapon(source,4,tonumber ( ammo[2] ),true) giveWeapon(source,22,tonumber ( ammo[3] ),true) elseif playerTeam == getTeamFromName ("Ejercito E.E.U.U") then giveWeapon(source,24,tonumber ( ammo[4] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,30,tonumber ( ammo[6] ),true) giveWeapon(source,34,tonumber ( ammo[8] ),true) elseif playerTeam == getTeamFromName ("Escuadron E.E.U.U") then giveWeapon(source,24,tonumber ( ammo[4] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,29,tonumber ( ammo[11] ),true) giveWeapon(source,30,tonumber ( ammo[6] ),true) giveWeapon(source,34,tonumber ( ammo[8] ),true) giveWeapon(source,17,tonumber ( ammo[9] ),true) giveWeapon(source,44,tonumber ( ammo[10] ),true) elseif playerTeam == getTeamFromName ("Ciudadano Japones") then giveWeapon(source,1,tonumber ( ammo[1] ),true) giveWeapon(source,4,tonumber ( ammo[2] ),true) giveWeapon(source,22,tonumber ( ammo[3] ),true) elseif playerTeam == getTeamFromName ("Ejercito Japones") then giveWeapon(source,24,tonumber ( ammo[4] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,30,tonumber ( ammo[6] ),true) giveWeapon(source,34,tonumber ( ammo[8] ),true) elseif playerTeam == getTeamFromName ("Escuadron Japones") then giveWeapon(source,24,tonumber ( ammo[4] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,29,tonumber ( ammo[11] ),true) giveWeapon(source,30,tonumber ( ammo[6] ),true) giveWeapon(source,34,tonumber ( ammo[8] ),true) giveWeapon(source,17,tonumber ( ammo[9] ),true) giveWeapon(source,44,tonumber ( ammo[10] ),true) end end end ) Link to comment
Moderators IIYAMA Posted January 19, 2013 Moderators Share Posted January 19, 2013 local ammo = { 1,100,60,150,50,5,300 } -- 1 = 1 -- 2 = 100 -- 3 = 60 -- 4 = 150 -- 5 = 50 -- 6 = 300 giveWeapon(source,24,ammo[1],true) --= 1 ammo giveWeapon(source,27,ammo[2],true) --= 100 ammo giveWeapon(source,30,ammo[3],true) --= 60 ammo giveWeapon(source,34,ammo[4],true) --= 150 ammo Link to comment
Xperia Posted January 19, 2013 Author Share Posted January 19, 2013 Don't work, only give me 30 bullets. Link to comment
Moderators IIYAMA Posted January 19, 2013 Moderators Share Posted January 19, 2013 (edited) You calling "ammo[11]" when it does not exist in the table it self....... Edited January 19, 2013 by Guest Link to comment
Xperia Posted January 19, 2013 Author Share Posted January 19, 2013 It's fixed, thanks all! 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