Solved Changing a keyall indication

Question that is answered or resolved.

Azul69

New member
Hello guys.

I am trying to modifie a function defined to open a menu when you are playing.

I have an example for a game that works well but it works when you press only one button (1 command)

Example:

void main()
{
int iPlIndex = getlocalvar("player");
void vPlEnt = getplayerproperty(iPlIndex, "entity");
int iPressAt2 = playerkeys(iPlIndex, 1, "attack3"); //0-Hold, 1-Press, 2-Release

if (iPressAt2) { ....

I want the function to work using not only the attack3 button but also the attack4 button simultaneously. I think it's possible, but I haven't found the right way to do it.For example, I've tried pressing "attack3" + "attack4", "attack3"+"attack4" or "attack3+attack4", but it hasn't worked.It's probably because I'm new to this, but I'd appreciate some help to resolve this issue.

Thank you very much for your help.
 
I want the function to work using not only the attack3 button but also the attack4 button simultaneously. I think it's possible, but I haven't found the right way to do it.For example, I've tried pressing "attack3" + "attack4", "attack3"+"attack4" or "attack3+attack4", but it hasn't worked.It's probably because I'm new to this, but I'd appreciate some help to resolve this issue.
Hi friend. You can try using a script like this in your keyscript or keyall events:

Code:
void main()
{
    void self = getlocalvar("self");
    int pIndex = getentityproperty(self, "playerindex");

    if(playerkeys(pIndex, 0, "attack3"))
    {
        if(playerkeys(pIndex, 0, "attack4"))
        {
            doSomething();
        }
    }
}
 
Hi friend. You can try using a script like this in your keyscript or keyall events:

Code:
void main()
{
    void self = getlocalvar("self");
    int pIndex = getentityproperty(self, "playerindex");

    if(playerkeys(pIndex, 0, "attack3"))
    {
        if(playerkeys(pIndex, 0, "attack4"))
        {
            doSomething();
        }
    }
}

Thanks for your answer man. I use your idea and combine it with another sugerence to solve it.

This works well

void main()
{
int iPlIndex = getlocalvar("player");
void vPlEnt = getplayerproperty(iPlIndex, "entity");
int iPressAt2 = playerkeys(iPlIndex, 0, "attack3") && playerkeys(iPlIndex, 0, "attack4"); //0-Hold, 1-Press, 2-Release

if (iPressAt2) { ....

Thanks again. :D
 
Back
Top Bottom