hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2020.04.03. 12:17



Jelenlévő felhasználók

Jelenleg 56 felhasználó van jelen :: 3 regisztrált, 0 rejtett és 53 vendég

A legtöbb felhasználó (652 fő) 2015.05.25. 22:38-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot], Csabika20034, Google [Bot] az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 19 hozzászólás ]  Oldal 1 2 Következő
Szerző Üzenet
 Hozzászólás témája: [CS:GO] VIP PLUGIN
HozzászólásElküldve: 2020.01.15. 15:40 
Offline
Újonc

Csatlakozott: 2019.01.12. 18:30
Hozzászólások: 13
Sziasztok!

A tegnapi napon elég sokat szenvedtem eme kis VIP pluginnal. Természetesen mindent a lehető SZÁMOMRA legegyszerűbben oldottam meg és semmi sem változtatható cvarokkval vagy ehhez hasonló dolgokkal.
Mivel én nem tudnám megcsinálni így akinek van kedve és affinitása átalakíthatja a plugint úgy, hogy ez egy elfogadható pluginocska legyen.
Illetve ha csak értesz a plugin íráshoz és hatalmas hibákat vélsz felfedezni, de nincs időd átírni írd le az észrevételed és megpróbálkozom vele. Tanulni mindig jó.
Jelenleg mit tud a plugin?
-Az első kör kivételével minden kör elején ad gránátokat/zeust és nagykevót.
-Az első kör kivételével minden kör elején megnyit egy fegyvermenüt.
-Ha tulajdonos,admin vagy vip csatlakozik különféle szöveget ír ki illetve ha lecsatlakozik szintúgy.
Hogy mi is az amit én elképzeltem, de NEM tudok megvalósítani?
-A fegyvermenü elmentse a választott fegyvert és a !guns menüvel lehetne változtatni rajta.
-Cvarokkal lehessen időzíteni, hogy melyik körben adja meg a dolgokat és mit.
-A VIPrespawn-t beleírni. (Hányszor egy pályán illetve egy körben újraéledni.)
Ha lesz kedvem tovább fogok szórakozni vele és megpróbálni megoldani.
Fontos tudni: A plugin minden egyes részét különböző pluginokból ollóztam és igazítottam egymáshoz, ezért lett ilyen amilyen. A plugin alapja Francisco VIPFeatures pluginja.
UPDATE: Időközben kiderült, hogy a sisak hibás.
Kód:
/*  SM Franug Vip Features
 *
 *  Copyright (C) 2017 Francisco 'Franc1sco' García
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see http://www.gnu.org/licenses/.
 */

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>

#define ADMFLAG_NEEDED ADMFLAG_CUSTOM1

#define DATA "2.0"

public Plugin:myinfo =
{
   name = "SM Franug Vip Features",
   author = "Franc1sco franug",
   description = "Features for vips",
   version = DATA,
   url = "http://steamcommunity.com/id/franug"
};


int RoundCount = 0;


new Handle:trie_armas;

new Handle:timers[MAXPLAYERS+1];


public OnPluginStart()
{
   CreateConVar("sm_franugvipfeatures_version", DATA, "", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
   
   trie_armas = CreateTrie();
   
   HookEvent("player_spawn", Event_PlayerSpawn);
   HookEvent("round_start", Event_RoundStart);
   HookEvent("announce_phase_end", ResetAfterTeamChange);
   HookEvent("cs_intermission", ResetAfterTeamChange);
   RegConsoleCmd("sm_guns", OpenMenu);

   
   for(new 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 OnClientPutInServer(client)
{
   SDKHook(client, SDKHook_WeaponEquipPost, EventItemPickup2);
}

public OnClientPostAdminCheck(client)
{
   if(GetUserFlagBits(client) & ADMFLAG_NEEDED) timers[client] = CreateTimer(3.0, Darm, client, TIMER_REPEAT);
   if (GetUserFlagBits(client) & ADMFLAG_ROOT)
   {
      PrintToChatAll("╔══════════════════════════════╗");
      PrintToChatAll("[TULAJDONOS] %N csatlakozott a szerverre", client);
      PrintToChatAll("╚══════════════════════════════╝");
   }else if (GetUserFlagBits(client) & ADMFLAG_GENERIC)
   {
      PrintToChatAll("╔═══════════════════════════╗");
      PrintToChatAll("[ADMIN] %N csatlakozott a szerverre", client);
      PrintToChatAll("╚═══════════════════════════╝");
   }else if(GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
   {
      PrintToChatAll("╔════════════════════════╗");
      PrintToChatAll("[VIP] %N csatlakozott a szerverre", client);
      PrintToChatAll("╚════════════════════════╝");
   } else
      {
         return;
   }
}

public OnClientDisconnect(client)
{
   if(timers[client] != INVALID_HANDLE)
   {
      KillTimer(timers[client]);
      timers[client] = INVALID_HANDLE;
   }

   if (GetUserFlagBits(client) & ADMFLAG_ROOT)
   {
      PrintToChatAll("╔══════════════════════════════╗");
      PrintToChatAll("[TULAJDONOS] %N lecsatlakozott a szerverről", client);
      PrintToChatAll("╚══════════════════════════════╝");
   }else if (GetUserFlagBits(client) & ADMFLAG_GENERIC)
   {
      PrintToChatAll("╔═══════════════════════════╗");
      PrintToChatAll("[ADMIN] %N lecsatlakozott a szerverről", client);
      PrintToChatAll("╚═══════════════════════════╝");
   }else if(GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
   {
      PrintToChatAll("╔════════════════════════╗");
      PrintToChatAll("[VIP] %N lecsatlakozott a szerverről", client);
      PrintToChatAll("╚════════════════════════╝");
   } else
      {
         return;
   }
}

public Action:Darm(Handle:timer, any:client)
{
   if(IsPlayerAlive(client))
   {
      new weapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon");
      if(weapon > 0 && (weapon == GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY)))
      {
         new warray;
         decl String:classname[4];
         //GetEdictClassname(weapon, classname, sizeof(classname));
         Format(classname, 4, "%i", GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex"));
         
         if(GetTrieValue(trie_armas, classname, warray))
         {
            //PrintToChat(client, "municion fijado a %i",warray[1]);
            if(GetReserveAmmo(weapon) != warray) SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", warray);
         }
      }
   }
}

public Action ResetAfterTeamChange(Event hEvent, const char[] chName, bool bDontBroadcast)
{
   RoundCount = 2;
   PrintToChatAll("%i", RoundCount);
}

stock GetReserveAmmo(weapon)
{
    return GetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
}

public Action:EventItemPickup2(client, weapon)
{
   if(weapon == GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY))
   {
      new warray;
      decl String:classname[4];
      //GetEdictClassname(weapon, classname, sizeof(classname));
      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(GetUserFlagBits(client) & ADMFLAG_NEEDED) SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", warray);
      }
   }
}

public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{   
   new client = GetClientOfUserId(GetEventInt(event, "userid"));
   
   if(GetClientTeam(client) < 2) return;

   if (IsValidClient(client))
   
   if(!(GetUserFlagBits(client) & ADMFLAG_NEEDED)) return;

   new iEnt;
   
   while ((iEnt = GetPlayerWeaponSlot(client, 3)) != -1)
   {
      RemovePlayerItem(client, iEnt);
      AcceptEntityInput(iEnt, "Kill");
   }
   
   GivePlayerItem(client, "weapon_hegrenade");
   GivePlayerItem(client, "weapon_flashbang");
   GivePlayerItem(client, "weapon_smokegrenade");
   GivePlayerItem(client, "weapon_molotov");
   if(GetClientTeam(client) == CS_TEAM_CT) SetEntProp(client, Prop_Send, "m_bHasDefuser", 1);
   if(RoundCount > 1) GunsMenu(client);
   if(RoundCount > 1) SetEntProp(client, Prop_Data, "m_ArmorValue", 100, 1);
   if(RoundCount > 1) SetEntProp(client, Prop_Data, "m_bHasHelmet", 1);
   
   while ((iEnt = GetPlayerWeaponSlot(client, 2)) != -1)
   {
      RemovePlayerItem(client, iEnt);
      AcceptEntityInput(iEnt, "Kill");
   }
   GivePlayerItem(client, "weapon_knife");
   GivePlayerItem(client, "weapon_taser");
   
   FakeClientCommand(client,"use weapon_knife");

}

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 (GetUserFlagBits(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 (GetUserFlagBits(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)
{
   if (client <= 0)return false;
   if (client > MaxClients)return false;
   if (!IsClientConnected(client))return false;
   if (IsClientReplay(client))return false;
   if (IsFakeClient(client))return false;
   if (IsClientSourceTV(client))return false;
   return IsClientInGame(client);
}


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: [CS:GO] VIP PLUGIN
HozzászólásElküldve: 2020.01.15. 19:39 
Offline
Senior Tag
Avatar

Csatlakozott: 2013.12.18. 13:57
Hozzászólások: 212
Megköszönt másnak: 13 alkalommal
Megköszönték neki: 17 alkalommal
Zendor20000 írta:
Sziasztok!

A tegnapi napon elég sokat szenvedtem eme kis VIP pluginnal. Természetesen mindent a lehető SZÁMOMRA legegyszerűbben oldottam meg és semmi sem változtatható cvarokkval vagy ehhez hasonló dolgokkal.
Mivel én nem tudnám megcsinálni így akinek van kedve és affinitása átalakíthatja a plugint úgy, hogy ez egy elfogadható pluginocska legyen.
Illetve ha csak értesz a plugin íráshoz és hatalmas hibákat vélsz felfedezni, de nincs időd átírni írd le az észrevételed és megpróbálkozom vele. Tanulni mindig jó.
Jelenleg mit tud a plugin?
-Az első kör kivételével minden kör elején ad gránátokat/zeust és nagykevót.
-Az első kör kivételével minden kör elején megnyit egy fegyvermenüt.
-Ha tulajdonos,admin vagy vip csatlakozik különféle szöveget ír ki illetve ha lecsatlakozik szintúgy.
Hogy mi is az amit én elképzeltem, de NEM tudok megvalósítani?
-A fegyvermenü elmentse a választott fegyvert és a !guns menüvel lehetne változtatni rajta.
-Cvarokkal lehessen időzíteni, hogy melyik körben adja meg a dolgokat és mit.
-A VIPrespawn-t beleírni. (Hányszor egy pályán illetve egy körben újraéledni.)
Ha lesz kedvem tovább fogok szórakozni vele és megpróbálni megoldani.
Fontos tudni: A plugin minden egyes részét különböző pluginokból ollóztam és igazítottam egymáshoz, ezért lett ilyen amilyen. A plugin alapja Francisco VIPFeatures pluginja.
UPDATE: Időközben kiderült, hogy a sisak hibás.
Kód:
/*  SM Franug Vip Features
 *
 *  Copyright (C) 2017 Francisco 'Franc1sco' García
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see http://www.gnu.org/licenses/.
 */

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>

#define ADMFLAG_NEEDED ADMFLAG_CUSTOM1

#define DATA "2.0"

public Plugin:myinfo =
{
   name = "SM Franug Vip Features",
   author = "Franc1sco franug",
   description = "Features for vips",
   version = DATA,
   url = "http://steamcommunity.com/id/franug"
};


int RoundCount = 0;


new Handle:trie_armas;

new Handle:timers[MAXPLAYERS+1];


public OnPluginStart()
{
   CreateConVar("sm_franugvipfeatures_version", DATA, "", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
   
   trie_armas = CreateTrie();
   
   HookEvent("player_spawn", Event_PlayerSpawn);
   HookEvent("round_start", Event_RoundStart);
   HookEvent("announce_phase_end", ResetAfterTeamChange);
   HookEvent("cs_intermission", ResetAfterTeamChange);
   RegConsoleCmd("sm_guns", OpenMenu);

   
   for(new 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 OnClientPutInServer(client)
{
   SDKHook(client, SDKHook_WeaponEquipPost, EventItemPickup2);
}

public OnClientPostAdminCheck(client)
{
   if(GetUserFlagBits(client) & ADMFLAG_NEEDED) timers[client] = CreateTimer(3.0, Darm, client, TIMER_REPEAT);
   if (GetUserFlagBits(client) & ADMFLAG_ROOT)
   {
      PrintToChatAll("╔══════════════════════════════╗");
      PrintToChatAll("[TULAJDONOS] %N csatlakozott a szerverre", client);
      PrintToChatAll("╚══════════════════════════════╝");
   }else if (GetUserFlagBits(client) & ADMFLAG_GENERIC)
   {
      PrintToChatAll("╔═══════════════════════════╗");
      PrintToChatAll("[ADMIN] %N csatlakozott a szerverre", client);
      PrintToChatAll("╚═══════════════════════════╝");
   }else if(GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
   {
      PrintToChatAll("╔════════════════════════╗");
      PrintToChatAll("[VIP] %N csatlakozott a szerverre", client);
      PrintToChatAll("╚════════════════════════╝");
   } else
      {
         return;
   }
}

public OnClientDisconnect(client)
{
   if(timers[client] != INVALID_HANDLE)
   {
      KillTimer(timers[client]);
      timers[client] = INVALID_HANDLE;
   }

   if (GetUserFlagBits(client) & ADMFLAG_ROOT)
   {
      PrintToChatAll("╔══════════════════════════════╗");
      PrintToChatAll("[TULAJDONOS] %N lecsatlakozott a szerverről", client);
      PrintToChatAll("╚══════════════════════════════╝");
   }else if (GetUserFlagBits(client) & ADMFLAG_GENERIC)
   {
      PrintToChatAll("╔═══════════════════════════╗");
      PrintToChatAll("[ADMIN] %N lecsatlakozott a szerverről", client);
      PrintToChatAll("╚═══════════════════════════╝");
   }else if(GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
   {
      PrintToChatAll("╔════════════════════════╗");
      PrintToChatAll("[VIP] %N lecsatlakozott a szerverről", client);
      PrintToChatAll("╚════════════════════════╝");
   } else
      {
         return;
   }
}

public Action:Darm(Handle:timer, any:client)
{
   if(IsPlayerAlive(client))
   {
      new weapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon");
      if(weapon > 0 && (weapon == GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY)))
      {
         new warray;
         decl String:classname[4];
         //GetEdictClassname(weapon, classname, sizeof(classname));
         Format(classname, 4, "%i", GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex"));
         
         if(GetTrieValue(trie_armas, classname, warray))
         {
            //PrintToChat(client, "municion fijado a %i",warray[1]);
            if(GetReserveAmmo(weapon) != warray) SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", warray);
         }
      }
   }
}

public Action ResetAfterTeamChange(Event hEvent, const char[] chName, bool bDontBroadcast)
{
   RoundCount = 2;
   PrintToChatAll("%i", RoundCount);
}

stock GetReserveAmmo(weapon)
{
    return GetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
}

public Action:EventItemPickup2(client, weapon)
{
   if(weapon == GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY))
   {
      new warray;
      decl String:classname[4];
      //GetEdictClassname(weapon, classname, sizeof(classname));
      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(GetUserFlagBits(client) & ADMFLAG_NEEDED) SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", warray);
      }
   }
}

public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{   
   new client = GetClientOfUserId(GetEventInt(event, "userid"));
   
   if(GetClientTeam(client) < 2) return;

   if (IsValidClient(client))
   
   if(!(GetUserFlagBits(client) & ADMFLAG_NEEDED)) return;

   new iEnt;
   
   while ((iEnt = GetPlayerWeaponSlot(client, 3)) != -1)
   {
      RemovePlayerItem(client, iEnt);
      AcceptEntityInput(iEnt, "Kill");
   }
   
   GivePlayerItem(client, "weapon_hegrenade");
   GivePlayerItem(client, "weapon_flashbang");
   GivePlayerItem(client, "weapon_smokegrenade");
   GivePlayerItem(client, "weapon_molotov");
   if(GetClientTeam(client) == CS_TEAM_CT) SetEntProp(client, Prop_Send, "m_bHasDefuser", 1);
   if(RoundCount > 1) GunsMenu(client);
   if(RoundCount > 1) SetEntProp(client, Prop_Data, "m_ArmorValue", 100, 1);
   if(RoundCount > 1) SetEntProp(client, Prop_Data, "m_bHasHelmet", 1);
   
   while ((iEnt = GetPlayerWeaponSlot(client, 2)) != -1)
   {
      RemovePlayerItem(client, iEnt);
      AcceptEntityInput(iEnt, "Kill");
   }
   GivePlayerItem(client, "weapon_knife");
   GivePlayerItem(client, "weapon_taser");
   
   FakeClientCommand(client,"use weapon_knife");

}

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 (GetUserFlagBits(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 (GetUserFlagBits(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)
{
   if (client <= 0)return false;
   if (client > MaxClients)return false;
   if (!IsClientConnected(client))return false;
   if (IsClientReplay(client))return false;
   if (IsFakeClient(client))return false;
   if (IsClientSourceTV(client))return false;
   return IsClientInGame(client);
}


Személy szerint szúrja a szemem az, hogy keveredik a transitional és az old syntax, illetve
Kód:
 error 017: undefined symbol "OpenMenu"

és
Kód:
 PrintToChatAll("%i", RoundCount);
Ez gondolom nem direkt lett benne hagyva

Gondolom pub szerverre lett tervezve így célszerűbb lehet a lejátszott körök számát így bekérni:
Kód:
stock int GetRoundCount()
{
   return GameRules_GetProp("m_totalRoundsPlayed");
}

Aztán GetRoundRound()
De ez rajtad múlik, így is jó, meg úgy is ha minden kör elején növeled a változó értékét +1-el, viszont a warmup is körnek számít az elején így azzal kezdeni kell valamit, pl ellenőrzöd úgy, hogy

Kód:
stock bool IsWarmup()
{
   return view_as<bool>(GameRules_GetProp("m_bWarmupPeriod"));
}

aztán if(!IsWarmup()) ..

GetUserFlagBits helyett pedig szerintem használj CheckCommandAccesst (A legtöbb esetben én is ezt használom, ritka amikor a GetUserFlagBits-re lenne szükség)
Pl if(CheckCommandAccess(client, "sm_admin", ADMFLAG_GENERIC)) .. //Ha van admin joga akkor .. Itt viszont ha pl ADMFLAG_ROOT-ot ellenőrzöl és az sm_admin-t úgyhagyod, akkor akinek van joga ahhoz a parancshoz annak is 1-et fog visszaadni, függetlenül attól, hogy van-e ADMFLAG_ROOT joga tehát lefog futni az if

Részletesebben nem néztem bele, ha kellene segítség az elképzelt dolgokhoz akkor írj nyugodtan és segítek

_________________
Taking private paid requests in PM

No more FREE requests.
Discord: KillStr3aK#9143 | GitHub


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: [CS:GO] VIP PLUGIN
HozzászólásElküldve: 2020.01.15. 22:15 
Offline
Újonc

Csatlakozott: 2019.01.12. 18:30
Hozzászólások: 13
Nagyon szépen köszönöm az iránymutatást.
Javítottam rajta és most már a sisakot is megadja.
A translational és az old syntax keveredése alatt mire gondolsz?
Az old syntaxot megpróbálom lecserélni újra.

Kód:
 
/*  SM Franug Vip Features
 *
 *  Copyright (C) 2017 Francisco 'Franc1sco' García
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see http://www.gnu.org/licenses/.
 */

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>

#define ADMFLAG_NEEDED ADMFLAG_CUSTOM1

#define DATA "2.0"

public Plugin:myinfo =
{
   name = "VIPPLUGIN",
   author = "Franc1sco franug",
   description = "Features for vips",
   version = DATA,
   url = "http://steamcommunity.com/id/franug"
};


int RoundCount = 0;


new Handle:trie_armas;

new Handle:timers[MAXPLAYERS+1];


public OnPluginStart()
{
   CreateConVar("sm_franugvipfeatures_version", DATA, "", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
   
   trie_armas = CreateTrie();
   
   HookEvent("player_spawn", Event_PlayerSpawn);
   HookEvent("round_start", Event_RoundStart);
   HookEvent("announce_phase_end", ResetAfterTeamChange);
   HookEvent("cs_intermission", ResetAfterTeamChange);

   
   for(new 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 OnClientPutInServer(client)
{
   SDKHook(client, SDKHook_WeaponEquipPost, EventItemPickup2);
}

public OnClientPostAdminCheck(client)
{
   if(GetUserFlagBits(client) & ADMFLAG_NEEDED) timers[client] = CreateTimer(3.0, Darm, client, TIMER_REPEAT);
   if (GetUserFlagBits(client) & ADMFLAG_ROOT)
   {
      PrintToChatAll("╔══════════════════════════════╗");
      PrintToChatAll("[TULAJDONOS] %N csatlakozott a szerverre", client);
      PrintToChatAll("╚══════════════════════════════╝");
   }else if (GetUserFlagBits(client) & ADMFLAG_GENERIC)
   {
      PrintToChatAll("╔═══════════════════════════╗");
      PrintToChatAll("[ADMIN] %N csatlakozott a szerverre", client);
      PrintToChatAll("╚═══════════════════════════╝");
   }else if(GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
   {
      PrintToChatAll("╔════════════════════════╗");
      PrintToChatAll("[VIP] %N csatlakozott a szerverre", client);
      PrintToChatAll("╚════════════════════════╝");
   } else
      {
         return;
   }
}

public OnClientDisconnect(client)
{
   if(timers[client] != INVALID_HANDLE)
   {
      KillTimer(timers[client]);
      timers[client] = INVALID_HANDLE;
   }

   if (GetUserFlagBits(client) & ADMFLAG_ROOT)
   {
      PrintToChatAll("╔══════════════════════════════╗");
      PrintToChatAll("[TULAJDONOS] %N lecsatlakozott a szerverről", client);
      PrintToChatAll("╚══════════════════════════════╝");
   }else if (GetUserFlagBits(client) & ADMFLAG_GENERIC)
   {
      PrintToChatAll("╔═══════════════════════════╗");
      PrintToChatAll("[ADMIN] %N lecsatlakozott a szerverről", client);
      PrintToChatAll("╚═══════════════════════════╝");
   }else if(GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
   {
      PrintToChatAll("╔════════════════════════╗");
      PrintToChatAll("[VIP] %N lecsatlakozott a szerverről", client);
      PrintToChatAll("╚════════════════════════╝");
   } else
      {
         return;
   }
}

public Action:Darm(Handle:timer, any:client)
{
   if(IsPlayerAlive(client))
   {
      new weapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon");
      if(weapon > 0 && (weapon == GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY)))
      {
         new warray;
         decl String: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 GetReserveAmmo(weapon)
{
    return GetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
}

public Action:EventItemPickup2(client, weapon)
{
   if(weapon == GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY))
   {
      new warray;
      decl String:classname[4];
      //GetEdictClassname(weapon, classname, sizeof(classname));
      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(GetUserFlagBits(client) & ADMFLAG_CUSTOM1) SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", warray);
      }
   }
}

public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{   
   new client = GetClientOfUserId(GetEventInt(event, "userid"));
   
   if(GetClientTeam(client) < 2) return;

   if (IsValidClient(client))
   
   if(!(GetUserFlagBits(client) & ADMFLAG_NEEDED)) return;

   new iEnt;
   
   while ((iEnt = GetPlayerWeaponSlot(client, 3)) != -1)
   {
      RemovePlayerItem(client, iEnt);
      AcceptEntityInput(iEnt, "Kill");
   }
   
   GivePlayerItem(client, "weapon_hegrenade");
   GivePlayerItem(client, "weapon_flashbang");
   GivePlayerItem(client, "weapon_smokegrenade");
   GivePlayerItem(client, "weapon_molotov");
   if(GetClientTeam(client) == CS_TEAM_CT) SetEntProp(client, Prop_Send, "m_bHasDefuser", 1);
   if(RoundCount > 1) GunsMenu(client);
   if(RoundCount > 1) SetEntProp(client, Prop_Data, "m_ArmorValue", 100, 1);
   if(IsValidClient(client, true) && RoundCount > 1 ) SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
   
   
   while ((iEnt = GetPlayerWeaponSlot(client, 2)) != -1)
   {
      RemovePlayerItem(client, iEnt);
      AcceptEntityInput(iEnt, "Kill");
   }
   GivePlayerItem(client, "weapon_knife");
   GivePlayerItem(client, "weapon_taser");
   
   FakeClientCommand(client,"use weapon_knife");

}

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 (GetUserFlagBits(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 (GetUserFlagBits(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 && IsClientConnected(client) && IsClientInGame(client) && (alive == false || IsPlayerAlive(client)))
   {
      return true;
   }
   return false;
}




Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: [CS:GO] VIP PLUGIN
HozzászólásElküldve: 2020.01.16. 00:58 
Offline
Újonc

Csatlakozott: 2019.01.12. 18:30
Hozzászólások: 13
Na ma este neki estem újraírni a dolgokat.
Viszooooooooooooooont.
A végeredmény egy hibátlanul leforduló viszont nem működő plugin. :DDD

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;
   }

}


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: [CS:GO] VIP PLUGIN
HozzászólásElküldve: 2020.01.16. 12:24 
Offline
Senior Tag
Avatar

Csatlakozott: 2013.12.18. 13:57
Hozzászólások: 212
Megköszönt másnak: 13 alkalommal
Megköszönték neki: 17 alkalommal
Idézet:
Illetve így nemtudom, hogy hogy tudnám megkülönböztetni a VIP,TULAJDONOS és ADMIN-okat a csatlakozásnál.

Itt a lista a jogokról:

Kód:
#define ADMFLAG_RESERVATION         (1<<0)      /**< Convenience macro for Admin_Reservation as a FlagBit */
#define ADMFLAG_GENERIC            (1<<1)      /**< Convenience macro for Admin_Generic as a FlagBit */
#define ADMFLAG_KICK            (1<<2)      /**< Convenience macro for Admin_Kick as a FlagBit */
#define ADMFLAG_BAN               (1<<3)      /**< Convenience macro for Admin_Ban as a FlagBit */
#define ADMFLAG_UNBAN            (1<<4)      /**< Convenience macro for Admin_Unban as a FlagBit */
#define ADMFLAG_SLAY            (1<<5)      /**< Convenience macro for Admin_Slay as a FlagBit */
#define ADMFLAG_CHANGEMAP         (1<<6)      /**< Convenience macro for Admin_Changemap as a FlagBit */
#define ADMFLAG_CONVARS            (1<<7)      /**< Convenience macro for Admin_Convars as a FlagBit */
#define ADMFLAG_CONFIG            (1<<8)      /**< Convenience macro for Admin_Config as a FlagBit */
#define ADMFLAG_CHAT            (1<<9)      /**< Convenience macro for Admin_Chat as a FlagBit */
#define ADMFLAG_VOTE            (1<<10)      /**< Convenience macro for Admin_Vote as a FlagBit */
#define ADMFLAG_PASSWORD         (1<<11)      /**< Convenience macro for Admin_Password as a FlagBit */
#define ADMFLAG_RCON            (1<<12)      /**< Convenience macro for Admin_RCON as a FlagBit */
#define ADMFLAG_CHEATS            (1<<13)      /**< Convenience macro for Admin_Cheats as a FlagBit */
#define ADMFLAG_ROOT            (1<<14)      /**< Convenience macro for Admin_Root as a FlagBit */
#define ADMFLAG_CUSTOM1            (1<<15)      /**< Convenience macro for Admin_Custom1 as a FlagBit */
#define ADMFLAG_CUSTOM2            (1<<16)      /**< Convenience macro for Admin_Custom2 as a FlagBit */
#define ADMFLAG_CUSTOM3            (1<<17)      /**< Convenience macro for Admin_Custom3 as a FlagBit */
#define ADMFLAG_CUSTOM4            (1<<18)      /**< Convenience macro for Admin_Custom4 as a FlagBit */
#define ADMFLAG_CUSTOM5            (1<<19)      /**< Convenience macro for Admin_Custom5 as a FlagBit */
#define ADMFLAG_CUSTOM6            (1<<20)      /**< Convenience macro for Admin_Custom6 as a FlagBit */


Innentől kezdve if(CheckCommandAccess(client, "blabla", ADMFLAG_ROOT)) stb.

Kód:
int g_iaGrenadeOffsets[] =  { 15, 17, 16, 14, 18, 17 };
Ezt így nem a legjobb ötlet használni, ezek az offsetek bármikor megváltozhatnak egy frissítéssel
Én ezt úgy szoktam, hogy:

Kód:
char g_sGrenadeNames[][] = { //random töltöttem fel, olyan gránátokat írj bele amiknek kell az offsete
    "weapon_tagrenade",
    "weapon_smokegrenade",
    "weapon_decoy",
    "weapon_healthshot",
    "weapon_flashbang"
};

int m_iGrenadeOffsets[sizeof(g_sGrenadeNames)];

public void OnMapStart()
{
   if(!m_iGrenadeOffsets[0]) {
        for (int i = 0; i < sizeof(g_sGrenadeNames); i++) {
            int entindex = CreateEntityByName(g_sGrenadeNames[i]);
            DispatchSpawn(entindex);
            m_iGrenadeOffsets[i] = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
            AcceptEntityInput(entindex, "Kill");
        }
    }
}


Így biztos, hogy a jó offsetet fogod használni (Nem azt mondom, hogy most nem jók mert nem néztem már 1 ideje, de ha valamikor változna akkor így nem kell külön nézegetni hogy most melyiknek mi, stb)

Hogyha több mint 1 sort akarsz kikommentelni akkor azt könnyebb úgy, hogy:
ehelyett:
Kód:
//if(IsPlayerGenericAdmin(client))
   //{
   //   PrintToChatAll("╔════════════════════════╗");
   //   PrintToChatAll("[VIP] %N lecsatlakozott a szerverről", client);
   //   PrintToChatAll("╚════════════════════════╝");
//   } else
//      {
   //      return;
//   }

így:
Kód:
/*if(IsPlayerGenericAdmin(client))
   {
      PrintToChatAll("╔════════════════════════╗");
      PrintToChatAll("[VIP] %N lecsatlakozott a szerverről", client);
      PrintToChatAll("╚════════════════════════╝");
   } else
      {
      return;
   }*/


Szerintem az IsPlayerGenericAdmint és az IsValidClientet lecserélheted ezekre:

Kód:
stock bool IsValidClient(int client)
{
   if(client <= 0) return false;
   if(client > MaxClients) return false;
   if(!IsClientConnected(client)) return false;
   if(IsFakeClient(client)) return false;
   if(IsClientSourceTV(client)) return false;
   return IsClientInGame(client);
}

stock bool IsVIP(int client)
{
   return (CheckCommandAccess(client, "dummytext", ADMFLAG_RESERVATION));
}

stock bool IsAdmin(int client)
{
   return (CheckCommandAccess(client, "dummytext", ADMFLAG_GENERIC));
}

stock bool IsOwner(int client)
{
   return (CheckCommandAccess(client, "dummytext", ADMFLAG_ROOT));
}


A menüknél alapból van EXIT gomb, tehát ez fölösleges:
Kód:
menu.ExitButton = true;


A menüben mi nem működik? Dob ki valami hibát?
A welcome messaget meg így már szerintem megtudod csinálni (if(IsAdmin(client)) .. else if.. else..) [Csak az IsOwnerrel kell kezdened]

_________________
Taking private paid requests in PM

No more FREE requests.
Discord: KillStr3aK#9143 | GitHub


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: [CS:GO] VIP PLUGIN
HozzászólásElküldve: 2020.01.16. 13:43 
Offline
Újonc

Csatlakozott: 2019.01.12. 18:30
Hozzászólások: 13
Egyetlen egy kérdésem lenne ezzel kapcsolatban if(CheckCommandAccess(client, "blabla", ADMFLAG_ROOT).
A "blabla" az pontosan mire szolgál? Bármit megadhatok oda? Mi a lényege?
Azt tudom, hogy ha oda megadom, hogy sm_tulaj pl. akkor az admin_override-ben felülírhatom bármilyen flagra.


UPDATE:
Erre jutottam ma. Minden működik ami benne van, a welcome message-val kicsit még trükközök majd viszont a fegyvermenü megadja a fegyvert, de nem cseréli le a jelenlegit ami nálad van hanem azt dobja el amit kiválasztottál.
Kód:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#include <multicolors>
#include <smlib>

#pragma semicolon 1
#pragma newdecls required



#define DATA "2.0"
#define VIP_PREFIX " ★ \x02[VIP]\x04"
#define ADMIN_PREFIX " ★ \x02[ADMIN]\x04"
#define TULAJ_PREFIX " ★ \x02[TULAJDONOS]\x04"

public Plugin myinfo =
{
   name = "VIP",
   author = "Zendor",
   description = "VIP PLUGIN",
   version = "0.1",
   url = "http://stat.erack.hu"
};

char PrimaryWeapon[MAXPLAYERS + 1][24];
char SecondaryWeapon[MAXPLAYERS + 1][24];

bool PrimarySelected[MAXPLAYERS+1];
bool SecondarySelected[MAXPLAYERS+1];
bool Remember[MAXPLAYERS+1];

Handle HP,
Flashbang,
Smokegrenade,
Hegrenade,
Molotov,
Armorvalue,
Bhashelmet,
Defuser,
Remove_grenade,
Taser,
trie_armas;
// Welcome_message;

char g_sGrenadeNames[][] = {
    "weapon_tagrenade",
    "weapon_smokegrenade",
    "weapon_decoy",
    "weapon_healthshot",
    "weapon_flashbang",
    "weapon_incgrenade"
};

int m_iGrenadeOffsets[sizeof(g_sGrenadeNames)];

Handle timers[MAXPLAYERS + 1];

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.", FCVAR_NONE, true, 0.0, true, 1.0);
//   Welcome_message = CreateConVar("vip_welcome", "1", "Üdvözlő üzenet.", FCVAR_NONE, true, 0.0, true, 1.0);

   
   
   trie_armas = CreateTrie();
   
   AutoExecConfig(true, "VIPBETA");

   HookEvent("player_spawn", Spawn);
   HookEvent("round_start", Event_RoundStart);
   HookEvent("announce_phase_end", ResetAfterTeamChange);
   HookEvent("cs_intermission", ResetAfterTeamChange);
   RegAdminCmd("sm_guns", GunsMenu, ADMFLAG_CUSTOM1);
   RegAdminCmd("sm_gunsmenu", GunsMenu, ADMFLAG_CUSTOM1);

   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);
   ResetClientSettings(client);
}

void ResetClientSettings(int client)
{
    PrimarySelected[client] = false;
    SecondarySelected[client] = false;
    Remember[client] = false;

    PrimaryWeapon[client] = "weapon_m4a1";
    SecondaryWeapon[client] = "weapon_glock";
}

public void OnClientPostAdminCheck(int client)
{
   if (IsVIP(client)) timers[client] = CreateTimer(3.0, Darm, client, TIMER_REPEAT);
}

public void OnClientDisconnect(int client)
{
   if(timers[client] != INVALID_HANDLE)
   {
      KillTimer(timers[client]);
      timers[client] = INVALID_HANDLE;
   }
}

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(IsVIP(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) && IsVIP(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(RoundCount > 1)
   {
      if(Remember[client])
      {
         GiveLastWeapons(client);
      }
      else
      {
         Weapons(client);
      }
   }
         
      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");
      }
   }
}

public void Weapons(int client)
{
    Menu menu = new Menu(Weapon_Menu);

    menu.SetTitle("[VIP] Fegyvermenü");
    menu.AddItem("new", "Új fegyvert választok");
    menu.AddItem("old", "Az előzőt használom");
    menu.AddItem("olddontask", "Az előzőt használom[Ne kérdezze meg újra]");

    menu.ExitButton = false;
    menu.Display(client, 15);
}


stock void StripNades(int client)
{
    while(RemoveWeaponBySlot(client, 3)){}
    for(int i = 0; i < 6; i++)
   SetEntProp(client, Prop_Send, "m_iAmmo", 0, _, m_iGrenadeOffsets[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;
}



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");
      }
   }
}


stock bool IsValidClient(int client, bool alive = false)
{
   if(client <= 0) return false;
   if(client > MaxClients) return false;
   if(!IsClientConnected(client)) return false;
   if(IsFakeClient(client)) return false;
   if(IsClientSourceTV(client)) return false;
   return IsClientInGame(client);
}


stock bool IsVIP(int client)
{
   return (CheckCommandAccess(client, "sm_vipjog", ADMFLAG_CUSTOM1));
}

stock bool IsAdmin(int client)
{
   return (CheckCommandAccess(client, "sm_adminjog", ADMFLAG_GENERIC));
}

stock bool IsOwner(int client)
{
   return (CheckCommandAccess(client, "sm_tulaj", ADMFLAG_ROOT));
}

public Action GunsMenu(int client, int args)
{
    if(!IsPlayerAlive(client))
    {
        return Plugin_Handled;
    }
    if(Remember[client])
    {
        Remember[client] = false;
        CPrintToChat(client, "[{lightred}VIP{default}] Újrabekapcsoltad a fegyvermenüt!");
        if(RoundCount > 1) {
        PrimarySelected[client] = true;
        }
        SecondarySelected[client] = true;
        return Plugin_Handled;
    }

    if(!PrimarySelected[client] && !SecondarySelected[client])
    {
        Weapons(client);
    }
    else
    {
        CPrintToChat(client, "[{lightred}VIP{default}] Már kiválasztottad a fegyvered!");
        return Plugin_Handled;
    }

    return Plugin_Continue;
}

public int Weapon_Menu(Menu menu, MenuAction action, int client, int param2)
{
    switch(action)
    {
        case MenuAction_Select:
        {
            char info[32];
            menu.GetItem(param2, info, sizeof(info));

            if (StrEqual(info, "new"))
            {
                SelectPrimaryWeapon(client);
                Remember[client] = false; 
            }
            else if (StrEqual(info, "old"))
            {
                GiveLastWeapons(client);
                Remember[client] = false; 
            }
            else if (StrEqual(info, "olddontask"))
            {
                CPrintToChat(client, "[{lightred}VIP{default}] Visszakapcsolhatod a fegyvermenüt ha újra beírod a chatbe {green}!guns{default}.");
                GiveLastWeapons(client);
                Remember[client] = true;
            }
        }

        case MenuAction_End:{delete menu;}
    }

    return 0;
}

public void SelectPrimaryWeapon(int client)
{
    Menu menu = new Menu(PrimaryWeapon_Menu);

    menu.SetTitle("Elsődleges fegyver");
    menu.AddItem("ak", "AK-47");
    menu.AddItem("mka", "M4A4");
    menu.AddItem("zagmka", "M4A1-S");
    menu.AddItem("awp", "AWP");
    menu.AddItem("sig553", "Sig 553");
    menu.AddItem("aug", "Aug");
    menu.AddItem("famas", "Famas");
    menu.AddItem("galil", "Galil AR");
    menu.AddItem("scout", "Scout");
    menu.AddItem("negev", "Negev");
    menu.AddItem("mac10", "Mac-10");
    menu.AddItem("pro90", "P90");
    menu.AddItem("nova", "Nova");
    menu.AddItem("xm1014", "XM1014");
    menu.AddItem("mag7", "MAG-7");

    menu.ExitButton = false;
    menu.Display(client, 15);
}


public int PrimaryWeapon_Menu(Menu menu, MenuAction action, int client, int param2)
{
    switch(action)
    {
        case MenuAction_Select:
        {
            char info[32];
            menu.GetItem(param2, info, sizeof(info));

            if (StrEqual(info, "ak"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_ak47");
                PrimaryWeapon[client] = "weapon_ak47";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "mka"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_m4a1");
                PrimaryWeapon[client] = "weapon_m4a1";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "zagmka"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_m4a1_silencer");
                PrimaryWeapon[client] = "weapon_m4a1_silencer";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "sig553"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_sg556");
                PrimaryWeapon[client] = "weapon_sg556";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "aug"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_aug");
                PrimaryWeapon[client] = "weapon_aug";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "famas"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_famas");
                PrimaryWeapon[client] = "weapon_famas";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "galil"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_galilar");
                PrimaryWeapon[client] = "weapon_galilar";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "negev"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_negev");
                PrimaryWeapon[client] = "weapon_negev";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "mac10"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_mac10");
                PrimaryWeapon[client] = "weapon_mac10";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "pro90"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_p90");
                PrimaryWeapon[client] = "weapon_p90";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "nova"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_nova");
                PrimaryWeapon[client] = "weapon_nova";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "xm1014"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_xm1014");
                PrimaryWeapon[client] = "weapon_xm1014";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "mag7"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_mag7");
                PrimaryWeapon[client] = "weapon_mag7";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "awp"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_awp");
                PrimaryWeapon[client] = "weapon_awp";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "scout"))
            {
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_ssg08");
                PrimaryWeapon[client] = "weapon_ssg08";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
        }

        case MenuAction_End:{delete menu;}
    }

    return 0;
}

public void SelectSecondaryWeapon(int client)
{
    Menu menu = new Menu(SecondaryWeapon_Menu);

    menu.SetTitle("Másodlagos fegyver");
    menu.AddItem("glock", "Glock-18");
    menu.AddItem("usps", "USP-S");
    menu.AddItem("usp", "P2000");
    menu.AddItem("p250", "P250");
    menu.AddItem("deagle", "Desert Eagle");
    menu.AddItem("revol", "R8 Revolver");
    menu.AddItem("f7", "Five-SeveN");
    menu.AddItem("dualbar", "Dual Berettas");
    menu.AddItem("tec9", "Tec-9");
    menu.AddItem("czauto", "CZ75-Auto");

    menu.ExitButton = false;
    menu.Display(client, 15);
}


public int SecondaryWeapon_Menu(Menu menu, MenuAction action, int client, int param2)
{
    switch(action)
    {
        case MenuAction_Select:
        {
            char info[32];
            menu.GetItem(param2, info, sizeof(info));

            if (StrEqual(info, "glock"))
            {
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_glock");
                SecondaryWeapon[client] = "weapon_glock";
            }
            else if (StrEqual(info, "usps"))
            {
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_usp_silencer");
                SecondaryWeapon[client] = "weapon_usp_silencer";
            }
            else if (StrEqual(info, "usp"))
            {
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_hkp2000");
                SecondaryWeapon[client] = "weapon_hkp2000";
            }
            else if (StrEqual(info, "p250"))
            {
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_p250");
                SecondaryWeapon[client] = "weapon_p250";
            }
            else if (StrEqual(info, "p250"))
            {
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_p250");
                SecondaryWeapon[client] = "weapon_p250";
            }
            else if (StrEqual(info, "deagle"))
            {
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_deagle");
                SecondaryWeapon[client] = "weapon_deagle";
            }
            else if (StrEqual(info, "revol"))
            {
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_revolver");
                SecondaryWeapon[client] = "weapon_revolver";
            }
            else if (StrEqual(info, "f7"))
            {
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_fiveseven");
                SecondaryWeapon[client] = "weapon_fiveseven";
            }
            else if (StrEqual(info, "dualbar"))
            {
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_elite");
                SecondaryWeapon[client] = "weapon_elite";
            }
            else if (StrEqual(info, "tec9"))
            {
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_tec9");
                SecondaryWeapon[client] = "weapon_tec9";
            }
            else if (StrEqual(info, "czauto"))
            {
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_cz75a");
                SecondaryWeapon[client] = "weapon_cz75a";
            }
        }

        case MenuAction_End:{delete menu;}
    }

    return 0;
}

void GiveLastWeapons(int client)
{
    GivePlayerItem(client, PrimaryWeapon[client]);
    GivePlayerItem(client, SecondaryWeapon[client]);
    PrimarySelected[client] = true;
    SecondarySelected[client] = true;
}


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: [CS:GO] VIP PLUGIN
HozzászólásElküldve: 2020.01.16. 16:09 
Offline
Senior Tag
Avatar

Csatlakozott: 2013.12.18. 13:57
Hozzászólások: 212
Megköszönt másnak: 13 alkalommal
Megköszönték neki: 17 alkalommal
Zendor20000 írta:
Egyetlen egy kérdésem lenne ezzel kapcsolatban if(CheckCommandAccess(client, "blabla", ADMFLAG_ROOT).
A "blabla" az pontosan mire szolgál? Bármit megadhatok oda? Mi a lényege?
Azt tudom, hogy ha oda megadom, hogy sm_tulaj pl. akkor az admin_override-ben felülírhatom bármilyen flagra.


Jelenleg, akkor fut le az a függvény hogyha van a "blabla" parancshoz hozzáférése VAGY van Z joga
Hogyha azt akarod hogy tényleg csak akkor fusson le ha van Z joga(tehát ez a fő-fő feltétel) akkor olyan parancsot érdemes oda be írni amit csak Z jog tud használni, vagy nem létezik, vagy ha létezik akkor ugye felülírni

Előfordulhat olyan, hogy pl CheckCommandAccess(client, "sm_admin", ADMFLAG_ROOT)-el akarod ellenőrizni azt, hogy van Z joga vagy sem
tegyük fel hogy ha van, akkor adni akarsz neki egy "TULAJ" csoportcímkét, amit meg is fog kapni mivel van Z joga
De mivel az sm_admin parancshoz van hozzáférése az ADMFLAG_GENERIC (flag b)-nek is így ő is ugyan úgy megfogja kapni a "TULAJ" csoportcímkét

_________________
Taking private paid requests in PM

No more FREE requests.
Discord: KillStr3aK#9143 | GitHub


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: [CS:GO] VIP PLUGIN
HozzászólásElküldve: 2020.01.16. 16:35 
Offline
Újonc

Csatlakozott: 2019.01.12. 18:30
Hozzászólások: 13
És azt megtudom valahogy oldani, hogy a fegyvermenü felülírja azt a fegyvert ami jelenleg a játékosnál van? Ne dobja le a földre.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: [CS:GO] VIP PLUGIN
HozzászólásElküldve: 2020.01.16. 17:54 
Offline
Senior Tag
Avatar

Csatlakozott: 2013.12.18. 13:57
Hozzászólások: 212
Megköszönt másnak: 13 alkalommal
Megköszönték neki: 17 alkalommal
Zendor20000 írta:
És azt megtudom valahogy oldani, hogy a fegyvermenü felülírja azt a fegyvert ami jelenleg a játékosnál van? Ne dobja le a földre.


Ha elveszed tőle a fegyvert előtte, akkor nem fogja kidobni

Kód:
stock void RemovePlayerPistol(int client) {
    int fegya;
    for (int i = 0; i < 6; i++)
    {
      fegya = GetPlayerWeaponSlot(client, i);
      if(IsValidEntity(fegya) && i == 1)
      {
         RemovePlayerItem(client, fegya);
      }
   }
}

stock void RemovePlayerPrimary(int client) {
    int fegya;
    for (int i = 0; i < 6; i++)
    {
      fegya = GetPlayerWeaponSlot(client, i);
      if(IsValidEntity(fegya) && i == 0)
      {
         RemovePlayerItem(client, fegya);
      }
   }
}

stock void RemovePlayerKnife(int client) {
    int fegya;
    for (int i = 0; i < 6; i++)
    {
      fegya = GetPlayerWeaponSlot(client, i);
      if(IsValidEntity(fegya) && i == 2)
      {
         RemovePlayerItem(client, fegya);
      }
   }
}

stock bool IsThisKnife(char[] knifename)
{
   if(IsStrContains(knifename, "knife") ||
       IsStrContains(knifename, "bayonet"))
       return true;

   return false;
}

stock bool IsSMG(char[] weapon)
{
   return (IsStrContains(weapon, "mp9") ||
         IsStrContains(weapon, "p90") ||
         IsStrContains(weapon, "mac10") ||
         IsStrContains(weapon, "ump45") ||
         IsStrContains(weapon, "mp7") ||
         IsStrContains(weapon, "mp5sd") ||
         IsStrContains(weapon, "bizon"))
}

stock bool IsHeavy(char[] weapon)
{
   return (IsStrContains(weapon, "nova") ||
         IsStrContains(weapon, "xm1014") ||
         IsStrContains(weapon, "mag7") ||
         IsStrContains(weapon, "negev") ||
         IsStrContains(weapon, "sawedoff"))
}

stock bool IsPistol(char[] weapon)
{
   return (IsStrContains(weapon, "deagle") ||
         IsStrContains(weapon, "usp_silencer") ||
         IsStrContains(weapon, "hkp2000") ||
         IsStrContains(weapon, "glock") ||
         IsStrContains(weapon, "elite") ||
         IsStrContains(weapon, "p250") ||
         IsStrContains(weapon, "cz75a") ||
         IsStrContains(weapon, "fiveseven") ||
         IsStrContains(weapon, "tec9") ||
         IsStrContains(weapon, "revolver"))
}

stock bool IsRifle(char[] weapon)
{
   return (IsStrContains(weapon, "awp") ||
         IsStrContains(weapon, "ak47") ||
         IsStrContains(weapon, "m4a1") ||
         IsStrContains(weapon, "famas") ||
         IsStrContains(weapon, "galilar") ||
         IsStrContains(weapon, "ssg08") ||
         IsStrContains(weapon, "sg556") ||
         IsStrContains(weapon, "aug") ||
         IsStrContains(weapon, "scar20") ||
         IsStrContains(weapon, "g3sg1"))
}

stock bool IsStrContains(char[] String, char[] Text, bool caseSensitive = false)
{
   if((StrContains(String, Text, caseSensitive) != -1))
      return true;

   return false;
}


Ezekkel szerintem megtudod oldani

_________________
Taking private paid requests in PM

No more FREE requests.
Discord: KillStr3aK#9143 | GitHub


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: [CS:GO] VIP PLUGIN
HozzászólásElküldve: 2020.01.16. 19:37 
Offline
Újonc

Csatlakozott: 2019.01.12. 18:30
Hozzászólások: 13
Nexd írta:
Zendor20000 írta:
És azt megtudom valahogy oldani, hogy a fegyvermenü felülírja azt a fegyvert ami jelenleg a játékosnál van? Ne dobja le a földre.


Ha elveszed tőle a fegyvert előtte, akkor nem fogja kidobni

Kód:
stock void RemovePlayerPistol(int client) {
    int fegya;
    for (int i = 0; i < 6; i++)
    {
      fegya = GetPlayerWeaponSlot(client, i);
      if(IsValidEntity(fegya) && i == 1)
      {
         RemovePlayerItem(client, fegya);
      }
   }
}

stock void RemovePlayerPrimary(int client) {
    int fegya;
    for (int i = 0; i < 6; i++)
    {
      fegya = GetPlayerWeaponSlot(client, i);
      if(IsValidEntity(fegya) && i == 0)
      {
         RemovePlayerItem(client, fegya);
      }
   }
}

stock void RemovePlayerKnife(int client) {
    int fegya;
    for (int i = 0; i < 6; i++)
    {
      fegya = GetPlayerWeaponSlot(client, i);
      if(IsValidEntity(fegya) && i == 2)
      {
         RemovePlayerItem(client, fegya);
      }
   }
}

stock bool IsThisKnife(char[] knifename)
{
   if(IsStrContains(knifename, "knife") ||
       IsStrContains(knifename, "bayonet"))
       return true;

   return false;
}

stock bool IsSMG(char[] weapon)
{
   return (IsStrContains(weapon, "mp9") ||
         IsStrContains(weapon, "p90") ||
         IsStrContains(weapon, "mac10") ||
         IsStrContains(weapon, "ump45") ||
         IsStrContains(weapon, "mp7") ||
         IsStrContains(weapon, "mp5sd") ||
         IsStrContains(weapon, "bizon"))
}

stock bool IsHeavy(char[] weapon)
{
   return (IsStrContains(weapon, "nova") ||
         IsStrContains(weapon, "xm1014") ||
         IsStrContains(weapon, "mag7") ||
         IsStrContains(weapon, "negev") ||
         IsStrContains(weapon, "sawedoff"))
}

stock bool IsPistol(char[] weapon)
{
   return (IsStrContains(weapon, "deagle") ||
         IsStrContains(weapon, "usp_silencer") ||
         IsStrContains(weapon, "hkp2000") ||
         IsStrContains(weapon, "glock") ||
         IsStrContains(weapon, "elite") ||
         IsStrContains(weapon, "p250") ||
         IsStrContains(weapon, "cz75a") ||
         IsStrContains(weapon, "fiveseven") ||
         IsStrContains(weapon, "tec9") ||
         IsStrContains(weapon, "revolver"))
}

stock bool IsRifle(char[] weapon)
{
   return (IsStrContains(weapon, "awp") ||
         IsStrContains(weapon, "ak47") ||
         IsStrContains(weapon, "m4a1") ||
         IsStrContains(weapon, "famas") ||
         IsStrContains(weapon, "galilar") ||
         IsStrContains(weapon, "ssg08") ||
         IsStrContains(weapon, "sg556") ||
         IsStrContains(weapon, "aug") ||
         IsStrContains(weapon, "scar20") ||
         IsStrContains(weapon, "g3sg1"))
}

stock bool IsStrContains(char[] String, char[] Text, bool caseSensitive = false)
{
   if((StrContains(String, Text, caseSensitive) != -1))
      return true;

   return false;
}


Ezekkel szerintem megtudod oldani



Nagyon szépen köszönöm! Sikerült is!
Jelenleg így néz ki a plugin:
Kód:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#include <multicolors>
#include <smlib>

#pragma semicolon 1
#pragma newdecls required



#define DATA "2.0"
#define VIP_PREFIX " ★ \x02[VIP]\x04"
#define ADMIN_PREFIX " ★ \x02[ADMIN]\x04"
#define TULAJ_PREFIX " ★ \x02[TULAJDONOS]\x04"

public Plugin myinfo =
{
   name = "VIP",
   author = "Zendor",
   description = "VIP PLUGIN",
   version = "0.1",
   url = "http://stat.erack.hu"
};

char PrimaryWeapon[MAXPLAYERS + 1][24];
char SecondaryWeapon[MAXPLAYERS + 1][24];

bool PrimarySelected[MAXPLAYERS+1];
bool SecondarySelected[MAXPLAYERS+1];
bool Remember[MAXPLAYERS+1];

Handle HP,
Flashbang,
Smokegrenade,
Hegrenade,
Molotov,
Armorvalue,
Bhashelmet,
Defuser,
Remove_grenade,
Taser,
trie_armas;
// Welcome_message;

char g_sGrenadeNames[][] = {
    "weapon_tagrenade",
    "weapon_smokegrenade",
    "weapon_decoy",
    "weapon_healthshot",
    "weapon_flashbang",
    "weapon_incgrenade"
};

int m_iGrenadeOffsets[sizeof(g_sGrenadeNames)];

Handle timers[MAXPLAYERS + 1];

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.", FCVAR_NONE, true, 0.0, true, 1.0);
//   Welcome_message = CreateConVar("vip_welcome", "1", "Üdvözlő üzenet.", FCVAR_NONE, true, 0.0, true, 1.0);

   
   
   trie_armas = CreateTrie();
   
   AutoExecConfig(true, "VIPBETA");

   HookEvent("player_spawn", Spawn);
   HookEvent("round_start", Event_RoundStart);
   HookEvent("announce_phase_end", ResetAfterTeamChange);
   HookEvent("cs_intermission", ResetAfterTeamChange);
   RegAdminCmd("sm_guns", GunsMenu, ADMFLAG_CUSTOM1);
   RegAdminCmd("sm_gunsmenu", GunsMenu, ADMFLAG_CUSTOM1);

   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);
   ResetClientSettings(client);
}

void ResetClientSettings(int client)
{
    PrimarySelected[client] = false;
    SecondarySelected[client] = false;
    Remember[client] = false;

    PrimaryWeapon[client] = "weapon_m4a1";
    SecondaryWeapon[client] = "weapon_glock";
}

public void OnClientPostAdminCheck(int client)
{
    if(IsOwner(client))
    {
        PrintToChatAll("╔════════════════════════╗");
        PrintToChatAll("%s %N csatlakozott a szerverre", TULAJ_PREFIX, client);
        PrintToChatAll("╚════════════════════════╝");
    }
    else if(IsAdmin(client))
    {
        PrintToChatAll("╔════════════════════════╗");
        PrintToChatAll("%s %N csatlakozott a szerverre", ADMIN_PREFIX, client);
        PrintToChatAll("╚════════════════════════╝");
    }
    else if (IsVIP(client))
    {
        timers[client] = CreateTimer(3.0, Darm, client, TIMER_REPEAT);
        PrintToChatAll("╔════════════════════════╗");
        PrintToChatAll("%s %N csatlakozott a szerverre", VIP_PREFIX, client);
        PrintToChatAll("╚════════════════════════╝");
    }
    else
    {
        return;
    }
}

public void OnClientDisconnect(int client)
{
   if(timers[client] != INVALID_HANDLE)
   {
      KillTimer(timers[client]);
      timers[client] = INVALID_HANDLE;
   }
}

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(IsVIP(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) && IsVIP(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(RoundCount > 1)
   {
      if(Remember[client])
      {
         GiveLastWeapons(client);
      }
      else
      {
         Weapons(client);
      }
   }
         
      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");
      }
   }
}

public void Weapons(int client)
{
    Menu menu = new Menu(Weapon_Menu);

    menu.SetTitle("[VIP] Fegyvermenü");
    menu.AddItem("new", "Új fegyvert választok");
    menu.AddItem("old", "Az előzőt használom");
    menu.AddItem("olddontask", "Az előzőt használom[Ne kérdezze meg újra]");

    menu.ExitButton = false;
    menu.Display(client, 15);
}


stock void StripNades(int client)
{
    while(RemoveWeaponBySlot(client, 3)){}
    for(int i = 0; i < 6; i++)
   SetEntProp(client, Prop_Send, "m_iAmmo", 0, _, m_iGrenadeOffsets[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;
}



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");
      }
   }
}


stock bool IsValidClient(int client, bool alive = false)
{
   if(client <= 0) return false;
   if(client > MaxClients) return false;
   if(!IsClientConnected(client)) return false;
   if(IsFakeClient(client)) return false;
   if(IsClientSourceTV(client)) return false;
   return IsClientInGame(client);
}


stock bool IsVIP(int client)
{
   return (CheckCommandAccess(client, "sm_vipjog", ADMFLAG_CUSTOM1));
}

stock bool IsAdmin(int client)
{
   return (CheckCommandAccess(client, "sm_adminjog", ADMFLAG_GENERIC));
}

stock bool IsOwner(int client)
{
   return (CheckCommandAccess(client, "sm_tulaj", ADMFLAG_ROOT));
}

public Action GunsMenu(int client, int args)
{
    if(!IsPlayerAlive(client))
    {
        return Plugin_Handled;
    }
    if(Remember[client])
    {
        Remember[client] = false;
        CPrintToChat(client, "[{lightred}VIP{default}] Újrabekapcsoltad a fegyvermenüt!");
        if(RoundCount > 1) {
        PrimarySelected[client] = true;
        }
        SecondarySelected[client] = true;
        return Plugin_Handled;
    }

    if(!PrimarySelected[client] && !SecondarySelected[client])
    {
        Weapons(client);
    }
    else
    {
        CPrintToChat(client, "[{lightred}VIP{default}] Már kiválasztottad a fegyvered!");
        return Plugin_Handled;
    }

    return Plugin_Continue;
}

public int Weapon_Menu(Menu menu, MenuAction action, int client, int param2)
{
    switch(action)
    {
        case MenuAction_Select:
        {
            char info[32];
            menu.GetItem(param2, info, sizeof(info));

            if (StrEqual(info, "new"))
            {
                SelectPrimaryWeapon(client);
                Remember[client] = false; 
            }
            else if (StrEqual(info, "old"))
            {
                GiveLastWeapons(client);
                Remember[client] = false;
            }
            else if (StrEqual(info, "olddontask"))
            {
                CPrintToChat(client, "[{lightred}VIP{default}] Visszakapcsolhatod a fegyvermenüt ha újra beírod a chatbe {green}!guns{default}.");
                GiveLastWeapons(client);
                Remember[client] = true;
            }
        }

        case MenuAction_End:{delete menu;}
    }

    return 0;
}

public void SelectPrimaryWeapon(int client)
{
    Menu menu = new Menu(PrimaryWeapon_Menu);

    menu.SetTitle("Elsődleges fegyver");
    menu.AddItem("ak", "AK-47");
    menu.AddItem("mka", "M4A4");
    menu.AddItem("zagmka", "M4A1-S");
    menu.AddItem("awp", "AWP");
    menu.AddItem("sig553", "Sig 553");
    menu.AddItem("aug", "Aug");
    menu.AddItem("famas", "Famas");
    menu.AddItem("galil", "Galil AR");
    menu.AddItem("scout", "Scout");
    menu.AddItem("negev", "Negev");
    menu.AddItem("mac10", "Mac-10");
    menu.AddItem("pro90", "P90");
    menu.AddItem("nova", "Nova");
    menu.AddItem("xm1014", "XM1014");
    menu.AddItem("mag7", "MAG-7");

    menu.ExitButton = false;
    menu.Display(client, 15);
}


public int PrimaryWeapon_Menu(Menu menu, MenuAction action, int client, int param2)
{
    switch(action)
    {
        case MenuAction_Select:
        {
            char info[32];
            menu.GetItem(param2, info, sizeof(info));
            if (StrEqual(info, "ak"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_ak47");
                PrimaryWeapon[client] = "weapon_ak47";

                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "mka"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_m4a1");
                PrimaryWeapon[client] = "weapon_m4a1";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "zagmka"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_m4a1_silencer");
                PrimaryWeapon[client] = "weapon_m4a1_silencer";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "sig553"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_sg556");
                PrimaryWeapon[client] = "weapon_sg556";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "aug"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_aug");
                PrimaryWeapon[client] = "weapon_aug";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "famas"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_famas");
                PrimaryWeapon[client] = "weapon_famas";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "galil"))
            {
                PrimarySelected[client] = true;
                RemovePlayerPrimary(client);
                GivePlayerItem(client, "weapon_galilar");
                PrimaryWeapon[client] = "weapon_galilar";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "negev"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_negev");
                PrimaryWeapon[client] = "weapon_negev";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "mac10"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_mac10");
                PrimaryWeapon[client] = "weapon_mac10";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "pro90"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_p90");
                PrimaryWeapon[client] = "weapon_p90";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "nova"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_nova");
                PrimaryWeapon[client] = "weapon_nova";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "xm1014"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_xm1014");
                PrimaryWeapon[client] = "weapon_xm1014";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "mag7"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_mag7");
                PrimaryWeapon[client] = "weapon_mag7";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "awp"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_awp");
                PrimaryWeapon[client] = "weapon_awp";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
            else if (StrEqual(info, "scout"))
            {
                RemovePlayerPrimary(client);
                PrimarySelected[client] = true;
                GivePlayerItem(client, "weapon_ssg08");
                PrimaryWeapon[client] = "weapon_ssg08";
                if(!SecondarySelected[client])
                {
                    SelectSecondaryWeapon(client);
                }
            }
        }

        case MenuAction_End:{delete menu;}
    }

    return 0;
}

public void SelectSecondaryWeapon(int client)
{
    Menu menu = new Menu(SecondaryWeapon_Menu);

    menu.SetTitle("Másodlagos fegyver");
    menu.AddItem("glock", "Glock-18");
    menu.AddItem("usps", "USP-S");
    menu.AddItem("usp", "P2000");
    menu.AddItem("p250", "P250");
    menu.AddItem("deagle", "Desert Eagle");
    menu.AddItem("revol", "R8 Revolver");
    menu.AddItem("f7", "Five-SeveN");
    menu.AddItem("dualbar", "Dual Berettas");
    menu.AddItem("tec9", "Tec-9");
    menu.AddItem("czauto", "CZ75-Auto");

    menu.ExitButton = false;
    menu.Display(client, 15);
}


public int SecondaryWeapon_Menu(Menu menu, MenuAction action, int client, int param2)
{
    switch(action)
    {
        case MenuAction_Select:
        {
            char info[32];
            menu.GetItem(param2, info, sizeof(info));

            if (StrEqual(info, "glock"))
            {
                RemovePlayerPistol(client);
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_glock");
                SecondaryWeapon[client] = "weapon_glock";
            }
            else if (StrEqual(info, "usps"))
            {
                RemovePlayerPistol(client);
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_usp_silencer");
                SecondaryWeapon[client] = "weapon_usp_silencer";
            }
            else if (StrEqual(info, "usp"))
            {
                RemovePlayerPistol(client);
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_hkp2000");
                SecondaryWeapon[client] = "weapon_hkp2000";
            }
            else if (StrEqual(info, "p250"))
            {
                RemovePlayerPistol(client);
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_p250");
                SecondaryWeapon[client] = "weapon_p250";
            }
            else if (StrEqual(info, "p250"))
            {
                RemovePlayerPistol(client);
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_p250");
                SecondaryWeapon[client] = "weapon_p250";
            }
            else if (StrEqual(info, "deagle"))
            {
                RemovePlayerPistol(client);
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_deagle");
                SecondaryWeapon[client] = "weapon_deagle";
            }
            else if (StrEqual(info, "revol"))
            {
                RemovePlayerPistol(client);
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_revolver");
                SecondaryWeapon[client] = "weapon_revolver";
            }
            else if (StrEqual(info, "f7"))
            {
                RemovePlayerPistol(client);
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_fiveseven");
                SecondaryWeapon[client] = "weapon_fiveseven";
            }
            else if (StrEqual(info, "dualbar"))
            {
                RemovePlayerPistol(client);
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_elite");
                SecondaryWeapon[client] = "weapon_elite";
            }
            else if (StrEqual(info, "tec9"))
            {
                RemovePlayerPistol(client);
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_tec9");
                SecondaryWeapon[client] = "weapon_tec9";
            }
            else if (StrEqual(info, "czauto"))
            {
                RemovePlayerPistol(client);
                SecondarySelected[client] = true;
                GivePlayerItem(client, "weapon_cz75a");
                SecondaryWeapon[client] = "weapon_cz75a";
                RemovePlayerPistol(client);
            }
        }

        case MenuAction_End:{delete menu;}
    }

    return 0;
}

void GiveLastWeapons(int client)
{
    GivePlayerItem(client, PrimaryWeapon[client]);
    GivePlayerItem(client, SecondaryWeapon[client]);
    PrimarySelected[client] = true;
    SecondarySelected[client] = true;
}

stock void RemovePlayerPistol(int client) {
    int fegya;
    for (int i = 0; i < 6; i++)
    {
      fegya = GetPlayerWeaponSlot(client, i);
      if(IsValidEntity(fegya) && i == 1)
      {
         RemovePlayerItem(client, fegya);
      }
   }
}

stock void RemovePlayerPrimary(int client) {
    int fegya;
    for (int i = 0; i < 6; i++)
    {
      fegya = GetPlayerWeaponSlot(client, i);
      if(IsValidEntity(fegya) && i == 0)
      {
         RemovePlayerItem(client, fegya);
      }
   }
}


stock bool IsThisKnife(char[] knifename)
{
   if(IsStrContains(knifename, "knife") ||
       IsStrContains(knifename, "bayonet"))
       return true;

   return false;
}

stock bool IsSMG(char[] weapon)
{
   return (IsStrContains(weapon, "mp9") ||
         IsStrContains(weapon, "p90") ||
         IsStrContains(weapon, "mac10") ||
         IsStrContains(weapon, "ump45") ||
         IsStrContains(weapon, "mp7") ||
         IsStrContains(weapon, "mp5sd") ||
         IsStrContains(weapon, "bizon"))
}

stock bool IsHeavy(char[] weapon)
{
   return (IsStrContains(weapon, "nova") ||
         IsStrContains(weapon, "xm1014") ||
         IsStrContains(weapon, "mag7") ||
         IsStrContains(weapon, "negev") ||
         IsStrContains(weapon, "sawedoff"))
}

stock bool IsPistol(char[] weapon)
{
   return (IsStrContains(weapon, "deagle") ||
         IsStrContains(weapon, "usp_silencer") ||
         IsStrContains(weapon, "hkp2000") ||
         IsStrContains(weapon, "glock") ||
         IsStrContains(weapon, "elite") ||
         IsStrContains(weapon, "p250") ||
         IsStrContains(weapon, "cz75a") ||
         IsStrContains(weapon, "fiveseven") ||
         IsStrContains(weapon, "tec9") ||
         IsStrContains(weapon, "revolver"))
}

stock bool IsRifle(char[] weapon)
{
   return (IsStrContains(weapon, "awp") ||
         IsStrContains(weapon, "ak47") ||
         IsStrContains(weapon, "m4a1") ||
         IsStrContains(weapon, "famas") ||
         IsStrContains(weapon, "galilar") ||
         IsStrContains(weapon, "ssg08") ||
         IsStrContains(weapon, "sg556") ||
         IsStrContains(weapon, "aug") ||
         IsStrContains(weapon, "scar20") ||
         IsStrContains(weapon, "g3sg1"))
}

stock bool IsStrContains(char[] String, char[] Text, bool caseSensitive = false)
{
   if((StrContains(String, Text, caseSensitive) != -1))
      return true;

   return false;
}


Nélküled nem lett volna se motivációm se kedvem megcsinálni. Tudásom meg végképp.
Elég sokat tanultam eme kis plugin megírása közben.
Kezdve az old és a transitional syntax közti különbséget. Már engem is zavar az oldsyntax ha megnyitok egy plugint. Igaz nem tudom 100%-ban megkülönböztetni őket, de amiket ismerek az megy. :D
Ha van valami ötleted amit még beleírhatnék, hogy azzal is gyakoroljak nyugodtan írd le azt megpróbálkozom vele.


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 19 hozzászólás ]  Oldal 1 2 Következő


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 1 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség és a hlmod.hu csapata
Portal: Kiss Portal Extension © Michael O'Toole