I seen your Client message and here how to blind it
Put this under #include <a_samp> #include <sscanf2>
Would look like this
PHP код:
#include <a_samp>
#include <sscanf2>
Put this with the defines, under the includes
PHP код:
#define MAX_LINES 10
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Put this any where is in script, just not in any Call Back
PHP код:
forward MessageTimer();
new Lines[MAX_LINES][256];
new TIME_FOR_EACH_MESSAGE = 60; //Time in seconds
new MessageTimerS;
stock ReadFileLine(File:name)
{
new str[256];
for(new linez = 0; linez != 1; linez++)
{
fread(name, str);
}
return str;
}
stock ReadLines()
{
new File:Messages = fopen("messages.txt", io_read);
for(new dlines = 0; dlines < MAX_LINES; dlines++)
{
format(Lines[dlines],256,"%s",ReadFileLine(Messages));
}
fclose(Messages);
}
Put this also any where is the script just not in any call back
PHP код:
public MessageTimer()
{
new rand = random(MAX_LINES);
SendClientMessageToAll(0xFFFFFFAA, Lines[rand]);
print(Lines[rand]);
return 1;
}
Put this under OnPlayerCommandText
PHP код:
dcmd(setline, 7, cmdtext);
dcmd(messagetime, 11, cmdtext);
if (strcmp("/starttimer", cmdtext, true) == 0)
{
if(IsPlayerAdmin(playerid))
{
if(MessageTimerS != 0)
{
KillTimer(MessageTimerS);
MessageTimerS = 0;
SendClientMessage(playerid, 0xFF8040FF, "The Message Timer has been deactivated.");
}
else
{
MessageTimerS = SetTimer("MessageTimer", TIME_FOR_EACH_MESSAGE*1000, true);
SendClientMessage(playerid, 0xFF8040FF, "The Message Timer has been activated.");
}
}
return 1;
}
Put this any where in the script just not in any Call Back
PHP код:
dcmd_setline(playerid, params[]) //This will NOT save the lines in messages.txt! It will only save the variable.
{ //The next version you will be able to save it in messages.txt
new line, message[256];
if(IsPlayerAdmin(playerid))
{
if(sscanf(params, "is[256]", line, message)) return SendClientMessage(playerid, 0xFF8040FF, "USAGE: /setline [line] [message]");
if(strlen(message) > 256) return SendClientMessage(playerid, 0xFF8040FF, "ERROR: Message too long!");
if(line > MAX_LINES+1 || line < 1) return SendClientMessage(playerid, 0xFF8040FF, "ERROR: This line doesn't exist!");
format(Lines[line-1], 256, "%s", message);
format(message, sizeof(message), "[LINE %i]{FF8040} has changed into: %s", line, message);
SendClientMessage(playerid, 0xFFC68CFF, message);
}
return 1;
}
dcmd_messagetime(playerid, params[])
{
new string[53], time;
if(IsPlayerAdmin(playerid))
{
if(sscanf(params, "i", time)) return SendClientMessage(playerid, 0xFF8040FF, "USAGE: /timemessage [seconds]");
KillTimer(MessageTimerS);
TIME_FOR_EACH_MESSAGE = time;
MessageTimerS = SetTimer("MessageTimer", TIME_FOR_EACH_MESSAGE*1000, true);
format(string, sizeof(string), "The messages will now display once every %i seconds", TIME_FOR_EACH_MESSAGE);
SendClientMessage(playerid, 0xFF8040FF, string);
}
return 1;
}