I have intresting question about y_groups.
#1

How to set visible pickup only for specific group?

How to send a message for specific player group?

Thouse are to my question.. I'm thinking how to do it.. But nothing comes in mind...
Reply
#2

You can use
pawn Код:
bool:Group_GetPlayer(Group:group, player);
above CreatePickup and check..
Same for SendClientMessage, using foreach with
pawn Код:
bool:Group_GetPlayer(Group:group, player);
I just scanned through the topic and this was the first method I came across.
Reply
#3

umm and how I will import the message in? I have all defined and works as charm... I have seted groups etc.. But here is the problem... How do I do it...

Maybe this will work for checking?
Sow it on forum..
pawn Код:
if (Group_GetPlayer(gTDF, playerid))
{
}
Reply
#4

Never worked with y_groups, but I am just guessing:
pawn Код:
foreach( new i: Player)
{
if (Group_GetPlayer(SomeGroup, i) == true )
{
 SendClientMessage(i, -1, "This is a message for people in SomeGroup only!");
}
}
Reply
#5

Okay I will try thank you for your time and respond!
Reply
#6

Still up! Sorry for bump so soon but it's really needed...
Reply
#7

You can use y_groups and foreach together natively, it says that in the y_groups release topic.

Quote:

YSI groups are foreach compatible - just specify which group you would like to loop through the players of:

pawn Код:
new Group:a = Group_Create("group");

Group_SetPlayer(a, 5, true);
Group_SetPlayer(a, 7, true);
Group_SetPlayer(a, 89, true);
Group_SetPlayer(a, 50, true);

foreach (Group(a), playerid)
{
    printf("%d", playerid);
}
Quote:

That code will give an output of:

Код:
5
7
50
89
Reply
#8

So basically if I set group as
pawn Код:
Group_SetPlayer(a, Bloodz, true);
It will show as bloodz?

And another thing I'm using it like this:

pawn Код:
Class_AddWithGroupSet(gLSPD,skinid)
If I basically set skin id could it work?
Reply
#9

To answer your first question, no. To create a new group, you would need to do this:

pawn Код:
new Group:Bloodz = Group_Create("Bloodz");
To add users to the group, you would need to do this:

pawn Код:
Group_SetPlayer(a, playerid, true);
To remove a user from the group, you would have to do this:

pawn Код:
Group_SetPlayer(a, 50, false);
And, to loop through the group, for example, to check if a player is in a group, you would do this:

pawn Код:
foreach (Group(Bloodz), playerid)
{
    printf("%d is in group Bloodz", playerid);
}
I've never used y_groups, but I'm assuming the Class_AddWithGroupSet function works just like you said.
Reply
#10

It works like that on player class select but the thing is.. I'm making it more advanced.. That why I'm thinking how to do it more currently so basically I need to remake gang system..

Just trying to understand how it works and which is the best way to work with y_groups.. Before I notices that but I thought group by skin id will be much easier so now I don't know if it will check if current skin is in that group or he ain't there is the question.. So basically what I want to make.. is 1 leader skin and rest on team is members...

That why I chosen select group by skin id.. + I removed skin selection..
it seemed more not in my thought style...

Big thanks anyway RealCop228 If I can somehow help you just pm me..

So btw I have it already in script
PHP код:
gLSPD Group_Create("LSPD");
gFBI Group_Create("FBI");
gCadet Group_Create("Cadet");
gMedics Group_Create("Medics"); 
Код:
new
 	Group:gLSPD,
 	Group:gFBI,
 	Group:gCadet,
 	Group:gMedics
;
So basically then I need to remove Class_AddWithGroupSet and add this:

Код:
Group_SetPlayer(a, 5, true);
Group_SetPlayer(a, 7, true);
Group_SetPlayer(a, 89, true);
Group_SetPlayer(a, 50, true);

foreach (Group(a), playerid)
{
    printf("%d", playerid);
}
Or I got it incorrectly?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)