//===== INCLUDY ===== #include #include #include #include //===== DEFINE ===== #define PLUGIN_NAME "Losowy VIP" #define PLUGIN_AUTHOR "Hanys & ✔ SnowWolf ✔" #define PLUGIN_DESCRIPTION "Plugin losuje osobe, ktora otrzyma vipa na jedna mape" #define PLUGIN_VERSION "v1.1" #define PLUGIN_URL "hanys.dispark.pl & steamcommunity.com/id/SnowWolfik" //===== Informacje o pluginie =====// public Plugin myinfo = { name = PLUGIN_NAME, author = PLUGIN_AUTHOR, description = PLUGIN_DESCRIPTION, version = PLUGIN_VERSION, url = PLUGIN_URL, }; //===== Handle ===== new Handle:Random_round; new Handle:Random_player; new Rounds = 0; //===== Public Actions & Cvary ===== public OnPluginStart() { CreateConVar("sm_randomvip", "1.0", "Losowy VIP", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD); Random_round = CreateConVar("random_round", "2", "W ktorej rundzie ma losowac losowego vip'a (Uwaga: Rozgrzewka liczona jest jako 1 runda!) 0:Losowy vip wylaczony", FCVAR_NOTIFY); Random_player = CreateConVar("random_player", "1", "Ile osob wymaganych jest do wylosowania losowego vip'a", FCVAR_NOTIFY); AutoExecConfig(true, "sm_vip_random"); HookEvent("round_start", Event_RoundStart); HookEvent("cs_win_panel_match", RestartRound); } //===== Public Actions [losowanie] ===== public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast) { new winner = GetRandomPlayer(3); new g_random_round = GetConVarInt(Random_round); Rounds = Rounds + 1; if (Rounds == g_random_round) { if (winner == -1) { PrintToChatAll("\x04[\x04VIP\x01] \x06Na serwerze znajduje sie za malo graczy do wylosowania losowego VIP'a\x01"); } AddUserFlags(winner, Admin_Reservation, Admin_Custom1); PrintToChatAll(" "); PrintToChatAll("[\x04 VIP \x01] \x01Za chwile zostanie wylosowany \x04VIP!"); PrintToChatAll("[\x04 VIP \x01] \x01-----\x01"); PrintToChatAll("[\x04 VIP \x01] \x01-----\x01"); PrintToChatAll("[\x04 VIP \x01] \x01-----\x01"); PrintToChatAll("[\x04 VIP \x01] \x01Losowym \x04VIP\x01'em zostaje..."); PrintToChatAll("[\x04 VIP \x01] \x02%N", winner); PrintToChatAll("[\x04 VIP \x01] \x04Gratulujemy !"); PrintToChatAll(" "); } } //===== Public Actions - restart ===== public Action:RestartRound(Handle:event, const String:name[], bool:dontBroadcast) { Rounds = 0; } //===== Ignore Admins, VIPs, GOTV ===== stock GetRandomPlayer(team) { new g_random_player = GetConVarInt(Random_player); new clients[MaxClients + 1], clientCount; for (new i = 1; i <= MaxClients; i++) if (IsClientInGame(i) && !IsFakeClient(i) && !GetAdminFlag(GetUserAdmin(i), Admin_Reservation & Admin_Ban & Admin_Custom1)) clients[clientCount++] = i; if (clientCount <= g_random_player) return -1; return clients[GetRandomInt(0, clientCount - 1)]; }