SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 28/09/2019, 10:56 AM   #11
Sh4rp
Little Clucker
 
Join Date: Sep 2019
Location: Italy
Posts: 27
Reputation: 14
Default Re: 'Welcome to my server' messages.

Nice tutorial, but... how can I make the welcome message appear after the "Connected to [servername]" message?
Sh4rp is offline   Reply With Quote
Old 28/09/2019, 04:54 PM   #12
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,442
Reputation: 1620
Default Re: 'Welcome to my server' messages.

Quote:
Now, since we want the message to be sent to the player, we need to add a return. Since we want it to be sent, the return as to be 1. So this is our final code:
So if I don't add this return the message will not be received by the player?
Kwarde is online now   Reply With Quote
Old 30/09/2019, 07:22 AM   #13
SiaReyes
Huge Clucker
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 327
Reputation: 22
Default Re: 'Welcome to my server' messages.

Quote:
Originally Posted by Kwarde View Post
So if I don't add this return the message will not be received by the player?

It's a callback return but the code return.
You can learn about returns from here:
https://wiki.sa-mp.com/wiki/Control_Structures#return

Quote:
Originally Posted by Sh4rp View Post
Nice tutorial, but... how can I make the welcome message appear after the "Connected to [servername]" message?
Put the code at top of OnPlayerConnect.
__________________
Offshowtime Fuck It!

Quote:
Originally Posted by Toroi View Post
blackmail people that join your server using their ip address as hostage

or get a job and play sa-mp for fun
SiaReyes is offline   Reply With Quote
Old 30/09/2019, 02:22 PM   #14
Sh4rp
Little Clucker
 
Join Date: Sep 2019
Location: Italy
Posts: 27
Reputation: 14
Default Re: 'Welcome to my server' messages.

Quote:
Originally Posted by SiaReyes View Post
It's a callback return but the code return.
You can learn about returns from here:
https://wiki.sa-mp.com/wiki/Control_Structures#return



Put the code at top of OnPlayerConnect.
Thanks for the reply, but nothing has changed.
Code:
Code:
public OnPlayerConnect(playerid)
{
	GetPlayerName(playerid, pName, sizeof(pName));
	new string[124];
	new string2[124];
	new string3[124];
	format(string, sizeof(string), "Benvenuto sulla Sharp's Development Gamemode %s!", pName);
	format(string2, sizeof(string2), "Versione %s del %s.", GMVersion, GMLastUpdate);
	SendClientMessage(playerid, COLOR_GREEN, string);
	SendClientMessage(playerid, -1, string2);
	SendClientMessage(playerid, -1, "Sviluppata da Sharp.  Contatto Discord: @Sharp#1708.");
	format (string3, sizeof(string3), "%s si  unito al server!", pName);
	SendClientMessageToAll(COLOR_GREEN, string3);
	return 1;
}
Result:
https://i.gyazo.com/4a7b0c15ee20dd87...46b7f9a90c.png
__________________
Discord contact: @Sharp#1708
Sh4rp is offline   Reply With Quote
Old 30/09/2019, 02:55 PM   #15
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,442
Reputation: 1620
Default Re: 'Welcome to my server' messages.

Quote:
Originally Posted by SiaReyes View Post
It's a callback return but the code return.
You can learn about returns from here:
https://wiki.sa-mp.com/wiki/Control_Structures#return
Don't worry I know how returns work, I was actually trying to be sarcastic because that is kinda my thing. What I ws trying to say was that the line I quoted is incorrect information(I'll quote again
Quote:
since we want the message to be sent to the player, we need to add a return
This line from the tutorial kinda says that the return is required if you want to send the message, which is incorrect. No matter if you use a return or not, the message will be sent -assuming this script is in the gamemode script.

Tht is what the return does in OnPlayerConnect. It either passes the callback to the next filterscript (return 1), or block other scripts from using the callback (return 0).

This really should be made clear in the tutorial (@Twizted) for you might mislead people this way who are new to scripting.

@Sh4rp:
Just use a timer with a slight delay (eg. 250ms)-> more or less if needed.
Instead of adding one or more timers for the messages, you could slightly delay the entire OnPlayerConnect() code. Just make a public function called OnPlayerConnect2 or so and put all your OnPlayerConnect code in there. And off course set a timer in the current OnPlayerConnect() callback.

Last edited by Kwarde; 14/10/2019 at 10:35 AM.
Kwarde is online now   Reply With Quote
Old 20/10/2019, 11:13 AM   #16
Rikossport2
Little Clucker
 
Join Date: Oct 2019
Location: Algeria
Posts: 2
Reputation: 0
Default Re: 'Welcome to my server' messages.

Well explained tutorial
__________________
discord : Rikos#8830
Rikossport2 is offline   Reply With Quote
Reply

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Server Message [SERVER TIPS, SERVER MESSAGE OF THE DAY] - Simple, basic but editable! roar Filterscripts 10 28/02/2013 03:19 PM
Making the chat and the message split? JaKe Elite Scripting Help 23 01/12/2012 12:51 PM
[Tutorial] Making a Private message system thefatshizms Tutorials 9 26/11/2012 12:49 PM
Need help making the sa-mp server send a message when someone join/leave the IRC channel. OleKristian95 Scripting Help 2 07/05/2012 02:00 AM
Question on a making my own private message command. CaptainCaveMan Help Archive 3 28/08/2009 04:07 PM


All times are GMT. The time now is 02:39 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.