Skip to content

Commit

Permalink
fix class change
Browse files Browse the repository at this point in the history
  • Loading branch information
Katsute committed Aug 7, 2023
1 parent b783fdf commit 6ac6422
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rrm_powerup_agility.sp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void OnPluginStart(){
RegisterModifiers();

AddCommandListener(OnDropItem, "dropitem");
HookEvent("player_changeclass", OnChangeClass);

AutoExecConfig(true, "rrm_powerup_agility", "rrm");
}
Expand Down Expand Up @@ -65,6 +66,14 @@ public void OnEntityCreated(int ent, const char[] classname){
AcceptEntityInput(ent, "Kill");
}

public void OnChangeClass(const Handle event, const char[] name, const bool dontBroadcast){
if(gEnabled){
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if(IsClientInGame(client) && !TF2_IsPlayerInCondition(client, cond))
TF2_AddCondition(client, cond);
}
}

public void OnExitResupply(const int resupply, const int client){
if(gEnabled && 0 < client < MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
ApplyPowerup(client);
Expand Down
9 changes: 9 additions & 0 deletions rrm_powerup_haste.sp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void OnPluginStart(){
RegisterModifiers();

AddCommandListener(OnDropItem, "dropitem");
HookEvent("player_changeclass", OnChangeClass);

AutoExecConfig(true, "rrm_powerup_haste", "rrm");
}
Expand Down Expand Up @@ -65,6 +66,14 @@ public void OnEntityCreated(int ent, const char[] classname){
AcceptEntityInput(ent, "Kill");
}

public void OnChangeClass(const Handle event, const char[] name, const bool dontBroadcast){
if(gEnabled){
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if(IsClientInGame(client) && !TF2_IsPlayerInCondition(client, cond))
TF2_AddCondition(client, cond);
}
}

public void OnExitResupply(const int resupply, const int client){
if(gEnabled && 0 < client < MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
ApplyPowerup(client);
Expand Down
9 changes: 9 additions & 0 deletions rrm_powerup_plague.sp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void OnPluginStart(){
RegisterModifiers();

AddCommandListener(OnDropItem, "dropitem");
HookEvent("player_changeclass", OnChangeClass);

AutoExecConfig(true, "rrm_powerup_plague", "rrm");
}
Expand Down Expand Up @@ -65,6 +66,14 @@ public void OnEntityCreated(int ent, const char[] classname){
AcceptEntityInput(ent, "Kill");
}

public void OnChangeClass(const Handle event, const char[] name, const bool dontBroadcast){
if(gEnabled){
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if(IsClientInGame(client) && !TF2_IsPlayerInCondition(client, cond))
TF2_AddCondition(client, cond);
}
}

public void OnExitResupply(const int resupply, const int client){
if(gEnabled && 0 < client < MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
ApplyPowerup(client);
Expand Down
9 changes: 9 additions & 0 deletions rrm_powerup_precision.sp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void OnPluginStart(){
RegisterModifiers();

AddCommandListener(OnDropItem, "dropitem");
HookEvent("player_changeclass", OnChangeClass);

AutoExecConfig(true, "rrm_powerup_precision", "rrm");
}
Expand Down Expand Up @@ -65,6 +66,14 @@ public void OnEntityCreated(int ent, const char[] classname){
AcceptEntityInput(ent, "Kill");
}

public void OnChangeClass(const Handle event, const char[] name, const bool dontBroadcast){
if(gEnabled){
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if(IsClientInGame(client) && !TF2_IsPlayerInCondition(client, cond))
TF2_AddCondition(client, cond);
}
}

public void OnExitResupply(const int resupply, const int client){
if(gEnabled && 0 < client < MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
ApplyPowerup(client);
Expand Down
9 changes: 9 additions & 0 deletions rrm_powerup_resistance.sp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void OnPluginStart(){
RegisterModifiers();

AddCommandListener(OnDropItem, "dropitem");
HookEvent("player_changeclass", OnChangeClass);

AutoExecConfig(true, "rrm_powerup_resistance", "rrm");
}
Expand Down Expand Up @@ -65,6 +66,14 @@ public void OnEntityCreated(int ent, const char[] classname){
AcceptEntityInput(ent, "Kill");
}

public void OnChangeClass(const Handle event, const char[] name, const bool dontBroadcast){
if(gEnabled){
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if(IsClientInGame(client) && !TF2_IsPlayerInCondition(client, cond))
TF2_AddCondition(client, cond);
}
}

public void OnExitResupply(const int resupply, const int client){
if(gEnabled && 0 < client < MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
ApplyPowerup(client);
Expand Down
9 changes: 9 additions & 0 deletions rrm_powerup_strength.sp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void OnPluginStart(){
RegisterModifiers();

AddCommandListener(OnDropItem, "dropitem");
HookEvent("player_changeclass", OnChangeClass);

AutoExecConfig(true, "rrm_powerup_strength", "rrm");
}
Expand Down Expand Up @@ -65,6 +66,14 @@ public void OnEntityCreated(int ent, const char[] classname){
AcceptEntityInput(ent, "Kill");
}

public void OnChangeClass(const Handle event, const char[] name, const bool dontBroadcast){
if(gEnabled){
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if(IsClientInGame(client) && !TF2_IsPlayerInCondition(client, cond))
TF2_AddCondition(client, cond);
}
}

public void OnExitResupply(const int resupply, const int client){
if(gEnabled && 0 < client < MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
ApplyPowerup(client);
Expand Down
9 changes: 9 additions & 0 deletions rrm_powerup_vampire.sp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void OnPluginStart(){
RegisterModifiers();

AddCommandListener(OnDropItem, "dropitem");
HookEvent("player_changeclass", OnChangeClass);

AutoExecConfig(true, "rrm_powerup_vampire", "rrm");
}
Expand Down Expand Up @@ -65,6 +66,14 @@ public void OnEntityCreated(int ent, const char[] classname){
AcceptEntityInput(ent, "Kill");
}

public void OnChangeClass(const Handle event, const char[] name, const bool dontBroadcast){
if(gEnabled){
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if(IsClientInGame(client) && !TF2_IsPlayerInCondition(client, cond))
TF2_AddCondition(client, cond);
}
}

public void OnExitResupply(const int resupply, const int client){
if(gEnabled && 0 < client < MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
ApplyPowerup(client);
Expand Down

0 comments on commit 6ac6422

Please sign in to comment.