SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/05/2019, 02:26 AM   #1
nbx2000
Big Clucker
 
Join Date: Dec 2016
Posts: 149
Reputation: 5
Default not random . order

How to do so that it is not random and have an order messages 1 2 3 message=?
Code:
new Text:Automatico;

new MensajesRandom[][] =
{
    "~b~[SERVIDOR] ~y~Puedes encontrar diversos objetos en el suelo, utiliza /buscar",
    "~b~[SERVIDOR] ~y~Si tienes alguna duda utiliza el comando /d (Tu duda)",
    "~b~[SERVIDOR] ~y~Para mayor información sobre el servidor utiliza /ayuda y /creditos",
    "~b~[SERVIDOR] ~y~Para obtener una cuenta V.I.P utiliza /ovip",
    "~b~[SERVIDOR] ~y~Para saber los comandos del servidor utiliza /comandos",
    "~b~[SERVIDOR] ~y~Puedes crear casas con /crearcasa"
};


public OnFilterScriptInit()
{
	Automatico = TextDrawCreate(5.000000, 420.000000,"_");
	TextDrawAlignment(Automatico,0);
	TextDrawBackgroundColor(Automatico,0x000000ff);
	TextDrawFont(Automatico,3);
	TextDrawLetterSize(Automatico,0.330000, 1.200000);
	TextDrawColor(Automatico,0xffffffff);
	TextDrawSetOutline(Automatico,1);
	TextDrawSetProportional(Automatico,1);
	TextDrawSetShadow(Automatico,1);
	TextDrawUseBox(Automatico, 1);
	TextDrawBoxColor(Automatico, 0x0000FF15);
	TextDrawTextSize(Automatico, 651.000000, -572.000000);
	SetTimer("TiempoAutomatico",6000,1);

	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    TextDrawHideForPlayer(playerid, Automatico);

	return 1;
}

public OnPlayerSpawn(playerid)
{
    TextDrawShowForPlayer(playerid, Automatico);

	return 1;
}

forward TiempoAutomatico();
public TiempoAutomatico()
{
    TextDrawSetString(Automatico, MensajesRandom[random(sizeof(MensajesRandom))]);
	return 1;
}
nbx2000 is offline   Reply With Quote
Old 11/05/2019, 10:21 AM   #2
Mugala
High-roller
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: Georgia, Tbilisi
Posts: 1,005
Reputation: 48
Default Re: not random . orden help

Create a variable which indicates current message number, than display the message by that variable.
After display that message, increase variable number.
__________________
hang in there, help is on the way.
Mugala is offline   Reply With Quote
Old 11/05/2019, 11:56 AM   #3
nbx2000
Big Clucker
 
Join Date: Dec 2016
Posts: 149
Reputation: 5
Default Re: not random . orden help

Example
nbx2000 is offline   Reply With Quote
Old 11/05/2019, 11:56 AM   #4
RIDE2DAY
Huge Clucker
 
RIDE2DAY's Avatar
 
Join Date: Jul 2015
Location: Modena, Italy
Posts: 212
Reputation: 381
Default Re: not random . orden help

PHP Code:
new current_idx// array index
new Text:Automatico;

new 
MensajesRandom[][] =
{
    
"~b~[SERVIDOR] ~y~Puedes encontrar diversos objetos en el suelo, utiliza /buscar",
    
"~b~[SERVIDOR] ~y~Si tienes alguna duda utiliza el comando /d (Tu duda)",
    
"~b~[SERVIDOR] ~y~Para mayor información sobre el servidor utiliza /ayuda y /creditos",
    
"~b~[SERVIDOR] ~y~Para obtener una cuenta V.I.P utiliza /ovip",
    
"~b~[SERVIDOR] ~y~Para saber los comandos del servidor utiliza /comandos",
    
"~b~[SERVIDOR] ~y~Puedes crear casas con /crearcasa"
};


public 
OnFilterScriptInit()
{
    
Automatico TextDrawCreate(5.000000420.000000,"_");
    
TextDrawAlignment(Automatico,0);
    
TextDrawBackgroundColor(Automatico,0x000000ff);
    
TextDrawFont(Automatico,3);
    
TextDrawLetterSize(Automatico,0.3300001.200000);
    
TextDrawColor(Automatico,0xffffffff);
    
TextDrawSetOutline(Automatico,1);
    
TextDrawSetProportional(Automatico,1);
    
TextDrawSetShadow(Automatico,1);
    
TextDrawUseBox(Automatico1);
    
TextDrawBoxColor(Automatico0x0000FF15);
    
TextDrawTextSize(Automatico651.000000, -572.000000);
    
    
SetTimer("TiempoAutomatico",6000,1);

    return 
1;
}

