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 gPlayerMoney;
|
||||
new gUsedMedic[ 33 ];
|
||||
new gUsedMedic[ MAXPLAYERS + 1 ];
|
||||
|
||||
|
||||
public Plugin:myinfo =
|
||||
@ -66,12 +66,17 @@ public OnMapStart()
|
||||
}
|
||||
public Action:Event_PlayerSpawn( Handle:event, const String:name[], bool:dontBroadcast )
|
||||
{
|
||||
if( GetConVarInt( gPluginEnabled ) == 1 )
|
||||
{
|
||||
new id = GetClientOfUserId( GetEventInt( event, "userid" ) );
|
||||
if( GetConVarInt( gPluginEnabled ) == 1 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
@ -169,3 +174,13 @@ stock AttachClientIcon( index )
|
||||
TE_WriteNum( "m_iAttachToClient", index );
|
||||
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