.:HyPeX:. Posted March 8, 2014 Share Posted March 8, 2014 Hey guys, i cant give myself teargass, (giveWeapon ( source, 17, 90)), and i cant see why, its just not giving me it. Link to comment
.:HyPeX:. Posted March 8, 2014 Author Share Posted March 8, 2014 This is basically the spawning function, tell me what more you need about it (too long for posting it entirely) The engineer class is not given teargas, the other weapons yes. function SpawnPlayer(player) bindKey(source, "R", "down", "reloadgun") local player = source ProtectionTable[source] = source timer = setTimer(function() ProtectionTable[player] = nil end, 5000, 1) if getPlayerTeam(player) == ATeam then local Spawned = #ASpawn local mathed = math.random(Spawned) spawnPlayer(player, ASpawn[mathed].X, ASpawn[mathed].Y, ASpawn[mathed].Z) setElementModel(source, 287) fadeCamera(source, true) class = getElementData(source, "Class") if class == "Medic" then giveWeapon ( source, 22, 60 , false ) giveWeapon ( source, 29, 180 , true ) outputChatBox("#0077FF[bF3]: You have selected medic, Press 'G' to drop a MedKit", source,255,255,255,true) setElementData(source, "MediKits", 2) setElementData(source, "Damage", 1) elseif class == "Assault" then giveWeapon ( source, 24, 180 , false ) giveWeapon ( source, 31, 600 , true ) setElementData(source, "Damage", 1) elseif class == "Sniper" then giveWeapon ( source, 23, 60 , false ) giveWeapon ( source, 34, 30 , true ) setElementData(source, "Damage", 2) elseif class == "Engineer" then giveWeapon ( source, 17, 90) giveWeapon (source, 39, 2) giveWeapon ( source, 27, 80 , true ) setElementData(source, "Damage", 1) end setCameraTarget (source, source) if isElementFrozen(source) then setElementFrozen(source, false) end Blips[source] = createBlipAttachedTo( source, 0, 2, 0, 255, 0, 255, 0, 99999, getPlayersInTeam(ATeam) ) setElementVisibleTo ( Blips[source], getRootElement(),false) for i, v in ipairs(getPlayersInTeam(ATeam)) do setElementVisibleTo ( Blips[source], v,true) end elseif getPlayerTeam(player) == BTeam then local Spawned = #BSpawn local mathed = math.random(Spawned) spawnPlayer(player, BSpawn[mathed].X, BSpawn[mathed].Y, BSpawn[mathed].Z) setElementModel(source, 285) Blips[source] = createBlipAttachedTo( source, 0, 2, 0, 255, 0, 255, 0, 99999, getPlayersInTeam(BTeam) ) setElementVisibleTo ( Blips[source], getRootElement(),false) for i, v in ipairs(getPlayersInTeam(BTeam)) do setElementVisibleTo ( Blips[source], v,true) end fadeCamera(source, true) class = getElementData(source, "Class") if class == "Medic" then giveWeapon ( source, 22, 60 , false ) giveWeapon ( source, 29, 180 , true ) setElementData(source, "MediKits", 2) setElementData(source, "Damage", 1) elseif class == "Assault" then giveWeapon ( source, 24, 180 , false ) giveWeapon ( source, 31, 600 , true ) setElementData(source, "Damage", 1) elseif class == "Sniper" then giveWeapon ( source, 23, 60 , false ) giveWeapon ( source, 34, 30 , true ) setElementData(source, "Damage", 2) elseif class == "Engineer" then giveWeapon ( source, 17, 20 , false ) giveWeapon (source, 39, 2, false) giveWeapon ( source, 27, 80 , true ) setElementData(source, "Damage", 1) end setCameraTarget (source, source) if isElementFrozen(source) then setElementFrozen(source, false) end end end addEvent("SpawnPlayer",true) addEventHandler("SpawnPlayer", getRootElement(), SpawnPlayer) Link to comment
Castillo Posted March 8, 2014 Share Posted March 8, 2014 Maybe they are being given before you actually spawn. Link to comment
.:HyPeX:. Posted March 8, 2014 Author Share Posted March 8, 2014 Maybe they are being given before you actually spawn. Spawning comes first, and the tear is before and after other 2 weapons wich are actually given so i've discarded this idea. Link to comment
Castillo Posted March 8, 2014 Share Posted March 8, 2014 Try adding this: addEventHandler ( "onPlayerSpawn", root, function ( ) outputChatBox ( "SPAWNED" ) end ) And an outputChatBox for when you give the weapon, then see which comes first. Link to comment
.:HyPeX:. Posted March 8, 2014 Author Share Posted March 8, 2014 Try adding this: addEventHandler ( "onPlayerSpawn", root, function ( ) outputChatBox ( "SPAWNED" ) end ) And an outputChatBox for when you give the weapon, then see which comes first. Spawned it outputed before Press "G" thingy on the medic class. Link to comment
Castillo Posted March 8, 2014 Share Posted March 8, 2014 So, which is being triggered first? try setting a timer of like 0.5 seconds to give the weapons. Link to comment
.:HyPeX:. Posted March 8, 2014 Author Share Posted March 8, 2014 So, which is being triggered first? try setting a timer of like 0.5 seconds to give the weapons. Spawn is given first, there should not be a problem with that, since it gives the other 2 weapons, of wich one is given before and the other is given after tearglass Link to comment
Castillo Posted March 8, 2014 Share Posted March 8, 2014 giveWeapon ( source, 17, 90) giveWeapon (source, 39, 2) Grenades, tear gas, satchels use the same slot. https://wiki.multitheftauto.com/wiki/Weapons Link to comment
.:HyPeX:. Posted March 9, 2014 Author Share Posted March 9, 2014 giveWeapon ( source, 17, 90) giveWeapon (source, 39, 2) Grenades, tear gas, satchels use the same slot. https://wiki.multitheftauto.com/wiki/Weapons Thanks!, i'll see what i can do then 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