Problems: Being banned while editing files, and random number problems
10 replies, posted
Hey all, I'm wondering about a problem I am having:
I'm trying to create an entity for an addon called DarkRP leveling and experience system, and trying to create an entity that gives a random amount of XP:
[CODE]math.randomseed(os.time())
for n = 0, 10000 do
randNumber = math.random(10000)
end
DarkRP.createEntity("Computer Parts(1-30000 XP)", {
ent = "level_give",
model = "models/props_lab/partsbin01.mdl",
price = 10000,
xpamount = randNumber,
level = 30,
max = 99,
cmd = "buyrandlevel",
customCheck = function(ply) return ply:IsUserGroup("Donator") or ply:IsAdmin() end
})[/CODE]
Trouble is, this creates a random number, but only once: every subsequent number is the same. If the server restarts or reloads or change maps, etc, it becomes random once again.
Also, I'm running into a problem when editing these files: I get banned. I didn't use to get banned when editing these, but now, I get banned instantly when it gets edited. Just me, or more specifically, my IP. Any help?
Thanks facepunch.
It's because you make randNumber into a variable, which will only be assigned one number. Try putting the math.random next to the xpamount.
[QUOTE=code_gs;44482677]It's because you make randNumber into a variable, which will only be assigned one number. Try putting the math.random next to the xpamount.[/QUOTE]
Alright, I've cleaned up the code, I don't think the for loop was even needed, but here's what it is now, still have the same problem:
[CODE]DarkRP.createEntity("Computer Parts(1-30000 XP)", {
math.randomseed(os.time()),
ent = "level_give",
model = "models/props_lab/partsbin01.mdl",
price = 10000,
xpamount = math.random(10000),
level = 30,
max = 99,
cmd = "buyrandlevel",
customCheck = function(ply) return ply:IsUserGroup("Donator") or ply:IsAdmin() end
})
[/CODE]
I think it's because of how DarkRP creates entities; it will not update it with values, rather, create it once and be done with it. I don't know a good way of combating this besides modifying it to constantly reload the entity, although that would just be stupid.
Yes - sadly I believe this is the case. reloading would indeed be stupid, and to the best of my knowledge, would make the game completely unplayable. Oh well. I guess it's random enough as it is, it'll update every server reset.
Any ideas about the banning thing?
I'm going to go out on a limb and say you're running an anti-cheat of some kind?
I [I]was[/I] running an anti-cheat, but I removed it for doing exactly that - ban on file edit. It's removed temporarily until I can get the server up and running...so...this doesn't really make any sense to me.
Anybody have an idea about me getting banned? still happens...
[QUOTE=atticusmas;44483652]I [I]was[/I] running an anti-cheat, but I removed it for doing exactly that - ban on file edit. It's removed temporarily until I can get the server up and running...so...this doesn't really make any sense to me.[/QUOTE]
If you want people to help you figure out why it bans you then you'll have to post the code.
I'm going to take a wild guess and assume it's QAC :v:
In which case, [url]http://facepunch.com/showthread.php?t=1379704[/url]
Actually -- no. I WAS running LEY anti cheat, but like I said, I removed it. What code do you want me to post?
Sorry, you need to Log In to post a reply to this thread.