How to create teams [Showing how to add colors too] -
Glossy42O - 30.10.2014
Introduction
Hello! I am stuun i am kinda new at samp forums i wanted to teach you how to make teams for newbies hope you enjoy it. It's simple if not explained tell me i will edit.
EDITED.
1.
First of all make sure you have teams under GameModeInit like that
PHP Code:
public OnGameModeInit()
{
SetGameModeText("Blank text");
AddPlayerClass(Here you put skin id ,Put here your coordinates,weapon 1,weapon_ammo,weapon 2,weapon_ammo,weapon 3,weapon_ammo);//That
2.
Make how much teams you want but here ima make only 1. if you wanna make more do the same.
3.
Define your team at the top like that
PHP Code:
#define TEAM_TEST//You don't put test, Put your team name
4.
Go in: public OnPlayerSpawn(playerid)
Put
PHP Code:
switch(GetPlayerTeam(playerid)){
5.
Now we will use cases this will be in OnPlayerSpawn
PHP Code:
case 1 .. 5://1 .. 5 is the ids and ".." is the numbers inside it like 2,3,4 and under it add bracket "{"
Like that:
PHP Code:
case: 1 .. 5:
{// That is a bracket.
6.
Now we will use SetPlayerTeam.
PHP Code:
SetPlayerTeam(playerid, TEAM_TEST);//SetPlayerTeam is sets the team so the friendly fire will be off. Then put the team name of course so the server will understand that they are team.
Now close bracket like that "}"
FULL CODE:
PHP Code:
case 1 .. 5:
{
SetPlayerTeam(playerid, TEAM_TEST);
}
If you need to add color just put this under SetPlayerTeam
PHP Code:
SetPlayerColor(playerid, COLOR_YOURCOLOUR);//SetPlayerColor sets his color after that choose the color and make sure it's defined at the top
Like that
PHP Code:
#define COLOR_YOURCOLOR
FULL CODE
PHP Code:
case: 1 .. 5:
{
SetPlayerTeam(playerid, TEAM_TEST);
SetPlayerColor(playerid, COLOR_YOURCOLOUR);
}
Hope you enjoyed my simple tutorial it's for newbies that are new at scripting.
Didn't explain good? Tell me i will edit it.
Re: How to make teams -
xMx4LiFe - 30.10.2014
if u can make one team for me u would be very thankful from myside
plz reply
Re: How to make teams -
Glossy42O - 30.10.2014
Well use the tutorial.
If you did not understand tell me. I'm sure i explained very well.
Re: How to make teams -
Glossy42O - 30.10.2014
Ah and could you please tell me
Why you asking me to make 1 for you? the tutorial wasn't explained enough? Cause if not please tell me.
Btw i didn't edit my last post cause when i press on it it loads 1 hour ffs. @Admins/Moderators
Re: How to make teams -
xMx4LiFe - 31.10.2014
it becuz when i make myself team isnt coming in-game
help me in making tht team bro plz
Re: How to make teams -
Glossy42O - 31.10.2014
You mean when u are in class selection you see only sky? or something no people on class selection?
Re: How to make teams -
Glossy42O - 31.10.2014
EDIT: nvm
Re: How to make teams -
xMx4LiFe - 31.10.2014
no i already have 5 teams in jarnu script but i wanna add 2 more when i added one team in team selection, its not apearring the team but the gang zones is thier
Re: How to make teams -
Glossy42O - 31.10.2014
I did not understand you anyways..Pm me insted
Re: How to make teams -
xMx4LiFe - 01.11.2014
man talk me here!!
u know jarnu?
he made a cod Script world at war
i upgrading it and added many features but when i add teams!! when i go to team selection those teams textdraws and selection doesnt appears!!
Re: How to make teams -
Glossy42O - 01.11.2014
Well i don't know how to fix it.
Sorry.
Re: How to make teams -
Epic_Mickey - 01.11.2014
Quote:
Originally Posted by xMx4LiFe
man talk me here!!
u know jarnu?
he made a cod Script world at war
i upgrading it and added many features but when i add teams!! when i go to team selection those teams textdraws and selection doesnt appears!!
|
Ofcourse not, this has nothing to do with textdraws.
Re: How to create teams [Showing how to add colors too] -
Kwarde - 14.11.2014
Quote:
Originally Posted by Stuun
First of all make sure you have teams under GameModeInit like that
PHP Code:
public OnGameModeInit()
{
SetGameModeText("Blank text");
AddPlayerClass(Here you put skin id ,Put here your coordinates,weapon 1,weapon_ammo,weapon 2,weapon_ammo,weapon 3,weapon_ammo);//That
|
So AddPlayerClass is used to add a team?
Quote:
Originally Posted by Stuun
2.
Make how much teams you want but here ima make only 5.
|
Where and how then?
Quote:
Originally Posted by Stuun
3.
Define your team at the top like that
PHP Code:
#define TEAM_TEST//You don't put test, Put your team name
|
How to add more teams?
Quote:
Originally Posted by Stuun
5.
Now we will use cases this will be in OnPlayerSpawn
PHP Code:
case 1 .. 5://1 .. 5 is the ids and ".." is the numbers inside it like 2,3,4 and under it add bracket "{"
Like that:
PHP Code:
case: 1 .. 5:
{// That is a bracket.
|
1- What does those IDs stand for?
2- sooo like this?
pawn Code:
public OnPlayerSpawn(playerid)
{
case 1 .. 5:
{
//
}
return 1;
}
Quote:
Originally Posted by Stuun
6.
Now we will use SetPlayerTeam.
PHP Code:
SetPlayerTeam(playerid, TEAM_TEST);//SetPlayerTeam is sets the team so the friendly fire will be off. Then put the team name of course so the server will understand that they are team.
Now close bracket like that "}"
|
But 'TEAM_TEST' didn't get a value at the #define. Will that also work?
Re: How to make teams -
Arastair - 14.11.2014
It's like gang stuff right?
Re: How to make teams -
Glossy42O - 14.11.2014
Quote:
Originally Posted by Arastair
It's like gang stuff right?
|
It could be.
And kwarde i will edit asap.
And how to add more teams? i think i explained it well -.-
Just define it under it i mean #define TEAM_yourteamname.
Re: How to make teams -
Arastair - 14.11.2014
Quote:
Originally Posted by Stuun
It could be.
|
That makes it way better +Rep
Re: How to make teams -
sammp - 14.11.2014
Lol this system will not work at all. There is no switch statement to fetch which team the player is in?
pawn Code:
switch(GetPlayerTeam(playerid)){
case 1..5: {
// code
} // sorry for bad indentation i didnt use pawno or anything
}
Re: How to make teams -
Glossy42O - 14.11.2014
Quote:
Originally Posted by sammp
Lol this system will not work at all. There is no switch statement to fetch which team the player is in?
pawn Code:
switch(GetPlayerTeam(playerid)){ case 1..5: { // code } // sorry for bad indentation i didnt use pawno or anything }
|
Omg i forgot that part :O
But i remember once i used without it and it still worked..
Re: How to make teams -
Kwarde - 14.11.2014
Quote:
Originally Posted by Stuun
Omg i forgot that part :O
But i remember once i used without it and it still worked..
|
Impossible! You might've confused it with something else, but the script will not even compile if you didn't add the switch() statement.
Also, you should add IDs after the TEAM_{teamname} defines. When you compile the script, the pre-compiler (that happens before the script actually gets compiled), will replace all the defines (it was called placeholders I think? Not sure!) with the #define data. For example:
pawn Code:
//Actual script;
#include <a_samp>
#define HELLO_WORLD "Hello world!"
main()
{
print(HELLO_WORLD);
return 1;
}
//Pre-compiled script:
#include <a_samp> //Actually, all the data of a_samp will be in one script.. but I'm not copying that all -atleast, I think it does, I read it once I think. Not sure!! -- It would make sense though-
main()
{
print("Hello world!"); //This got replaced with the HELLO_WORLD define data.
return 1;
}
So, if you don't use IDs, this will happen;
pawn Code:
//Actual script:
#include <a_samp>
#define TEAM_ALFA
#define TEAM_BRAVO
#define TEAM_CHARLIE
#define TEAM_DELTA
#define TEAM_ECHO
#define TEAM_FOXTROT
main()
{
printf("TEAM_ALFA is %d", TEAM_ALFA);
printf("TEAM_BRAVO is %d", TEAM_BRAVO);
printf("TEAM_CHARLIE is %d", TEAM_CHARLIE);
printf("TEAM_DELTA is %d", TEAM_DELTA);
printf("TEAM_ECHO is %d", TEAM_ECHO);
printf("TEAM_FOXTROT is %d", TEAM_FOXTROT);
return 1;
}
//Pre-compiled script:
#include <a_samp>
main()
{
printf("TEAM_ALFA is %d", );
printf("TEAM_BRAVO is %d", );
printf("TEAM_CHARLIE is %d", );
printf("TEAM_DELTA is %d", );
printf("TEAM_ECHO is %d", );
printf("TEAM_FOXTROT is %d", );
return 1;
}
That won't even compile, it'd just give 12 errors (6x error 29, and 6x error 21). This would be a proper way:
pawn Code:
#include <a_samp>
#define TEAM_ALFA 0
#define TEAM_BRAVO 1
#define TEAM_CHARLIE 2
#define TEAM_DELTA 3
#define TEAM_ECHO 4
#define TEAM_FOXTROT 5
main()
{
printf("TEAM_ALFA is %d", TEAM_ALFA);
printf("TEAM_BRAVO is %d", TEAM_BRAVO);
printf("TEAM_CHARLIE is %d", TEAM_CHARLIE);
printf("TEAM_DELTA is %d", TEAM_DELTA);
printf("TEAM_ECHO is %d", TEAM_ECHO);
printf("TEAM_FOXTROT is %d", TEAM_FOXTROT);
return 1;
}
You should also consider using SetTeamCount();.
This post is not meant to be mean, but it's only fully intended so your PAWN knowledge gets extended, so you have a better understanding of what you're doing, and so that you can improve (or please, re-write!) your tutorial.
p.s.
AddPlayerClass doesn't add teams. It only adds an option in the class selection with spawn data, weapon data and skin data. You can, however, used AddPlayerClassEx and also add data on what team they should be.
*
Re: How to make teams -
sammp - 14.11.2014
Right on Kwarde,
He shouldn't be writing tutorials if he is unsure as to what he is doing.....