16.10.2011, 18:49
pawn Код:
new MapChange;
forward StartedNewRound(); // On top of your script.
forward NewMapTimer(); // delete playerid from definition
main()
{
print("\n----------------------------------");
print(" Swat 5 TDM");
print("----------------------------------\n");
}
public OnGameModeInit()
{
SetTimer("NewMapTimer",14000,true); // this is 2 min timer for MapChangechange basically has to be on true for it to change the other MapChangewhen timer is over OnPlayerSpawn Further in the tutorial you will know why
// others, but DO NOT WRITE Mapchange = 0; Mapchange = 1; Mapchange = 2; like in your code
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
if(classid == 0)
{
gTeam[playerid] = TEAM_SWAT;
}
if(classid == 1)
{
gTeam[playerid] = TEAM_TERRORIST;
}
switch(classid)
{
case 0: GameTextForPlayer(playerid, "~b~S.W.A.T Team",1000, 5);
case 1: GameTextForPlayer(playerid, "~r~TERRORIST Team",1000, 5);
}
}
public OnPlayerSpawn(playerid)
{
switch ( MapChange )
{
case 0: // this is map 1 (or 0, dunno how you defined it)
{
if(gTeam[playerid] == TEAM_SWAT)
{
SetPlayerPos(playerid , -4198.6240,395.5814,26.1159,18.4021);
SetPlayerFacingAngle(playerid,0.0); // Facing Angle of the first map
SetPlayerAttachedObject( playerid, 4, 18728, 3, 3.147600, -0.303776, -0.873292, 0.000000, 285.771484, 0.000000, 1.000000, 1.000000, 1.000000 ); // smoke_flare - policespark
SetPlayerAttachedObject( playerid, 0, 19140, 2, 0.082782, 0.036745, 0.004386, 88.674697, 78.979743, 0.000000, 1.000000, 1.000000, 1.000000 ); // PoliceGlasses3 - POLICEGLASS
SetPlayerAttachedObject( playerid, 1, 19141, 2, 0.094478, 0.007213, 0.000000, 0.000000, 0.000000, 0.000000, 1.200000, 1.200000, 1.200000 ); // SWATHelmet1 - POLICEHELMENT
SetPlayerAttachedObject( playerid, 2, 19142, 1, 0.009792, 0.041990, 0.000000, 0.000000, 0.000000, 0.000000, 1.200000, 1.200000, 1.200000 ); // SWATArmour1 - POLICE VEST
SetPlayerAttachedObject( playerid, 3, 355, 1, -0.067703, -0.209309, 0.147603, 0.735208, 52.436073, 4.960443, 1.299999, 1.299999, 1.299999 ); // ak47
}
else if( gTeam[playerid] == TEAM_TERRORIST )
{
SetPlayerPos(playerid , -4253.7134,463.4392,29.7993,359.6018);
SetPlayerFacingAngle(playerid,0.0); // Facing Angle of the first map
}
}
case 1: // this is map 2 (or 1, dunno how you defined it)
{
if(gTeam[playerid] == TEAM_SWAT)
{
SetPlayerPos(playerid, 2922.6501464844,4044.9099121094,42.10636138916);
SetPlayerFacingAngle(playerid,0.0); // Facing Angle of the first map
}
else if( gTeam[playerid] == TEAM_TERRORIST )
{
SetPlayerPos(playerid, 2927.7348632813,4312.9345703125,42.668674468994);
SetPlayerFacingAngle(playerid,0.0);
}
}
case 2: // this is map 3 (or 2, dunno how you defined it)
{
if(gTeam[playerid] == TEAM_SWAT)
{
SetPlayerPos(playerid, -1932.6234, 1605.1670, 27.5018);
}
else if( gTeam[playerid] == TEAM_TERRORIST )
{
SetPlayerPos(playerid, -2273.5742, 1655.1820, 48.3878);
// etc etc
}
}
}
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public NewMapTimer() { // The callback we forwarded on the beginning of the tutorial
MapChange++; // this makes it to go to the second MapChange++ part basically does it
if (MapChange == 3) MapChange = 0; // if the round ends, you get to the first round again ( ROTATING )
GameTextForAll("~b~ Loading Next ~w~MAP",4000,3); // Sends everyone in server a gametext
SetTimer("StartedNewRound",6000,false); // Starts a new timer for the MapChangechange 4 seconds this basically starts the new MapChangeand always must be in false
return 1;
}
public StartedNewRound() // The callback we forwarded in the beginning of this tutorial
{
for(new i = 0; i < MAX_PLAYERS; i++) // this loops everyone in the server also you can use foreach include for this part
{
SpawnPlayer ( i ) ; // Re Spawns everyone in the server which then gets OnPlayerSpawn Callback called
switch ( MapChange ) { // This part is basically for your new MapChangesettings like giving them weapons
case 0:{
SendClientMessage(i,-1,"New MapChangeLoad");
}
case 1: {
SendClientMessage(i,-1,"New MapChangeLoad");
}
case 2: {
SendClientMessage(i,-1,"New MapChangeLoad");
}
}
}
return 1;
}