Added 4 new natives to TF2 ext. (bug 4166, r=pred)
Added natives for Regenerate, add/remove condition, and SetPlayerPowerPlay. Also updated TF2 test plugin.
This commit is contained in:
@@ -57,6 +57,33 @@ enum TFTeam
|
||||
TFTeam_Blue = 3
|
||||
};
|
||||
|
||||
enum TFCond
|
||||
{
|
||||
TFCond_Slowed = 0,
|
||||
TFCond_Zoomed,
|
||||
TFCond_Disguising,
|
||||
TFCond_Disguised,
|
||||
TFCond_Cloaked,
|
||||
TFCond_Ubercharged,
|
||||
TFCond_TeleportedGlow,
|
||||
TFCond_Taunting,
|
||||
TFCond_UberchargeFading,
|
||||
TFCond_Unknown1,
|
||||
TFCond_Teleporting,
|
||||
TFCond_Kritzkrieged,
|
||||
TFCond_Unknown2,
|
||||
TFCond_DeadRingered,
|
||||
TFCond_Bonked,
|
||||
TFCond_Dazed,
|
||||
TFCond_Buffed,
|
||||
TFCond_Charging,
|
||||
TFCond_DemoBuff,
|
||||
TFCond_Healing,
|
||||
TFCond_OnFire,
|
||||
TFCond_Overhealed,
|
||||
TFCond_Jarated
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a client on fire for 10 seconds.
|
||||
*
|
||||
@@ -75,6 +102,46 @@ native TF2_IgnitePlayer(client, target);
|
||||
*/
|
||||
native TF2_RespawnPlayer(client);
|
||||
|
||||
/**
|
||||
* Regenerates a client's health and ammunition
|
||||
*
|
||||
* @param client Player's index.
|
||||
* @noreturn
|
||||
* @error Invalid client index, client not in game, or no mod support.
|
||||
*/
|
||||
native TF2_RegeneratePlayer(client);
|
||||
|
||||
/**
|
||||
* Adds a condition to a player
|
||||
*
|
||||
* @param client Player's index.
|
||||
* @param condition Integer identifier of condition to apply.
|
||||
* @param duration Duration of condition (does not apply to all conditions).
|
||||
* @noreturn
|
||||
* @error Invalid client index, client not in game, or no mod support.
|
||||
*/
|
||||
native TF2_AddCondition(client, TFCond:condition, Float:duration);
|
||||
|
||||
/**
|
||||
* Removes a condition from a player
|
||||
*
|
||||
* @param client Player's index.
|
||||
* @param condition Integer identifier of condition to remove.
|
||||
* @noreturn
|
||||
* @error Invalid client index, client not in game, or no mod support.
|
||||
*/
|
||||
native TF2_RemoveCondition(client, TFCond:condition);
|
||||
|
||||
/**
|
||||
* Enables/disables PowerPlay mode on a player.
|
||||
*
|
||||
* @param client Player's index.
|
||||
* @param enabled Whether to enable or disable PowerPlay on player.
|
||||
* @noreturn
|
||||
* @error Invalid client index, client not in game, or no mod support.
|
||||
*/
|
||||
native TF2_SetPlayerPowerPlay(client, bool:enabled);
|
||||
|
||||
/**
|
||||
* Disguises a client to the given model and team. Only has an effect on spies.
|
||||
*
|
||||
|
||||
@@ -15,25 +15,21 @@ public Plugin:myinfo =
|
||||
public OnPluginStart()
|
||||
{
|
||||
RegConsoleCmd("sm_burnme", Command_Burn);
|
||||
RegConsoleCmd("sm_invuln", Command_Invuln);
|
||||
RegConsoleCmd("sm_respawn", Command_Respawn);
|
||||
RegConsoleCmd("sm_disguise", Command_Disguise);
|
||||
RegConsoleCmd("sm_remdisguise", Command_RemDisguise);
|
||||
RegConsoleCmd("sm_class", Command_Class);
|
||||
RegConsoleCmd("sm_remove", Command_Remove);
|
||||
RegConsoleCmd("sm_changeclass", Command_ChangeClass);
|
||||
RegConsoleCmd("sm_regenerate", Command_Regenerate);
|
||||
RegConsoleCmd("sm_uberme", Command_UberMe);
|
||||
RegConsoleCmd("sm_unuberme", Command_UnUberMe);
|
||||
RegConsoleCmd("sm_setpowerplay", Command_SetPowerPlay);
|
||||
}
|
||||
|
||||
public Action:Command_Class(client, args)
|
||||
{
|
||||
TF2_RemoveAllWeapons(client);
|
||||
|
||||
decl String:text[10];
|
||||
GetCmdArg(1, text, sizeof(text));
|
||||
|
||||
new one = StringToInt(text);
|
||||
|
||||
TF2_EquipPlayerClassWeapons(client, TFClassType:one);
|
||||
|
||||
PrintToChat(client, "Test: sniper's classnum is %i (should be %i)", TF2_GetClass("sniper"), TFClass_Sniper);
|
||||
|
||||
@@ -93,28 +89,6 @@ public Action:Command_Burn(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_Invuln(client, args)
|
||||
{
|
||||
if (client == 0)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
if (args < 1)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[10];
|
||||
GetCmdArg(1, text, sizeof(text));
|
||||
|
||||
new bool:one = !!StringToInt(text);
|
||||
|
||||
TF2_SetPlayerInvuln(client, one)
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_Disguise(client, args)
|
||||
{
|
||||
if (client == 0)
|
||||
@@ -165,3 +139,71 @@ public Action:Command_Respawn(client, args)
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_Regenerate(client, args)
|
||||
{
|
||||
if (client == 0)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
TF2_RegeneratePlayer(client);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_UberMe(client, args)
|
||||
{
|
||||
if (client == 0)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
if (args < 1)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[10];
|
||||
GetCmdArg(1, text, sizeof(text));
|
||||
|
||||
new Float:one = StringToFloat(text);
|
||||
|
||||
TF2_AddCondition(client, TFCond_Ubercharged, one);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_UnUberMe(client, args)
|
||||
{
|
||||
if (client == 0)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
TF2_RemoveCondition(client, TFCond_Ubercharged);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_SetPowerPlay(client, args)
|
||||
{
|
||||
if (client == 0)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
if (args < 1)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:text[10];
|
||||
GetCmdArg(1, text, sizeof(text));
|
||||
|
||||
new bool:one = bool:StringToInt(text);
|
||||
|
||||
TF2_SetPlayerPowerPlay(client, one);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
Reference in New Issue
Block a user