Can you make this plugin compatible for zephyrus store?
PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools_entinput>
#include <sdktools_functions>
#include <shop>
public Plugin myinfo =
{
name = "[Shop] New weapons",
author = "Drumanid",
version = "1.0.2",
url = ""
};
char g_sBuffer[MAXPLAYERS +1][32];
float g_fDamage;
#define VE(%0) view_as<EventHook>(%0)
#define LC(%0) for(int %0 = 1; %0 <= MaxClients; ++%0) if(IsClientInGame(%0))
public void OnPluginStart()
{
LoadTranslations("shop_new_weapons.phrases.txt");
LC(iClient)
OnClientPostAdminCheck(iClient);
HookEvent("round_start", VE(RoundStart), EventHookMode_Pre);
HookEvent("player_spawn", VE(PlayerSpawn));
}
public void OnPluginEnd()
{
Shop_UnregisterMe();
}
#define SZF(%0) %0, sizeof(%0)
public void OnMapStart()
{
if(!Shop_IsStarted())
return;
else Shop_UnregisterMe();
char sPath[64];
Shop_GetCfgFile(SZF(sPath), "new_weapons.txt");
KeyValues hKeyValues = CreateKeyValues("new_weapons");
if(!FileToKeyValues(hKeyValues, sPath))
SetFailState("No found file: %s", sPath);
char sName[32], sDescription[64];
hKeyValues.GetString("name", SZF(sName));
hKeyValues.GetString("description", SZF(sDescription));
g_fDamage = hKeyValues.GetFloat("damage", 30.0);
CategoryId category_id = Shop_RegisterCategory("new_weapons", sName, sDescription);
if(hKeyValues.GotoFirstSubKey())
{
do
{
if(hKeyValues.GetSectionName(SZF(sName)) && Shop_StartItem(category_id, sName))
{
hKeyValues.GetString("name", SZF(sName));
Shop_SetInfo(sName, NULL_STRING, hKeyValues.GetNum("price", -1),
hKeyValues.GetNum("sellprice", -1),
Item_Togglable,
hKeyValues.GetNum("duration", 604800));
Shop_SetCallbacks(_, OnEquipItem);
Shop_EndItem();
}
}
while(hKeyValues.GotoNextKey());
}
delete hKeyValues;
}
#define CHECKBLOCK(%0) StrEqual(g_sBuffer[%0], "Block")
public ShopAction OnEquipItem(int iClient, CategoryId category_id,
const char[] sCategory, ItemId item_id, const char[] sItem, bool bIsOn, bool bElapsed)
{
if(CHECKBLOCK(iClient))
{
PrintToChat(iClient, "%t", "Block change weapon");
return Shop_UseOff;
}
if(bIsOn || bElapsed)
{
DeleteWeapon(iClient);
g_sBuffer[iClient] = "Block";
return Shop_UseOff;
}
Shop_ToggleClientCategoryOff(iClient, category_id);
strcopy(g_sBuffer[iClient], sizeof(g_sBuffer[]), sItem);
GiveWeapon(iClient);
return Shop_UseOn;
}
public void OnClientPostAdminCheck(int iClient)
{
g_sBuffer[iClient][0] = 0;
SDKHook(iClient, SDKHook_OnTakeDamage, OnTakeDamageAlive);
}
void RoundStart()
{
LC(iClient)
{
if(CHECKBLOCK(iClient))
g_sBuffer[iClient][0] = 0;
}
}
void PlayerSpawn(Event hEvent)
{
RequestFrame(PlayerSpawnFrame, hEvent.GetInt("userid"));
}
void PlayerSpawnFrame(int iClient)
{
if((iClient = GetClientOfUserId(iClient)) > 0 && IsClientInGame(iClient))
GiveWeapon(iClient);
}
void GiveWeapon(int iClient)
{
if(g_sBuffer[iClient][0] && DeleteWeapon(iClient))
EquipPlayerWeapon(iClient, GivePlayerItem(iClient, g_sBuffer[iClient]));
}
#define ISVALIDCLIENT(%0) (0 < %0 <= MaxClients)
Action OnTakeDamageAlive(int iVictim, int &iAttacker, int &iInflictor, float &fDamage,
int &iDamageType,int &iWeapon, float fDamageForce[3], float fDamagePosition[3])
{
if(!ISVALIDCLIENT(iVictim) || !ISVALIDCLIENT(iAttacker) ||
g_sBuffer[iAttacker][0] == 0 || iDamageType != 4224)
return Plugin_Continue;
fDamage = g_fDamage;
return Plugin_Changed;
}
bool DeleteWeapon(int iClient)
{
if(!IsPlayerAlive(iClient))
return false;
int iWeapon;
while((iWeapon = GetPlayerWeaponSlot(iClient, 2)) != -1)
{
RemovePlayerItem(iClient, iWeapon);
AcceptEntityInput(iWeapon, "Kill");
}
GivePlayerItem(iClient, "weapon_knife");
return true;
}
PHP Code:
"Phrases"
{
"Block change weapon"
{
"en" "You will be able to change weapons only in the new round."
}
}
PHP Code:
"New_Weapons"
{
"name" "New Weapons"
"description" ""
"damage" "30.0"
"weapon_fists"
{
"name" "Fists"
"price" "2000"
"sellprice" "1000"
"duration" "0"
}
"weapon_axe"
{
"name" "Axe"
"price" "2000"
"sellprice" "1000"
"duration" "0"
}
"weapon_hammer"
{
"name" "Hammer"
"price" "2000"
"sellprice" "1000"
"duration" "0"
}
"weapon_spanner"
{
"name" "Spanner"
"price" "2000"
"sellprice" "1000"
"duration" "0"
}
}
__________________