AAO25.com

Community => Games & Programming => Topic started by: LEEFFM on Wednesday, November 12, 2014, 21:04:51 PM

Title: bug in weapons forcer aka PickASniper
Post by: LEEFFM on Wednesday, November 12, 2014, 21:04:51 PM
ok so my PickASniper mod is pretty much  crusades weapon forcer -{DG}-Crusade19 but with snipers :P I typed it out by hand because that a good way to learn what's really going on in the code to get the result.
so this mod works for the most part the problem ive been trying to solve is the first time I "say sniper [class]" it does not work but it works every time after that, I have it set so when you join the server you get ClassSniper and when your use the "say sniper [class]" the first time you still get ClassSniper I can change what weapon you get but I want it to work every time.

could someone look at the code and help me further understand what I can to fix the error? It appears to be a bug that crusade never fixed in his mod which makes it a little harder to understand what im trying to learn.

PickASniper.uc - http://pastebin.com/Hg8eeheq (http://pastebin.com/Hg8eeheq)
MVHandler.uc - http://pastebin.com/04VUYppy (http://pastebin.com/04VUYppy)
Title: Re: bug in weapons forcer aka PickASniper
Post by: teddy_grizzly_bear on Thursday, November 13, 2014, 01:46:36 AM
If I were to guess (and bare in mind this is my 2nd time ever looking at UScript), I would guess it's in the 2nd part (04VUYppy), where in the if statement on line 41 you create a new field in Playerdata, but later on still refer to the -1st element in PlayerData, but you should in fact refer to the one you inserted. Now, I can't see any value assigned to z, so it might be 0 (which, I don't know), but in any case you would need to add nr=z; to the if statement in line 41 (i.e to line 46 for example).

But like I said, I don't know UScript, so I might be completely wrong (for example in python, -1st element in a list/array is the last element anyway).
Title: Re: bug in weapons forcer aka PickASniper
Post by: LEEFFM on Thursday, November 13, 2014, 02:52:29 AM
OMG Teddy I love you lol I tried a bunch of crap none of it worked, but yes you were correct that worked, I was thinking maybe I had to do z = something but didn't think nr = z :P
Title: Re: bug in weapons forcer aka PickASniper
Post by: teddy_grizzly_bear on Thursday, November 13, 2014, 03:18:56 AM
OMG Teddy I love you lol I tried a bunch of crap none of it worked, but yes you were correct that worked, I was thinking maybe I had to do z = something but didn't think nr = z :P
You better love me long time ;)
Title: Re: bug in weapons forcer aka PickASniper
Post by: M@dness on Thursday, November 13, 2014, 03:45:03 AM
haha  teddy is a savant  he probably just took a glance at it and had ur answer from that .
Title: Re: bug in weapons forcer aka PickASniper
Post by: teddy_grizzly_bear on Thursday, November 13, 2014, 04:47:40 AM
haha  teddy is a savant  he probably just took a glance at it and had ur answer from that .
lol, far from it. In fact I looked at the wrong part at first ;)