Giter Site home page Giter Site logo

Comments (8)

Headline avatar Headline commented on September 26, 2024 1

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

from gangs.

Headline avatar Headline commented on September 26, 2024 1

Also remove = true from the include too

from gangs.

Headline avatar Headline commented on September 26, 2024

Done

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

from gangs.

Headline avatar Headline commented on September 26, 2024

Let me know if/how it works and I'll close this. Thanks.

from gangs.

shanapu avatar shanapu commented on September 26, 2024

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

from gangs.

Headline avatar Headline commented on September 26, 2024

If you still have problems I can try something else

from gangs.

shanapu avatar shanapu commented on September 26, 2024

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!

from gangs.

Headline avatar Headline commented on September 26, 2024

No problem. Let me know if you have any more issues

from gangs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.