#define FILTERSCRIPT
#include <a_samp>
#include <dini>
#define GREEN 0x21DD00FF
#if defined FILTERSCRIPT
static Text:RandNewsText;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Textdraw MOTD (Message Of The Day) by AiRa LoKa");
print("--------------------------------------\n");
RandNewsText = TextDrawCreate(10.000000, 435.000000, " ");
TextDrawBackgroundColor(RandNewsText, 255);
TextDrawFont(RandNewsText, 1);
TextDrawLetterSize(RandNewsText, 0.35, 1.0);
TextDrawColor(RandNewsText, GREEN);
TextDrawSetOutline(RandNewsText, 1);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
#endif
public OnPlayerConnect(playerid)
{
new file[128];
format(file, sizeof(file), "motd.ini");
if(dini_Exists(file))
{
new string[256];
new thing[256];
thing = dini_Get(file, "MOTD");
format(string, sizeof(string), "%s", thing);
TextDrawSetString(RandNewsText, string);
}
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");
format(string, sizeof(string), "%s", thing);
TextDrawSetString(RandNewsText, string);
}
TextDrawShowForPlayer(playerid, RandNewsText);
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");
format(string, sizeof(string), "%s", thing);
TextDrawSetString(RandNewsText, string);
}
else
{
SendClientMessage(playerid, GREEN, "[ERROR]: You are not a RCON administrator!");
}
return 1;
}
return 0;
}
static Text:RandNewsText;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Textdraw MOTD (Message Of The Day) by AiRa LoKa");
print("--------------------------------------\n");
RandNewsText = TextDrawCreate(10.000000, 435.000000, " ");
TextDrawBackgroundColor(RandNewsText, 255);
TextDrawFont(RandNewsText, 1);
TextDrawLetterSize(RandNewsText, 0.35, 1.0);
TextDrawColor(RandNewsText, GREEN);
TextDrawSetOutline(RandNewsText, 1);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
#endif
public OnPlayerConnect(playerid)
{
new file[128];
format(file, sizeof(file), "motd.ini");
if(dini_Exists(file))
{
new string[256];
new thing[256];
thing = dini_Get(file, "MOTD");
format(string, sizeof(string), "%s", thing);
TextDrawSetString(RandNewsText, string);
}
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");
format(string, sizeof(string), "%s", thing);
TextDrawSetString(RandNewsText, string);
}
TextDrawShowForPlayer(playerid, RandNewsText);
SetTimer("dtextdraws", 300000, false);
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");
format(string, sizeof(string), "%s", thing);
TextDrawSetString(RandNewsText, string);
}
else
{
SendClientMessage(playerid, GREEN, "[ERROR]: You are not a RCON administrator!");
}
return 1;
}
return 0;
}
public dtextdraws()
{
PlayerTextDrawDestroy(playerid, RandNewsText);
}
Note to the post above: deleting the textdraw will prevent to showing it to any future player since it's not a player saved textdraw. Use the TextDrawHideForPlayer instead with SetTimerEx
|
pawn Код:
|
C:\Users\User\Desktop\Republic State Roleplay\filterscripts\motd.pwn(86) : warning 235: public function lacks forward declaration (symbol "dtextdraws")
C:\Users\User\Desktop\Republic State Roleplay\filterscripts\motd.pwn(88) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
#define FILTERSCRIPT
#include <a_samp>
#include <dini>
#define GREEN 0x21DD00FF
#if defined FILTERSCRIPT
static Text:RandNewsText;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Textdraw MOTD (Message Of The Day) by AiRa LoKa");
print("--------------------------------------\n");
RandNewsText = TextDrawCreate(10.000000, 435.000000, " ");
TextDrawBackgroundColor(RandNewsText, 255);
TextDrawFont(RandNewsText, 1);
TextDrawLetterSize(RandNewsText, 0.35, 1.0);
TextDrawColor(RandNewsText, GREEN);
TextDrawSetOutline(RandNewsText, 1);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
#endif
public OnPlayerConnect(playerid)
{
new file[128];
format(file, sizeof(file), "motd.ini");
if(dini_Exists(file))
{
new string[256];
new thing[256];
thing = dini_Get(file, "MOTD");
format(string, sizeof(string), "%s", thing);
TextDrawSetString(RandNewsText, string);
}
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");
format(string, sizeof(string), "%s", thing);
TextDrawSetString(RandNewsText, string);
}
SetTimerEx("HideMotd",60*1000*5,false,"i",playerid);
TextDrawShowForPlayer(playerid, RandNewsText);
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");
format(string, sizeof(string), "%s", thing);
TextDrawSetString(RandNewsText, string);
}
else
{
SendClientMessage(playerid, GREEN, "[ERROR]: You are not a RCON administrator!");
}
return 1;
}
return 0;
}
forward HideMotd(playerid);
public HideMotd(playerid)
{
TextDrawHideForPlayer(playerid, RandNewsText);
return 1;
}