Scripts / From Prod Chat. In LUA the Direct Command - GetPlayerWeaponID ( )

Author
Message
Mortt
8
Years of Service
User Offline
Joined: 16th May 2016
Location:
Posted: 6th Mar 2017 08:59
The returned ID is a number that is representaitive of the weapon the player currenty is using.
Is this ID a constant or is it a variable number ID?
If a constant then it is the same ID number "always" for that game.
If it is a variable then the ID number can change throughout the same game.

Can anyone help out with this problem.
I need to know so that I know how to use the ID in my LUA code.
(Custom) Intel i7 3.3 Mhz. 16 GB fast ram. EVGA Nvidia 560 Ti 4GB. Dell US27 2560 x 1440. AOC 24 1920 x 1080. Awesome.
Next G. Card EVGA GeForce GTX 970 Superclocked ACX 2.0 Gaming 4GB GDDR5 PCIe3.0 Graphics Card.
Would Like EVGA NVIDIA GeForce GTX 1080 8GB GDDR5X PCIe3.0 Graphics Card
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Mar 2017 09:59
It changes from machine to machine for sure, if you dont want to call the command all the time then I should think as long as you store the value as a variable and then use that variable in your script you'll be fine.
I assume you're worried about multiple levels? Best way is just to quickly test it.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Mortt
8
Years of Service
User Offline
Joined: 16th May 2016
Location:
Posted: 6th Mar 2017 13:13
I am trying to get the name of the weapon that the player is currently using.

The image and weapon data can then be put into the hud and on the screen.

(Custom) Intel i7 3.3 Mhz. 16 GB fast ram. EVGA Nvidia 560 Ti 4GB. Dell US27 2560 x 1440. AOC 24 1920 x 1080. Awesome.
Next G. Card EVGA GeForce GTX 970 Superclocked ACX 2.0 Gaming 4GB GDDR5 PCIe3.0 Graphics Card.
Would Like EVGA NVIDIA GeForce GTX 1080 8GB GDDR5X PCIe3.0 Graphics Card
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Mar 2017 13:34
why not just use this then?
g_PlayerGunName = ""
so
Prompt(g_PlayerGunName)
will show the name of the gun on screen (note this also returns the folder so you should likely add a check for a "\" in the string and only return the string after it)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 6th Mar 2017 15:51 Edited at: 6th Mar 2017 18:11
Quote: "If a constant then it is the same ID number "always" for that game."


In gunspec.txt you've:

Quote: "; GUN HUD (0-colt,1-magnum,2-uzi,3-shotgun,4-rifle,5-rpg,6-grenade,7-bow,8-mace,9-stone,10-sword,11-staff)"


So I think it should be, does not matter whats the level is. Just my thought.

Try code bellow if you don't want to del with "\".
Notice you can add more weapons to the "weapon_names" array/table/list Or how the hell it called.



hth

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
Mortt
8
Years of Service
User Offline
Joined: 16th May 2016
Location:
Posted: 6th Mar 2017 19:01
If I could find out what current weapon that the player was using through using the ID from here "GetPlayerWeaponID ( )"
Then all the data for the weapon that the player is currently using can then be put into the HUD and then be shown, allong with the weapon image.

It is if the ID from the "GetPlayerWeaponID()" being the same number when the game is run in any other PC. If this number changes then how can it be used?

I have a work around, but the script is over 300 lines.

But, it is the relationship between this ID and other PC computers. On my PC, this number 26 from the "GetPlayerWeaponID()" is a Typhoon and is from BSP. If this number for this weapon is the same from every PC computer then all is good. But, if this number does not relate to this gun Typhoon in all other PC computers then it is a problem, as this ID could not be used as the computer would generate a different number and he game would not run.

This is the kind of thing that I am trying to do.

This is just a simplified example

if weaponID == 26 then
display data and image in the HUD for Typhoon

Problem, Is 26 going to be the same number in every other PC for the Typhoon
(Custom) Intel i7 3.3 Mhz. 16 GB fast ram. EVGA Nvidia 560 Ti 4GB. Dell US27 2560 x 1440. AOC 24 1920 x 1080. Awesome.
Next G. Card EVGA GeForce GTX 970 Superclocked ACX 2.0 Gaming 4GB GDDR5 PCIe3.0 Graphics Card.
Would Like EVGA NVIDIA GeForce GTX 1080 8GB GDDR5X PCIe3.0 Graphics Card
PM

Login to post a reply

Server time is: 2024-05-17 13:42:54
Your offset time is: 2024-05-17 13:42:54