[FilterScript] First
#1

Textdraw based Random Messages

Features
  • Messages aren't repeated.
  • Selected randomly.
  • Very easy to add new messages.
  • Textdraw based.
PHP код:
#include a_samp
new
    
Text RandomMsgTD,
    
RandomMsgID = -1,
    
RandomMsgs[][] =
{
    
"Message number 1"
    
"Message number 2"
    
"Message number 3"
};
public 
OnFilterScriptInit()
{
    
RandomMsgTD TextDrawCreate(8.000000431.000000, ~p~~h~News ~w~_.);
    
TextDrawBackgroundColor(RandomMsgTD255);
    
TextDrawFont(RandomMsgTD2);
    
TextDrawLetterSize(RandomMsgTD0.2000001.200000);
    
TextDrawColor(RandomMsgTD, -1);
    
TextDrawSetOutline(RandomMsgTD1);
    
TextDrawSetProportional(RandomMsgTD1);
    
TextDrawSetSelectable(RandomMsgTD0);
    
    
RandomMessage();
    
SetTimer(RandomMessage45000true);
    return 
1;
}
public 
OnPlayerConnect(playeridTextDrawShowForPlayer(playeridRandomMsgTD);
public 
OnPlayerDisconnect(playeridreasonTextDrawHideForPlayer(playeridRandomMsgTD);
forward RandomMessage();
public  
RandomMessage()
{
    
reselect_msg
    
new string[150], rID random(sizeof RandomMsgs);
    if(
RandomMsgID == rID) goto reselect_msg;
    
format(stringsizeof string, ~r~News ~w~%sRandomMsgs[rID]);
    
TextDrawSetString(RandomMsgTDstring);
    return 
1;

Reply
#2

Very simple, but good for a beginner.
Reply
#3

Nicee +1

But dude .. just solve the errors.
Reply
#4

Quote:

Messages aren't repeated.

I'd say this is the best feature.
Reply
#5

6 Errors on compiling, gj mate, gj

Fixed Version (still not worth releasing):

PHP код:
#define MAX_MESSAGE_SIZE 150
new Text:RandomMsgTDRandomMsgID;
new 
RandomMsgs[][MAX_MESSAGE_SIZE] = 

    
"Message number 1",  
    
"Message number 2",  
    
"Message number 3" 
}; 
public 
OnFilterScriptInit() 

    
RandomMsgTD TextDrawCreate(8.000000431.000000"~p~~h~News ~w~_."); 
    
TextDrawBackgroundColor(RandomMsgTD255); 
    
TextDrawFont(RandomMsgTD2); 
    
TextDrawLetterSize(RandomMsgTD0.2000001.200000); 
    
TextDrawColor(RandomMsgTD, -1); 
    
TextDrawSetOutline(RandomMsgTD1); 
    
TextDrawSetProportional(RandomMsgTD1); 
    
TextDrawSetSelectable(RandomMsgTD0); 
     
    
RandomMessage(); 
    
SetTimer("RandomMessage"45000true); 
    return 
1

public 
OnPlayerConnect(playerid)
{
    
TextDrawShowForPlayer(playeridRandomMsgTD); 
}
public 
OnPlayerDisconnect(playeridreason){
{
    
TextDrawHideForPlayer(playeridRandomMsgTD); 
}
forward RandomMessage(); 
public  
RandomMessage() 

    new 
rID getNewRandomMessageID();
    new 
string[MAX_MESSAGE_SIZE 15 /*because of the stuff infront of the actual message*/];
    
format(stringsizeof(string), "~r~News ~w~%s"RandomMsgs[rID]); 
    
TextDrawSetString(RandomMsgTDstring); 
    return 
1;
}  
getNewRandomMessageID()
{
    new 
newRandomID random(sizeof(RandomMsgs)); 
    return 
newRandomID == RandomMsgID getNewRandomMessageID() : newRandomID;

Also give your topic a proper name ^^
Reply
#6

^ Marcel, a little appreciation for a newbie who at least tried to do something. However, your version isn't perfect as well...
Reply
#7

Quote:
Originally Posted by Logic_
Посмотреть сообщение
^ Marcel, a little appreciation for a newbie who at least tried to do something. However, your version isn't perfect as well...
He didn't want to make a better version, he just fixed the errors the thread author made, and don't use the "newbie" card since it affects him the most. He will think he can release anything, just because he is new to it, no he can't. Just because he is new he should be criticized all the time so he doesn't make the mistakes and actually learns something.
Reply
#8

Good job rassh
Reply
#9

REMOVE THIS SORRY MY NET WAS GETTING SHOWER REMOVE THIS!
Reply
#10

Quote:
Originally Posted by Logic_
Посмотреть сообщение
^ Marcel, a little appreciation for a newbie who at least tried to do something. However, your version isn't perfect as well...
My intent wasn't to make a perfect version

Quote:
Originally Posted by Marcel
Fixed Version (still not worth releasing):
And to the people saying nice, please read the code before saying it is nice, even though that guy might be a beginner he should at least try to compile his code before releasing it ^^

Quote:
Originally Posted by SkyT
Посмотреть сообщение
PHP код:
new rand;
while((
rand random(max)) == last) { } 
While loops boooh, Recursion for the win :P
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)