Jump to content
MakeWebGames

Best Way to Prevent Repetitive Attacks?


TonyCisseroni

Recommended Posts

I have added the attack and mug modules in GL2...

What is the best way to prevent a user from repeating it over and over again?

If I mug someone, I can mug them again and again until they are broke.

How can I stop this and add a delay of at least 24 hours before I can mug that player again?

I don't want to prevent the user from mugging anyone for 24 hours, just from mugging the same player again in a 24 hour period.

Any suggestions?

UPDATE: I found a solution and I don't think I can delete my post here. The solution I came up with was to use a timestamp in the db and add a day to it. Then I check if the current time is greater than the timestamp in the db. If it is, they can do it again.

Edited by TonyCisseroni
Link to comment
Share on other sites

24 minutes ago, Curt said:

That is a perfect solution 😉

Good job. 

Thank you! Now I need to look into the regular timer function for crimes and theft. That way they can't mug everyone in the game all at once 😁

Here is my code to add one day to the current time for a timestamp in the db: 

$muggedtime = strtotime('+1 day', $time);

 

Edited by TonyCisseroni
Link to comment
Share on other sites

What you can do is store each mugging into a table and determine what a decent number of muggings in "x" amount of time would be like 3/hr or whatever. 
 

I created a mugging module for NWE and used this exact same approach
 

I looked at the timers GL offers and didn’t see anything that may help you unless there was some sort of data field that you can serialize or whatever to extract that information out but I think it only returns a timestamp

Edited by KyleMassacre
  • Like 1
Link to comment
Share on other sites

Just out of curiosity why would you want to stop it? In all my years of text based games one constant was that you needed to watch leaving money out or you would get robbed. Part of strategic gameplay is making sure not to leave stuff on the markets and then log out. Limiting people to mugging player a once every 24 hours is really limiting gameplay.

  • Like 3
Link to comment
Share on other sites

14 hours ago, Veramis said:

Just out of curiosity why would you want to stop it? In all my years of text based games one constant was that you needed to watch leaving money out or you would get robbed. Part of strategic gameplay is making sure not to leave stuff on the markets and then log out. Limiting people to mugging player a once every 24 hours is really limiting gameplay.

I'm not limiting them to mugging every 24 hours, I'm limiting them from mugging the same player over and over without restriction.

Link to comment
Share on other sites

9 hours ago, TonyCisseroni said:

I'm not limiting them to mugging every 24 hours, I'm limiting them from mugging the same player over and over without restriction.

I know, I still don't see the point in restricting it. Limiting gameplay because one player makes a mistake and leaves money out makes no sense.

Link to comment
Share on other sites

1 hour ago, Veramis said:

I know, I still don't see the point in restricting it. Limiting gameplay because one player makes a mistake and leaves money out makes no sense.

Could be seen as harassment once it hits a certain point. As a preventative measure, I don't see x-per-time-limiting same-player hits as a bad idea - as long as it's not too restrictive.

Link to comment
Share on other sites

9 hours ago, Magictallguy said:

Could be seen as harassment once it hits a certain point. As a preventative measure, I don't see x-per-time-limiting same-player hits as a bad idea - as long as it's not too restrictive.

True, usually games have clear guidelines for harassment, I myself have used in the past the rule that offline hits don't count towards harassment. Harassment to me is something that impedes gameplay, with the player being at fault for leaving items and whatever else on the market, I don't see it as harassment so much as a lesson learned. Now if those mugs all happened online then it'd be a little different.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...