L
life
Крашит сервер!
Добавляет в раздел "Способности " пункт "Длинные прыжки".
Исходник GitHub - R1KO/shop
Автором плагина является RIKO, Я лишь залил плагин из старого раздела форума в новый.
с этим должно работать нормальноC этим плагином Модуль плагина - [VIP] Double Jump не конлфиктует?
Это вы со мной новой версией поделились, или надо обновить ресурс ? :)
Ладно, обновлю, так будет лучше думаю@Иванчо Бальбовски, не знаю. может я что-то правил но не выкладывал. просто приложил ту версию что есть у меня.
1.2 -> 1.4
#pragma semicolon 1
#include <sourcemod>
#include <shop>
#define CATEGORY "ability"
#define ITEM "longjump"
new bool:g_bHasLJ[MAXPLAYERS+1],
Float:g_fLastJump[MAXPLAYERS+1];
new g_iPrice,
g_iSellPrice,
g_iDuration,
ItemId:id,
Float:g_fInterval,
Float:g_fDistance;
new VelocityOffset_0=-1,
VelocityOffset_1=-1,
BaseVelocityOffset=-1;
public Plugin:myinfo =
{
name = "[Shop] Long Jump",
author = "R1KO",
version = "1.4"
};
public OnPluginStart()
{
new Handle:hCvar;
HookConVarChange((hCvar = CreateConVar("sm_shop_longjump_price", "30000", "Стоимость покупки длинных прыжков.")), OnPriceChange);
g_iPrice = GetConVarInt(hCvar);
HookConVarChange((hCvar = CreateConVar("sm_shop_longjump_sellprice", "10000", "Стоимость продажи длинных прыжков.")), OnSellPriceChange);
g_iSellPrice = GetConVarInt(hCvar);
HookConVarChange((hCvar = CreateConVar("sm_shop_longjump_duration", "2592000", "Длительность длинных прыжков в секундах.")), OnDurationChange);
g_iDuration = GetConVarInt(hCvar);
HookConVarChange((hCvar = CreateConVar("sm_shop_longjump_interval", "2.0", "Время между прижками")), OnIntervalChange);
g_fInterval = GetConVarFloat(hCvar);
HookConVarChange((hCvar = CreateConVar("sm_shop_longjump_distance", "1.2", "Усиление прыжка")), OnDistanceChange);
g_fDistance = GetConVarFloat(hCvar);
AutoExecConfig(true, "shop_longjump", "shop");
CloseHandle(hCvar);
VelocityOffset_0 = GetSendPropOffset("CBasePlayer", "m_vecVelocity[0]");
VelocityOffset_1 = GetSendPropOffset("CBasePlayer", "m_vecVelocity[1]");
BaseVelocityOffset = GetSendPropOffset("CBasePlayer", "m_vecBaseVelocity");
HookEvent("player_jump", Event_PlayerJump);
if (Shop_IsStarted()) Shop_Started();
}
GetSendPropOffset(const String:sNetClass[], const String:sPropertyName[])
{
new iOffset = FindSendPropOffs(sNetClass, sPropertyName);
if (iOffset == -1) SetFailState("Fatal Error: Unable to find offset: \"%s::%s\"", sNetClass, sPropertyName);
return iOffset;
}
public OnPriceChange(Handle:hCvar, const String:oldValue[], const String:newValue[]) if(id != INVALID_ITEM) g_iPrice = GetConVarInt(hCvar);
public OnSellPriceChange(Handle:hCvar, const String:oldValue[], const String:newValue[]) if(id != INVALID_ITEM) g_iSellPrice = GetConVarInt(hCvar);
public OnDurationChange(Handle:hCvar, const String:oldValue[], const String:newValue[]) if(id != INVALID_ITEM) g_iDuration = GetConVarInt(hCvar);
public OnIntervalChange(Handle:hCvar, const String:oldValue[], const String:newValue[]) g_fInterval = GetConVarFloat(hCvar);
public OnDistanceChange(Handle:hCvar, const String:oldValue[], const String:newValue[]) g_fDistance = GetConVarFloat(hCvar);
public OnPluginEnd() Shop_UnregisterMe();
public Shop_Started()
{
new CategoryId:category_id = Shop_RegisterCategory(CATEGORY, "Способности", "");
if (Shop_StartItem(category_id, ITEM))
{
Shop_SetInfo("Длинные прыжки", "", g_iPrice, g_iSellPrice, Item_Togglable, g_iDuration);
Shop_SetCallbacks(OnItemRegistered, OnLJUsed);
Shop_EndItem();
}
}
public OnItemRegistered(CategoryId:category_id, const String:category[], const String:item[], ItemId:item_id) id = item_id;
/*
public Shop_OnAuthorized(iClient)
{
g_bHasLJ[iClient] = Shop_IsClientItemToggled(iClient, id);
g_fLastJump[iClient] = 0.0;
}
*/
public ShopAction:OnLJUsed(iClient, CategoryId:category_id, const String:category[], ItemId:item_id, const String:item[], bool:isOn, bool:elapsed)
{
if (isOn || elapsed)
{
g_bHasLJ[iClient] = false;
return Shop_UseOff;
}
g_bHasLJ[iClient] = true;
return Shop_UseOn;
}
public Action:Event_PlayerJump(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
new iClient = GetClientOfUserId(GetEventInt(hEvent, "userid"));
if(g_bHasLJ[iClient])
{
decl Float:fGameTime;
fGameTime = GetGameTime();
if ((fGameTime - g_fLastJump[iClient]) > g_fInterval)
{
g_fLastJump[iClient] = fGameTime;
decl Float:finalvec[3];
finalvec[0] = GetEntDataFloat(iClient, VelocityOffset_0)*g_fDistance/2.0;
finalvec[1] = GetEntDataFloat(iClient, VelocityOffset_1)*g_fDistance/2.0;
finalvec[2] = 0.0;
SetEntDataVector(iClient, BaseVelocityOffset, finalvec, true);
}
}
}
В том и прикол,что он не появляется в compiled.@BossKotoriiNeSmok, игнорируй: скомпиленный плагин работать будет
Спасибо,исходничек можн сразу?)