RevDev
Użytkownik-
Postów
3 -
Dołączył
-
Ostatnia wizyta
Ostatnie wizyty
Blok z ostatnimi odwiedzającymi dany profil jest wyłączony i nie jest wyświetlany użytkownikom.
Osiągnięcia RevDev
Nowicjusz (1/14)
0
Reputacja
-
ROZWIĄZANE Nie działa darmowy vip w godzinach za frazę w nicku
RevDev opublikował(a) temat w Problem z kodem
Tak jak w temacie #pragma semicolon 1 #include <sourcemod> #include <cstrike> #include <sdktools> #include <sdkhooks> #include <multicolors> #pragma newdecls required public Plugin myinfo = { name = "Bonus za nick", author = "XXX", description = "Dodaje graczą dodatkowy hajs za dodanie w nicku", version = "1.0.1" }; ConVar g_CvarRewardNick, gg_OdGodziny, gg_DoGodziny, gg_VipActive, g_CvarMatchCase; int DarmowyVip = 0; public void OnPluginStart() { HookEvent("round_start", Event_RoundStart); g_CvarRewardNick = CreateConVar("sm_reward", "Google.pl", "Fraza za ktora dostaje sie nagrody"); g_CvarMatchCase = CreateConVar("sm_reward_match", "0", ""); gg_VipActive = CreateConVar("sm_reward_vip_active", "1", "Czy Vip w nocy ma być aktywny?"); gg_OdGodziny = CreateConVar("sm_reward_vip_odgodziny", "24", "Od ktorej godziny ma dawac vipa?"); gg_DoGodziny = CreateConVar("sm_reward_vip_dogodziny", "6", "Do ktorej godziny ma dawac vipa?"); } public void OnClientAuthorized(int client) { if(IsValidClient(client)) { char name[MAX_NAME_LENGTH], advert[MAX_NAME_LENGTH]; GetClientName(client, name, sizeof(name)); g_CvarRewardNick.GetString(advert, MAX_NAME_LENGTH); if (StrContains(name, advert, GetConVarBool(g_CvarMatchCase)) == -1) { return; } if(DarmowyVip) { AddUserFlags(client, Admin_Reservation); } else { RemoveUserFlags(client, Admin_Reservation); } } } bool IsValidClient(int client) { return 0 < client <= MaxClients && IsClientInGame(client); } public Action Event_RoundStart(Event hEvent, const char[] chName, bool bDontBroadcast) { int client = GetClientOfUserId(hEvent.GetInt("userid")); char name[MAX_NAME_LENGTH], advert[MAX_NAME_LENGTH]; GetClientName(client, name, sizeof(name)); g_CvarRewardNick.GetString(advert, MAX_NAME_LENGTH); if (StrContains(name, advert, GetConVarBool(g_CvarMatchCase)) == -1) { return; } if (GetConVarBool(gg_VipActive)) { int gg_od_godziny = GetConVarInt(gg_OdGodziny); int gg_do_godziny = GetConVarInt(gg_DoGodziny); if(gg_od_godziny || gg_do_godziny) { char godzina_str[8]; FormatTime(godzina_str, sizeof(godzina_str), "%H", GetTime()); int godzina = StringToInt(godzina_str); if(gg_od_godziny > gg_do_godziny) DarmowyVip = (godzina >= gg_od_godziny || godzina < gg_do_godziny)? 1: 0; else DarmowyVip = (godzina >= gg_od_godziny && godzina < gg_do_godziny)? 1: 0; } else DarmowyVip = 0; } } -
ROZWIĄZANE Dodatkowy hajs za dopisek w nicku
RevDev odpowiedział(a) na RevDev temat w Problem z kodem
Errory naprawione wystarczyło usunąć int client z parametrów funkcji -
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); }