Closed Hexer10 closed 7 years ago
It's implementation will look like this
public void Gangs_OnPerksSetPre(int client, bool &shouldGive = true)
{
if (!ShouldReceivePerks(client)) // should not receive perks
{
shouldGive = false;
}
}
Let me know if/how it works and I'll close this. Thanks.
won't work for me.
Should not it be Action
instead of void
?
// myjailbreak_gangs.sp
//
// D:\Code\MyJailbreak\addons\sourcemod\scripting\include\hl_gangs.inc(120) : error 059: function argument may not have a default value (variable "shouldGive")
// D:\Code\MyJailbreak\addons\sourcemod\scripting\myjailbreak_gangs.sp(48) : error 059: function argument may not have a default value (variable "shouldGive")
// Includes
#include <sourcemod>
#include <hl_gangs>
#include <myjailbreak>
// Compiler Options
#pragma semicolon 1
#pragma newdecls required
public void Gangs_OnPerksSetPre(int client, bool &shouldGive = true)
{
if (MyJailbreak_IsEventDayRunning())
{
shouldGive = false;
}
}
Try this
// Includes
#include <sourcemod>
#include <hl_gangs>
#include <myjailbreak>
// Compiler Options
#pragma semicolon 1
#pragma newdecls required
public void Gangs_OnPerksSetPre(int client, bool &shouldGive)
{
if (MyJailbreak_IsEventDayRunning())
{
shouldGive = false;
}
}
Also remove = true
from the include too
If you still have problems I can try something else
hl_gangs.inc
/**
* Called immediately before perks are given. Set shouldGive to false in order to skip giving perks.
* @param int client index
* @param &bool shouldGive
* @noreturn
*/
forward void Gangs_OnPerksSetPre(int client, bool &shouldGive);
and
public void Gangs_OnPerksSetPre(int client, bool &shouldGive)
{
if (MyJailbreak_IsEventDayRunning() || MyJailbreak_IsEventDayPlanned())
{
shouldGive = false;
}
}
works great! Thanks for fast response!
No problem. Let me know if you have any more issues
Maybe a forward that get trigger on round start? Like: Gangs_OnPerksActived that can be returned to Plugin_Handle to disable giving on the perks?
This is just an idea.
Thanks.