UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Simple Script Simply Won't Work

broken avatar :(
Created 11 years ago
by Eternal_Fire
0 Members and 1 Guest are viewing this topic.
1,976 views
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 23 April 2015
Last active: 5 years ago
Posts
165
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
Signature
Money isn't everything but everything has a price
×
Eternal_Fire's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Eternal_Fire's Contact & Social Links
So I am quite new to scripting and I made a simple script and decided to test it in game to see if it works but nothing happens
Code Snippet
Plaintext
test_script()
{
        self endon("death");
self endon("disconnect");
        self waittill("spawned_player");
        self thread radius_check();
}
radius_check()
{
 
        while(1)
        {
                if (self isonground(true))
                {
                        iprintln ( "Player is on the ground" );
                        wait 0.1;
                }
                if (self isonground(false))
                {
                        iprintln ( "Player is not on the ground" );
                        wait 0.1;
                }
                else
                {
                continue;
                wait 0.1;
                }
         }
}

It should print those things but it just doesn't and i don't know why, any help is appreciated.
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 2 years ago
Posts
1,186
Respect
1,332Add +1
Forum Rank
Zombie Colossus
Primary Group
Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
You didn't tell the script what 'self' is. Something like this:

Code Snippet
Plaintext
init()
{
level thread on_player_conect();
}

on_player_conect()
{
while(1)
{
level waittill( "connecting", player ); // here you defined 'player' by using the waittill
player thread on_player_spawned();
}
}

on_player_spawned() // player threads this function, so player is now become 'self'
{
self endon( "disconnect" );

while(1)
{
self waittill( "spawned_player" );

self thread radius_check();
}
}

radius_check()
{
self endon("death");
self endon("disconnect");
        while(1)
        {
                if (self isonground(true))
                {
                        iprintln ( "Player is on the ground" );
                        wait 0.1;
                }
                if (self isonground(false))
                {
                        iprintln ( "Player is not on the ground" );
                        wait 0.1;
                }
                else
                {
                continue;
                wait 0.1;
                }
         }
}



EDIT:

Just noticed this, not sure if this would work:

Code Snippet
Plaintext
                if (self isonground(true))
                {
                        iprintln ( "Player is on the ground" );
                        wait 0.1;
                }
                if (self isonground(false))
                {
                        iprintln ( "Player is not on the ground" );
                        wait 0.1;
                }


If it doesn't work change it into:
Code Snippet
Plaintext
                if( self isonground() == true )                     //  or simply: if( self isonground() )
                {
                        iprintln ( "Player is on the ground" );
                        wait 0.1;
                }
                if( self isonground() == false )                   // or:  if( !self isonground() )
                {
                        iprintln ( "Player is not on the ground" );
                        wait 0.1;
                }
Last Edit: July 26, 2015, 08:37:00 am by Harry Bo21
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 23 April 2015
Last active: 5 years ago
Posts
165
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
×
Eternal_Fire's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Eternal_Fire's Contact & Social Links
Code Snippet
Plaintext
	while(1)
{
self waittill( "spawned_player" );

self thread radius_check()
}

Getting an bad syntax error on that last bracket now
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Missing end-line at that function call. (add ; )
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
Code Snippet
Plaintext
continue;
wait 0.1;

I think those should be the other way around too

# EDIT

actually its fine the otherway, could be done either
Last Edit: July 26, 2015, 08:38:07 am by Harry Bo21
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 23 April 2015
Last active: 5 years ago
Posts
165
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
×
Eternal_Fire's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Eternal_Fire's Contact & Social Links
Missing end-line at that function call. (add ; )

Ah right, sorry

Double Post Merge: July 27, 2015, 04:10:34 am
Ech, the script still doesn't seem to be functioning because nothing is being printed on screen, any idea why?
Last Edit: July 27, 2015, 04:10:34 am by Eternal_Fire

 
Loading ...