/cmotd cmd Help [Rep +1 ]
#1

Hello,
I have a server. In it when a player Join, he gets a message like : Message of the Day : blabla....................
Code:
Код:
SendClientMessage(playerid, COLOR_YELLOW, "Message of The Day : ...........................");
So Its not a FS, Its a single line in MY Gm under OnPlayerConnect.
Can anyone make a command like /cmotd and than only RCON Logged in Can change the Message of the Day !

Can anyone Make for Me ?
Thanks
Reply
#2

Here you gooo

PHP код:
public OnFilterScriptInit() //When the filterscript initiates
{
    print(
"\n--------------------------------------"); //Prints something in the server box
    
print(" MOTD FS"); //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"); //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(filesizeof(file), "motd.ini");
    if(
dini_Exists(file)){
    new 
string[256];
    new 
thing[256];
    
thing dini_Get(file"MOTD"); //Finds the file
    
format(stringsizeof(string), "Server MOTD: %s"thing); //Creates the string
    
SendClientMessage(playeridGREENstring); //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(stringsizeof(string), "Server MOTD: %s"thing);
    
SendClientMessage(playeridGREENstring); //Posts the message
    
}
    return 
1//Returns
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    new 
file[128];
    
format(filesizeof(file), "motd.ini");
    if (
strcmp("/motd"cmdtexttrue5) == 0)
    {
        if(
IsPlayerAdmin(playerid)){
            new 
string[256];
            
strmid(stringcmdtext6256);
            
dini_Set(file"MOTD"string);
            new 
thing[256];
            
thing dini_Get(file"MOTD"); //Finds the file
            
format(stringsizeof(string), "Server MOTD: %s"thing);
            
SendClientMessage(playeridGREENstring); //Posts the message
        
}else{
        
SendClientMessage(playeridGREEN"You have to be logged into RCON in order to change the motd!");
        }
        return 
1;
    }
    return 
0;

Quote:

Credits to Kyle_Olsen btw

Reply
#3

Код:
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(21) : error 026: no matching "#if..."
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(27) : error 017: undefined symbol "dini_Exists"
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(30) : error 017: undefined symbol "dini_Get"
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(30) : error 033: array must be indexed (variable "thing")
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(32) : error 017: undefined symbol "GREEN"
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(34) : error 017: undefined symbol "dini_Create"
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(35) : error 017: undefined symbol "dini_Set"
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(38) : error 017: undefined symbol "dini_Get"
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(38) : error 033: array must be indexed (variable "thing")
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(40) : error 017: undefined symbol "GREEN"
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(53) : error 017: undefined symbol "dini_Set"
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(55) : error 017: undefined symbol "dini_Get"
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(55) : error 033: array must be indexed (variable "thing")
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(57) : error 017: undefined symbol "GREEN"
C:\Documents and Settings\User\Desktop\Hosted Server\filterscripts\motd.pwn(60) : error 017: undefined symbol "GREEN"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


15 Errors.
Reply
#4

You have dini?
Reply
#5

Download Dini CLICK HERE

Then put this on top of your gm or fs
PHP код:
#include <dini> 
Then Define your color green too
like this
PHP код:
#define GREEN 0x00FF00FF 
Reply
#6

where i need to add motd.ini ?
Reply
#7

It'll create the file itself in the /scriptfiles directory, so you don't have to worry about that
Reply
#8

Thx for Help !
Repped +1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)