SA-MP Forums Archive
[help] - message - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [help] - message (/showthread.php?tid=106816)



[help] - message - PANNA - 05.11.2009

can someone tell me how to make a message that will be showed every 10 minutes, and it will not be as a client message in the chat but you see it with great letters, at your screen, in the color red, with the text, /report rulebreakers!


Re: [help] - message - Correlli - 05.11.2009

https://sampwiki.blast.hk/wiki/Random_Messages - these are with SendClientMessage, it's easy to change it to GameText or Textdraw - https://sampwiki.blast.hk/wiki/TextDrawCreate / https://sampwiki.blast.hk/wiki/GameTextForPlayer


Re: [help] - message - Alice[WS] - 05.11.2009

Код:
SetTimer("FunctionName", 1000*60*10, 1);

public FunctionName()
{
    GameTextForAll("~r~/report rulebreakers!", 5000, 0);
}



Re: [help] - message - PANNA - 05.11.2009

Quote:
Originally Posted by Alice[A11
]
Код:
SetTimer("FunctionName", 1000*60*10, 1);

public FunctionName()
{
   GameTextForAll("~r~/report rulebreakers!", 5000, 0);
}
C:\Users\Onno\Documents\ALLIN1\da\gamemodes\saa.pw n(66) : error 021: symbol already defined: "SetTimer"



Re: [help] - message - Correlli - 05.11.2009

First learn how to use SetTimer and where.


Re: [help] - message - PANNA - 05.11.2009

just givve me the good code without that error please.


Re: [help] - message - Alice[WS] - 05.11.2009

SetTimer("FunctionName", 1000*60*10, 1); have to be in the OnGameModInit function


Re: [help] - message - Correlli - 05.11.2009

Quote:
Originally Posted by PANNA
just givve me the good code without that error please.
He did, just learn how to use it and where.


Re: [help] - message - Kyosaur - 05.11.2009

Quote:
Originally Posted by PANNA
just givve me the good code without that error please.
EDIT:

He gave you perfectly good code, and advice. Listen to him next time :P. (functions can not be placed outside of defines/callbacks/custom subroutines)

pawn Код:
#include <a_samp>

#define MESSAGE_TIME 60 //how many seconds it takes to show the next message

#define DEFAULT_SHOW_TIME 10 //Default time for the messages to be shown
#define DEFAULT_STYLE 3 //defualt syle for the messages

new MessageID, bool:Static;

enum MessageData
{
    Message[128],
    DisplayTime,
    Style
}

new ServerMessages[][MessageData] =
{
    //Message, DisplayTime, Style
    {"ZOMG MESSAGE 1", DEFAULT_SHOW_TIME,DEFAULT_STYLE},
    {"ZOMG MESSAGE 2", DEFAULT_SHOW_TIME,DEFAULT_STYLE},
    {"ZOMG MESSAGE 3", DEFAULT_SHOW_TIME,DEFAULT_STYLE},
    {"ETC", DEFAULT_SHOW_TIME,DEFAULT_STYLE}
};

public OnFilterScriptInit()
{
    Static = true;
    SetTimer("SendServerMessage", MESSAGE_TIME*1000, true);
    return 1;
}

forward SendServerMessage();
public SendServerMessage()
{
    if(Static == false)
    {
        new ID = random(sizeof(ServerMessages));
        GameTextForAll(ServerMessages[ID][Message],ServerMessages[ID][DisplayTime]*1000,ServerMessages[ID][Style]);
        return 1;
    }

    if(MessageID < sizeof(ServerMessages) && Static == true)
    {
        GameTextForAll(ServerMessages[MessageID][Message],ServerMessages[MessageID][DisplayTime]*1000,ServerMessages[MessageID][Style]);
        MessageID++;
        return 1;
    }
    MessageID = 0;
    GameTextForAll(ServerMessages[MessageID][Message],ServerMessages[MessageID][DisplayTime]*1000,ServerMessages[MessageID][Style]);
    MessageID++;
    return 1;
}

sorry, dont have time to test it ... post any problems and i'll fix them (if there are any).

Works fine. Use the gametext color codes to change the color of the message etc..


Re: [help] - message - Nameless303 - 06.11.2009

<DELETE>