How to do this for all players using foreach
#1

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
Reply
#2

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.
Reply
#3

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|||)
Reply
#4

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.
Reply
#5

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 ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)