Join and leave messages
#1

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
Reply
#2

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)
Reply
#3

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

Quote:

Message: Hello

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)