cato-a / CoDaM_MiscMod

Official MiscMod for CoDaM in Call of Duty 1.1
BSD 3-Clause "New" or "Revised" License
15 stars 5 forks source link

fix issue #29 #30

Closed raphael12333 closed 4 months ago

raphael12333 commented 4 months ago

I see all the content of the ban file gets stored in a single string, it seems to me a string can handle max 1024 chars I'm surprised that if some big servers experienced an issue with this they didn't PR a solution, because i guess they made a fix for themselves

cato-a commented 4 months ago

Hi, was there something wrong with the other code snippet? I think that looks cleaner/more readable. It's similar to your code so should work.

raphael12333 commented 4 months ago

I've just tested your way to do the loop, I'm getting this error:

******* script runtime error *******
cannot cast "wh" to int: (file 'codam\_mm_commands.gsc', line 1839)
        bannedsrvtime = (int)line[4];
                                 *

With this ban file:

1.1.1.1%%moderator1%%player123%%0%%1717430706%%wh
1.1.1.1%%raph%%...

I updated the commit source code with the current code I'm not sure this error is caused by the new code, but i'm not getting it with the previous one with a server running with the same ban file content

cato-a commented 4 months ago

I'll take a look at it later.

Just an observation there are 2 % signs in that banfile output, where there should be just one.

raphael12333 commented 4 months ago

I thought it was on purpose because i see like: https://github.com/cato-a/CoDaM_MiscMod/blob/73df9ff387b009997522aca3f5ffca65ef3facc6/___CoDaM_MiscMod/codam/_mm_commands.gsc#L1529

Ok that would be cool if you can take a look Regards

cato-a commented 4 months ago

It's 2 %% like that because it saves only 1 % the file, with 1 % there would be a blank if I remember correctly. The game strips out %. Perhaps the new fread/fwrite doesn't.

You can try change it to 1 %.

raphael12333 commented 4 months ago

I don't remember if the ban .dat file gets only 1 % using codextended I've removed the extra % from the ban .dat file and from the source code, I don't notice any issue Currently when using !ban, 1 % gets properly added in the ban .dat file for separating elements

After doing some tests with the new loop, the error is gone with the latest commit

There is no error anymore, it works Regards