Raised This Month: $51 Target: $400
 12% 

Maprate modification - vote not firing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 09-23-2016 , 02:21   Maprate modification - vote not firing
Reply With Quote #1

This is the original plugin:

Spoiler


This is my ever so slight modifications:

Spoiler


Basically, the only important lines changed are line 69 and 159. I want players to get the map rate popped to them after playing the map for X amount of seconds, regardless of death (useful for surf & bhop servers where it is one long round, the plugin currently works around player deaths). Instead of hooking player_death I hooked round_start (probably not the ideal way), assuming the vote would be popped to the player X amount of seconds after the round start rather than player death, but the vote never pops. I figure a better and more accurate way of achieving what I want would be to hook a team change, but I'm not sure if that's even an event after a little bit of searching. It works well if I manually type !maprate. No error logs, nothing. Any tips? Still learning the ropes with sourcepawn.

tl;dr Want map rate to pop after X amount of seconds of player being in game, instead of depending on player death.

Last edited by sneaK; 09-23-2016 at 18:40. Reason: code > php and tldr
sneaK is offline
blacklagoon
Senior Member
Join Date: Jun 2012
Old 09-23-2016 , 04:29   Re: Maprate modification - vote not firing
Reply With Quote #2

To hook on team change example :
Code:
public OnPluginStart()
{
  AddCommandListener(Command_JoinTeam, "jointeam");
}

public Action:Command_JoinTeam(client, const String:command[], argc) 
{
  if ( team change is allowed)
  {
    return Plugin_Continue;
  }
  else
  {
    return Plugin_Handled;
  }
}
From post : https://forums.alliedmods.net/showthread.php?t=118281

Last edited by blacklagoon; 09-23-2016 at 04:29.
blacklagoon is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 09-23-2016 , 11:23   Re: Maprate modification - vote not firing
Reply With Quote #3

I didn't see the 'Generic Source Events' page in the wiki, no wonder I couldn't find a team change event under CS:GO (game it's for).

Ideally, I should be able to replace round_start with player_team and that theoretically should be able to solve my issue, correct? I can test in several hours and report back
sneaK is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 09-23-2016 , 18:45   Re: Maprate modification - vote not firing
Reply With Quote #4

So I updated my code above to change round_start to player_team. The vote is now popping, but only if a player switches teams a second time.

I say a second time, because technically after the client enters the game, they change teams from <Unassigned> to either Terrorist, Counter-Terrorist, or Spectator, as demonstrated below:

Code:
17:42:04 "blackhawk74<2><STEAM_1:0:xx><>" entered the game
17:42:04 "blackhawk74<2><STEAM_1:0:xx>" switched from team <Unassigned> to <TERRORIST>
Now, I'm not sure if this is still requiring a player death, because when I switch teams "a second time", this is the order of events:

Code:
17:43:38 "blackhawk74<2><STEAM_1:0:xx>" switched from team <TERRORIST> to <CT>
17:43:38 "blackhawk74<2><STEAM_1:0:xx><CT>" [1920 10424 -6160] committed suicide with "world"
and then the map rate pops up.

Any thoughts?

Last edited by sneaK; 09-23-2016 at 18:45.
sneaK is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-23-2016 , 19:45   Re: Maprate modification - vote not firing
Reply With Quote #5

Be careful with blocking join team. On connect the command fires and if blocked it screws with a bunch of crap including the triggering of the client cant select a team bug as of a few updates ago.
__________________

Last edited by Neuro Toxin; 09-23-2016 at 19:46.
Neuro Toxin is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 09-23-2016 , 23:35   Re: Maprate modification - vote not firing
Reply With Quote #6

Quote:
Originally Posted by Neuro Toxin View Post
Be careful with blocking join team. On connect the command fires and if blocked it screws with a bunch of crap including the triggering of the client cant select a team bug as of a few updates ago.
Yeah, that's why I'm avoiding using blacklagoon's suggested code at the moment, I don't want it to have anything to do with managing team switches.
sneaK is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-24-2016 , 01:39   Re: Maprate modification - vote not firing
Reply With Quote #7

My current codes around this sets a bool flag on disconnect, which means on connect, it skips the first jointeam command and removed the flag ;)
__________________
Neuro Toxin is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 09-29-2016 , 13:49   Re: Maprate modification - vote not firing
Reply With Quote #8

To be honest, I'm a little lost at the moment. Without going too in-depth, I'm still stuck at requiring a death or second team switch for the vote to actually pop for the client. Any thoughts?
sneaK is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode