(+REP) MOTD [Message Of The Day]
#2

Run your pawn.exe
Create a new fileby hitting the new button
Select all by pressing Ctrl + A button on your keyboard
Paste the whole script you want to add to your server
Save it by hitting the save button(save in the filterscripts folder)
Compile it by clicking the compile or run button

Add the filterscript's file name to the server.cfg
E.G.:
if your filterscripts name is fs.amx
Код:
filtescripts fs

EDITED SCRIPT:


pawn Код:
/*
MOTD FilterScript by Kyle_Olsen
And fixed bug by AiRaLoKa
Do NOT remove this credit tag.
*/


#define FILTERSCRIPT //This is a filterscript
#define GREEN                   0x21DD00FF //The green color of the MOTD, if you would like another color, just change it


#include <a_samp> //Including the pawno include. Already in every server, no need to add it
#include <dini> //Including the dini include. NOT INCLUDED. Get it here: http://dracoblue.net/download-release/35/dini_1_6.zip

#if defined FILTERSCRIPT //If this is a filterscript, do anything between #if and #endif

public OnFilterScriptInit() //When the filterscript initiates
{
        print("\n--------------------------------------"); //Prints something in the server box
        print(" MOTD filterscript by Kyle_Olsen loaded\nFixed by AiRaLoKa"); //Prints something in the server box
        print("--------------------------------------\n"); //Prints something in the server box

        return 1; //Returns
}

public OnFilterScriptExit() //On the exit of the filterscript
{
        print("\n--------------------------------------"); //Prints something in the server box
        print(" MOTD filterscript by Kyle_Olsen unloaded\nFixed by AiRaLoKa"); //Prints something in the server box
        print("--------------------------------------\n"); //Prints something in the server box
        return 1;
}

#endif //Ends the if defined filterscript above

public OnPlayerConnect(playerid) //When the player connects to the server, all inside of the {} is done
{
        new file[128];
        format(file, sizeof(file), "motd.ini");
        if(dini_Exists(file)){
            new string[256];
            new thing[256];
            thing = dini_Get(file, "MOTD"); //Finds the file
            format(string, sizeof(string), "Server MOTD: %s", thing); //Creates the string
            SendClientMessage(playerid, GREEN, string); //Posts the message
        }else{
            dini_Create(file);
            dini_Set(file, "MOTD", "This is your server MOTD. Change it by signing into RCON and using the command /motd");
            new string[256];
            new thing[256];
            thing = dini_Get(file, "MOTD"); //Finds the file
            format(string, sizeof(string), "Server MOTD: %s", thing);
            SendClientMessage(playerid, GREEN, string); //Posts the message
        }
        return 1; //Returns
}
public OnPlayerCommandText(playerid, cmdtext[])
{
        new file[128];
        format(file, sizeof(file), "motd.ini");
        if (strcmp("/motd", cmdtext, true, 5) == 0)
        {
                if(IsPlayerAdmin(playerid)){
                    new string[256];
                    strmid(string, cmdtext, 6, 256);
                    dini_Set(file, "MOTD", string);
                    new thing[256];
                    thing = dini_Get(file, "MOTD"); //Finds the file
                    format(string, sizeof(string), "Server MOTD: %s", thing);
                    SendClientMessage(playerid, GREEN, string); //Posts the message

                }else{
                    SendClientMessage(playerid, GREEN, "You have to be logged into RCON in order to change the motd!");
                }
                return 1;
        }
        return 0;
}
Reply


Messages In This Thread
(+REP) MOTD [Message Of The Day] - by SplinteX - 16.12.2013, 21:32
Re: (+REP) MOTD [Message Of The Day] - by AiRaLoKa - 16.12.2013, 21:57
Re: (+REP) MOTD [Message Of The Day] - by AiRaLoKa - 16.12.2013, 22:03
Re: (+REP) MOTD [Message Of The Day] - by SplinteX - 16.12.2013, 22:16
Re: (+REP) MOTD [Message Of The Day] - by SplinteX - 17.12.2013, 06:44
Re: (+REP) MOTD [Message Of The Day] - by AiRaLoKa - 17.12.2013, 08:19
Re: (+REP) MOTD [Message Of The Day] - by SplinteX - 17.12.2013, 08:30
Re: (+REP) MOTD [Message Of The Day] - by AiRaLoKa - 17.12.2013, 08:35
Re: (+REP) MOTD [Message Of The Day] - by Honey - 16.05.2014, 12:23
Re: (+REP) MOTD [Message Of The Day] - by AiRaLoKa - 27.05.2014, 23:59

Forum Jump:


Users browsing this thread: 3 Guest(s)