RevDev Opublikowano Styczeń 9, 2020 o 16:54 Udostępnij Opublikowano Styczeń 9, 2020 o 16:54 Plugin się kompiluje, nie wyskakują żadne errory/błędy w konsoli, ale nie daję dodatkowego hajsu za dopisek w nicku #pragma semicolon 1 #include <sourcemod> #include <cstrike> #pragma newdecls required public Plugin myinfo = { name = "Bonus za nick", author = "Reward", description = "Dodaje graczą dodatkowy hajs za dodanie w nicku", version = "1.0.0" }; ConVar g_cvAdvert, g_cvMatchCase, gg_CvarVipKillMoney, gg_CvarVipKillKnifeMoney, gg_CvarVipHeadShotMoney, gg_CvarMaxHP, gg_CvarVipBombPlantedMoney, gg_CvarVipBombDefusedMoney; public void OnPluginStart() { g_cvAdvert = CreateConVar("sm_aa_advert", "Google.pl", "Advertisement to search for in players' names."); g_cvMatchCase = CreateConVar("sm_aa_match_case", "0", "Determines if the advertisement should be case-sensitive."); gg_CvarVipKillKnifeMoney = CreateConVar("gpieniadze_kill_knife_vip", "100", "How much money the VIP player should get for killing by the knife?"); gg_CvarVipHeadShotMoney = CreateConVar("gpieniadze_hs_vip", "70", "How much money should the VIP player get for the headshot?"); gg_CvarMaxHP = CreateConVar("gzycie_max_vip", "105", "What is the maximum amount of health that the vip player can achieve?"); gg_CvarVipKillMoney = CreateConVar("gpieniadze_kill_vip", "50", "How much money should the VIP player get for the homicide?"); gg_CvarVipBombPlantedMoney = CreateConVar("gpieniadze_podlozenie_vip", "50", "How much money should the VIP player get for planting the bomb?"); gg_CvarVipBombDefusedMoney = CreateConVar("gpieniadze_rozbrojenie_vip", "50", "How much money should the VIP player get for defusing the bomb?"); } bool IsValidClient(int client) { return 0 < client <= MaxClients && IsClientInGame(client); } public Action Event_PlayerDeath(int client, Event hEvent, const char[] chName, bool bDontBroadcast) { int attacker = GetClientOfUserId(hEvent.GetInt("attacker")); int victim = GetClientOfUserId(hEvent.GetInt("userid")); if (!IsValidClient(attacker)) return; char weapon[64]; GetEventString(hEvent, "weapon", weapon, sizeof(weapon)); char name[MAX_NAME_LENGTH], advert[MAX_NAME_LENGTH]; GetClientName(client, name, sizeof(name)); g_cvAdvert.GetString(advert, MAX_NAME_LENGTH); if (StrContains(name, advert, GetConVarBool(g_cvMatchCase)) == -1) { return; } if (GetClientTeam(attacker) != GetClientTeam(victim)) { bool headshot = hEvent.GetBool("headshot", false); //false - default. int gPieniadzeGracza = GetEntProp(attacker, Prop_Send, "m_iAccount"); int gHP = GetClientHealth(attacker); if (headshot) { SetEntProp(attacker, Prop_Send, "m_iAccount", gg_CvarVipHeadShotMoney.IntValue + gPieniadzeGracza); if (gHP + 1 > gg_CvarMaxHP.IntValue) SetEntityHealth(attacker, gg_CvarMaxHP.IntValue); if (gHP + 1 <= gg_CvarMaxHP.IntValue) SetEntityHealth(attacker, gHP + 1); PrintToChat(client, "[Reward] Zostałeś nagrodzony +%d$ za wsparcie serwera!", GetConVarInt(gg_CvarVipHeadShotMoney)); } else { SetEntProp(attacker, Prop_Send, "m_iAccount", gg_CvarVipKillMoney.IntValue + gPieniadzeGracza); if (gHP + 1 > gg_CvarMaxHP.IntValue) SetEntityHealth(attacker, gg_CvarMaxHP.IntValue); if (gHP + 1 <= gg_CvarMaxHP.IntValue) SetEntityHealth(attacker, gHP + 1); PrintToChat(client, "[Reward] Zostałeś nagrodzony +%d$ za wsparcie serwera!", GetConVarInt(gg_CvarVipKillMoney)); } //if (StrEqual(weapon, "knife")) if (StrContains(weapon, "knife", false) != -1 || StrContains(weapon, "bayonet", false) != -1) { SetEntProp(attacker, Prop_Send, "m_iAccount", gg_CvarVipKillKnifeMoney.IntValue + gPieniadzeGracza); PrintToChat(client, "[Reward] Zostałeś nagrodzony +%d$ za wsparcie serwera!", GetConVarInt(gg_CvarVipKillKnifeMoney)); if (gHP + 1 > gg_CvarMaxHP.IntValue) SetEntityHealth(attacker, gg_CvarMaxHP.IntValue); if (gHP + 1 <= gg_CvarMaxHP.IntValue) SetEntityHealth(attacker, gHP + 1); } } } public Action Event_BombPlanted(int client, Event hEvent, const char[] chName, bool bDontBroadcast) { char name[MAX_NAME_LENGTH], advert[MAX_NAME_LENGTH]; GetClientName(client, name, sizeof(name)); g_cvAdvert.GetString(advert, MAX_NAME_LENGTH); if (StrContains(name, advert, GetConVarBool(g_cvMatchCase)) == -1) { return; } int client = GetClientOfUserId(hEvent.GetInt("userid")); int gPieniadzeGracza = GetEntProp(client, Prop_Send, "m_iAccount"); PrintToChat(client, "[Reward] Zostałeś nagrodzony +%d$ za wsparcie serwera!", GetConVarInt(gg_CvarVipBombPlantedMoney)); SetEntProp(client, Prop_Send, "m_iAccount", gg_CvarVipBombPlantedMoney.IntValue + gPieniadzeGracza); } public Action Event_BombDefused(int client, Event hEvent, const char[] chName, bool bDontBroadcast) { char name[MAX_NAME_LENGTH], advert[MAX_NAME_LENGTH]; GetClientName(client, name, sizeof(name)); g_cvAdvert.GetString(advert, MAX_NAME_LENGTH); if (StrContains(name, advert, GetConVarBool(g_cvMatchCase)) == -1) { return; } int client = GetClientOfUserId(hEvent.GetInt("userid")); int gPieniadzeGracza = GetEntProp(client, Prop_Send, "m_iAccount"); PrintToChat(client, "[Reward] Zostałeś nagrodzony +%d$ za wsparcie serwera!", GetConVarInt(gg_CvarVipBombDefusedMoney)); SetEntProp(client, Prop_Send, "m_iAccount", gg_CvarVipBombDefusedMoney.IntValue + gPieniadzeGracza); } Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Inext Opublikowano Styczeń 9, 2020 o 17:50 Udostępnij Opublikowano Styczeń 9, 2020 o 17:50 Zaloguj się lub zarejestruj aby zobaczyć zawartość. Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
RevDev Opublikowano Styczeń 10, 2020 o 06:32 Autor Udostępnij Opublikowano Styczeń 10, 2020 o 06:32 Zaloguj się lub zarejestruj aby zobaczyć zawartość. Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
owner_2019 Opublikowano Styczeń 10, 2020 o 07:02 Udostępnij Opublikowano Styczeń 10, 2020 o 07:02 Zaloguj się lub zarejestruj aby zobaczyć zawartość. Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi