Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 76 additions & 71 deletions addons/amxmodx/scripting/include/rt_api.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
#endif
#define _rt_api_included

public stock const VERSION[] = "2.3.17";
public stock const AUTHORS[] = "DEV-CS.RU Community";
#define PLUGIN_VERSION "2.4.0"
#define PLUGIN_AUTHORS "HLDS.RUN Community"

/**
* The name of the general dictionary file
*/
#define PLUGIN_DICTIONARY "rt_library.txt"

/**
* Invalid entity index
Expand Down Expand Up @@ -56,171 +61,171 @@ new const DEAD_BODY_CLASSNAME[] = "rt_corpse_empty";
/**
* [PRE] Called after the activator starts resurrection/planting (on press USE - `E`)
*
* @param iEnt Corpse entity index
* @param iPlayer Player id who can be ressurected
* @param iActivator Player id who ressurect
* @param eMode MODE_REVIVE - started the resurrection, MODE_PLANT - started planting
* @param entId Corpse entity index
* @param playerId Player id who can be ressurected
* @param activatorId Player id who ressurect
* @param mode MODE_REVIVE - started the resurrection, MODE_PLANT - started planting
*
* @return PLUGIN_CONTINUE to start resurrection/planting
* PLUGIN_HANDLED to stop resurrection/planting
*/
forward rt_revive_start(const iEnt, const iPlayer, const iActivator, const Modes:eMode);
forward rt_revive_start(const entId, const playerId, const activatorId, const Modes:mode);

/**
* [POST] Called after the activator starts resurrection/planting (on press USE - `E`)
*
* @note This forward will not be called if something was blocked attempt in rt_revive_start()
* @note This forward will not be called if something was blocked attempt in rt_revive_start()
*
* @param iEnt Corpse entity index
* @param iPlayer Player id who can be ressurected
* @param iActivator Player id who ressurect
* @param eMode MODE_REVIVE - started the resurrection, MODE_PLANT - started planting
* @param entId Corpse entity index
* @param playerId Player id who can be ressurected
* @param activatorId Player id who ressurect
* @param mode MODE_REVIVE - started the resurrection, MODE_PLANT - started planting
*
* @noreturn
*/
forward rt_revive_start_post(const iEnt, const iPlayer, const iActivator, const Modes:eMode);
forward rt_revive_start_post(const entId, const playerId, const activatorId, const Modes:mode);

/**
* PreThink on resurrection/planting
*
* @note Timer can be 0.0
* @note Timer can be 0.0
*
* @param iEnt Corpse entity index
* @param iPlayer Player id who can be ressurected
* @param iActivator Player id who ressurect
* @param fTimer Resurrection time
* @param eMode MODE_REVIVE - the player continues to be resurrected, MODE_PLANT - the player continues to be planted
* @param entId Corpse entity index
* @param playerId Player id who can be ressurected
* @param activatorId Player id who ressurect
* @param timer Resurrection time
* @param mode MODE_REVIVE - the player continues to be resurrected, MODE_PLANT - the player continues to be planted
*
* @return PLUGIN_CONTINUE to continue resurrection/planting
* PLUGIN_HANDLED to stop resurrection/planting
*/
forward rt_revive_loop_pre(const iEnt, const iPlayer, const iActivator, const Float:fTimer, Modes:eMode);
forward rt_revive_loop_pre(const entId, const playerId, const activatorId, const Float:timer, Modes:mode);

/**
* PostThink on resurrection/planting
*
* @note Timer can't be 0.0
* @note Timer can't be 0.0
*
* @param iEnt Corpse entity index
* @param iPlayer Player id who can be ressurected
* @param iActivator Player id who ressurect
* @param fTimer Resurrection time
* @param eMode MODE_REVIVE - the player continues to be resurrected, MODE_PLANT - the player continues to be planted
* @param entId Corpse entity index
* @param playerId Player id who can be ressurected
* @param activatorId Player id who ressurect
* @param timer Resurrection time
* @param mode MODE_REVIVE - the player continues to be resurrected, MODE_PLANT - the player continues to be planted
*
* @noreturn
*/
forward rt_revive_loop_post(const iEnt, const iPlayer, const iActivator, const Float:fTimer, Modes:eMode);
forward rt_revive_loop_post(const entId, const playerId, const activatorId, const Float:timer, Modes:mode);

/**
* Called after the resurrection/planting is ending
*
* @param iEnt Corpse entity index
* @param iPlayer Player id who can be ressurected
* @param iActivator Player id who ressurect
* @param eMode MODE_REVIVE - the player was resurrected, MODE_PLANT - the player was planted
* @param entId Corpse entity index
* @param playerId Player id who can be ressurected
* @param activatorId Player id who ressurect
* @param mode MODE_REVIVE - the player was resurrected, MODE_PLANT - the player was planted
*
* @noreturn
*/
forward rt_revive_end(const iEnt, const iPlayer, const iActivator, const Modes:eMode);
forward rt_revive_end(const entId, const playerId, const activatorId, const Modes:mode);

