Na ma este neki estem újraírni a dolgokat.
Viszooooooooooooooont.
A végeredmény egy hibátlanul leforduló viszont nem működő plugin.
DD
A plugin kódja:
Kód:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#pragma semicolon 1
#pragma newdecls required
#define DATA "2.0"
public Plugin myinfo =
{
name = "VIP",
author = "Zendor",
description = "VIP PLUGIN",
version = "0.1",
url = "http://stat.erack.hu"
};
Handle HP,
Flashbang,
Smokegrenade,
Hegrenade,
Molotov,
Armorvalue,
Bhashelmet,
Defuser,
Remove_grenade,
Taser,
trie_armas;
Handle timers[MAXPLAYERS + 1];
int g_iaGrenadeOffsets[] = {15, 17, 16, 14, 18, 17},
RoundCount = 0;
public void OnPluginStart()
{
HP = CreateConVar("vip_hp_start", "100", "Hány HP-n kezdjenek a VIP-k.", FCVAR_NOTIFY);
Flashbang = CreateConVar("vip_grenade_flashbang", "1", "Kapjon a VIP flash gránátot a kör elején? (1-2))", FCVAR_NOTIFY, true, 0.0, true, 2.0);
Smokegrenade = CreateConVar("vip_grenade_smokegrenade", "0", "Kapjon a VIP smoke-t a kör elején?", FCVAR_NONE, true, 0.0, true, 1.0);
Hegrenade = CreateConVar("vip_grenade_hegrenade", "1", "Kapján a VIP gránátot a kör elején?", FCVAR_NONE, true, 0.0, true, 1.0);
Molotov = CreateConVar("vip_grenade_molotov", "0", "Kapján a VIP molót a kör elején? ",FCVAR_NONE, true, 0.0, true, 1.0);
Armorvalue = CreateConVar("vip_armorvalue", "100", "Mennyi armor-t kapjonak a VIP-k", FCVAR_NONE, true, 0.0, true, 1.0);
Remove_grenade = CreateConVar("vip_grenade_remove", "0", "A kör elején eltávolítja az összes gránátot", FCVAR_NONE, true, 0.0, true, 1.0);
Defuser = CreateConVar("vip_defuser", "1", "CT-ben kapjanak a VIP-k defusert?", FCVAR_NONE, true, 0.0, true, 1.0);
Bhashelmet = CreateConVar("vip_bhashelmet", "1", "Legyen sisakjuk a VIP-knak?", FCVAR_NONE, true, 0.0, true, 1.0);
Taser = CreateConVar("vip_taser", "1.0", "Zeust ad minden körben.");
trie_armas = CreateTrie();
AutoExecConfig(true, "VIPBETA");
HookEvent("player_spawn", Spawn);
HookEvent("round_start", Event_RoundStart);
HookEvent("announce_phase_end", ResetAfterTeamChange);
HookEvent("cs_intermission", ResetAfterTeamChange);
for (int i = 1; i <= MaxClients; i++) {
if (IsValidClient(i))
OnClientPutInServer(i);
OnClientPostAdminCheck(i);
}
}
public void OnMapStart()
{
RoundCount = 0;
}
public Action Event_RoundStart(Event hEvent, const char[] chName, bool bDontBroadcast)
{
RoundCount = RoundCount + 1;
}
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_WeaponEquipPost, EventItemPickup2);
}
public void OnClientPostAdminCheck(int client)
{
if (IsPlayerGenericAdmin(client)) timers[client] = CreateTimer(3.0, Darm, client, TIMER_REPEAT);
if (IsPlayerGenericAdmin(client))
{
PrintToChatAll("╔══════════════════════════════╗");
PrintToChatAll("[TULAJDONOS] %N csatlakozott a szerverre", client);
PrintToChatAll("╚══════════════════════════════╝");
}else if (IsPlayerGenericAdmin(client))
{
PrintToChatAll("╔═══════════════════════════╗");
PrintToChatAll("[ADMIN] %N csatlakozott a szerverre", client);
PrintToChatAll("╚═══════════════════════════╝");
}else if(IsPlayerGenericAdmin(client))
{
PrintToChatAll("╔════════════════════════╗");
PrintToChatAll("[VIP] %N csatlakozott a szerverre", client);
PrintToChatAll("╚════════════════════════╝");
} else
{
return;
}
}
public void OnClientDisconnect(int client)
{
if(timers[client] != INVALID_HANDLE)
{
KillTimer(timers[client]);
timers[client] = INVALID_HANDLE;
}
if (IsPlayerGenericAdmin(client))
{
PrintToChatAll("╔══════════════════════════════╗");
PrintToChatAll("[TULAJDONOS] %N lecsatlakozott a szerverről", client);
PrintToChatAll("╚══════════════════════════════╝");
}else if (IsPlayerGenericAdmin(client))
{
PrintToChatAll("╔═══════════════════════════╗");
PrintToChatAll("[ADMIN] %N lecsatlakozott a szerverről", client);
PrintToChatAll("╚═══════════════════════════╝");
}else if(IsPlayerGenericAdmin(client))
{
PrintToChatAll("╔════════════════════════╗");
PrintToChatAll("[VIP] %N lecsatlakozott a szerverről", client);
PrintToChatAll("╚════════════════════════╝");
} else
{
return;
}
}
public Action Darm(Handle timer, any client)
{
if(IsPlayerAlive(client))
{
int weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
if(weapon > 0 && (weapon == GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY)))
{
int warray;
char classname[4];
Format(classname, 4, "%i", GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex"));
if(GetTrieValue(trie_armas, classname, warray))
{
if(GetReserveAmmo(weapon) != warray) SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", warray);
}
}
}
}
public Action ResetAfterTeamChange(Event hEvent, const char[] chName, bool bDontBroadcast)
{
RoundCount = 2;
}
stock int GetReserveAmmo(int weapon)
{
return GetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
}
public Action EventItemPickup2(int client,int weapon)
{
if(weapon == GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY))
{
int warray;
char classname[4];
Format(classname, 4, "%i", GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex"));
if(!GetTrieValue(trie_armas, classname, warray))
{
warray = GetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
SetTrieValue(trie_armas, classname, warray);
}
else
{
if(IsPlayerGenericAdmin(client)) SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", warray);
}
}
}
public Action Spawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid")),
team = GetClientTeam(client),
g_HP = GetConVarInt(HP),
g_Flashbang = GetConVarInt(Flashbang);
if(client > 0 && IsPlayerAlive(client) && IsPlayerGenericAdmin(client))
{
SetEntityHealth(client, g_HP);
if(GetConVarBool(Remove_grenade)) StripNades(client);
if(GetConVarBool(Smokegrenade)) GivePlayerItem(client, "weapon_smokegrenade");
if(GetConVarBool(Hegrenade)) GivePlayerItem(client, "weapon_hegrenade");
if(GetConVarBool(Molotov) && team == CS_TEAM_T) GivePlayerItem(client, "weapon_molotov");
if(GetConVarBool(Molotov) && team == CS_TEAM_CT) GivePlayerItem(client, "weapon_incgrenade");
if(GetConVarBool(Armorvalue)) SetEntProp(client, Prop_Send, "m_ArmorValue", 100);
if(GetConVarBool(Taser)) GivePlayerItem(client, "weapon_taser");
if(GetConVarBool(Bhashelmet) && RoundCount > 1) SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
if(GetConVarBool(Flashbang))
{
for (int i = 1; i <= g_Flashbang; i++)
GivePlayerItem(client, "weapon_flashbang");
}
if(team == CS_TEAM_CT)
{
if(GetConVarBool(Defuser) && GetEntProp(client, Prop_Send, "m_bHasDefuser") == 0) GivePlayerItem(client, "item_defuser");
}
}
}
stock void StripNades(int client)
{
while(RemoveWeaponBySlot(client, 3)){}
for(int i = 0; i < 6; i++)
SetEntProp(client, Prop_Send, "m_iAmmo", 0, _, g_iaGrenadeOffsets[i]);
}
stock bool RemoveWeaponBySlot(int client, int iSlot)
{
int iEntity = GetPlayerWeaponSlot(client, iSlot);
if(IsValidEdict(iEntity))
{
RemovePlayerItem(client, iEntity);
AcceptEntityInput(iEntity, "Kill");
return true;
}
return false;
}
public int MenuHandler2(Menu menusec, MenuAction action, int client, int itemNum)
{
if (action == MenuAction_Select)
{
char info[32];
GetMenuItem(menusec, itemNum, info, sizeof(info));
if (IsPlayerAlive(client))
GivePlayerItem(client, info);
}
else if (action == MenuAction_End)
CloseHandle(menusec);
}
public Action PistolMenu(int client)
{
if (IsPlayerGenericAdmin(client) && ADMFLAG_CUSTOM1 && RoundCount > 1 && IsValidClient(client))
{
Menu menusec = new Menu(MenuHandler2);
menusec.SetTitle("VIP : Choose Pistol");
menusec.AddItem("weapon_deagle", "Deagle");
menusec.AddItem("weapon_revolver", "R8 Revolver");
menusec.AddItem("weapon_fiveseven", "Five-Seven");
menusec.AddItem("weapon_tec9", "Tec-9");
menusec.AddItem("weapon_cz75a", "CZ7a");
menusec.AddItem("weapon_elite", "Dual Elites");
menusec.AddItem("weapon_p250", "p250");
menusec.ExitButton = true;
menusec.Display(client, 15);
}
}
stock void StripAllWeapons(int client)
{
int iEnt;
for (int i = 0; i <= 2; i++)
{
while ((iEnt = GetPlayerWeaponSlot(client, i)) != -1)
{
RemovePlayerItem(client, iEnt);
AcceptEntityInput(iEnt, "Kill");
}
}
}
public int MenuHandler1(Menu menu, MenuAction action, int client, int itemNum)
{
if (action == MenuAction_Select)
{
char info[32];
GetMenuItem(menu, itemNum, info, sizeof(info));
if (IsPlayerAlive(client))
{
StripAllWeapons(client);
GivePlayerItem(client, "weapon_knife");
GivePlayerItem(client, info);
PistolMenu(client);
}
}
else if (action == MenuAction_End)
CloseHandle(menu);
}
public Action GunsMenu(int client)
{
if (IsPlayerGenericAdmin(client) && ADMFLAG_CUSTOM1 && RoundCount > 1 && IsValidClient(client))
{
Menu menu = new Menu(MenuHandler1);
menu.SetTitle("VIP : Choose your Gun");
menu.AddItem("weapon_ak47", "AK-47");
menu.AddItem("weapon_m4a1", "M4A4");
menu.AddItem("weapon_sg556", "SG553");
menu.AddItem("weapon_m4a1_silencer", "M4A1-S");
menu.AddItem("weapon_awp", "AWP");
menu.AddItem("weapon_ssg08", "SCOUT");
menu.AddItem("weapon_xm1014", "XM1014");
menu.AddItem("weapon_famas", "FAMAS");
menu.ExitButton = true;
menu.Display(client, 15);
}
}
stock bool IsValidClient(int client, bool alive = false)
{
if(client >= 1 && client <= MaxClients && IsClientInGame(client) && (alive == false || IsPlayerAlive(client)))
{
return true;
}
return false;
}
stock bool IsPlayerGenericAdmin(int client)
{
if (!CheckCommandAccess(client, "sm_vipp", 0, true) && !CheckCommandAccess(client, "arenaskilla", ADMFLAG_ROOT, true)) return false;
{
return true;
}
}
A hibaüzenetek:
Kód:
L 01/15/2020 - 23:23:55: [SM] Exception reported: Client 3 is not connected
L 01/15/2020 - 23:23:55: [SM] Blaming: VIPPLUGIN.smx
L 01/15/2020 - 23:23:55: [SM] Call stack trace:
L 01/15/2020 - 23:23:55: [SM] [0] GetUserFlagBits
L 01/15/2020 - 23:23:55: [SM] [1] Line 105, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnClientPostAdminCheck
L 01/15/2020 - 23:23:55: [SM] [2] Line 84, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnPluginStart
L 01/15/2020 - 23:37:11: [SM] Exception reported: Client 7 is not connected
L 01/15/2020 - 23:37:11: [SM] Blaming: VIPPLUGIN.smx
L 01/15/2020 - 23:37:11: [SM] Call stack trace:
L 01/15/2020 - 23:37:11: [SM] [0] GetUserFlagBits
L 01/15/2020 - 23:37:11: [SM] [1] Line 90, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnClientPostAdminCheck
L 01/15/2020 - 23:37:11: [SM] [2] Line 69, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnPluginStart
L 01/15/2020 - 23:40:21: [SM] Exception reported: Client 6 is not connected
L 01/15/2020 - 23:40:21: [SM] Blaming: VIPPLUGIN.smx
L 01/15/2020 - 23:40:21: [SM] Call stack trace:
L 01/15/2020 - 23:40:21: [SM] [0] GetUserFlagBits
L 01/15/2020 - 23:40:21: [SM] [1] Line 90, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnClientPostAdminCheck
L 01/15/2020 - 23:40:21: [SM] [2] Line 69, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnPluginStart
L 01/15/2020 - 23:40:56: [SM] Exception reported: Client 6 is not connected
L 01/15/2020 - 23:40:56: [SM] Blaming: VIPPLUGIN.smx
L 01/15/2020 - 23:40:56: [SM] Call stack trace:
L 01/15/2020 - 23:40:56: [SM] [0] GetUserFlagBits
L 01/15/2020 - 23:40:56: [SM] [1] Line 90, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnClientPostAdminCheck
L 01/15/2020 - 23:40:56: [SM] [2] Line 69, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnPluginStart
L 01/15/2020 - 23:42:01: [SM] Exception reported: Client 7 is not connected
L 01/15/2020 - 23:42:01: [SM] Blaming: VIPPLUGIN.smx
L 01/15/2020 - 23:42:01: [SM] Call stack trace:
L 01/15/2020 - 23:42:01: [SM] [0] GetUserFlagBits
L 01/15/2020 - 23:42:01: [SM] [1] Line 90, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnClientPostAdminCheck
L 01/15/2020 - 23:42:01: [SM] [2] Line 69, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnPluginStart
L 01/15/2020 - 23:42:31: Error log file session closed.
L 01/15/2020 - 23:42:31: SourceMod error session started
L 01/15/2020 - 23:42:31: Info (map "de_mirage") (file "/home/container/csgo/addons/sourcemod/logs/errors_20200115.log")
L 01/15/2020 - 23:42:31: [SM] Exception reported: Client 1 is not connected
L 01/15/2020 - 23:42:31: [SM] Blaming: VIPPLUGIN.smx
L 01/15/2020 - 23:42:31: [SM] Call stack trace:
L 01/15/2020 - 23:42:31: [SM] [0] GetUserFlagBits
L 01/15/2020 - 23:42:31: [SM] [1] Line 90, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnClientPostAdminCheck
L 01/15/2020 - 23:42:31: [SM] [2] Line 69, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnPluginStart
------------------------------------------------- Eddig használtam GetUserFlagBits-et. Ezután már IsPlayerGenericAdmin ez volt.
L 01/15/2020 - 23:42:31: [SM] Unable to load plugin "VIPPLUGIN.smx": Error detected in plugin startup (see error logs)
L 01/15/2020 - 23:49:18: [SM] Exception reported: Client index 9 is invalid (arg 2)
L 01/15/2020 - 23:49:18: [SM] Blaming: VIPPLUGIN.smx
L 01/15/2020 - 23:49:18: [SM] Call stack trace:
L 01/15/2020 - 23:49:18: [SM] [0] VFormat
L 01/15/2020 - 23:49:18: [SM] [1] Line 386, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\include\halflife.inc::PrintToChatAll
L 01/15/2020 - 23:49:18: [SM] [2] Line 93, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnClientPostAdminCheck
L 01/15/2020 - 23:49:18: [SM] [3] Line 68, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnPluginStart
L 01/15/2020 - 23:50:29: [SM] Exception reported: Client index 5 is invalid (arg 2)
L 01/15/2020 - 23:50:29: [SM] Blaming: VIPPLUGIN.smx
L 01/15/2020 - 23:50:29: [SM] Call stack trace:
L 01/15/2020 - 23:50:29: [SM] [0] VFormat
L 01/15/2020 - 23:50:29: [SM] [1] Line 386, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\include\halflife.inc::PrintToChatAll
L 01/15/2020 - 23:50:29: [SM] [2] Line 93, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnClientPostAdminCheck
L 01/15/2020 - 23:50:29: [SM] [3] Line 68, C:\Users\Asus TUF\Downloads\CSGO\sourcemod-1.10.0-git6456-windows\addons\sourcemod\scripting\VIPPLUGIN.sp::OnPluginStart
Ezeket a hibaüzeneteket produkálta.
Eleinte még GetUserFlagBits-et használtam néhol, majd kicseréltem őket arra amit mondtál.
Illetve így nemtudom, hogy hogy tudnám megkülönböztetni a VIP,TULAJDONOS és ADMIN-okat a csatlakozásnál.
UPDATE:
A fegyvermenün és a welcome message-n kívül minden működik.
Kód:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#pragma semicolon 1
#pragma newdecls required
#define DATA "2.0"
public Plugin myinfo =
{
name = "VIP",
author = "Zendor",
description = "VIP PLUGIN",
version = "0.1",
url = "http://stat.erack.hu"
};
Handle HP,
Flashbang,
Smokegrenade,
Hegrenade,
Molotov,
Armorvalue,
Bhashelmet,
Defuser,
Remove_grenade,
Taser,
trie_armas;
Handle timers[MAXPLAYERS + 1];
int g_iaGrenadeOffsets[] = { 15, 17, 16, 14, 18, 17 };
int RoundCount = 1;
public void OnPluginStart()
{
HP = CreateConVar("vip_hp_start", "100", "Hány HP-n kezdjenek a VIP-k.", FCVAR_NOTIFY);
Flashbang = CreateConVar("vip_grenade_flashbang", "1", "Kapjon a VIP flash gránátot a kör elején? (1-2))", FCVAR_NOTIFY, true, 0.0, true, 2.0);
Smokegrenade = CreateConVar("vip_grenade_smokegrenade", "0", "Kapjon a VIP smoke-t a kör elején?", FCVAR_NONE, true, 0.0, true, 1.0);
Hegrenade = CreateConVar("vip_grenade_hegrenade", "1", "Kapján a VIP gránátot a kör elején?", FCVAR_NONE, true, 0.0, true, 1.0);
Molotov = CreateConVar("vip_grenade_molotov", "0", "Kapján a VIP molót a kör elején? ",FCVAR_NONE, true, 0.0, true, 1.0);
Armorvalue = CreateConVar("vip_armorvalue", "100", "Mennyi armor-t kapjonak a VIP-k", FCVAR_NONE, true, 0.0, true, 1.0);
Remove_grenade = CreateConVar("vip_grenade_remove", "0", "A kör elején eltávolítja az összes gránátot", FCVAR_NONE, true, 0.0, true, 1.0);
Defuser = CreateConVar("vip_defuser", "1", "CT-ben kapjanak a VIP-k defusert?", FCVAR_NONE, true, 0.0, true, 1.0);
Bhashelmet = CreateConVar("vip_bhashelmet", "1", "Legyen sisakjuk a VIP-knak?", FCVAR_NONE, true, 0.0, true, 1.0);
Taser = CreateConVar("vip_taser", "1.0", "Zeust ad minden körben.");
trie_armas = CreateTrie();
AutoExecConfig(true, "VIPBETA");
HookEvent("player_spawn", Spawn);
HookEvent("round_start", Event_RoundStart);
HookEvent("announce_phase_end", ResetAfterTeamChange);
HookEvent("cs_intermission", ResetAfterTeamChange);
for (int i = 1; i <= MaxClients; i++) {
if (IsClientInGame(i))
OnClientPutInServer(i);
OnClientPostAdminCheck(i);
}
}
public void OnMapStart()
{
RoundCount = 0;
}
public Action Event_RoundStart(Event hEvent, const char[] chName, bool bDontBroadcast)
{
RoundCount = RoundCount + 1;
}
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_WeaponEquipPost, EventItemPickup2);
}
public void OnClientPostAdminCheck(int client)
{
if (IsPlayerGenericAdmin(client)) timers[client] = CreateTimer(3.0, Darm, client, TIMER_REPEAT);
// if(IsPlayerGenericAdmin(client))
//{
// PrintToChatAll("╔════════════════════════╗");
// PrintToChatAll("[VIP] %N csatlakozott a szerverre", client);
// PrintToChatAll("╚════════════════════════╝");
//} else
// {
// return;
//}
}
public void OnClientDisconnect(int client)
{
if(timers[client] != INVALID_HANDLE)
{
KillTimer(timers[client]);
timers[client] = INVALID_HANDLE;
}
//if(IsPlayerGenericAdmin(client))
//{
// PrintToChatAll("╔════════════════════════╗");
// PrintToChatAll("[VIP] %N lecsatlakozott a szerverről", client);
// PrintToChatAll("╚════════════════════════╝");
// } else
// {
// return;
// }
}
public Action Darm(Handle timer, any client)
{
if(IsPlayerAlive(client))
{
int weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
if(weapon > 0 && (weapon == GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY)))
{
int warray;
char classname[4];
Format(classname, 4, "%i", GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex"));
if(GetTrieValue(trie_armas, classname, warray))
{
if(GetReserveAmmo(weapon) != warray) SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", warray);
}
}
}
}
public Action ResetAfterTeamChange(Event hEvent, const char[] chName, bool bDontBroadcast)
{
RoundCount = 1;
}
stock int GetReserveAmmo(int weapon)
{
return GetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
}
public Action EventItemPickup2(int client,int weapon)
{
if(weapon == GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY))
{
int warray;
char classname[4];
Format(classname, 4, "%i", GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex"));
if(!GetTrieValue(trie_armas, classname, warray))
{
warray = GetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
SetTrieValue(trie_armas, classname, warray);
}
else
{
if(IsPlayerGenericAdmin(client)) SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", warray);
}
}
}
public Action Spawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid")),
team = GetClientTeam(client),
g_HP = GetConVarInt(HP),
g_Flashbang = GetConVarInt(Flashbang);
if(client > 0 && IsPlayerAlive(client) && IsPlayerGenericAdmin(client))
{
SetEntityHealth(client, g_HP);
if(GetConVarBool(Remove_grenade)) StripNades(client);
if(GetConVarBool(Smokegrenade)) GivePlayerItem(client, "weapon_smokegrenade");
if(GetConVarBool(Hegrenade)) GivePlayerItem(client, "weapon_hegrenade");
if(GetConVarBool(Molotov) && team == CS_TEAM_T) GivePlayerItem(client, "weapon_molotov");
if(GetConVarBool(Molotov) && team == CS_TEAM_CT) GivePlayerItem(client, "weapon_incgrenade");
if(GetConVarBool(Armorvalue) && RoundCount > 1) SetEntProp(client, Prop_Send, "m_ArmorValue", 100);
if(GetConVarBool(Taser)) GivePlayerItem(client, "weapon_taser");
if(GetConVarBool(Bhashelmet) && RoundCount > 1) SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
if(GetConVarBool(Flashbang))
{
for (int i = 1; i <= g_Flashbang; i++)
GivePlayerItem(client, "weapon_flashbang");
}
if(team == CS_TEAM_CT)
{
if(GetConVarBool(Defuser) && GetEntProp(client, Prop_Send, "m_bHasDefuser") == 0) GivePlayerItem(client, "item_defuser");
}
}
}
stock void StripNades(int client)
{
while(RemoveWeaponBySlot(client, 3)){}
for(int i = 0; i < 6; i++)
SetEntProp(client, Prop_Send, "m_iAmmo", 0, _, g_iaGrenadeOffsets[i]);
}
stock bool RemoveWeaponBySlot(int client, int iSlot)
{
int iEntity = GetPlayerWeaponSlot(client, iSlot);
if(IsValidEdict(iEntity))
{
RemovePlayerItem(client, iEntity);
AcceptEntityInput(iEntity, "Kill");
return true;
}
return false;
}
public int MenuHandler2(Menu menusec, MenuAction action, int client, int itemNum)
{
if (action == MenuAction_Select)
{
char info[32];
GetMenuItem(menusec, itemNum, info, sizeof(info));
if (IsPlayerAlive(client))
GivePlayerItem(client, info);
}
else if (action == MenuAction_End)
CloseHandle(menusec);
}
public Action PistolMenu(int client)
{
if (IsValidClient(client))
{
if (IsPlayerGenericAdmin(client))
{
Menu menusec = new Menu(MenuHandler2);
menusec.SetTitle("VIP : Choose Pistol");
menusec.AddItem("weapon_deagle", "Deagle");
menusec.AddItem("weapon_revolver", "R8 Revolver");
menusec.AddItem("weapon_fiveseven", "Five-Seven");
menusec.AddItem("weapon_tec9", "Tec-9");
menusec.AddItem("weapon_cz75a", "CZ7a");
menusec.AddItem("weapon_elite", "Dual Elites");
menusec.AddItem("weapon_p250", "p250");
menusec.ExitButton = true;
menusec.Display(client, 15);
}
}
}
stock void StripAllWeapons(int client)
{
int iEnt;
for (int i = 0; i <= 2; i++)
{
while ((iEnt = GetPlayerWeaponSlot(client, i)) != -1)
{
RemovePlayerItem(client, iEnt);
AcceptEntityInput(iEnt, "Kill");
}
}
}
public int MenuHandler1(Menu menu, MenuAction action, int client, int itemNum)
{
if (action == MenuAction_Select)
{
char info[32];
GetMenuItem(menu, itemNum, info, sizeof(info));
if (IsPlayerAlive(client))
{
StripAllWeapons(client);
GivePlayerItem(client, "weapon_knife");
GivePlayerItem(client, info);
PistolMenu(client);
}
}
else if (action == MenuAction_End)
CloseHandle(menu);
}
public Action GunsMenu(int client)
{
if (IsValidClient(client))
{
if (IsPlayerGenericAdmin(client))
{
Menu menu = new Menu(MenuHandler1);
menu.SetTitle("VIP : Choose your Gun");
menu.AddItem("weapon_ak47", "AK-47");
menu.AddItem("weapon_m4a1", "M4A4");
menu.AddItem("weapon_sg556", "SG553");
menu.AddItem("weapon_m4a1_silencer", "M4A1-S");
menu.AddItem("weapon_awp", "AWP");
menu.AddItem("weapon_ssg08", "SCOUT");
menu.AddItem("weapon_xm1014", "XM1014");
menu.AddItem("weapon_famas", "FAMAS");
menu.ExitButton = true;
menu.Display(client, 15);
}
}
}
stock bool IsValidClient(int client, bool alive = false)
{
if(client >= 1 && client <= MaxClients && IsClientInGame(client) && (alive == false || IsPlayerAlive(client)))
{
return true;
}
return false;
}
stock bool IsPlayerGenericAdmin(int client)
{
if (!CheckCommandAccess(client, "sm_vipp", 0, true) && !CheckCommandAccess(client, "arenaskilla", ADMFLAG_ROOT, true)) return false;
{
return true;
}
}