public OnClientAuthorized(client, const String:auth[])
{
// Forward event to all modules.
new any:eventdata[2][64];
eventdata[0][0] = client;
strcopy(eventdata[1], sizeof(eventdata[]), auth);
EventMgr_Forward(g_EvOnClientAuthorized, eventdata, sizeof(eventdata), sizeof(eventdata[]), g_CommonDataType5);
}
public void OnClientAuthorized(int iClient, const char[] szAuth) {
any aEventData[2][64];
aEventData[0][0] = iClient;
strcopy(view_as<char>(aEventData[1]), sizeof(aEventData[]), szAuth);
EventMgr_Forward(g_EvOnClientAuthorized, aEventData, sizeof(aEventData), sizeof(aEventData[]), g_CommonDataType5);
}
Спасибо большое@marlboro,
PHP:public void OnClientAuthorized(int iClient, const char[] szAuth) { any aEventData[2][64]; aEventData[0][0] = iClient; strcopy(view_as<char>(aEventData[1]), sizeof(aEventData[]), szAuth); EventMgr_Forward(g_EvOnClientAuthorized, aEventData, sizeof(aEventData), sizeof(aEventData[]), g_CommonDataType5); }
Лучше бы напрямую вызывали форвард, и по нормальному передавали аргументы.
И что это должно дать?Консольную переменную first_aid_heal_percent проверь
Да, я нашел выход. сама игра L4D видимо оффсет только увеличивает датчик здоровье, квар еще нужен, вот так у меня заработало.@alexmy, а так пробовали?
PHP:SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), 200, 4, true);
SetEntProp(client, Prop_Send, "m_iMaxHealth", GetConVarInt(MaxHealth));{
SetConVarInt(FindConVar("first_aid_kit_max_heal"), 200, false, false);
}
ConfigMgr_WriteCell(module, configindex, ConfigData_ReloadFunc, GetFunctionByName(GetMyHandle(), "configreloadfunc"));
GetFunctionByName · functions · SourceMod Scripting API Reference
Но это лишь в теории. Сложно что-то определенное сказать, увидев лишь одну строку.PHP:ConfigMgr_WriteCell(module, configindex, ConfigData_ReloadFunc, GetFunctionByName(GetMyHandle(), "configreloadfunc"));
stock ConfigRegistrationResults:ConfigMgr_Register(Module:module, const String:configreloadfunc[], const String:configpath[], &configindex = -1)
{
decl String:modulefullname[MM_DATA_FULLNAME];
ModuleMgr_ReadString(module, ModuleData_FullName, modulefullname, sizeof(modulefullname));
// Check if the module has registered the max number of config files.
configindex = ConfigMgr_FindNextIndex(module);
if (configindex == -1)
{
LogError("[Config Manager] Module \"%s\" can't register more than %d config files!", modulefullname, CM_MODULE_MAX_CONFIGS);
return RegResult_LimitExceeded;
}
// Bypass validation by using an empty path.
if (configpath[0] != 0)
{
new bool:validated = ConfigMgr_ValidateFile(configpath);
if (!validated)
LogError("[Config Manager] Module \"%s\" trying to register a non-existant config file! (%s)", modulefullname, configpath);
// Check if this path is already registered.
if (ConfigMgr_PathToIndex(module, configpath) > -1)
{
LogError("[Config Manager] Module \"%s\" can't register a config file (%s) more than once!", modulefullname, configpath);
return RegResult_Duplicate;
}
}
// Write the config data to the module data arrays.
ConfigMgr_WriteCell(module, configindex, ConfigData_ReloadFunc, GetFunctionByName(GetMyHandle(), configreloadfunc));
ConfigMgr_WriteString(module, configindex, ConfigData_Path, CM_DATA_PATH, configpath);
return RegResult_Success;
}
@marlboro, меня интересует функция ConfigMgr_WriteCell(), а не ConfigMgr_Register()
stock ConfigMgr_WriteCell(Module:module, configindex, ConfigData:data, any:value)
{
// Read all the module's config data.
new configdata[ConfigData];
ConfigMgr_ReadAll(module, configindex, configdata);
// Change the value of the specified module config data.
configdata[data] = value;
// Overwrite the old array with the modified one.
ConfigMgr_WriteAll(module, configindex, configdata);
}
Выдает ошибкиТогда:
PHP:ConfigMgr_WriteCell(module, configindex, ConfigData_ReloadFunc, _:(GetFunctionByName(GetMyHandle(), "configreloadfunc"));
Большое спасибо помогло, на вашем примере исправил остальное.@marlboro, скобочку забыл.
Первое варн, он связан с обновление синтаксиса. В твоём случае, временно можно игнорить.PHP:ConfigMgr_WriteCell(module, configindex, ConfigData_ReloadFunc, _:(GetFunctionByName(GetMyHandle(), "configreloadfunc")));
stock EventMgr_OnModuleRegister(Handle:adtModule)
{
// Push an array that has space for the max number of events the project can have as the "Function" type to the module's data array.
// This is being pushed into our allocated space for event function data.
newFunction:funcProjectEvents[sizeof(g_EMEvents)];
PushArrayArray(adtModule, funcProjectEvents[0], sizeof(funcProjectEvents));
}
И в правда. Не заметил спасибо@marlboro, пробел случаем после new и перед Function не потерял?)
PurchaseUpgrade(client,Module:upgrade)
{
if(IsValidPlayer(client))
{
if(!IsUpgradeInterlocked(client, upgrade))
{
new isbot=IsFakeClient(client);
if(g_CoreConfigCache[CoreConfig_bot_enable]||!g_CoreConfigCache[CoreConfig_bot_enable]&&!isbot)
{
if(g_CoreConfigCache[CoreConfig_bot_control]&&isbot)
{
new count=CountHumans();
if(!count)
return -1;
}
decl String:name[MM_DATA_FULLNAME],String:translatedname[MM_DATA_FULLNAME];
ModuleMgr_ReadString(upgrade, ModuleData_FullName, name, sizeof(name));
GetUpgradeTranslatedFullName(client,upgrade,translatedname,sizeof(translatedname));
new level=GetPlayerUpgradeLevel(client,upgrade);
if(level<=GetUpgradeConfigMaxLevel(upgrade))
{
new credits=GetCredits(client);
new cost=GetUpgradeConfigCost(upgrade)+(level*GetUpgradeConfigiCost(upgrade));
if(credits>=cost)
{
SetPlayerUpgradeLevel(client,upgrade,level+1);
SetCredits(client,-cost,false);
TransMgr_PrintText(client, MsgFormat_Plugin, MsgType_Chat, INVALID_MODULE, false, "Successfully purchase upgrade", translatedname, level+1);
LogMgr_Print(g_moduleCore, LogType_Debug, "PurchaseUpgrade", "Client %d purchased upgrade %s at level %d", client, name, level+1);
// Call forward
new any:eventdata[2][1];
eventdata[0][0] = client;
eventdata[1][0] = level+1;
new any:modules[2];
modules[0] = upgrade;
modules[1] = INVALID_MODULE;
EventMgr_Forward(g_EvOnUpgradePurchase, eventdata, sizeof(eventdata), sizeof(eventdata[]), g_CommonDataType3, modules);
}
else
TransMgr_PrintText(client, MsgFormat_Plugin, MsgType_Chat, INVALID_MODULE, false, "Not enough credits for upgrade", translatedname, level+1, cost);
}
else
{
TransMgr_PrintText(client, MsgFormat_Plugin, MsgType_Chat, INVALID_MODULE, false, "At max level for upgrade");
LogMgr_Print(g_moduleCore, LogType_Debug, "PurchaseUpgrade", "Client %d is at maxlevel for upgrade %s", client, name);
}
return -1;
}
else
return 0;
}
else
{
TransMgr_PrintText(client, MsgFormat_Plugin, MsgType_Chat, INVALID_MODULE, false, "Upgrade is interlocked");
LogMgr_Print(g_moduleCore, LogType_Debug, "PurchaseUpgrade", "Client %d tried to buy interlocked upgrade %s", client, name);
}
}