Get a players team (Not with id)
#1

Hi!


Are there any command/callback that you can check wich team a player is in...
But not with a specific team, just check wich team they are in...
Something like: GetPlayerTeam but not with a id..

I've chekt Wiki & ****** etc.. But I didn't found anything..

Thanks alot for reply!.
Reply
#2

what do you mean by
But not with a specific team, just check wich team they are in...
Reply
#3

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
what do you mean by
But not with a specific team, just check wich team they are in...
Yeah, are there any function that checks wich team a player are in?..

I don't want with a id..
Reply
#4

https://sampwiki.blast.hk/wiki/GetPlayerTeam
Reply
#5

You could create variables and do those, just like an Admin system.
pawn Код:
new team1[MAX_PLAYERS];
new team1str[MAX_PLAYERS][128]; //To set the name of the team so it's a str var too. We can use other ways too but this is bit easy.

public OnPlayerSpawn(playerid)
{
  team1[playerid] = 1;
  team1str[playerid] = "EXAMPLE";
  return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
 new Lname[MAX_PLAYER_NAME];
 GetPlayerName(playerid, Lname, sizeof(Lname));
 new str[128];
 format(str, sizeof(str), "%s has left the team server. (Team ID:%d | Team name:%s)", Lname, team1[playerid], team1str[playerid]);
 SendClientMessageToAll(0xFF0000, str);
 return 1;
}
I believe it will output like this:
Lordz has left the team server. (Team ID:1 | Team name:EXAMPLE)
Reply
#6

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
You could create variables and do those, just like an Admin system.
pawn Код:
new team1[MAX_PLAYERS];
new team1str[MAX_PLAYERS][128]; //To set the name of the team so it's a str var too. We can use other ways too but this is bit easy.

public OnPlayerSpawn(playerid)
{
  team1[playerid] = 1;
  team1str[playerid] = "EXAMPLE";
  return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
 new Lname[MAX_PLAYER_NAME];
 GetPlayerName(playerid, Lname, sizeof(Lname));
 new str[128];
 format(str, sizeof(str), "%s has left the team server. (Team ID:%d | Team name:%s)", Lname, team1[playerid], team1str[playerid]);
 SendClientMessageToAll(0xFF0000, str);
 return 1;
}
I believe it will output like this:
Lordz has left the team server. (Team ID:1 | Team name:EXAMPLE)
But that just gets a players name ??.. Sorry if I misunderstood... But I want something like GetPlayerTeam but with out id/s...
Reply
#7

I think SA-MP provides 'GetPlayerTeam' function only for getting the Team ID. Here's a small stock in creating team name too.
pawn Код:
new playateamname[MAX_PLAYER_NAME][128];

stock SetPlayerTeamEx(playerid, team, teamname[])
{
 SetPlayerTeam(playerid, team);
 playateamname[playerid] = teamname;
 return 1;
}

stock GetPlayerTeamName(playerid)
{
 return playateamname[playerid];
}
Now the SetPlayerTeamEx sets the team as well as a name.
Example: SetPlayerTeamEx(playerid, 1, "Lordz's team");
Which means the team id of player is 1 and team name of player is "Lordz's team".

GetPlayerTeamName gets the team name of the player. If you want too hook the SetPlayerTeam function so that it do sets team and teamname without using setplayerteamex, use this too below:
pawn Код:
#if defined _ALS_SetPlayerTeam
 #undef SetPlayerTeam
#else
#define _ALS_SetPlayerTeam
#endif

#define SetPlayerTeam SetPlayerTeamEx

/*Now the SetPlayerTeam has been added with setting team name too:
SetPlayerTeam(playerid, teamid, teamname[]);
GetPlayerTeam(playerid); -> For getting team id.
GetPlayerTeamName(playerid); -> For getting team name. */
Reply
#8

I still don't want to get a name, I just want to check which team/gang a player are in..

Thanks alot anyway!.
Reply
#9

Or you mean the class choosen?
Reply
#10

Hmm sorry but it's hard to explain..

I mean like: I need a function so I can check wich player is in wich team...

But I don't need the id thing because it should not show up on just 1 team..

I hope you understeand now.. Pretty hard to explain..

I will make a turfwar so it has to check wich team is there so it can flash in right color.. Etc..


Edit: Lordz, yes maybe I think so, I think it will work with that..
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)