Page 1 of 1

get Players weapon?

Posted: Fri Jun 04, 2004 3:42 pm
by Elgan
Hey, is it possible to detect what weapon or what weapon class/type is being used?


ive tried everything but everything returned NILL :(

Posted: Fri Jun 04, 2004 4:02 pm
by jv_map
There's several ways, this is probably the easiest:

Code: Select all

local.randomnum = randomint 1000
local.player weaponcommand dual targetname local.randomnum
local.thisplayersweapon = entity local.randomnum // or $(local.randomnum)
local.thisplayersweapon targetname "" // clear targetname
Do not execute a weaponcommand each frame though, they will stack and cause major lag after about a minute or so.

Posted: Fri Jun 04, 2004 4:09 pm
by Elgan
cool...out of intrest..whats the hardest way?:)

Posted: Fri Jun 04, 2004 4:48 pm
by At0miC
LOL, the hardest way is to find out yourself :lol:

Posted: Fri Jun 04, 2004 5:41 pm
by jv_map
Well that's probably true At0mic :wink:

Another way would be this:

Code: Select all

parm.weapplayer = local.player
local.player weaponcommand dual exec somescript.scr
local.weapon = local.player.lastdetectedweapon
And then in main somescript.scr have:

Code: Select all

main:
  parm.weapplayer.lastdetectedweapon = self
end