/**
* Called when the player has stopped resurrecting/planting
*
* @param iEnt Corpse entity index
* @param iPlayer Player id who can be ressurected or RT_NULLENT
* @param iActivator Player id who ressurect or RT_NULLENT
* @param eMode MODE_REVIVE - stopped the resurrection, MODE_PLANT - stopped planting
* @param entId Corpse entity index
* @param playerId Player id who can be ressurected or RT_NULLENT
* @param activatorId Player id who ressurect or RT_NULLENT
* @param mode MODE_REVIVE - stopped the resurrection, MODE_PLANT - stopped planting
*
* @noreturn
*/
forward rt_revive_cancelled(const iEnt, const iPlayer, const iActivator, const Modes:eMode);
forward rt_revive_cancelled(const entId, const playerId, const activatorId, const Modes:mode);

/**
* Called before a corpse is created
*
* @param iEnt Corpse entity index
* @param iPlayer Player id whose corpse
* @param entId Corpse entity index
* @param playerId Player id whose corpse
*
* @return PLUGIN_CONTINUE to continue the created of a corpse
* PLUGIN_HANDLED to stop the created of a corpse
*/
forward rt_creating_corpse_start(const iEnt, const iPlayer);
forward rt_creating_corpse_start(const entId, const playerId);

/**
* Called after the creation of the corpse is completed
*
* @param iEnt Corpse entity index
* @param iPlayer Player id whose corpse
* @param fVecOrigin Coordinates of the corpse
* @param entId Corpse entity index
* @param playerId Player id whose corpse
* @param vecOrigin Coordinates of the corpse
*
* @noreturn
*/
forward rt_creating_corpse_end(const iEnt, const iPlayer, const Float:fVecOrigin[3]);
forward rt_creating_corpse_end(const entId, const playerId, const Float:vecOrigin[3]);

/**
* Returns current user mode
*
* @note In rt_revive_cancelled() and rt_revive_end() always return MODE_NONE
* @note In rt_revive_cancelled() and rt_revive_end() always return MODE_NONE
*
* @param iPlayer Client index
* @param playerId Client index
*
* @return see 'Modes' enum
*/
native Modes:rt_get_user_mode(iPlayer);
native Modes:rt_get_user_mode(playerId);

/**
* Will interrupt the current process
*
* @param iPlayer Client index
* @param playerId Client index
*
* @return true if success, false otherwise
*/
native bool:rt_reset_use(iPlayer);
native bool:rt_reset_use(playerId);

/**
* Removal of corpses
*
* @param iPlayer Player id whose corpse or 0 for all corpses
* @param szClassName Entity classname
* @param playerId Player id whose corpse or 0 for all corpses
* @param className Entity classname
*
* @return Player id who is resurrecting or 0
*/
stock RemoveCorpses(const iPlayer = 0, const szClassName[] = DEAD_BODY_CLASSNAME) {
new iEnt = RT_NULLENT;
new iActivator, iOwner;
stock RemoveCorpses(const playerId = 0, const className[] = DEAD_BODY_CLASSNAME) {
new entId = RT_NULLENT;
new activatorId, ownerId;

while((iEnt = rg_find_ent_by_class(iEnt, szClassName)) > 0) {
if(!is_nullent(iEnt)) {
if(iPlayer && (iOwner = get_entvar(iEnt, var_owner)) != iPlayer)
while((entId = rg_find_ent_by_class(entId, className)) > 0) {
if(!is_nullent(entId)) {
if(playerId && (ownerId = get_entvar(entId, var_owner)) != playerId)
continue;

if(iPlayer && iOwner == iPlayer)
iActivator = get_entvar(iEnt, var_iuser1);
if(playerId && ownerId == playerId)
activatorId = get_entvar(entId, var_iuser1);

set_entvar(iEnt, var_flags, FL_KILLME);
set_entvar(iEnt, var_nextthink, 0.0);
set_entvar(iEnt, var_iuser1, 0);
set_entvar(entId, var_flags, FL_KILLME);
set_entvar(entId, var_nextthink, 0.0);
set_entvar(entId, var_iuser1, 0);

if(iActivator)
if(activatorId)
break;
}
}

return iActivator;
return activatorId;
}

/**
* Notifying players in chat
*
* @param iPlayer Player id or 0 to display to all clients
* @param iSender Player id used as the message sender or color type
* @param szFmtRules Formatting rules
* @param playerId Player id or 0 to display to all clients
* @param senderId Player id used as the message sender or color type
* @param fmtRules Formatting rules
*
* @noreturn
*/
stock NotifyClient(const iPlayer, const iSender, any:...) {
stock NotifyClient(const playerId, const senderId, any:...) {
new szMessage[MAX_MESSAGE_LENGTH];
SetGlobalTransTarget(iPlayer);
SetGlobalTransTarget(playerId);
vformat(szMessage, charsmax(szMessage), "%l", 3);
client_print_color(iPlayer, iSender, "%l %s", "RT_CHAT_TAG", szMessage);
}
client_print_color(playerId, senderId, "%l %s", "RT_CHAT_TAG", szMessage);
}
Loading
Loading