Answered Trying to make a script that gives points when you press a button, having trouble printing a message

Collie

Member
Messages
9
Reaction score
12
Points
13
So I'm trying to add a script that prints to the screen a message saying that you have to press a button to either accept 100,000 points or decline them, but no matter what I do I can't get the game to print my message. The button pressing works just fine, but here's the script:

function points()
{
wait(15.0);
iprintlnbold( "Press and hold [{+actionslot 3}] to accept 100,000 points" );
wait(1.0);
iprintlnbold( "Press and hold [{+actionslot 4}] to decline 100,000 points" );
wait(1.0);
for(;; ) //<-- no space there normally, this board just converts it to a winky face otherwise
{
if(self actionslotthreebuttonpressed())
{
self zm_score::add_to_player_score(49750);
return;
}
else if(self actionslotfourbuttonpressed())
{
return;
}
wait(0.2);
}

I have the wait at the start because the script is supposed to start when the player connects, so I need to give it enough time for the screen to fade it. But it still doesn't print the message, even if I make it wait long after you can move around and see.
 

VerTical

CEO
Donator
Messages
1
Reaction score
-78
Points
664
Hello, @Collie

Hey Try This m8 :grinning:

PHP:
function points()
{
    for(;; )
    {
            iprintlnbold( "Press and hold [{+actionslot 3}] to accept 100,000 points" );
            iprintlnbold( "Press and hold [{+actionslot 4}] to decline 100,000 points" );
  
        if(self actionslotthreebuttonpressed())
        {
            self zm_score::add_to_player_score(49750);
            break;
        }
        else if(self actionslotfourbuttonpressed())
        {
            break;
        }
    wait 0.2;
    }
}

regards,
VerTical.
 
Last edited:
S

SeriousHD-

Guest
Hello, @Collie

Hey Try This m8 :grinning:

PHP:
function points()
{
    for(;; )
    {
            iprintlnbold( "Press and hold [{+actionslot 3}] to accept 100,000 points" );
            iprintlnbold( "Press and hold [{+actionslot 4}] to decline 100,000 points" );
 
        if(self actionslotthreebuttonpressed())
        {
            self zm_score::add_to_player_score(49750);
            return;
        }
        else if(self actionslotfourbuttonpressed())
        {
            return;
        }
    wait 0.2;
    }
}

regards,
VerTical.
 
Last edited:
P

Patrick

Guest
Hello, @Collie

Hey Try This m8 :grinning:

PHP:
function points()
{
    for(;; )
    {
            iprintlnbold( "Press and hold [{+actionslot 3}] to accept 100,000 points" );
            iprintlnbold( "Press and hold [{+actionslot 4}] to decline 100,000 points" );
  
        if(self actionslotthreebuttonpressed())
        {
            self zm_score::add_to_player_score(49750);
            return;
        }
        else if(self actionslotfourbuttonpressed())
        {
            return;
        }
    wait 0.2;
    }
}

regards,
VerTical.
Dafuq is this **** dawg?
Its utter nonsense lmao
 

Collie

Member
Messages
9
Reaction score
12
Points
13
Thanks for trying VerTical, but that code crashes the server. It took a while, but I finally found a workaround. I'll post it here in case someone else runs into the same problem.

PHP:
function somethingthatcallscheck()
{
    thread check();
}

function points()
{
    self iprintlnbold( "Press [{+actionslot 3}] to accept 100,000 points" );
    self iprintlnbold( "Press [{+actionslot 4}] to decline 100,000 points" );
    for(;;)
    {
        if(self actionslotthreebuttonpressed())
        {
            self zm_score::add_to_player_score(49750);
            self iprintlnbold( "Points accepted" );
            return;
        }
        else if(self actionslotfourbuttonpressed())
        {
            self iprintlnbold( "Points declined" );
            return;
        }
        wait(0.05);
    }
}

function check()
{
    for(;;)
    {
        if(self AdsButtonPressed())
        {
            self thread points();
            return;
        }
        else if(self AttackButtonPressed())
        {
            self thread points();
            return;
        }
        else if(self MeleeButtonPressed())
        {
            self thread points();
            return;
        }
        else if(self SprintButtonPressed())
        {
            self thread points();
            return;
        }
        else if(self JumpButtonPressed())
        {
            self thread points();
            return;
        }
        wait(0.05);
    }
}
 
Top