Post: [1.11] checkMatchingTeam Function
04-06-2014, 10:52 PM #1
RatchetBooty
Former Staff
(adsbygoogle = window.adsbygoogle || []).push({}); Hey guys, today I will be releasing a function that checks if one client is on the same team as another client, there are endless possibilities of what this could be used for. It could be used for team mods, so like friendly team and enemy team and a lot more. So let's get started.

First off we want to start by adding these 2 codes:

    
public static bool checkMatchingTeam(int me, int otherclient)
{
return PS3.Extension.ReadInt32(G_ClientTeam(me)) == PS3.Extension.ReadInt32(G_ClientTeam(otherclient));
}
public static uint G_ClientTeam(int client)
{
return (0xF46FE3+ ((uint)client * 0x3700));
}


What "checkMatchingTeam" does is check if one clients team is the same as another. If you want to create a function that checks if one clients team is different than another's simply change "==" to "!="

Then add this code:

    
public void TEAM(int client)
{
if(checkMatchingTeam(client, 1))
{

IPrintln(1, "Hey you're on the same team as the lobby host");
}
else
{
IPrintln(1, "Hey you're playing against the host of this lobbys team!");
}
}



You can keep repeating the code for each client simply by copying what's in the brackets and pasting it over and over again and changing 1 to a different client number each time. Now remember, you can change whatever is in the { } brackets, I'm just giving an example. Also, "client" is your client number, or whoever's team you want to compare with another person. And "1" is the client # that you're comparing you're team with. So right now, "client , 1" is comparing your team with client 1. So now we need to add in a timer or a background worker, and then add this code into your timer or background worker:

    

TEAM(0);



Change 0 to whatever your client number is, so if you do TEAM(2); it will compare your team with client 1, from the earlier code. If you guys have any questions about it just post down below :p Enjoy.

Note: You can essentially nest another if statement in the if statement that checks for matching team, you can use the onPlayerSpawned function made by AlmightySo with the matching team function: You must login or register to view this content.

So put the onPlayerSpawned function inside of the if statement that checks for matching teams, then what it will do it is check if the person is on the same team as you, then it will check if the person on your team is alive then it will proceed by doing whatever is in the { } brackets.
(adsbygoogle = window.adsbygoogle || []).push({});

The following 8 users say thank you to RatchetBooty for this useful post:

coreconfusion, iMoDz-Baptiste, ResistTheJamsha, MayhemLobbiez, Sir Quack, Sticky, Taylors Bish
04-06-2014, 10:55 PM #2
Sir Quack
I am error
k den
04-06-2014, 11:30 PM #3
Originally posted by RatchetBooty View Post
Hey guys, today I will be releasing a function that checks if one client is on the same team as another client, there are endless possibilities of what this could be used for. It could be used for team mods, so like friendly team and enemy team and a lot more. So let's get started.

First off we want to start by adding these 2 codes:

    
public static bool checkMatchingTeam(int me, int otherclient)
{
return PS3.Extension.ReadInt32(G_ClientTeam(me)) == PS3.Extension.ReadInt32(G_ClientTeam(otherclient));
}
public static uint G_ClientTeam(int client)
{
return (0x00f474e3 + ((uint)client * 0x3700));
}


What "checkMatchingTeam" does is check if one clients team is the same as another. If you want to create a function that checks if one clients team is different than another's simply change "==" to "!="

Then add this code:

    
public void TEAM(int client)
{
if(checkMatchingTeam(client, 1))
{

IPrintln(1, "Hey you're on the same team as the lobby host");
}
else
{
IPrintln(1, "Hey you're playing against the host of this lobbys team!");
}
}



You can keep repeating the code for each client simply by copying what's in the brackets and pasting it over and over again and changing 1 to a different client number each time. Now remember, you can change whatever is in the { } brackets, I'm just giving an example. Also, "client" is your client number, or whoever's team you want to compare with another person. And "1" is the client # that you're comparing you're team with. So right now, "client , 1" is comparing your team with client 1. So now we need to add in a timer or a background worker, and then add this code into your timer or background worker:

    

TEAM(0);



Change 0 to whatever your client number is, so if you do TEAM(2); it will compare your team with client 1, from the earlier code. If you guys have any questions about it just post down below :p Enjoy.


Nice Ratchet :yes:
04-07-2014, 02:10 AM #4
coreconfusion
I defeated!
thanks for this
04-07-2014, 03:25 PM #5
Originally posted by RatchetBooty View Post
Hey guys, today I will be releasing a function that checks if one client is on the same team as another client, there are endless possibilities of what this could be used for. It could be used for team mods, so like friendly team and enemy team and a lot more. So let's get started.

First off we want to start by adding these 2 codes:

    
public static bool checkMatchingTeam(int me, int otherclient)
{
return PS3.Extension.ReadInt32(G_ClientTeam(me)) == PS3.Extension.ReadInt32(G_ClientTeam(otherclient));
}
public static uint G_ClientTeam(int client)
{
return (0x00f474e3 + ((uint)client * 0x3700));
}


What "checkMatchingTeam" does is check if one clients team is the same as another. If you want to create a function that checks if one clients team is different than another's simply change "==" to "!="

Then add this code:

    
public void TEAM(int client)
{
if(checkMatchingTeam(client, 1))
{

IPrintln(1, "Hey you're on the same team as the lobby host");
}
else
{
IPrintln(1, "Hey you're playing against the host of this lobbys team!");
}
}



You can keep repeating the code for each client simply by copying what's in the brackets and pasting it over and over again and changing 1 to a different client number each time. Now remember, you can change whatever is in the { } brackets, I'm just giving an example. Also, "client" is your client number, or whoever's team you want to compare with another person. And "1" is the client # that you're comparing you're team with. So right now, "client , 1" is comparing your team with client 1. So now we need to add in a timer or a background worker, and then add this code into your timer or background worker:

    

TEAM(0);



Change 0 to whatever your client number is, so if you do TEAM(2); it will compare your team with client 1, from the earlier code. If you guys have any questions about it just post down below :p Enjoy.


Lol..
04-08-2014, 11:46 AM #6
RatchetBooty
Former Staff
Note: You can essentially nest another if statement in the if statement that checks for matching team, you can use the onPlayerSpawned function made by AlmightySo with the matching team function: You must login or register to view this content.

So put the onPlayerSpawned function inside of the if statement that checks for matching teams, then what it will do it is check if the person is on the same team as you, then it will check if the person on your team is alive then it will proceed by doing whatever is in the { } brackets.

The following user thanked RatchetBooty for this useful post:

coreconfusion
04-29-2014, 09:36 PM #7
RatchetBooty
Former Staff
Updated the function to 1.11.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo