[Tutorial] SA-MP's Easiest Way To Make A Team
#1

This tutorial is all about teaching you guys how to script team in the easiest way in whole SA-MP.

ok first of all go and open your pawn file then after you open you have to do the followings as i do.

ok first of all you need to know how to add classes and save positions ok. if you don't know then watch this tutorial

and learn [ame]http://www.youtube.com/watch?v=eMXxdUaTcNU[/ame]

[ame]http://www.youtube.com/watch?v=4Qe6NbLm5bc[/ame]

[ame]http://www.youtube.com/watch?v=PFWnXssIBRA&feature=relmfu[/ame]

watch all part of this tutorial.

then now if you know the basics how to create player class then come to my tutorial now watch carefully.

select a new script or old one if you want to do in that then go in script ok then in above the game-mode init() give

this suppose i take team America And Team UK then i have to do like this first of all add player classes in gamemode

like this

PHP код:
public OnGameModeInit()
{
    
SetGameModeText("America Vs UK V1.5");
    
// America
    
AddPlayerClass(286,1522.6503,-806.6635,72.1700,97.8118,29,500,33,500,24,320);
    
// United Kingdom
        
AddPlayerClass(269,1279.3276,-778.4965,95.9663,83.8298,29,500,34,280,23,450);
    
    return 
1;

ok after you finish doing the followings adding your classes then you want to make this teams right so in class

selection they be team and you can have a TDM server for scripting team first of all do this on above game-mode init()

PHP код:
#endif
new gTeam[MAX_PLAYERS];
public 
OnGameModeInit()
{
    
SetGameModeText("America Vs UK V1.5");
    
// America
    
AddPlayerClass(286,1522.6503,-806.6635,72.1700,97.8118,29,500,33,500,24,320);
    
// United Kingdom
        
AddPlayerClass(269,1279.3276,-778.4965,95.9663,83.8298,29,500,34,280,23,450);
        return 
1;

ok you saw i added another thing which the the new gTeam[MAX_PLAYERS] we need this array for getting players

like 500 something.

then when you finished adding this new thing you will get a warning avoid the warning until you finish your script.

now you will need to know that for adding teams you need some defines alright then here see the defines.

PHP код:
//________________________________//
//__________TEAM DEFINES__________//
#define TEAM_AMERICA 0//__________//
#define TEAM_UK 1//______________//
//_______________________________//
#define AMERICASPAWN      "1522.6503,-806.6635,72.1700"
#define UKSPAWN           "1279.3276,-778.4965,95.9663"
#define AMERICACOLOR      "COLOR_BLUE"
#define UKCOLOR           "COLOR_RED" 
and you also need some colour defines for that define add these colors

PHP код:
//_________________________________//
//____________COLORS_______________//
#define COLOR_BLUE 0x0000FFFF//____//
#define COLOR_RED 0xFF0000AA//_____//
#define COLOR_GREEN 0x008000FF
#define COLOR_BLUE 0x0000FFFF
#define COLOR_BRIGHTRED 0xFF000AAA
#define COLOR_AQUA 0x00FFFFAA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_BEIGE 0xFFF8DCAA
#define COLOR_BLACK 0x000000AA
#define COLOR_LIGHTERBLUE 0x00BFFFAA
#define COLOR_BLUELIGHT 0x1E90FFAA
#define COLOR_BLUEMEDIUM 0x0000CDAA
#define COLOR_BLUEDARK 0x00008BAA
#define COLOR_PINK 0xFF1493AA
#define COLOR_PINKDARK 0xFF00FFAA
#define COLOR_GREENLIGHT 0x00FF00AA
#define COLOR_GREENDARK 0x006400AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OKER 0x808000AA
#define COLOR_ORANGE 0xFF4500AA
#define COLOR_ORANGELIGHT 0xFF8C00AA
#define COLOR_PURPLE 0x800080AA
#define COLOR_VIOLETDARK 0x9400D3AA
#define COLOR_INDIGO 0xAB0082AA
#define COLOR_RED 0xFF0000AA
#define COLOR_SAND 0xFFDEADAA
#define COLOR_SILVER 0xC0C0C0AA
#define COLOR_TEAL 0x008080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GOLD 0xFFD700AA
#define COLOR_BROWN 0x8B4513AA
#define COLOR_BROWNLIGHT 0xA0522DAA
#define COLOR_GRAY 0xA9A9A9AA
#define COLOR_GRAYDARK 0x696969AA
#define COLOR_INVISIBLE 0xFFFFFF00
#define COLOR_INDIA  0x80000096
#define COLOR_PAKISTAN 0x40808096
#define COLOR_NEPAL 0x8000FF96
#define COLOR_BRAZIL 0xB7B70096
#define COLOR_CHINA 0x80808096
#define COLOR_GREECE 0x00000096
#define COLOR_SINGAPORE 0x00FFFF96
#define COLOR_IRAQ 0x8080C096 
ok after you finish adding colors and all those then we are ready in defines.

you saw that i gave the define #define TEAM_AMERICA 0 #define TEAM_UK 1 these are the team numbers

so you can separate teams and you saw i added these two

#define AMERICASPAWN "1522.6503,-806.6635,72.1700"
#define UKSPAWN "1279.3276,-778.4965,95.9663"

these two codes are the SetPlayerPos code of the spawn so that the place is visible in selection so that when

a player joins your server he/she can see the place of spawn.

and you saw i gave these two defines

#define AMERICACOLOR "COLOR_BLUE"
#define UKCOLOR "COLOR_RED"

i gave this defines so everyone who comes in the server can select a team and each team can have 1 color you can

choose your own color.

you the step in which we get to script go to

PHP код:
public OnPlayerRequestClass(playeridclassid
now after you go there do the followings as i do remember i said you to see that tutotial of how to save places and

other things and learn it from there and come to my script now here is the thing you need most.

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    switch(
classid)
    {
        case 
0:
        {
           
gTeam[playerid] = TEAM_AMERICA;
           
GameTextForPlayer(playerid"~b~America"50005);
           
SetPlayerPos(playerid1522.6503,-806.6635,72.1700);
           
SetPlayerFacingAngle(playerid4018);
           
SetPlayerCameraPos(playerid1514.0861,-806.9355,72.0768);
           
SetPlayerCameraLookAt(playerid1522.6503,-806.6635,72.1700);
        }
        case 
1:
        {
           
gTeam[playerid] = TEAM_UK;
           
GameTextForPlayer(playerid"~g~UK"50005);
           
SetPlayerPos(playerid1279.3276,-778.4965,95.9663);
           
SetPlayerFacingAngle(playerid,8298);
           
SetPlayerCameraPos(playerid,1266.1062,-778.3137,95.9665);
           
SetPlayerCameraLookAt(playerid,1279.3276,-778.4965,95.9663);
        }
        
        }
        
SetPlayerToTeamColour(playerid); // calls the custom function
        
{
    }
    return 
1;

for doing this camera and facing angle things you need to see that tutorial so you know how to script a those things.

this is the most important part of script.

now you saw i added a thing SetPlayerTeamToColour(playerid); that is needed it to set your teams colour now is

the final step of your script adding one colour to your team.

now do this thing down that request class.

PHP код:
SetPlayerToTeamColour(playerid)
{
    if(
gTeam[playerid] == TEAM_AMERICA)
    {
        
SetPlayerColor(playerid,COLOR_BLUE);
    }
    else if(
gTeam[playerid] == TEAM_UK)
    {
        
SetPlayerColor(playerid,COLOR_RED);
    }
    

for setting your teams color you need to do this


PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Blank Filterscript by your name here");
    print(
"--------------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
#else
//_________________________________//
//____________COLORS_______________//
#define COLOR_BLUE 0x0000FFFF//____//
#define COLOR_RED 0xFF0000AA//_____//
#define COLOR_GREEN 0x008000FF
#define COLOR_BLUE 0x0000FFFF
#define COLOR_BRIGHTRED 0xFF000AAA
#define COLOR_AQUA 0x00FFFFAA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_BEIGE 0xFFF8DCAA
#define COLOR_BLACK 0x000000AA
#define COLOR_LIGHTERBLUE 0x00BFFFAA
#define COLOR_BLUELIGHT 0x1E90FFAA
#define COLOR_BLUEMEDIUM 0x0000CDAA
#define COLOR_BLUEDARK 0x00008BAA
#define COLOR_PINK 0xFF1493AA
#define COLOR_PINKDARK 0xFF00FFAA
#define COLOR_GREENLIGHT 0x00FF00AA
#define COLOR_GREENDARK 0x006400AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OKER 0x808000AA
#define COLOR_ORANGE 0xFF4500AA
#define COLOR_ORANGELIGHT 0xFF8C00AA
#define COLOR_PURPLE 0x800080AA
#define COLOR_VIOLETDARK 0x9400D3AA
#define COLOR_INDIGO 0xAB0082AA
#define COLOR_RED 0xFF0000AA
#define COLOR_SAND 0xFFDEADAA
#define COLOR_SILVER 0xC0C0C0AA
#define COLOR_TEAL 0x008080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GOLD 0xFFD700AA
#define COLOR_BROWN 0x8B4513AA
#define COLOR_BROWNLIGHT 0xA0522DAA
#define COLOR_GRAY 0xA9A9A9AA
#define COLOR_GRAYDARK 0x696969AA
#define COLOR_INVISIBLE 0xFFFFFF00
#define COLOR_INDIA  0x80000096
#define COLOR_PAKISTAN 0x40808096
#define COLOR_NEPAL 0x8000FF96
#define COLOR_BRAZIL 0xB7B70096
#define COLOR_CHINA 0x80808096
#define COLOR_GREECE 0x00000096
#define COLOR_SINGAPORE 0x00FFFF96
#define COLOR_IRAQ 0x8080C096
//________________________________//
//__________TEAM DEFINES__________//
#define TEAM_AMERICA 0//__________//
#define TEAM_UK 1//______________//
//_______________________________//
#define AMERICASPAWN      "1522.6503,-806.6635,72.1700"
#define UKSPAWN           "1279.3276,-778.4965,95.9663"
#define AMERICACOLOR      "COLOR_BLUE"
#define UKCOLOR           "COLOR_RED"
main()
{
    print(
"\n----------------------------------");
    print(
"America Vs UK V1.5");
    print(
"----------------------------------\n");
}
#endif
new America;
new 
UK;
new 
gTeam[MAX_PLAYERS];
public 
OnGameModeInit()
{
    
SetGameModeText("America Vs UK V1.5");
    
// America
    
AddPlayerClass(286,1522.6503,-806.6635,72.1700,97.8118,29,500,33,500,24,320);
    
// United Kingdom
        
AddPlayerClass(269,1279.3276,-778.4965,95.9663,83.8298,29,500,34,280,23,450);
   
    return 
1;
}
public 
OnGameModeExit()
{
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    switch(
classid)
    {
        case 
0:
        {
           
gTeam[playerid] = TEAM_AMERICA;
           
GameTextForPlayer(playerid"~b~America"50005);
           
SetPlayerPos(playerid1522.6503,-806.6635,72.1700);
           
SetPlayerFacingAngle(playerid4018);
           
SetPlayerCameraPos(playerid1514.0861,-806.9355,72.0768);
           
SetPlayerCameraLookAt(playerid1522.6503,-806.6635,72.1700);
        }
        case 
1:
        {
           
gTeam[playerid] = TEAM_UK;
               
GameTextForPlayer(playerid"~g~UK"50005);
           
SetPlayerPos(playerid1279.3276,-778.4965,95.9663);
           
SetPlayerFacingAngle(playerid,8298);
           
SetPlayerCameraPos(playerid,1266.1062,-778.3137,95.9665);
           
SetPlayerCameraLookAt(playerid,1279.3276,-778.4965,95.9663);
        }
        
        }
        
SetPlayerToTeamColour(playerid); // calls the custom function
        
{
    }
    return 
1;
}
SetPlayerToTeamColour(playerid)
{
    if(
gTeam[playerid] == TEAM_AMERICA)
    {
        
SetPlayerColor(playerid,COLOR_BLUE);
    }
    else if(
gTeam[playerid] == TEAM_UK)
    {
        
SetPlayerColor(playerid,COLOR_RED);
    }
    
}
public 
OnPlayerConnect(playerid)
{
    
SendClientMessage(playeridCOLOR_GREEN,"Welcome To America Vs UK TDM Server");
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    return 
1;
}
public 
OnVehicleSpawn(vehicleid)
{
    return 
1;
}
public 
OnVehicleDeath(vehicleidkillerid)
{
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    return 
1;
}
public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
    return 
1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    return 
1;
}
public 
OnPlayerEnterCheckpoint(playerid)
{
    return 
1;
}
public 
OnPlayerLeaveCheckpoint(playerid)
{
    return 
1;
}
public 
OnPlayerEnterRaceCheckpoint(playerid)
{
    return 
1;
}
public 
OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 
1;
}
public 
OnRconCommand(cmd[])
{
    return 
1;
}
public 
OnPlayerRequestSpawn(playerid)
{
    return 
1;
}
public 
OnObjectMoved(objectid)
{
    return 
1;
}
public 
OnPlayerObjectMoved(playeridobjectid)
{
    return 
1;
}
public 
OnPlayerPickUpPickup(playeridpickupid)
{
    return 
1;
}
public 
OnVehicleMod(playeridvehicleidcomponentid)
{
    return 
1;
}
public 
OnVehiclePaintjob(playeridvehicleidpaintjobid)
{
    return 
1;
}
public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
    return 
1;
}
public 
OnPlayerSelectedMenuRow(playeridrow)
{
    return 
1;
}
public 
OnPlayerExitedMenu(playerid)
{
    return 
1;
}
public 
OnPlayerInteriorChange(playeridnewinterioridoldinteriorid)
{
    return 
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    return 
1;
}
public 
OnRconLoginAttempt(ip[], password[], success)
{
    return 
1;
}
public 
OnPlayerUpdate(playerid)
{
    return 
1;
}
public 
OnPlayerStreamIn(playeridforplayerid)
{
    return 
1;
}
public 
OnPlayerStreamOut(playeridforplayerid)
{
    return 
1;
}
public 
OnVehicleStreamIn(vehicleidforplayerid)
{
    return 
1;
}
public 
OnVehicleStreamOut(vehicleidforplayerid)
{
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    return 
1;
}
public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    return 
1;

ok after you finish your script it will be something like this
Reply
#2

You didn't explain each parts, i wouldn't called this tutorial.
a tutorial has explanation. Each line in the code must have explanation.

plus you just copy these codes from your gamemode script America vs UK
Reply
#3

Yes i did i wanted players to learn more easily so that they know how to script team
Reply
#4

Quote:
Originally Posted by Nirzor
Посмотреть сообщение
Yes i did i wanted players to learn more easily so that they know how to script team
Do you have brain?
Newbie will not understand the code without the explanation.
Edit this thread and put an explanation example

pawn Код:
SendClientMessage(playerid, -1, "Test");
• Test will be sent as client message in game, -1 means color white.

Please explain each part.

this is horrible 0/10

Reply
#5

are you mad i explained everything line by line and you are saying i did not do anything this is for the guys who knows

how to add the classes setplayerpos and setplayerfacing angle i gave those tutorial so newbies knows how to script

the basic so they understand my tutorial you did not see anything
Reply
#6

Quote:
Originally Posted by Nirzor
Посмотреть сообщение
are you mad i explained everything line by line and you are saying i did not do anything this is for the guys who knows

how to add the classes setplayerpos and setplayerfacing angle i gave those tutorial so newbies knows how to script

the basic so they understand my tutorial you did not see anything
You only explain some of them not all of them.

- i will not reply in this tutorial anymore since i already said my ratings and opinion
Reply
#7

Please read this topic...
This tutorial is not even good.
I will tell you why:
  • Lack of explaining it proper
  • Posting videos is helping at all
  • You use the [php] tags, while you have to use [pawn] and you forgot to put some parts in [pawn]
  • Considering the mess, you can't see what you have to add in the script and what not
  • Leaving useless callbacks in the script
Romel is right with:
Quote:

You didn't explain each parts, i wouldn't called this tutorial.
a tutorial has explanation. Each line in the code must have explanation.

You are posting a piece of code, without explaining what everything does? (=> Line by line)
Also: start a line with a Capital and end it with a dot. Make it readable

Don't think I hate you or something similar, I am just telling you what you can do better in this tutorial
Reply
#8

Let me summarize this tutorial.


"Watch this! Copy this! Paste this here! Watch this again! Learn!"
Reply
#9

This is utter shit.
Reply
#10

I know the pawn language relatively well and not even I could understand what the OP was trying to tell me..

My only reaction: wut.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)