SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 06/02/2010, 04:01 AM   #1
Flake.
High-roller
 
Flake.'s Avatar
 
Join Date: Sep 2009
Location: 1400
Posts: 1,166
Reputation: 132
Default HELP! Capture the point!

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
Flake. is offline  
Old 06/02/2010, 04:52 AM   #2
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,781
Reputation: 266
Default Re: HELP! Capture the point!

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...
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic
Babul is offline  
Old 06/02/2010, 05:03 AM   #3
Flake.
High-roller
 
Flake.'s Avatar
 
Join Date: Sep 2009
Location: 1400
Posts: 1,166
Reputation: 132
Default Re: HELP! Capture the point!

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 (c) 1997-2006, ITB CompuPhase


26 Errors.
Flake. is offline  
Old 06/02/2010, 06:10 AM   #4
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,781
Reputation: 266
Default Re: HELP! Capture the point!

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);
}
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic
Babul is offline  
Old 06/02/2010, 06:18 AM   #5
Flake.
High-roller
 
Flake.'s Avatar
 
Join Date: Sep 2009
Location: 1400
Posts: 1,166
Reputation: 132
Default Re: HELP! Capture the point!

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
Flake. is offline  
Old 06/02/2010, 06:23 AM   #6
Flake.
High-roller
 
Flake.'s Avatar
 
Join Date: Sep 2009
Location: 1400
Posts: 1,166
Reputation: 132
Default Re: HELP! Capture the point!

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"
Flake. is offline  
Old 06/02/2010, 09:08 PM   #7
Flake.
High-roller
 
Flake.'s Avatar
 
Join Date: Sep 2009
Location: 1400
Posts: 1,166
Reputation: 132
Default Re: HELP! Capture the point!

sorry to *Bump* anyone can help?
Flake. is offline  
Old 07/02/2010, 02:20 AM   #8
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,781
Reputation: 266
Default Re: HELP! Capture the point!

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
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic
Babul is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[HELP] Capture the point Flake. Help Archive 2 06/02/2010 11:47 PM
[SOLVED] Point in range of point. CaHbKo Help Archive 3 01/02/2010 01:04 PM
Capture the factory Chivava Help Archive 0 23/01/2010 10:22 AM
Vehicle point to point help. osanji Help Archive 3 31/12/2009 01:10 PM
Capture The Car? DeltaAirlines12 Help Archive 3 10/09/2009 11:50 PM


All times are GMT. The time now is 06:52 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.