FS code to combine with GM
#3

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 0linez != 1linez++)
    {
        
fread(namestr);
    }
    return 
str;
}
stock ReadLines()
{
    new 
File:Messages fopen("messages.txt"io_read);
    for(new 
dlines 0dlines MAX_LINESdlines++)
    {
        
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(0xFFFFFFAALines[rand]);
    print(
Lines[rand]);
    return 
1;

Put this under OnPlayerCommandText
PHP код:
    dcmd(setline7cmdtext);
    
dcmd(messagetime11cmdtext);
    if (
strcmp("/starttimer"cmdtexttrue) == 0)
    {
        if(
IsPlayerAdmin(playerid))
        {
            if(
MessageTimerS != 0)
            {
               
KillTimer(MessageTimerS);
                
MessageTimerS 0;
                
SendClientMessage(playerid0xFF8040FF"The Message Timer has been deactivated.");
            }
            else
            {
                
MessageTimerS SetTimer("MessageTimer"TIME_FOR_EACH_MESSAGE*1000true);
                
SendClientMessage(playerid0xFF8040FF"The Message Timer has been activated.");
            }
        }
        return 
1;
    } 
Put this any where in the script just not in any Call Back
PHP код:
dcmd_setline(playeridparams[])     //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 linemessage[256];
    if(
IsPlayerAdmin(playerid))
    {
        if(
sscanf(params"is[256]"linemessage)) return SendClientMessage(playerid0xFF8040FF"USAGE: /setline [line] [message]");
        if(
strlen(message) > 256) return SendClientMessage(playerid0xFF8040FF"ERROR: Message too long!");
        if(
line MAX_LINES+|| line 1) return SendClientMessage(playerid0xFF8040FF"ERROR: This line doesn't exist!");
        
format(Lines[line-1], 256"%s"message);
        
format(messagesizeof(message), "[LINE %i]{FF8040} has changed into: %s"linemessage);
        
SendClientMessage(playerid0xFFC68CFFmessage);
    }
    return 
1;
}
dcmd_messagetime(playeridparams[])
{
    new 
string[53], time;
    if(
IsPlayerAdmin(playerid))
    {
        if(
sscanf(params"i"time)) return SendClientMessage(playerid0xFF8040FF"USAGE: /timemessage [seconds]");
        
KillTimer(MessageTimerS);
        
TIME_FOR_EACH_MESSAGE time;
        
MessageTimerS SetTimer("MessageTimer"TIME_FOR_EACH_MESSAGE*1000true);
        
format(stringsizeof(string), "The messages will now display once every %i seconds"TIME_FOR_EACH_MESSAGE);
        
SendClientMessage(playerid0xFF8040FFstring);
    }
    return 
1;

Reply


Messages In This Thread
FS code to combine with GM - by Alcatraz Gaming - 24.11.2012, 09:09
Re: FS code to combine with GM - by DrTHE - 24.11.2012, 09:20
Re: FS code to combine with GM - by DaRk_RaiN - 24.11.2012, 09:25
Re: FS code to combine with GM - by Alcatraz Gaming - 24.11.2012, 09:25
Re: FS code to combine with GM - by DaRk_RaiN - 24.11.2012, 09:38

Forum Jump:


Users browsing this thread: 1 Guest(s)