How to do this for all players using foreach -
iSanchez - 02.01.2017
Hello i am using y_text and y_languages to translate my server to multiple languages but I noticed the group "ALL_PLAYERS" is not coded at the moment in YSI 4.0, so I decided to simulate this group using foreach.
Код:
foreach(new iplayerid : Player)
{
Text_Send(iplayerid,$USER_HAS_CONNECTED, PName(playerid), playerid, GetPlayerCountry(playerid));
}
But I need that foreach loop everytime I need to use Text_Send.
Is there any possibility to make a macro or something to prevent putting it everytime?
Like, for example: Text_SendToAll (this function is disabled in YSI 4, I don't know why
)
Thank you so much
Re: How to do this for all players using foreach -
oMa37 - 03.01.2017
Make a function and call it however you want but with the same parameters as Text_Send (except the playerid parameter no need for it), and use the loop inside it.
I can't really show you an example code because i'm using the phone.
Respuesta: Re: How to do this for all players using foreach -
iSanchez - 03.01.2017
Quote:
Originally Posted by oMa37
Make a function and call it however you want but with the same parameters as Text_Send (except the playerid parameter no need for it), and use the loop inside it.
I can't really show you an example code because i'm using the phone.
|
Hm the problem is, what I don't understand the parameters for Text_Send because it is defined as a macro under YSI_Players/y_text.inc
Код:
#define UNDO_MOVE|||
#define DO_MOVE|||%0``` %0DO_MOVE|||
#define Text_Send(%0,%1) PSF:_Text_Send(%0,DO_TEXT_SET:%1 UNDO_MOVE|||)
Re: How to do this for all players using foreach -
SickAttack - 03.01.2017
Quote:
Originally Posted by oMa37
Make a function and call it however you want but with the same parameters as Text_Send (except the playerid parameter no need for it), and use the loop inside it.
I can't really show you an example code because i'm using the phone.
|
He will have to do something similar to those SendFormattedMessage functions, which involves assembly.
It is possible to create a macro btw.
Re: How to do this for all players using foreach -
oMa37 - 03.01.2017
Never used y_text actually, But i think it would work if you copy the function from the old YSI library and paste it in the one you got.
EDIT:
Quote:
Originally Posted by SickAttack
He will have to do something similar to those SendFormattedMessage functions, which involves assembly.
It is possible to create a macro btw.
|
Ah so it send a formatted message, didn't know ...