HELP! Capture the point!
#1

hey for my cod6 mission server i wanted to make a capture the point so basicly the player has to be in the marked checkpoint for 5 seconds then there team gets a point and i want the ponts to be first team to 5 points also the 3 teams are USA Rusia and Romania and a textdraw on the screen sayin the teams scores

i have tyied to make this but i keep failing can someone help me please
Reply
#2

maybe that concept can help you @ starting a neat conquer-the-bases mode - i freezed that concept by now due to my preference to finish other stuff...

at top of script, define some variables, arrays and 1 constant:
Code:
new CP_Base_PlayersToCheck;
new CP_Base_PlayerCheckID[MAX_PLAYERS];
const CP_Base_BasesToCheck=9;
new CP_Base_Checkpoint[CP_Base_BasesToCheck];
new CP_Base_Owner[CP_Base_BasesToCheck];
new CP_Base_Counter[CP_Base_BasesToCheck];
new CP_Base_CounterModifiedRecently[CP_Base_BasesToCheck];
new Float:CP_Base_Pos[CP_Base_BasesToCheck][3]=
{
	{1682.7716,-2286.5437,-1.2347}, // CPBase_LS_Airport
	{1157.7881,-2037.0204,69.0078}, // CPBase_LS_Castle
	{2263.3303,27.7052,26.4306}, // CPBase_LS_Montgomery

	{-1485.0216,-367.2024,15.2949}, // CPBase_SF_AirPort
	{-2324.6926,-1637.6180,483.7031}, // CPBase_SF_Chilliad
	{-2210.5786,-2375.0747,31.3332}, // CPBase_SF_AngelPine

	{1680.0149,1447.9613,10.7739}, // CPBase_LV_AirPort
	{491.6579,884.7720,-31.0023}, // CPBase_LV_HunterQuarry
	{-2091.0764,2313.4854,25.9141}, // CPBase_LV_BaySide
};
add into your ongamemodeinit:
Code:
public OnGameModeInit()
//---------------------
SetTimer("TimerBases",1000,true);
for(new CP=0;CP<CP_Base_BasesToCheck;CP++)
{
	CP_Base_Checkpoint[CP] = CreateCheckpoint(-1,CP_Base_Pos[CP][0],CP_Base_Pos[CP][1],CP_Base_Pos[CP][2],8.0,80.0);
}
then, somewhere between functions, add those:
Code:
public OnPlayerEnterStreamedCheckpoint(playerid,streamid)
//--------------------------------------------------------
{
	for(new CP=0;CP<CP_Base_BasesToCheck;CP++)
	{
		if(streamid == CP_Base_Checkpoint[CP])
		{
			CP_Base_PlayersToCheck++;
			CP_Base_PlayerCheckID[CP_Base_PlayersToCheck]=playerid;
			SendClientMessageToAll(0xffffff,"Base CP Entered.");
			return 1;
		}
	}
}
Code:
forward TimerBases();
public TimerBases()
//---------------------
{
	if(CP_Base_PlayersToCheck>0)
	{
		for(new BaseM=0;BaseM<CP_Base_BasesToCheck;BaseM++)
		{
		  CP_Base_CounterModifiedRecently[BaseM]=0;
		}
 		for(new BCPpc=0;BCPpc<CP_Base_PlayersToCheck;BCPpc++)
		{
			new Float:X,Float:Y,Float:Z,InRange;
			GetPlayerPos(CP_Base_PlayerCheckID[BCPpc],Float:X,Float:Y,Float:Z);
			for(new CP=0;CP<12;CP++)
			{
				InRange=IsPlayerInRangeOfPoint(CP_Base_PlayerCheckID[BCPpc],15,CP_Base_Pos[CP][0],CP_Base_Pos[CP][1],CP_Base_Pos[CP][2]);
				if (InRange==1)
				{
					SendClientMessageToAll(0xffffffff,"in range.");
					CP_Base_CounterModifiedRecently[CP]=1;
					CP_Base_Counter[CP]++;
					if(CP_Base_Counter[CP]<10)
					{
						new string[128];
						format(string,sizeof(string),"[%d] Base %d - Team %d - time to take control: %d",CP_Base_Owner[CP],CP,gTeam[CP_Base_PlayerCheckID[BCPpc]],CP_Base_Counter[CP]);
						SendClientMessageToAll(0xffffffff,string);
					}
					else if (InRange==0)
					{
					  CP_Base_Owner[CP]=gTeam[CP_Base_PlayerCheckID[BCPpc]];
						new string[128];
						format(string,sizeof(string),"[%d] Base %d - Team %d - took over base",CP_Base_Owner[CP],CP,gTeam[CP_Base_PlayerCheckID[BCPpc]]);
						SendClientMessageToAll(0xffffffff,string);
					}
			  }
//			  else
//			  {
//			  	CP_Base_PlayerCheckID[BCPpc]=CP_Base_PlayerCheckID[CP_Base_PlayersToCheck];
//					CP_Base_PlayersToCheck--;
//					SendClientMessageToAll(0xffffffff,"1 player is not adding score to a Base Counter anymore.");
//				}
			}
		}
		for(new BaseM=0;BaseM<CP_Base_BasesToCheck;BaseM++)
		{
		  if(CP_Base_CounterModifiedRecently[BaseM]==0)
		  {
			  CP_Base_Counter[BaseM]=0;
		  }
		}
	}
sorry in advance if i missed something, i searched thru my entore gamemode for the "base" string. so there shouldnd miss anything.
the concept works, but theres a glitch: when you enter a checkpoint, you dont need to stay in the checkpoint to add more points to take control over it. but when u go away from it and go near only the checkpoint again, it will start counting. further it will add you a second tie to the players adding score. so you can speed up the process with only 1 player. that will end in spam (messages for easy "degubbing").
that thing should work for more players in a CP too, each adding some points. when it reaches a certain amount, it will trigger a function which is not included so far.
ah btw: you will need to include a CheckPointSteamer
i used the CPS by DragSta, so you will need to download it and copy the cps.inc into "GTA Server/pawno/include" and then add the
Code:
#include <cps>//credits to dragsta
at top of your gamemode aswell...
Reply
#3

i get errors
when i add this
Code:
public OnGameModeInit()
{
SetTimer("TimerBases",1000,true);
{
	for(new CP=0;CP<CP_Base_BasesToCheck;CP++)
	{
		CP_Base_Checkpoint[CP] = CreateCheckpoint(-1,CP_Base_Pos[CP][0],CP_Base_Pos[CP][1],CP_Base_Pos[CP][2],8.0,80.0);
	}
the errors are:

Code:
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(155) : error 018: initialization data exceeds declared size
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(769) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(770) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(840) : error 017: undefined symbol "strtok"
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(840) : error 033: array must be indexed (variable "cmd")
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(843) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(844) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(845) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(846) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(847) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(848) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(849) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(853) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(854) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(855) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(856) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(857) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(858) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(859) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(860) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(861) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(862) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(863) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(864) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(865) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(866) : error 004: function "SendPlayerFormattedText" is not implemented

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Reply
#4

Code:
wow, you copied it pretty fast, after posting it, i had to correct some bugs...
search in your script, if theres already a "OnGameModeInit".. then add this inside:
SetTimer("TimerBases",1000,true);
for(new CP=0;CP<CP_Base_BasesToCheck;CP++)
{
	CP_Base_Checkpoint[CP] = CreateCheckpoint(-1,CP_Base_Pos[CP][0],CP_Base_Pos[CP][1],CP_Base_Pos[CP][2],8.0,80.0);
}
Reply
#5

Quote:
Originally Posted by Babul
Code:
wow, you copied it pretty fast, after posting it, i had to correct some bugs...
search in your script, if theres already a "OnGameModeInit".. then add this inside:
SetTimer("TimerBases",1000,true);
for(new CP=0;CP<CP_Base_BasesToCheck;CP++)
{
	CP_Base_Checkpoint[CP] = CreateCheckpoint(-1,CP_Base_Pos[CP][0],CP_Base_Pos[CP][1],CP_Base_Pos[CP][2],8.0,80.0);
}
i know.. -_- there isnt i added it in under ongamemodeint
Reply
#6

when i add that code i get 2 errors

Code:
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(46) : error 018: initialization data exceeds declared size
C:\Users\ELLIOT\Desktop\CodServer\gamemodes\lvdm.pwn(1701) : error 017: undefined symbol "CreateCheckpoint"
Reply
#7

sorry to *Bump* anyone can help?
Reply
#8

aw holy shit, i forgot to remove the , after the 9th definition of the CP positions:
Code:
	{-2091.0764,2313.4854,25.9141}, // CPBase_LV_BaySide
should be
Code:
	{-2091.0764,2313.4854,25.9141} // CPBase_LV_BaySide
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)