Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Be the Robot" plugin compatibility #361

Open
naydef opened this issue Feb 6, 2016 · 8 comments
Open

"Be the Robot" plugin compatibility #361

naydef opened this issue Feb 6, 2016 · 8 comments

Comments

@naydef
Copy link
Contributor

naydef commented Feb 6, 2016

There are servers, including my own server, which have Be the Robot plugin(https://forums.alliedmods.net/showthread.php?t=193067). It's fun to use this plugin, but the boss can use it to change his model to robot or or his class model. The plugin has 3 natives:

/**
 * Checks if a client is a robot.
 *
 * @param client            Index of the client to check.
 * @return                  RobotStatus value of the client; RobotStatus_Human if they're a human, RobotStatus_Robot if they're a robot, RobotStatus_WantsToBeRobot if they want to be a robot, but can't for some reason.
 */
native RobotStatus:BeTheRobot_GetRobotStatus(client);

/**
 * Sets if a client should be robot or not.
 *
 * @param client            Index of the client to set.
 * @param toggle            True to make the client a robot, false to change them back to a human. Skip this argument to toggle instead.
 * @noreturn
 */
native BeTheRobot_SetRobot(client, bool:toggle = bool:2);

/**
 * Uses Be the Robot's "CheckTheRules()" native to check if a client should be allowed to be a robot or not.
 *
 * @param client            Index of the client to check.
 * @return                  True if the client is allowed to be a robot (not dead, allowed class by server, etc.) false otherwise.
 */
native bool:BeTheRobot_CheckRules(client);

The code can be added to MakeBoss timer:

if(BeTheRobot_GetRobotStatus(client))
{
     BeTheRobot_SetRobot(client, false);
}

or it can be added to ff2_external_integration for FF2v2.0. This reminds me why there isn't a forward, which is called when MakeBoss timer is called. It will be useful, when some subplugin want to for example give weapon, set attached particles, etc. I see plugins like shadow93's Blitzkrieg receive his rocket launcher on round start, instead of when the boss spawns.

Edit: Now I see that this plugin doesn't have a forward for example to hook when the boss want to become a robot and block it.

@50Wliu
Copy link
Member

50Wliu commented Feb 6, 2016

Sure, this can be added to ff2_external_integration.

@50Wliu 50Wliu added this to the 2.0.0 milestone Feb 6, 2016
@naydef
Copy link
Contributor Author

naydef commented Feb 6, 2016

Yes, but the tiny problem is that ff2 can't detect if the player becomes robot. Maybe just will paste this code in some timer to check if the player is a robot and if he is, we will call BeTheRobot_SetRobot(client, false). Anyway, it seems that this plugin is not supported, maybe someone will take over this plugin and add forward. We will see.

@WildCard65
Copy link
Contributor

AddCommandListener on the command and return Plugin_Handled or Plugin_Stop in the listener callback if caller is boss?

@naydef
Copy link
Contributor Author

naydef commented Mar 7, 2016

Yes, exactly. Don't use Plugin_Stop. Never!

@WildCard65
Copy link
Contributor

Oh and why is that?

@naydef
Copy link
Contributor Author

naydef commented Mar 7, 2016

Originally Posted by Naydef

  1. Why in sound hook, Plugin_Stop is used instead of Plugin_Handled? I read that Plugin_Handled stop emitting sound, but Plugin_Stop stop emitting sound and stop the hook chain. What does it mean. Does it mean that it's like "for" loop and Plugin_Stop is like break for this loop?

Originally Posted by asherkin

Yes, it is like this (roughly):
Code:

foreach (plugin) {
  call plugin callback();
  if (Plugin_Stop)
    break;
}
if (!Plugin_Handled && !Plugin_Stop) {
  call game functiion();
}

You should generally never use Plugin_Stop.

@Deathreus
Copy link

There's several places you have to use it though, you use it to stop a repeating timer, and you use it in sound hooks to stop the original sound from playing. You can also use it in a select few events and forwards to prevent them from firing. Generally you don't need to do that in an event, as you can almost always prevent an event from doing something with Plugin_Continue.

@WildCard65
Copy link
Contributor

@naydef I was talking about AddCommandListener, not a sound hook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants