Author Topic: 2 Presidents and 2 Vice presidents !  (Read 6637 times)

Offline Yash

  • VIP
  • Hero Member
  • **
  • Posts: 549
  • Rank: Sucka
  • Score: 2448
  • “Anyone can do my job, but no one can be me.”
2 Presidents and 2 Vice presidents !
« on: August 08, 2016, 04:45:52 pm »
Most of the time there are 2 president and 2 vice president in game ! Please fix it :)
#PlanB.Echo* [14] VIP Chat Quinn: How's Kencer
#PlanB.Echo* [10] VIP Chat Schottky_BiB: deadman?
#PlanB.Echo* [32] VIP Chat [RZ]Deadman: ?
#PlanB.Echo* [10] VIP Chat Schottky_BiB: yash is asking how are you
#PlanB.Echo* [9] VIP Chat SatviK:  XD
#PlanB.Echo* [14] VIP Chat Quinn: Xd

Offline Finisher

  • VIP
  • Hero Member
  • **
  • Posts: 1033
  • Rank: Jacker
  • Score: 45472
  • Jerusalemite
Re: 2 Presidents and 2 Vice presidents !
« Reply #1 on: August 08, 2016, 11:48:26 pm »
Suffered a lot from this issue today, needs a fix asap!

Offline Storm

  • VIP
  • Sr. Member
  • **
  • Posts: 278
  • Rank: Snitch
  • Score: 1263
  • Respect if you want to be respected
Re: 2 Presidents and 2 Vice presidents !
« Reply #2 on: August 09, 2016, 12:19:26 am »
If a player is caught bugging the President he should be temp-banned

Offline pRiMoZ

  • VIP
  • Jr. Member
  • **
  • Posts: 68
  • Rank: Unknown
  • Score: Unknown
Re: 2 Presidents and 2 Vice presidents !
« Reply #3 on: August 09, 2016, 12:30:23 am »
If a player is caught bugging the President he should be temp-banned
Problem is that this happens due to mistakes too...
like- ''i just joined the game and pres slot seemed free, picked it and bang...2 presis''

Offline style!

  • VIP
  • Jr. Member
  • **
  • Posts: 58
  • Rank: Unknown
  • Score: Unknown
Re: 2 Presidents and 2 Vice presidents !
« Reply #4 on: August 09, 2016, 12:34:20 am »
I think the problem is class available isn't updated as fast as needed.


style_n_elegance

Offline Jonne

  • Head Admin
  • Hero Member
  • *****
  • Posts: 1926
  • Rank: Chump
  • Score: 3751
Re: 2 Presidents and 2 Vice presidents !
« Reply #5 on: August 09, 2016, 02:54:48 am »
If a player is caught bugging the President he should be temp-banned
Problem is that this happens due to mistakes too...
like- ''i just joined the game and pres slot seemed free, picked it and bang...2 presis''

Yea, it happened mostly by mistake because 2 people picked president at the exact same time.

I think the problem is class available isn't updated as fast as needed.

I think that was the problem, so I moved it up in the 'chain of events', let's see if that makes a difference (Only for President though, not for vice as it isn't that big of a problem). If you still see 2 presis or 2 vices, do /checkpres, and it should auto-fix it.

Offline YoMama

  • VIP
  • Hero Member
  • **
  • Posts: 638
  • Rank: Hoodsta
  • Score: 24630
Re: 2 Presidents and 2 Vice presidents !
« Reply #6 on: August 09, 2016, 10:20:50 am »
If a player is caught bugging the President he should be temp-banned
Problem is that this happens due to mistakes too...
like- ''i just joined the game and pres slot seemed free, picked it and bang...2 presis''

Yea, it happened mostly by mistake because 2 people picked president at the exact same time.

I think the problem is class available isn't updated as fast as needed.

