All pastes #526308 Raw Edit

Anonymous

public text v1 · immutable
#526308 ·published 2007-05-31 19:22 UTC
rendered paste body
#include <a_samp>

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_BLUE 0x0000AA20
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_SYSTEM 0xEFEFF7AA

#define SAB 0
#define Visitors 1


new gClass[MAX_PLAYERS];
new gStarted;
new gTeam[MAX_PLAYERS];

new gSAB;
new gVisitors;

main()
{
	print("\n");
	print("|--------------------------------------------|");
	print("|               [SAB] Vs [!]               |");
	print("|--------------------------------------------|");
	print("\n\n");
}



public OnGameModeInit()
{
	print("GameModeInit()");
	gStarted = 0;
	SetGameModeText("[SAB] vs [!] - WAR");
	// Sexy Ass Banana
	AddPlayerClass(167, 1314.0957,2211.7778,12.0156, 0, 32, 9999999999, 26, 9999999999, 0, 0);
	AddPlayerClass(155, 1410.7576,2109.6572,12.0156, 0, 32, 9999999999, 26, 9999999999, 0, 0);
	// Visitors
	AddPlayerClass(206, 1370.1654,2196.1580,9.7578, 0, 32, 9999999999, 26, 9999999999, 0, 0);
	AddPlayerClass(202, 1394.9240,2171.6423,9.7578, 0, 32, 9999999999, 26, 9999999999, 0, 0);
	//Referee
		AddPlayerClass(171, 1351.9501,2152.5134,11.0156, 0, 0, 0, 0, 0, 0, 0);
			AddPlayerClass(172, 1351.9501,2152.5134,11.0156, 0, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerInterior(playerid,14);
	SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
	SetPlayerFacingAngle(playerid, 270.0);
	SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
	SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
	if (classid == 0)
		{
		gClass[playerid] = 0;
	    GameTextForPlayer(playerid,"~y~Sexy Ass Banana",1000,5);
	    SetPlayerColor(playerid, COLOR_YELLOW);
		}
	else if (classid == 1)
		{
		gClass[playerid] = 1;
	    GameTextForPlayer(playerid,"~y~Sexy Ass Banana",1000,5);
	    SetPlayerColor(playerid, COLOR_YELLOW);
		}
	else if (classid == 2)
		{
		gClass[playerid] = 2;
		GameTextForPlayer(playerid,"~r~[!]",1000,5);
		SetPlayerColor(playerid, COLOR_RED);
		}
	else if (classid == 3)
		{
		gClass[playerid] = 3;
		GameTextForPlayer(playerid,"~r~[!]",1000,5);
		SetPlayerColor(playerid, COLOR_RED);
		}
  	else if (classid == 4)
		{
		gClass[playerid] = 4;
		GameTextForPlayer(playerid,"~r~Referee",1000,5);
		SetPlayerColor(playerid, COLOR_WHITE);
		}
			else if (classid == 5)
		{
		gClass[playerid] = 5;
		GameTextForPlayer(playerid,"~r~Referee",1000,5);
		SetPlayerColor(playerid, COLOR_WHITE);
		}
	return 1;
}

public OnGameModeExit()
{
	print("GameModeExit()");
	return 1;
}

public OnPlayerConnect(playerid)
{
	printf("OnPlayerConnect(%d)", playerid);
	SendClientMessage(playerid, COLOR_YELLOW, "When: Friday 1st June");
	SendClientMessage(playerid, COLOR_YELLOW, "Who: [SAB] Vs [!]");
	SendClientMessage(playerid, COLOR_YELLOW, "Where: Baseball Field");
	SendClientMessage(playerid, COLOR_YELLOW, "Weapons: Sawnoff's and tec9's");
	SendClientMessage(playerid, COLOR_RED, "Please, use /help, and remember to choose your team class.");
	SetTimer("ShowScores", 200000, 1);
	return 1;
}

public OnPlayerDisconnect(playerid)
{
	printf("OnPlayerDisconnect(%d)", playerid);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	printf("OnPlayerSpawn(%d)", playerid);
	SendClientMessage(playerid, COLOR_RED, "Please, use /help");
	SetPlayerWorldBounds(playerid, 1413.6134, 1296.2489, 2217.8245, 2099.6621);
	SetPlayerInterior(playerid, 0);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	printf("OnPlayerDeath(%d, %d, %d)", playerid, killerid, reason);
	new string[256];
	if (gTeam[killerid] != gTeam[playerid])
		{
		SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
		if (gTeam[killerid] == SAB)
			{
			gSAB += 1;
			if (gSAB == 100)
				{
				format(string, sizeof(string),"~y~SAB ~w~won the war!!~n~Final results:~n~[SAB] = %d [-D-] = %d", gSAB, gVisitors);
				GameTextForAll(string, 20000, 6);
				SetTimer("OnGameModeExit", 20000, 0);
				for(new i=0;i<MAX_PLAYERS;i++)
					{
					TogglePlayerControllable(i, 0);
					}
				}
			}
		else if (gTeam[killerid] == Visitors)
			{
			gVisitors += 1;
			if (gVisitors == 100)
				{
				format(string, sizeof(string),"~y~[!] ~w~won the war!!~n~Final results:~n~[SAB] = %d [-D-] = %d", gSAB, gVisitors);
				GameTextForAll(string, 20000, 6);
				SetTimer("OnGameModeExit", 20000, 0);
				for(new i=0;i<MAX_PLAYERS;i++)
					{
					TogglePlayerControllable(i, 0);
					}
				}
			}
		}
	if (gTeam[killerid] == gTeam[playerid])
		{
		SetPlayerScore(killerid, GetPlayerScore(killerid)-1);
		SendClientMessage(playerid, COLOR_RED, "*** DONT TEAMKILL, YOU LOST 1 POINT***");
		}
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid)
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new string[256];
	
	if (strcmp(cmdtext, "/help", true)==0)
		{
		if (gStarted == 0)
	    	{
	    	SendClientMessage(playerid, COLOR_RED, "Match hasnt started yet. Wait to all people to join");
	    	SendClientMessage(playerid, COLOR_RED, "or for an admin to start the TDM.");
	    	}
	    SendClientMessage(playerid, COLOR_SYSTEM, "This is a team deathmatch. Every kill = 1 point");
	    SendClientMessage(playerid, COLOR_SYSTEM, "for you and for your clan.");
	    SendClientMessage(playerid, COLOR_SYSTEM, "First clan to reach 100 points, will win the war!");
	    SendClientMessage(playerid, COLOR_YELLOW, "Look at /scores to see scores");
	    if (IsPlayerAdmin(playerid))
	    		{
	    		SendClientMessage(playerid, COLOR_YELLOW, "Do /resetdeathmatch to restart deathmatch.");
	    		}
	    return 1;
		}
		
	else if (strcmp(cmdtext, "/scores", true)==0)
		{
		format(string, sizeof(string), "[SAB] = %d  -  [!] = %d", gSAB, gVisitors);
		SendClientMessage(playerid, COLOR_BLUE, string);
	    return 1;
		}
	
	else if (strcmp(cmdtext, "/resetdeathmatch", true)==0)
		{
		if (IsPlayerAdmin(playerid))
			{
			for(new i=0; i<MAX_PLAYERS; i++)
    			{
    			if (gClass[i] == 0)
    				{
    					SetPlayerPos(i, 1314.0957,2211.7778,12.0156);
  	        		}
  	        		else if (gClass[i] == 1)
    				{
    					SetPlayerPos(i, 1410.7576,2109.6572,12.0156);
  	       			}
  	        		else if (gClass[i] == 2)
    				{
    					SetPlayerPos(i, 1370.1654,2196.1580,9.7578);
  	       			}
  	        		else if (gClass[i] == 3)
    				{
	    				SetPlayerPos(i, 1394.9240,2171.6423,9.7578);
        			}
        			SetPlayerScore(i, 0);
    				SetPlayerHealth(i,100);
  					ResetPlayerWeapons(i);
  					SetPlayerInterior(i, 0);
   					GivePlayerWeapon(i, 32,9999999999);
        			GivePlayerWeapon(i, 26,9999999999);
    			}
				if (gStarted == 0)
			    	{
		    		gStarted = 1;
	    			SendClientMessage(playerid, COLOR_RED, "You have started the match!!!");
	    			GameTextForAll("~r~[-D-] ~w~Vs. ~y~[SAB]~n~~w~The match has started!!!", 5000, 6);
	    			SendClientMessageToAll(COLOR_RED, "*** Match started!!!!!");
		    		}
		    	else
	    			{
	    			gStarted = 1;
	    			SendClientMessage(playerid, COLOR_RED, "You have restarted the match!!!");
	    			GameTextForAll("~r~[-D-] ~w~Vs. ~y~[SAB]~n~~w~The match has been restarted!!!", 5000, 6);
	    			SendClientMessageToAll(COLOR_RED, "*** Match restarted!!!!!");
   	        		}
   	        	}
	    return 1;
	    }
	else
		{
		SendClientMessage(playerid, COLOR_RED, "Error 404 - Command not found. Please, use /help");
		return 1;
		}
	return 1;
}

public OnPlayerInfoChange(playerid)
{
	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 ShowScores()
{
	new string[256];
	format(string, sizeof(string), "[SAB] = %d  -  [!] = %d", gSAB, gVisitors);
	SendClientMessageToAll(COLOR_BLUE, string);
}