[Tutorial] How to make teams
#19

Quote:
Originally Posted by Stuun
View Post
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.
*
Reply


Messages In This Thread
How to create teams [Showing how to add colors too] - by Glossy42O - 30.10.2014, 13:55
Re: How to make teams - by xMx4LiFe - 30.10.2014, 16:44
Re: How to make teams - by Glossy42O - 30.10.2014, 17:02
Re: How to make teams - by Glossy42O - 30.10.2014, 19:39
Re: How to make teams - by xMx4LiFe - 31.10.2014, 11:15
Re: How to make teams - by Glossy42O - 31.10.2014, 11:34
Re: How to make teams - by Glossy42O - 31.10.2014, 16:21
Re: How to make teams - by xMx4LiFe - 31.10.2014, 16:39
Re: How to make teams - by Glossy42O - 31.10.2014, 17:58
Re: How to make teams - by xMx4LiFe - 01.11.2014, 10:16
Re: How to make teams - by Glossy42O - 01.11.2014, 12:12
Re: How to make teams - by Epic_Mickey - 01.11.2014, 13:22
Re: How to create teams [Showing how to add colors too] - by Kwarde - 14.11.2014, 14:58
Re: How to make teams - by Arastair - 14.11.2014, 15:26
Re: How to make teams - by Glossy42O - 14.11.2014, 15:41
Re: How to make teams - by Arastair - 14.11.2014, 15:46
Re: How to make teams - by sammp - 14.11.2014, 15:50
Re: How to make teams - by Glossy42O - 14.11.2014, 15:55
Re: How to make teams - by Kwarde - 14.11.2014, 17:00
Re: How to make teams - by sammp - 14.11.2014, 18:40
Re: How to make teams - by Glossy42O - 14.11.2014, 18:54
Re: How to make teams - by Kwarde - 14.11.2014, 19:05
Re: How to make teams - by Glossy42O - 15.11.2014, 03:45
Re: How to make teams - by Quickie - 15.11.2014, 04:51
Re: How to make teams - by Kwarde - 15.11.2014, 10:01

Forum Jump:


Users browsing this thread: 3 Guest(s)