09.12.2012, 12:02
Making Teams
First of all we need to know a bit about how to make team system.
We need a define first of all to confirm our teams.
Now you have successfully defined you team congratulations we have passed the first step of making a team.
Now we need to get a variable through which we can detect our teams so lets get started.
We are now using the global variable to detect our teams so we can know who is in which team.
Now moving to the next step of the things and now we need to add a player class on.
Before doing anything here you need to learn from other sa-mp tutorials how to get player's position and add player
class things or you will fall in trouble reading this tutorial.
now moving on to the next step when we're using OnPlayerRequestClass.
Remember i told you need to learn how to set a player's position and all those things and camera lookat how to
make them from other sa-mp tutorials now if you have learned then you must have known what those means.
SetPlayerPos is used to set the players position on spawning.
SetPlayerFacingAngle is the code when player will be on class selection it will show the angle in that position.
SetPlayerCameraPos is the camera position when player's will be on class selection the camera look of that.
SetPlayerCameraLookAt is the camera look at when player is spawning.
SetPlayerTeam is used to set a player's team and mainly to prevent the team kill thing.
Then you saw there is SetPlayerToTeamColour i made a stock about that so player can set to its team's color.
See we again used the gTeam for detecting what the player's team is so you get how we detect teams like this so finally we have completed our team system now you can enjoy the team system.
Hope You Liked The Tutorial
Thanks For Reading
First of all we need to know a bit about how to make team system.
We need a define first of all to confirm our teams.
Code:
#define YourTeamName // The name of your team in capital.
Now we need to get a variable through which we can detect our teams so lets get started.
Code:
new gTeam[MAX_PLAYERS];
Now moving to the next step of the things and now we need to add a player class on.
Code:
{ //==============================Game-Mode=====================================// SetGameModeText("Your GM Name"); //================================Teams=======================================// AddPlayerClass(Skin,x,y,z,weapon,ammo,weapon,ammo,weapon,ammo); return 1; }
class things or you will fall in trouble reading this tutorial.
now moving on to the next step when we're using OnPlayerRequestClass.
Code:
public OnPlayerRequestClass(playerid, classid) { switch(classid) { case 0: { gTeam[playerid] = YourTeamName; // Team name of yours GameTextForPlayer(playerid, "text", time, style); // Game text SetPlayerPos(playerid, x,y,z); // Player Position SetPlayerFacingAngle(playerid, cords); //Facing angle for player SetPlayerCameraPos(playerid, x,y,z); // Camera position SetPlayerCameraLookAt(playerid, x,y,z); //The look at of camera SetPlayerTeam(playerid, YourTeamName); // The anti team kill for setting player's team } } { SetPlayerToTeamColour(playerid); } return 1; }
make them from other sa-mp tutorials now if you have learned then you must have known what those means.
SetPlayerPos is used to set the players position on spawning.
SetPlayerFacingAngle is the code when player will be on class selection it will show the angle in that position.
SetPlayerCameraPos is the camera position when player's will be on class selection the camera look of that.
SetPlayerCameraLookAt is the camera look at when player is spawning.
SetPlayerTeam is used to set a player's team and mainly to prevent the team kill thing.
Then you saw there is SetPlayerToTeamColour i made a stock about that so player can set to its team's color.
Code:
SetPlayerToTeamColour(playerid) { if(gTeam[playerid] == YourTeamName) // The team's name for setting colour. { SetPlayerColor(playerid,YourColourHere); //The color you have to put in to get a player in that team's colour. } }
Hope You Liked The Tutorial
Thanks For Reading