fixing some indexes out of bounds
This commit is contained in:
parent
226cf3319b
commit
2d661b5a30
@ -18,7 +18,7 @@ new Handle:gShowInChat = INVALID_HANDLE;
|
|||||||
new Handle:gMaxTimeUse = INVALID_HANDLE;
|
new Handle:gMaxTimeUse = INVALID_HANDLE;
|
||||||
|
|
||||||
new gPlayerMoney;
|
new gPlayerMoney;
|
||||||
new gUsedMedic[ 33 ];
|
new gUsedMedic[ MAXPLAYERS + 1 ];
|
||||||
|
|
||||||
|
|
||||||
public Plugin:myinfo =
|
public Plugin:myinfo =
|
||||||
@ -66,12 +66,17 @@ public OnMapStart()
|
|||||||
}
|
}
|
||||||
public Action:Event_PlayerSpawn( Handle:event, const String:name[], bool:dontBroadcast )
|
public Action:Event_PlayerSpawn( Handle:event, const String:name[], bool:dontBroadcast )
|
||||||
{
|
{
|
||||||
if( GetConVarInt( gPluginEnabled ) == 1 )
|
if( GetConVarInt( gPluginEnabled ) == 1 )
|
||||||
{
|
{
|
||||||
new id = GetClientOfUserId( GetEventInt( event, "userid" ) );
|
new id = GetClientOfUserId( GetEventInt( event, "userid" ) );
|
||||||
|
if (!IsValidClient(id))
|
||||||
|
{
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
gUsedMedic[ id ] = 0;
|
gUsedMedic[ id ] = 0;
|
||||||
}
|
}
|
||||||
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
public Action:Command_Medic( id, args )
|
public Action:Command_Medic( id, args )
|
||||||
{
|
{
|
||||||
@ -169,3 +174,13 @@ stock AttachClientIcon( index )
|
|||||||
TE_WriteNum( "m_iAttachToClient", index );
|
TE_WriteNum( "m_iAttachToClient", index );
|
||||||
TE_SendToAll();
|
TE_SendToAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
stock bool IsValidClient(int client)
|
||||||
|
{
|
||||||
|
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user