mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 00:43:20 +00:00
add extra checks for processtargetstring to affect only alive survivors
This commit is contained in:
parent
d26ce4b924
commit
1824acf4b8
4 changed files with 31 additions and 13 deletions
Binary file not shown.
Binary file not shown.
|
@ -91,13 +91,17 @@ public Action Command_SetClientModel(int client, int args) {
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < target_count; i++) {
|
for (int i = 0; i < target_count; i++) {
|
||||||
SetEntProp(target_list[i], Prop_Send, "m_survivorCharacter", modelID);
|
if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2) {
|
||||||
SetEntityModel(target_list[i], modelPath);
|
SetEntProp(target_list[i], Prop_Send, "m_survivorCharacter", modelID);
|
||||||
if (IsFakeClient(target_list[i])) {
|
SetEntityModel(target_list[i], modelPath);
|
||||||
char name[32];
|
if (IsFakeClient(target_list[i])) {
|
||||||
GetSurvivorName(target_list[i], name, sizeof(name));
|
char name[32];
|
||||||
SetClientInfo(target_list[i], "name", name);
|
GetSurvivorName(target_list[i], name, sizeof(name));
|
||||||
}
|
SetClientInfo(target_list[i], "name", name);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
ReplyToCommand(client, "%N is not a valid player. Must be an alive survivor.", target_list[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -140,16 +144,15 @@ public Action Event_OnWeaponDrop(int client, int weapon) {
|
||||||
#if defined DEBUG 0
|
#if defined DEBUG 0
|
||||||
PrintToServer("Bot %N dropped melee weapon %s", client, wpn);
|
PrintToServer("Bot %N dropped melee weapon %s", client, wpn);
|
||||||
#endif
|
#endif
|
||||||
CreateTimer(0.1, Timer_HideEntity, weapon);
|
RequestFrame(Frame_HideEntity, weapon);
|
||||||
botDropMeleeWeapon[client] = weapon;
|
botDropMeleeWeapon[client] = weapon;
|
||||||
}
|
}
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
public Action Timer_HideEntity(Handle timer, int entity) {
|
public void Frame_HideEntity(int entity) {
|
||||||
TeleportEntity(entity, OUT_OF_BOUNDS, NULL_VECTOR, NULL_VECTOR);
|
TeleportEntity(entity, OUT_OF_BOUNDS, NULL_VECTOR, NULL_VECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Event_EnterSaferoom(Event event, const char[] name, bool dontBroadcast) {
|
public void Event_EnterSaferoom(Event event, const char[] name, bool dontBroadcast) {
|
||||||
char currentGamemode[16];
|
char currentGamemode[16];
|
||||||
hMPGamemode.GetString(currentGamemode, sizeof(currentGamemode));
|
hMPGamemode.GetString(currentGamemode, sizeof(currentGamemode));
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
//TODO: Detect if player activates crescendo from far away
|
//TODO: Detect if player activates crescendo from far away
|
||||||
//Possibly cancel event, make poll for other users. if no one responds, activate troll mode/swarm or kick/ban depending on FF amount?
|
//Possibly cancel event, make poll for other users. if no one responds, activate troll mode/swarm or kick/ban depending on FF amount?
|
||||||
|
|
||||||
|
//TODO: Replace all timers with userID not clientID. GetClientUserId() -> timer
|
||||||
|
//On player_disconnect event, NOT the forward remove?
|
||||||
|
|
||||||
public Plugin myinfo =
|
public Plugin myinfo =
|
||||||
{
|
{
|
||||||
|
@ -47,7 +49,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
|
||||||
lateLoaded = true;
|
lateLoaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//TODO: Register a main loop (create / destroy on troll targets count). Implement 'slow drain' with loop.
|
|
||||||
|
|
||||||
public void OnPluginStart() {
|
public void OnPluginStart() {
|
||||||
EngineVersion g_Game = GetEngineVersion();
|
EngineVersion g_Game = GetEngineVersion();
|
||||||
|
@ -68,6 +70,8 @@ public void OnPluginStart() {
|
||||||
RegAdminCmd("sm_ftr", Command_ResetUser, ADMFLAG_ROOT, "Resets user of any troll effects.");
|
RegAdminCmd("sm_ftr", Command_ResetUser, ADMFLAG_ROOT, "Resets user of any troll effects.");
|
||||||
RegAdminCmd("sm_fta", Command_ApplyUser, ADMFLAG_ROOT, "Apply a troll mod to a player, or shows menu if no parameters.");
|
RegAdminCmd("sm_fta", Command_ApplyUser, ADMFLAG_ROOT, "Apply a troll mod to a player, or shows menu if no parameters.");
|
||||||
|
|
||||||
|
HookEvent("player_disconnect", Event_PlayerDisconnect);
|
||||||
|
|
||||||
AutoExecConfig(true, "l4d2_feedthetrolls");
|
AutoExecConfig(true, "l4d2_feedthetrolls");
|
||||||
|
|
||||||
if(lateLoaded) {
|
if(lateLoaded) {
|
||||||
|
@ -85,6 +89,13 @@ public void OnMapStart() {
|
||||||
HookEntityOutput("func_button", "OnPressed", Event_ButtonPress);
|
HookEntityOutput("func_button", "OnPressed", Event_ButtonPress);
|
||||||
CreateTimer(MAIN_TIMER_INTERVAL_S, Timer_Main, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
|
CreateTimer(MAIN_TIMER_INTERVAL_S, Timer_Main, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
|
||||||
}
|
}
|
||||||
|
public void OnPlayerDisconnect(int client) {
|
||||||
|
g_iTrollUsers[client] = 0;
|
||||||
|
}
|
||||||
|
public void Event_PlayerDisconnect(Event event, const char[] name, bool dontBroadcast) {
|
||||||
|
int client = GetClientOfUserId(event.GetInt("userid"));
|
||||||
|
g_iTrollUsers[client] = 0;
|
||||||
|
}
|
||||||
public void OnClientAuthorized(int client, const char[] auth) {
|
public void OnClientAuthorized(int client, const char[] auth) {
|
||||||
if(StrContains(auth, "BOT", true) == -1) {
|
if(StrContains(auth, "BOT", true) == -1) {
|
||||||
TestForTarget(client, auth);
|
TestForTarget(client, auth);
|
||||||
|
@ -128,8 +139,10 @@ public Action Command_ResetUser(int client, int args) {
|
||||||
}
|
}
|
||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
{
|
{
|
||||||
ResetClient(target_list[i], true);
|
if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2) {
|
||||||
ShowActivity(client, "reset troll effects on \"%N\". ", target_list[i]);
|
ResetClient(target_list[i], true);
|
||||||
|
ShowActivity(client, "reset troll effects on \"%N\". ", target_list[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -282,6 +295,8 @@ public int ChooseTrollModiferHandler(Menu menu, MenuAction action, int param1, i
|
||||||
delete menu;
|
delete menu;
|
||||||
}
|
}
|
||||||
public Action Event_ButtonPress(const char[] output, int entity, int client, float delay) {
|
public Action Event_ButtonPress(const char[] output, int entity, int client, float delay) {
|
||||||
|
PrintToServer("Client %N pressed a func_button", client);
|
||||||
|
PrintToConsoleAll("Client %N pressed a func_button", client);
|
||||||
if(hAutoPunish.IntValue & 1 > 0) {
|
if(hAutoPunish.IntValue & 1 > 0) {
|
||||||
float closestDistance = -1.0, cPos[3], scanPos[3];
|
float closestDistance = -1.0, cPos[3], scanPos[3];
|
||||||
GetClientAbsOrigin(client, cPos);
|
GetClientAbsOrigin(client, cPos);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue