Join and leave messages - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Join and leave messages (
/showthread.php?tid=249520)
Join and leave messages -
thimo - 19.04.2011
Hey i wanna make something that you can set your own personal join message Like:
"Thimo has joined the server: Best boy of world XD"
But i dont know how to do that anyone a idea
Thanx
Re: Join and leave messages -
Ash. - 19.04.2011
You would have to store the "personal message" in the users personal file.
For example (using dini)
pawn Код:
new file[64];
format(file, sizeof(file), "accounts/%s.ini", ReturnName(playerid));
dini_Set(file, "personalmsg", "Best boy of the world XD");
//Then when you go to connect;
format(file, sizeof(file), "accounts/%s.ini", ReturnName(playerid));
format(string, sizeof(string), "%s has joined the server: %s", ReturnName(playerid), dini_Get(file, "personalmsg"));
Simples
Obviously that'll have to adapted quite considerably, as it is raw from my script (with some changes)
Re: Join and leave messages -
xir - 19.04.2011
You can use this, it will allow a player to type their own personal message with a cmd. It will get saved in scriptfiles with the player name and inside the file it will be like this
And when they connect the message will display
You will need zcmd, sscanf(plugin) & dini.
Or you could just convert the cmd to strcmp and change sscanf to strtok
pawn Код:
// by xir, enjoy
public OnPlayerConnect(playerid)
{
new file[128], pName[MAX_PLAYER_NAME], Message[256], string[128];
GetPlayerName(playerid, pName, sizeof(pName));
format(file, sizeof(file), "%s.ini", pName);
Message = dini_Get(file, "Message");
format(string, sizeof(string), "Welcome to the server %s. Your Message: %s", pName, Message);
SendClientMessage(playerid, -1, string);
return 1;
}
COMMAND:joinmessage(playerid, params[])
{
new string[128], file[128], pName[MAX_PLAYER_NAME];
if(sscanf(params, "s[128]", params[0])) return SendClientMessage(playerid, -1, "Usage: /joinmessage <message>");
format(string, sizeof(string), "You have set your Join Message to: %s", params[0]);
SendClientMessage(playerid, -1, string);
GetPlayerName(playerid, pName, sizeof(pName));
format(file, sizeof(file), "%s.ini", pName);
dini_Create(file);
dini_Set(file, "Message", params[0]);
return 1;
}
Enjoy