Hey, as the title say, i need a Plugin where all Chickens on the map follow one random Player after round start, if someone kill the guy round will end and in Chat will Print (the killer) "<name> won the round", please.
Thanks
Last edited by iskenderkebab33; 11-03-2018 at 17:30.
int ent = -1;
while((ent = FindEntityByClassname(ent, "chicken")) != -1)
{
SetEntPropEnt(ent, Prop_Send, "m_leader", leader);
}
}
public Action Event_PlayerDeath(Handle event, const char[] name, bool dontBroadcast)
{
int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
int victim = GetClientOfUserId(GetEventInt(event, "userid"));
if(victim == leader) killer = attacker;
}
// Edit from
// https://forums.alliedmods.net/showpost.php?p=2448824&postcount=2
stock int GetRandomPlayer()
{
int clients[MAXPLAYERS + 1];
int clientCount;
for (int i = 1; i <= MAXPLAYERS ; i++)
{
if(IsValidClient(i)) clients[clientCount++] = i;
}
return (clientCount == 0) ? -1 : clients[GetRandomInt(0, clientCount - 1)];
}
stock bool IsValidClient(int client)
{
if (client <= 0) return false;
if (client > MaxClients) return false;
if (!IsClientConnected(client)) return false;
return IsClientInGame(client);
}
int ent = -1; while((ent = FindEntityByClassname(ent, "chicken")) != -1) { SetEntPropEnt(ent, Prop_Send, "m_leader", leader); } }
public Action Event_PlayerDeath(Handle event, const char[] name, bool dontBroadcast) { int attacker = GetClientOfUserId(GetEventInt(event, "attacker")); int victim = GetClientOfUserId(GetEventInt(event, "userid")); if(victim == leader) killer = attacker; }
// Edit from // https://forums.alliedmods.net/showpost.php?p=2448824&postcount=2 stock int GetRandomPlayer() { int clients[MAXPLAYERS + 1]; int clientCount;
for (int i = 1; i <= MAXPLAYERS ; i++) { if(IsValidClient(i)) clients[clientCount++] = i; } return (clientCount == 0) ? -1 : clients[GetRandomInt(0, clientCount - 1)]; }
stock bool IsValidClient(int client) { if (client <= 0) return false; if (client > MaxClients) return false; if (!IsClientConnected(client)) return false; return IsClientInGame(client); }
many thanks! can you also add, if someone kill a player (not the Chicken Leader) the round will End and it will Print, "You killed the wrong guy, starting new round.." would by nice, please. Thanks!
Last edited by iskenderkebab33; 07-27-2018 at 02:42.