Raised This Month: $51 Target: $400
 12% 

Where am I going wrong ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
liveon33
New Member
Join Date: Mar 2017
Old 03-22-2017 , 11:15   Where am I going wrong ?
Reply With Quote #1

Hey,

I'm struggling to get the below to work - I'm new to coding SourceMod and at present I'm trying to get a welcome message - the snippet of code is below;

public OnClientPutInServer(client)
{
PrintToChat(client, "[BOT] Welcome to the server %s")
}
liveon33 is offline
liveon33
New Member
Join Date: Mar 2017
Old 03-22-2017 , 11:23   Re: Where am I going wrong ?
Reply With Quote #2

public OnClientPutInServer(client)
{
char name[MAX_NAME_LENGTH];
GetClientName(name, sizeof(name));
PrintToChat(client, "[BOT] Welcome to the server %s", name)
}



I think I am getting closer ?
liveon33 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 03-22-2017 , 11:25   Re: Where am I going wrong ?
Reply With Quote #3

OnClientPutInServer Is fired before the client is even in the game, You might want to hook the "player_spawn" event and display the message there.
Also PrintToChat(client, "Welcome to the server %N", client); will print the client's name.
Mitchell is offline
liveon33
New Member
Join Date: Mar 2017
Old 03-22-2017 , 11:32   Re: Where am I going wrong ?
Reply With Quote #4

Quote:
Originally Posted by Mitchell View Post
OnClientPutInServer Is fired before the client is even in the game, You might want to hook the "player_spawn" event and display the message there.
Also PrintToChat(client, "Welcome to the server %N", client); will print the client's name.
public Action Event_PlayerSpawn
{
PrintToChat(client, "[BOT] Welcome to the server %N", client);
}

I've tried this whilst hooking the event but still no joy ?
liveon33 is offline
liveon33
New Member
Join Date: Mar 2017
Old 03-22-2017 , 11:46   Re: Where am I going wrong ?
Reply With Quote #5

Sorted. I was being stupid
liveon33 is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-23-2017 , 09:43   Re: Where am I going wrong ?
Reply With Quote #6

Quote:
Originally Posted by Mitchell View Post
OnClientPutInServer Is fired before the client is even in the game
If he needs it desperately when player connects, task is the best solution.
__________________

Last edited by edon1337; 03-23-2017 at 09:43.
edon1337 is offline
Reply



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 21:39.


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