GetWeaponAtSlot a substitute?

Started by Fjose, Jan 29, 2015, 01:28 AM

Previous topic - Next topic

Fjose

'GetWeaponAtSlot' since this function does not exist or maybe have other name, I'll would like know the correct name for this function, if this was added and how use it.

.

`player.GetWeaponAtSlot(integer)` Perhaps you did something wrong. And as long as you didn't got a syntax error then the function is there.
.

Fjose

well, I was using 'player.GetWeaponAtSlot( player.Weapon )' as player.Weapon is represented like an number but in this case the error says: Member Variable not found.

DizzasTeR

It says that memver variable not found because the function is taking 1 parameter but you are calling player parameter as well.

.

#4
You seem to be confusing the weapon ID with the weapon slot index. My current idea of this concept is the following.

Allocate 3 weapon slots for the player:
player.Slot = 3;
Give the player 3 weapons:
player.GiveWeapon(WEP_PYTHON, 56);
player.GiveWeapon(WEP_SHOTGUN, 32);
player.GiveWeapon(WEP_SNIPER, 18);

Get the weapon in slot #2:
if (player.GetWeaponAtSlot(2) == WEP_SHOTGUN) print("I was right!");
else print("I was wrong!");

And so on....

I don't get the system either because some of the functions are missing. Like `player.SetWeaponAtSlot()`. Which is why I'm not so sure of what I've written so far.
.

AdTec_224

player.Slot sets the players currently active slot, it doesn't allocate slots (as far as I'm aware) so doing player.Slot = 3; would actually set the player weapon slot to 3, which is according to this (random google search got me that) is the slot reserved for pistols and therefore the if statement in that example would always return "I was wrong!".

Stormeus

#6
The real question here is why you're trying GetWeaponAtSlot(player.Weapon). You already know what weapon they have out, don't you? :P

That said, "Member Variable not found" shouldn't happen. At the very least, a different error should occur. If you can get this down to a minimal script that reproduces the issue, I might be able to trace the issue in the plugin.

Fjose

#7
GetWeaponAtSlot doesn't exist, I was trying with 'GetWeaponAtSlot(1)' after read all their posts. and stormeus when I was testing how work that function, I knew not to put (idk if this oration is written correctly xD) and use player.Weapon for check.

Also the number of slots begins from 1 to 8 or 0 to 7??

Off topic text removed. Make a separate topic if you have problems.

Sk

#8
Quote from: Fjose on Jan 29, 2015, 03:12 PMGetWeaponAtSlot doesn't exist, I was trying with 'GetWeaponAtSlot(1)' after read all their posts. and stormeus when I was testing how work that function, I knew not to put (idk if this oration is written correctly xD) and use player.Weapon for check.
Some Thing Must be Wrong on your End might be an old plugin or something try this
http://pastebin.com/5RKQbhgg
Tested = http://s20.postimg.org/eyo829onf/screenshot_54.png
Quote from: Fjose on Jan 29, 2015, 03:12 PMAlso the number of slots begins from 1 to 8 or 0 to 7??
0-8
Quote from: Fjose on Jan 29, 2015, 03:12 PMNote (OFF Topic): Why the coordinates of the cars are not same like in 0.3, I mean.. when I uses <Vehicle model="224" world="1" x="-842.2524" y="-909.7036" z="10.8677" angle="356.8192" col1="0" col2="0"/>, everything looks good but the coordinates are not taken how must be, maybe I can't use negative values? - In the image you can see the vehicle, each
vehicle take that  position, I mean, everything to the north.. http://oi60.tinypic.com/25polub.jpg
Make Sure the Angle Is correct Angle Really Does Matter.

Fjose

hmm... sk I have the last version uploaded by gudio, I don't have why then this function does not work, anyways can pass me your squirrel plugin :/

Sk

Quote from: Fjose on Jan 29, 2015, 09:59 PMhmm... sk I have the last version uploaded by gudio, I don't have why then this function does not work, anyways can pass me your squirrel plugin :/
m also using the plugins last uploaded by gudio
https://bitbucket.org/stormeus/0.4-squirrel/downloads

Fuzzie

Quoteelse if( cmd == "weaponatslot" ){
      ClientMessage( "The weapon at " + text + " is " + GetWeaponName( player.GetWeaponAtSlot( text.tointeger() ) ), player, 255, 120, 0 );
   }

This worked perfectly fine for me. I was able to get the weapon name. Also the slots can extend to infinity but the weapon slots used is only till 8 (Snipers).

The text argument in this case is a number. During testing, I used the numbers 0 to 10. If the slot is empty, it will return Unarmed

I think I am using the latest version of the Squirrel plug-in but I could be wrong. Either way, it still worked for me. If it still doesn't for you, post the code where you used player.GetWeaponAtSlot(). It could be the way you used it.

Fjose

thanks for their answers. now is working :)