Sprawdz teraz. Troche poprawilem kod, wczesniej jak bylo na serwerze kilku adminow to przy wyjsciu jednego funkcje przestawaly dzialac.
#include <sdkhooks>
#include <sdktools>
#include <cstrike>
new maksymalne_zdrowie = 130;
new dodatkowe_dolary = 5000;
public OnPluginStart()
{
CreateConVar("Modificy Player", "1.0", "Linux`");
HookEvent("round_start", UchwycRunde);
HookEvent("round_end", UchwycRunde);
HookEvent("player_spawn", Odrodzenie);
}
public Action:UchwycRunde(Handle:event_round, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event_round, "userid"));
if(!IsValidClient(client) || !IsValidTeamAdmin(client))
return;
SetEntData(client, FindSendPropOffs("CCSPlayer", "m_iAccount"), GetEntData(client, FindSendPropOffs("CCSPlayer", "m_iAccount"))+dodatkowe_dolary);
}
public Action:Odrodzenie(Handle:event_spawn, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event_spawn, "userid"));
if(!IsValidClient(client) || !IsValidTeamAdmin(client))
return;
if(IsPlayerAlive(client))
SetEntData(client, FindDataMapOffs(client, "m_iHealth"), maksymalne_zdrowie);
}
public bool:IsValidClient(client)
{
if(client >= 1 && client <= MaxClients && IsClientInGame(client))
return true;
return false;
}
public bool:IsValidTeamAdmin(client)
{
for(new i = 1, max = GetMaxClients(); i <= max; ++ i)
{
if(IsClientInGame(i) && GetClientTeam(client) == GetClientTeam(i) && GetUserFlagBits(i) & ADMFLAG_BAN)
return true;
}
return false;
}
I teraz jak chcesz zrobic by funkcja wykonywala sie tylko dla graczy ktorzy sa w jednej druzynie z adminem dodajesz na poczatku publicu sprawdzanie czy gracz jest podlaczony i czy jest admin w druzynie:
if(!IsValidClient(client) || !IsValidTeamAdmin(client))
return;