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