Results 1 to 4 of 4

Thread: Printbold help needed!

  1. #1
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts

    Question Printbold help needed!

    Hello, i need help with "self iprintlnbold" command. I want to make something like an automatic welcome message, that when player joins in game it will print some nice welcome message on his screen. I think it goes under Callback_PlayerConnect()
    I am newb in this kinda stuff ^^

    ~EvoloZz
    Last edited by EvoloZz; 7th November 2012 at 18:11.

  2. #2
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by EvoloZz View Post
    Hello, i need help with "self iprintlnbold" command. I want to make something like an automatic welcome message, that when player joins in game it will print some nice welcome message on his screen. I think it goes under Callback_PlayerConnect()
    I am newb in this kinda stuff ^^

    ~EvoloZz
    Basically, don't call the function on a connecting player. It's not the best place to use it because as soon as they connect, a menu of some sorts will pop up and block them seeing it. Wait till they spawn, then do your message.

    Code:
    init()
    {
    	level thread onPlayerConnect();
    }
    
    onPlayerConnect()
    {
    	for( ;; )
    	{
    		level waittill( "connecting", player );
    		
    		player.pers[ "welcomed" ] = undefined;
    		
    		player thread onPlayerSpawned();
    	}
    }
    
    onPlayerSpawned()
    {
    	self endon( "disconnect" );
    	
    	for( ;; )
    	{
    		self waittill( "spawned_player" );
    		
    		self thread WelcomeMessage();
    	
    	}
    
    }
    
    WelcomeMessage()
    {
    	self endon( "disconnect" );
    
    	if( isdefined( self.pers[ "welcomed" ] ) ) return;
    	self.pers[ "welcomed" ] = true;
    
    	self iprintlnBold( "Hello" );
    
    }

  3. The Following 3 Users Say Thank You to Tally For This Useful Post:

    2ReaL (11th November 2012),EvoloZz (7th November 2012),kung foo man (7th November 2012)

  4. #3
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts
    Quote Originally Posted by Tally View Post
    Basically, don't call the function on a connecting player. It's not the best place to use it because as soon as they connect, a menu of some sorts will pop up and block them seeing it. Wait till they spawn, then do your message.

    Code:
    init()
    {
    	level thread onPlayerConnect();
    }
    
    onPlayerConnect()
    {
    	for( ;; )
    	{
    		level waittill( "connecting", player );
    		
    		player.pers[ "welcomed" ] = undefined;
    		
    		player thread onPlayerSpawned();
    	}
    }
    
    onPlayerSpawned()
    {
    	self endon( "disconnect" );
    	
    	for( ;; )
    	{
    		self waittill( "spawned_player" );
    		
    		self thread WelcomeMessage();
    	
    	}
    
    }
    
    WelcomeMessage()
    {
    	self endon( "disconnect" );
    
    	if( isdefined( self.pers[ "welcomed" ] ) ) return;
    	self.pers[ "welcomed" ] = true;
    
    	self iprintlnBold( "Hello" );
    
    }
    So i have to make entirely new .gsc file? Like _welcomemessage.gsc?

  5. #4
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by EvoloZz View Post
    So i have to make entirely new .gsc file? Like _welcomemessage.gsc?
    Yes. You could put it in any of the stock files, but it is best to learn how to create your own files and put them in your mod.

    BTW - a sign of a good modder, someone who has the aptitude for modding is someone who takes the initiative. Don't ask first, do it and find out. If you then run into problems, go to a forum and ask. But always try something first before you ask. I learnt from mod forums like this, but I rarely asked questions. I just jumped in the deep end and tried swimming.

  6. The Following 4 Users Say Thank You to Tally For This Useful Post:

    2ReaL (11th November 2012),EvoloZz (7th November 2012),Killer.Pro (8th November 2012),kung foo man (7th November 2012)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •