04.05.2012, 05:53
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
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()
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.
and you also need some colour defines for that define add these colors
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
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.
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.
for setting your teams color you need to do this
ok after you finish your script it will be something like this
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;
}
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;
}
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"
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
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(playerid, classid)
other things and learn it from there and come to my script now here is the thing you need most.
PHP код:
public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 0:
{
gTeam[playerid] = TEAM_AMERICA;
GameTextForPlayer(playerid, "~b~America", 5000, 5);
SetPlayerPos(playerid, 1522.6503,-806.6635,72.1700);
SetPlayerFacingAngle(playerid, 4018);
SetPlayerCameraPos(playerid, 1514.0861,-806.9355,72.0768);
SetPlayerCameraLookAt(playerid, 1522.6503,-806.6635,72.1700);
}
case 1:
{
gTeam[playerid] = TEAM_UK;
GameTextForPlayer(playerid, "~g~UK", 5000, 5);
SetPlayerPos(playerid, 1279.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;
}
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);
}
}
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(playerid, classid)
{
switch(classid)
{
case 0:
{
gTeam[playerid] = TEAM_AMERICA;
GameTextForPlayer(playerid, "~b~America", 5000, 5);
SetPlayerPos(playerid, 1522.6503,-806.6635,72.1700);
SetPlayerFacingAngle(playerid, 4018);
SetPlayerCameraPos(playerid, 1514.0861,-806.9355,72.0768);
SetPlayerCameraLookAt(playerid, 1522.6503,-806.6635,72.1700);
}
case 1:
{
gTeam[playerid] = TEAM_UK;
GameTextForPlayer(playerid, "~g~UK", 5000, 5);
SetPlayerPos(playerid, 1279.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(playerid, COLOR_GREEN,"Welcome To America Vs UK TDM Server");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
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(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}