Jump to content

GiveWeapon Failing?


Recommended Posts

Posted

Hey guys, i cant give myself teargass, (giveWeapon ( source, 17, 90)), and i cant see why, its just not giving me it.

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted

Post the script.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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) 

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted

Maybe they are being given before you actually spawn.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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.

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted

Try adding this:

addEventHandler ( "onPlayerSpawn", root, 
    function ( ) 
        outputChatBox ( "SPAWNED" ) 
    end 
) 

And an outputChatBox for when you give the weapon, then see which comes first.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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.

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted

So, which is being triggered first? try setting a timer of like 0.5 seconds to give the weapons.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...