public 
OnPlayerDisconnect(playeridreason)
{
    
TextDrawHideForPlayer(playeridAutomatico);

    return 
1;
}

public 
OnPlayerSpawn(playerid)
{
    
TextDrawShowForPlayer(playeridAutomatico);

    return 
1;
}

forward TiempoAutomatico();
public 
TiempoAutomatico()
{
    
// array_idx will be 0 initially, so it'll show the first message.
    // once the timer repeats, it'll be 1 and it'll show the second message.
    
TextDrawSetString(AutomaticoMensajesRandom[current_idx]);

    
current_idx++; // increase the index

    
if(current_idx >= sizeof(MensajesRandom)) // if the current index is > array max index
    
{
        
current_idx 0// set it 0, and the messages repeat again in order
    
}
    return 
1;

RIDE2DAY is offline   Reply With Quote
Old 11/05/2019, 12:21 PM   #5
nbx2000
Big Clucker
 
Join Date: Dec 2016
Posts: 149
Reputation: 5
Default Re: not random . orden help

Not working
nbx2000 is offline   Reply With Quote
Old 11/05/2019, 12:29 PM   #6
Plastikmensch
Huge Clucker
 
Join Date: Aug 2016
Posts: 251
Reputation: 16
Default Re: not random . orden help

Code:
TextDrawSetString(Automatico, MensajesRandom[current_idx]);
needs to be
Code:
TextDrawSetString(Automatico, MensajesRandom[current_idx][0]);
since it's defined to be a 2-dimensional array
Plastikmensch is offline   Reply With Quote
Old 11/05/2019, 07:03 PM   #7
nbx2000
Big Clucker
 
Join Date: Dec 2016
Posts: 149
Reputation: 5
Default Re: not random . orden help

the problem persists a message appears then they do not appear anymore
nbx2000 is offline   Reply With Quote
Old 11/05/2019, 08:47 PM   #8
DRIFT_HUNTER
High-roller
 
Join Date: Oct 2009
Posts: 2,062
Reputation: 184
Default Re: not random . order

pawn Code:
new gMessagesCount = 0;

forward TiempoAutomatico();
public TiempoAutomatico()
{
   
    TextDrawSetString(Automatico, MensajesRandom[gMessagesCount]);
    gMessagesCount++;
    if(gMessagesCount >= sizeof(MensajesRandom)) gMessagesCount = 0;
    return 1;
}
__________________
Путин here,
Путин there,
Путин просто everywhere.


Any PM's that include question about any kind of help will be ignored.
Use appropriate boards for that
DRIFT_HUNTER is offline   Reply With Quote
Old 12/05/2019, 04:15 AM   #9
nbx2000
Big Clucker
 
Join Date: Dec 2016
Posts: 149
Reputation: 5
Default Re: not random . order

Quote:
Originally Posted by DRIFT_HUNTER View Post
pawn Code:
new gMessagesCount = 0;

forward TiempoAutomatico();
public TiempoAutomatico()
{
   
    TextDrawSetString(Automatico, MensajesRandom[gMessagesCount]);
    gMessagesCount++;
    if(gMessagesCount >= sizeof(MensajesRandom)) gMessagesCount = 0;
    return 1;
}
I've tried it seems to be good, thanks to all
nbx2000 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vehicle ID's Loading in random order. MySQL R41 Tass007 Scripting Help 17 02/08/2018 12:47 AM
ORDER BY | See <-- ilepopivanov Scripting Help 1 22/06/2015 08:07 PM
[Tutorial] Random Aspects - Using numargs(), getarg(...) and random(...) to make random systems dynamic and easier! SickAttack Tutorials 7 10/05/2015 10:39 AM
order [Cop]MaddDogg Help Archive 5 13/05/2009 08:34 PM
Putting numbers in random order... Robbin237 Help Archive 0 31/03/2009 04:07 PM


All times are GMT. The time now is 04:45 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.