Skip to content

Commit

Permalink
handle invalid slot ent
Browse files Browse the repository at this point in the history
  • Loading branch information
Katsute committed Aug 4, 2023
1 parent 4a75ed0 commit 28c6dd9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Mini.sp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ public void OnConvarChanged(const ConVar convar, const char[] oldValue, const ch

public void OnBuilt(const Event event, const char[] name, const bool dontBroadcast){
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if(TF2_GetPlayerClass(client) == TFClass_Engineer && GetEntProp(GetPlayerWeaponSlot(client, 2), Prop_Send, "m_iItemDefinitionIndex") == 142){
int slot = GetPlayerWeaponSlot(client, 2);
if(TF2_GetPlayerClass(client) == TFClass_Engineer &&
IsValidEntity(slot) &&
GetEntProp(slot, Prop_Send, "m_iItemDefinitionIndex") == 142){
int ent = GetEventInt(event, "index");
char entname[20];
GetEntityClassname(ent, entname, 20);
Expand Down

0 comments on commit 28c6dd9

Please sign in to comment.