WHAT?!?!?!?!! ANOTHER RTD PLUGIN?! BUT WE ALREADY HAVE ONE FOR TF2, CSS, AND ZOMBIE MASTER(?)
^ true, but...
psyRTD is a modular RTD Core that can host many effect plugins.
This will lead to many more games being able to have rtd fun without having to edit existing plugins. This will save redundant code on effects that works on multiple games and will easily allow others to contribute effect plugins for their favorite game or generic effect plugins that work across multiple games.
When making modules (plugins) for psyRTD, you register an effect, good or bad, give the effect a name, and specify a callback to use if that effect is chosen. psyRTD does all the RTD logic itself.
Natives (see psyrtd.inc for more details and the psyrtd-example.sp for usage example):
PHP Code:
enum psyRTDAction {
psyRTD_Continue, // accept the roll
psyRTD_NotApplicable, // effect doesn't work on or apply to current player (ex. because of class/team/game/state)
// this will trigger a re-roll automatically if psyrtd_allowunusable is set to 0 (default)
psyRTD_Reroll // re-roll (usually because effect is disabled. return the former value if effect just doesn't apply
};
enum psyRTDEffectEndReason {
psyRTDEndReason_Unknown,
psyRTDEndReason_TimeExpired,
psyRTDEndReason_PlayerDied,
psyRTDEndReason_PlayerLeft // uses OnClientDisconnect
};
functag psyRTDEffectCallback psyRTDAction:public(client);
native psyRTD_RegisterEffect(type, const String:name[], psyRTDEffectCallback:callback);
native psyRTD_RegisterTimedEffect(type, const String:name[], Float:duration, psyRTDEffectCallback:starteffect, psyRTDEffectEndCallback:killeffect);
native psyRTD_ChangeEffectDuration(iRTDEffectId, effectType, Float:duration);
native psyRTD_UnregisterEffect(iRTDEffectId, effectType);
native psyRTDGame:psyRTD_GetGame();
native psyRTD_PrintToChat(client, const String:format[], any:...);
stock psyRTD_PrintToChatAll(const String:format[], any:...);
Cvars:
(Plugin will auto-create cfg/sourcemod/psyrtd.cfg)
psyrtd_goodchance -
Decimal chance to roll a good effect versus a bad effect (between 0.0 and 1.0, default 0.5)
psyrtd_waittime -
Time that must be waited between subsequent dice rolls (in seconds)
psyrtd_waitmode -
Wait Mode. 0 (default) - Applies to whole server. 1 - Applies to each player individually.
psyrtd_waitpenalty -
Reset wait timer if rtd is called again too soon. 0 (default) - Disabled. 1 - Enabled. Not recommended for wait mode 0.
psyrtd_allowunusable -
Allow wasted rolls (no auto re-roll when rolling effect not applicable to current class/team). Default 0 (off).
psyrtd_adminflag -
Admin flag required to be able to use rtd (ex. \"b\") Default \"\" (none)
You can add as many effect modules as you want. They will stack fine.
Plugin developers, feel free to create new creative ones, even if it's just one or two effects.
Premade Effect Modules:
Thanks to:
Dragonshadow - Motivation + promise of generic effects plugin.
Pimpinjuice - Damage stock.
pheadxdll - RTD effects that I ripped off.
Examples:
The psyrtd-example.sp shows a basic single-effect plugin that can be used as a template.
Changelog:
Code:
1.0.1
+ Added time left on wait message to avoid confusion
- Fixed minor issue with text coloring on roll message
1.0
Initial supported release