I think that was the problem, so I moved it up in the 'chain of events', let's see if that makes a difference (Only for President though, not for vice as it isn't that big of a problem). If you still see 2 presis or 2 vices, do /checkpres, and it should auto-fix it.
Thanks for creating a fix, but I feel like there should be a way of avoiding the problem in the first place. I would look into mutexes for the President/Vice President classes (by the way, it's mistakenly "VicePresident" in the server). Basically, they stop two threads (or players) from using the same part of your code at the same time. From my research, it appears that PAWN doesn't have mutex support built in, but if you'd like help, I could try messing with it and see if I can't slap something together. Also, if you haven't already done this, you could call whatever function you've made for /checkpres ~10 seconds after "<Player> is now President" is printed in the chat and eliminate most cases as well.

Offline Jonne

  • Head Admin
  • Hero Member
  • *****
  • Posts: 1926
  • Rank: Chump
  • Score: 3751
Re: 2 Presidents and 2 Vice presidents !
« Reply #7 on: August 11, 2016, 01:01:01 pm »
Thanks for creating a fix, but I feel like there should be a way of avoiding the problem in the first place. I would look into mutexes for the President/Vice President classes (by the way, it's mistakenly "VicePresident" in the server). Basically, they stop two threads (or players) from using the same part of your code at the same time. From my research, it appears that PAWN doesn't have mutex support built in, but if you'd like help, I could try messing with it and see if I can't slap something together. Also, if you haven't already done this, you could call whatever function you've made for /checkpres ~10 seconds after "<Player> is now President" is printed in the chat and eliminate most cases as well.

I just made it a command for now, I'll look into a permanent solution that prevents the problem from happening first. I think I've found one now, I'll test it tonight. If I can't find a solution that completely fixes the problem, I'll add it in a timer.

Offline Altus_Demens

  • Admin
  • Hero Member
  • ****
  • Posts: 1119
  • Rank: Hoodsta
  • Score: 23951
Re: 2 Presidents and 2 Vice presidents !
« Reply #8 on: August 11, 2016, 03:12:29 pm »
Thanks for creating a fix, but I feel like there should be a way of avoiding the problem in the first place. I would look into mutexes for the President/Vice President classes (by the way, it's mistakenly "VicePresident" in the server). Basically, they stop two threads (or players) from using the same part of your code at the same time. From my research, it appears that PAWN doesn't have mutex support built in, but if you'd like help, I could try messing with it and see if I can't slap something together. Also, if you haven't already done this, you could call whatever function you've made for /checkpres ~10 seconds after "<Player> is now President" is printed in the chat and eliminate most cases as well.
Sorry if my post will be irrelevant, but I guess that creating mutex interface using pawn where we can't even work normally with threads would be a lot of hard and ungrateful work, and it probably will cause a lot of new troubles like thread blocking and performance issues (in the best case it would be like "synchronized" block in Java which is almost deprecated). I am sure that there's better and easier solution but it's hard to tell not seeing the code. Anyways, if you want to mess with the threads, it's better use things like samgdk and work with "complete" programming language with threads, mutexes and others things built-in.
A paltry man and poor of mind
At all things ever mocks;
For never he knows, what he ought to know,
That he is not free from faults.

Offline YoMama

  • VIP
  • Hero Member
  • **
  • Posts: 638
  • Rank: Hoodsta
  • Score: 24630
Re: 2 Presidents and 2 Vice presidents !
« Reply #9 on: August 12, 2016, 10:50:31 am »
Thanks for creating a fix, but I feel like there should be a way of avoiding the problem in the first place. I would look into mutexes for the President/Vice President classes (by the way, it's mistakenly "VicePresident" in the server). Basically, they stop two threads (or players) from using the same part of your code at the same time. From my research, it appears that PAWN doesn't have mutex support built in, but if you'd like help, I could try messing with it and see if I can't slap something together. Also, if you haven't already done this, you could call whatever function you've made for /checkpres ~10 seconds after "<Player> is now President" is printed in the chat and eliminate most cases as well.
Sorry if my post will be irrelevant, but I guess that creating mutex interface using pawn where we can't even work normally with threads would be a lot of hard and ungrateful work, and it probably will cause a lot of new troubles like thread blocking and performance issues (in the best case it would be like "synchronized" block in Java which is almost deprecated). I am sure that there's better and easier solution but it's hard to tell not seeing the code. Anyways, if you want to mess with the threads, it's better use things like samgdk and work with "complete" programming language with threads, mutexes and others things built-in.
How would it be irrelevant? You make a valid point. I know very little about PAWN, so I'm glad to learn more about it.

Offline Skyfire

  • VIP
  • Newbie
  • **
  • Posts: 12
  • Rank: Unknown
  • Score: Unknown
  • The mind is everything. You become what you think
Re: 2 Presidents and 2 Vice presidents !
« Reply #10 on: August 12, 2016, 10:53:50 am »
It's easy to speculate about the problem without seeing the code. If you need a hand debugging the code Jonne drop me a PM with relevant lines

Offline DrPepper

  • VIP
  • Newbie
  • **
  • Posts: 5
  • Rank: Unknown
  • Score: Unknown
Re: 2 Presidents and 2 Vice presidents !
« Reply #11 on: August 15, 2016, 04:08:36 am »
Thanks for creating a fix, but I feel like there should be a way of avoiding the problem in the first place. I would look into mutexes for the President/Vice President classes (by the way, it's mistakenly "VicePresident" in the server). Basically, they stop two threads (or players) from using the same part of your code at the same time. From my research, it appears that PAWN doesn't have mutex support built in, but if you'd like help, I could try messing with it and see if I can't slap something together. Also, if you haven't already done this, you could call whatever function you've made for /checkpres ~10 seconds after "<Player> is now President" is printed in the chat and eliminate most cases as well.

I just made it a command for now, I'll look into a permanent solution that prevents the problem from happening first. I think I've found one now, I'll test it tonight. If I can't find a solution that completely fixes the problem, I'll add it in a timer.

I feel like adding a timer or using OnPlayerUpdate can be easily used to fix the problem. But I have no idea what the code is like, just a suggestion given on the idea what you said.

Offline Jonne

  • Head Admin
  • Hero Member
  • *****
  • Posts: 1926
  • Rank: Chump
  • Score: 3751
Re: 2 Presidents and 2 Vice presidents !
« Reply #12 on: August 16, 2016, 10:41:53 pm »
If you see it happen again, please post it here (with the name of who the presidents were and around what time it happened, so I can look into it). It should be fixed now (It wasn't happening because they took pres at the same time, I was just an idiot and forgot a check). 2 vices might still happen, but that's not that big of an issue, if this solutions works for presidents I'll add it for vices too.

Offline Messy.

  • Newbie
  • *
  • Posts: 8
  • Rank: Unknown
  • Score: Unknown
  • We are born to kill!!!!!!!!
Re: 2 Presidents and 2 Vice presidents !
« Reply #13 on: August 27, 2016, 05:59:32 pm »
Its fixed

Offline Finisher

  • VIP
  • Hero Member
  • **
  • Posts: 1033
  • Rank: Jacker
  • Score: 45472
  • Jerusalemite
Re: 2 Presidents and 2 Vice presidents !
« Reply #14 on: August 29, 2016, 08:25:17 pm »
No it's not.. happened again today