Raised This Month: $ Target: $400
 0% 

[HOWTO]Player Connects


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
FormulaZero
BANNED
Join Date: Feb 2007
Location: Sector 7G
Old 02-17-2007 , 18:47   [HOWTO]Player Connects
Reply With Quote #1

* This will explain and tell you how to get when a player is connected*

  • Information
This FAQ will break down a code. This code will contain when a player joins and enters

============================================= ===

First let's write the first part:
PHP Code:
public client_putinserver(id
Since we got this done we need to go further and set are task!
PHP Code:
set_task(3.0"welcome"id
This tells us that the player has just connected. You can replace "welcome" with anything you want, but you'll need that later on. "welcome" is not the message that will be displayed.

Allright, since we know the user has conected let's move on.
PHP Code:
new name[32
Characters here. [32] stores information.

Now let's get his name!
PHP Code:
get_user_name(idname31
This saves the users name.

We can set our hud message now!
PHP Code:
set_hudmessage(2250015450665100, -1)
    
show_hudmessage(id"Hello and Welcome %s!."name
The numbers in set_hudmessage sets where the text will be displayed, in this case -1 is needed at the end. Allways seperate numbers with ,.
show_hudmessage - The id makes sure that only the player connecting is shown this message. "Hello and Welcome %s" is the message that the player will see. name at the end was user in
PHP Code:
get_user_name(idname31
So we must use the same text used in the middle there, in this case it's name.

We have gotten our full code now:
PHP Code:
public client_putinserver(id)
{
    
    
set_task(3.0"welcome"id)
}

public 
welcome(id)
{
    new 
name[32]
    
get_user_name(idname31)
    
set_hudmessage(225000.050.4506.06.00.50.5, -1)
    
show_hudmessage(0"Hello and Welcome %s!."name)

%s - This stores and shows the clients name. This is a character array. (String)



Last edited by FormulaZero; 02-17-2007 at 18:57.
FormulaZero is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:56.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode