All pastes #986137 Raw Edit

[GM] CIA VS NAZI

public text v1 · immutable
·published 2008-04-15 15:43 UTC
rendered paste body
#include <a_samp>
#include <core>
#include <float>
#pragma tabsize 0

static gTeam[MAX_PLAYERS];

#define TEAM_CIA 1
#define TEAM_NAZI 2
#define TEAM_CIA_COLOR 0x33AA33AA
#define TEAM_NAZI_COLOR 0xD9ED61FF
#define GOLD_COLOR 0xFFCA00FF
forward end();
forward Bombplant(playerid);
new RadarObjects;


strtok( const string[], &index, const seperator[] = " " )
{
	new
		index2,
		result[ 30 ];

	index2 =  strfind(string, seperator, false, index);


	if(index2 == -1)
	{
		if(strlen(string) > index)
		{
			strmid(result, string, index, strlen(string), 30);
			index = strlen(string);
		}
		return result;
	}
	if(index2 > (index + 29))
	{
		index2 = index + 29;
		strmid(result, string, index, index2, 30);
		index = index2;
		return result;
	}
	strmid(result, string, index, index2, 30);
	index = index2 + 1;
	return result;
}
forward SetPlayerToTeamColor(playerid);
forward SetupPlayerForClassSelection(playerid);
forward SetPlayerTeamFromClass(playerid,classid);



//---------------------------------------------------------

main()
{
print("|________CIA Vs Nazi Parashute start_______|");
print("|___________Created By Deathsgrip____________|");
print("|___ modify this script as much as you want___|");
}

//---------------------------------------------------------


//---------------------------------------------------------

public OnGameModeInit()
{
	SetGameModeText("CIA Vs The Nazis");
	 SetTimer("END",1200000,1);
	ShowPlayerMarkers(0);
	ShowNameTags(1);
	SetWorldTime(19);

	// CIA CLASSES
		AddPlayerClass(163,1350.9174,1.3599,750.6380,137.0284,0,0,0,0,46,1);
		AddPlayerClass(164,1330.9174,1.5599,800.6380,137.02844,0,0,0,0,46,1);
		AddPlayerClass(165,1340.9174,1.4599,850.6380,137.0284,0,0,0,0,46,1);
 	// Nazi CLASSES
		AddPlayerClass(179,1116.5000,-236.0907,71.7436,314.1847,0,0,0,0,0,0); //
		AddPlayerClass(79,1070.4393,-293.0717,73.9851,179.7633,0,0,0,0,0,0); //
		AddPlayerClass(144,1048.4751,-340.3150,73.9922,298.5178,0,0,0,0,0,0);
//------------------------------------------------------------------------------
		RadarObjects = CreateObject(3279, 1104.161987, -345.445587, 73.067802, 0.0000, 0.0000, 0.0000);
		RadarObjects = CreateObject(3389, 1104.467773, -345.774353, 89.145927, 0.0000, 0.0000, 0.0000);
//------------------------------------------------------------------------------
    return 1;
}

//---------------------------------------------------------

public OnPlayerConnect(playerid)
{
	SetPlayerColor(playerid,0x888888FF);
	SendClientMessage(playerid, TEAM_CIA_COLOR, " Welcome to CIA vs NAZI  type /HELP for HELP");
	SendClientMessage(playerid, GOLD_COLOR, " Team killing will remove 1 point off your score");
    return 1;
}

//---------------------------------------------------------

public SetupPlayerForClassSelection(playerid)
{
	SetPlayerInterior(playerid,11);
	SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
    SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
	SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);
	SetPlayerFacingAngle(playerid,0.0);
}

//---------------------------------------------------------

public SetPlayerTeamFromClass(playerid,classid)
{
	// Set their team number based on the class they selected.
	if(classid == 0 || classid == 1 || classid == 2) {
		gTeam[playerid] = TEAM_CIA;
	} else if(classid == 3 || classid == 4 || classid == 5) {
	    gTeam[playerid] = TEAM_NAZI;
	}
}

//---------------------------------------------------------

public SetPlayerToTeamColor(playerid)
{
	if(gTeam[playerid] == TEAM_CIA) {
		SetPlayerColor(playerid,TEAM_CIA_COLOR); // Nazi
	} else if(gTeam[playerid] == TEAM_NAZI) {
	    SetPlayerColor(playerid,TEAM_NAZI_COLOR); // Air
	}
}

//---------------------------------------------------------

public OnPlayerRequestClass(playerid, classid)
{
	SetupPlayerForClassSelection(playerid);
	SetPlayerTeamFromClass(playerid,classid);
	
	if(classid == 0 || classid == 1 || classid == 2) {
		GameTextForPlayer(playerid,"~g~ Cia",1000,4);
		SetPlayerPos(playerid,1547.3622,17.2908,24.1326);
		SetPlayerCameraLookAt(playerid,1547.3622,17.2908,24.1326);
		SetPlayerInterior(playerid,0);
    	SetPlayerCameraPos(playerid,1556.3684,19.2326,24.1580);
		SetPlayerFacingAngle(playerid,275.1760);
		  SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE2);
		PlayerPlaySound(playerid, 1183  ,0 ,0 ,0);
	} else if(classid == 3 || classid == 4 || classid == 5) {
	    GameTextForPlayer(playerid,"~r~NAZI",1000,4);
    	SetPlayerPos(playerid,1070.3176,-288.1326,73.9922);
		SetPlayerCameraLookAt(playerid,1070.3176,-288.1326,73.9922);
		SetPlayerInterior(playerid,0);
    	SetPlayerCameraPos(playerid,1071.7734,-298.2260,73.9851);
		SetPlayerFacingAngle(playerid,180.7950);
		SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE1);
		PlayerPlaySound(playerid, 1062  ,0 ,0 ,0);
	}
	
	return 1;
}

//---------------------------------------------------------

public OnPlayerSpawn(playerid)
{
	SetPlayerToTeamColor(playerid);
	SetPlayerInterior(playerid,0);
	PlayerPlaySound(playerid, 1063 ,0 ,0 ,0);

	if(gTeam[playerid] == TEAM_CIA) {
     SetPlayerCheckpoint(playerid,1103.5146,-345.8786,90.1459,5.0);
     SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE1);
	    GameTextForPlayer(playerid,
		   "Blow up the Nazi radar tower ",
		   6000,4);
	}
	else if(gTeam[playerid] == TEAM_NAZI) {
	SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE1);
	SetPlayerCheckpoint(playerid,1103.5146,-345.8786,90.1459,5.0);
		GameTextForPlayer(playerid,
	    
		   "Defend the rader tower",
		   6000,4);
	}

	return 1;
}

//---------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/help", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, GOLD_COLOR, "|_| Help |_|");
		SendClientMessage(playerid, GOLD_COLOR, "~ /rules - This displays the servers rules .");
		SendClientMessage(playerid, GOLD_COLOR, "~ /Commands - This command displays a list of available commands.");
		SendClientMessage(playerid, GOLD_COLOR, "~ /objective  - This command tells you the objective of the gamemode.");
		return 1;
	}
//---------------------------------------------------------
	if(strcmp(cmdtext, "/Clearchat", true) == 0)
{
   if(IsPlayerAdmin(playerid))
   {
   	SendClientMessageToAll(GOLD_COLOR," ");
	SendClientMessageToAll(GOLD_COLOR," ");
	SendClientMessageToAll(GOLD_COLOR," ");
	SendClientMessageToAll(GOLD_COLOR," ");
	SendClientMessageToAll(GOLD_COLOR," ");
	SendClientMessageToAll(GOLD_COLOR," ");
 	SendClientMessageToAll(GOLD_COLOR," ");
	SendClientMessageToAll(GOLD_COLOR," ");
	SendClientMessageToAll(GOLD_COLOR," ");
   	}
 	else
	{
	SendClientMessage(playerid,GOLD_COLOR,"Your not an admim. login to use this commmand.");
   }
   return 1;
}
//---------------------------------------------------------
	if (strcmp("/rules", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, TEAM_NAZI_COLOR, "________________________________");
		SendClientMessage(playerid, GOLD_COLOR, "~ 1. No hacking,cheating or exploting bugs ~");
		SendClientMessage(playerid, GOLD_COLOR, " 2.Killing will get you a point ");
		SendClientMessage(playerid, GOLD_COLOR, "~ 3. Team killing will remove 1 point off your score ~");
		SendClientMessage(playerid, TEAM_CIA_COLOR, "________________________________");
		return 1;
	}
//------------------------------------------------------------------------------
	if (strcmp("/Objective", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, TEAM_NAZI_COLOR, "|_|Objetive|_|");
		SendClientMessage(playerid, GOLD_COLOR, "CIA GOAL: Must destroy the radar tower .");
		SendClientMessage(playerid, GOLD_COLOR, "Nazi GOAL: Must defend the radar tower");
		SendClientMessage(playerid, GOLD_COLOR, "Secondry goal: Kill for points ");
		SendClientMessage(playerid, TEAM_CIA_COLOR, "________________________________");
		return 1;
 	}
//------------------------------------------------------------------------------
	if (strcmp("/Commands", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, TEAM_NAZI_COLOR, "|_|Commands|_|");
		SendClientMessage(playerid, GOLD_COLOR, "/Plantbomb - CIA command to plant a bomb in the radar checkpoint");
		SendClientMessage(playerid, GOLD_COLOR, "/Defusebomb - Nazi command that defuses a planted bomb");
		SendClientMessage(playerid, GOLD_COLOR, "/Help - This command shows the help screen");
		SendClientMessage(playerid, GOLD_COLOR, "/Objective - This command shows the gamemode objective");
		SendClientMessage(playerid, GOLD_COLOR, "/supplydrop - This command cost 5 points and allows suplies to be dropped");
		SendClientMessage(playerid, GOLD_COLOR, "/uav - This command cost 3 points and allows your team to see evryone on the radar");
		SendClientMessage(playerid, TEAM_CIA_COLOR, "________________________________");
		return 1;
	 }
//------------------------------------------------------------
//------------------------------------------------------------------------------
   	new cmd[30];
    new idx;
    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/Freeze", true) == 0)
    if(IsPlayerAdmin(playerid))
    {
        new tmp[30];
        tmp = strtok(cmdtext, idx);
        new otherplayer = strval(tmp);
        if(IsPlayerConnected(otherplayer))
        {
            SendClientMessage(otherplayer,GOLD_COLOR, "Frozen by admin request!");
            TogglePlayerControllable(otherplayer,0);

        }
		else
		{


				 if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,GOLD_COLOR,"You must be Admin!");
}					if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid,GOLD_COLOR,"Invalid id!");
    	    return 1;
    }
   	new cmd2[40];
    new idx2;
    cmd2 = strtok(cmdtext, idx2);

    if(strcmp(cmd, "/Unfreeze", true) == 0)
    if(IsPlayerAdmin(playerid))
    {
        new tmp[40];
        tmp = strtok(cmdtext, idx);
        new otherplayer = strval(tmp);

        if(IsPlayerConnected(otherplayer))
	{
 			SendClientMessage(otherplayer, 0xFFFF00AA, "Unfrozen by rcon command!");
			TogglePlayerControllable(otherplayer,1);
        }
		else
		{
 				if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFFFF00AA,"You must be Admin!");
  }         	if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid,0xFFFF00AA,"Invalid id!");

		return 1;
}

return 0;
}

//---------------------------------------------------------

public OnPlayerDeath(playerid, killerid, reason)
{
	if(killerid == INVALID_PLAYER_ID) {
        SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
	} else {
        if(gTeam[killerid] != gTeam[playerid]) {
	    	// Valid kill
	    	SendDeathMessage(killerid,playerid,reason);
			SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
     	}
		else {
		    // Team kill
		    SetPlayerScore(killerid,GetPlayerScore(killerid)-2);
		}
	}
 	return 1;
}
//---------------------------------
public OnPlayerEnterCheckpoint(playerid)
{
	if(gTeam[playerid] == TEAM_CIA) {
	    GameTextForPlayer(playerid,
 	"Blow up the radar tower/plantbomb",6000,4);
		   
	}
else if(gTeam[playerid] == TEAM_NAZI) {
		GameTextForPlayer(playerid,
	"Defend the rader tower with /defusebomb",6000,4);
	}

    return 1;

}
public end()
{
GameModeExit();
return 1;

}
public Bombplant(playerid)
{
		CreateExplosion( 1104.161987, -345.445587, 73.067802,2,10.0);
		CreateExplosion( 1104.161987, -345.445587, 73.067802,2,10.0);
		CreateExplosion( 1104.161987, -345.445587, 73.067802,2,10.0);
		CreateExplosion(1104.467773, -345.774353, 89.145927,2,10.0);
		CreateExplosion(1104.467773, -345.774353, 89.145927,2,10.0);
		DestroyObject(RadarObjects);
		CreateExplosion(1104.467773, -345.774353, 89.145927,2,10.0);
		SetTimer("end",5000,1);
		GameTextForAll("CIA have won",5000,3);
return 1;
}