30.07.2013, 13:54
this is my code
So I Got Error here its tell me CP[Millitary-Base] = CreateDynamicCP("4.0059,1373.2476,9.1719") is not defined "base"
How i can fix it ?Thx
pawn Код:
#include <streamer> //Important include you need to have streamer in-case you want this to work!
//Variables (Put them after your includes)
new iCP[MAX_PLAYERS];
new UnderAttack[30];
new Captured[30];
new CP[30];
new Zone[30];
new timer[MAX_PLAYERS][30];
new CountVar[MAX_PLAYERS] = 25;
new InCP[MAX_PLAYERS][30];
new CountTime[MAX_PLAYERS];
//=================================
new gTeam[MAX_PLAYERS]; //Team variable. ignore if you already got
#define TEAM_ARMY 0 //Ignore if you already got team defines
#define TEAM_TERRORIST 1 //Ignore if you already got team defines
#define TEAM_NONE 2 //Ignore if you already got team defines
#define ARMY_COLOR 0x375FFFFF
#define TERRORIST_COLOR 0xFF0000FF
//========Zone=Defines=============
#define Millitary-Base 0
//=================================
//========OnGameModeInit Codes============
CP[Millitary-Base] = CreateDynamicCP("4.0059,1373.2476,9.1719")
Zone[Millitary-Base] = GangZoneCreate("(-70.3125,1292.96875,89.84375,1425.78125);")
UnderAttack[Millitary-Base] = -1
Captured[Millitary-Base] = -1
tCP[Millitary-Base] = TEAM_NONE
//========== OnPlayerConnect codes ======
iCP[playerid] = -1;
InCP[playerid][GAS] = 0;
if(tCP[Millitary-Base] == TEAM_ARMY) return GangZoneShowForPlayer(playerid, Zone[Millitary-Base], 0x375FFFFF);
else if(tCP[Millitary-Base] == TEAM_TERRORIST) return GangZoneShowForPlayer(playerid, Zone[Millitary-Base], 0xFF0000FF);
//=========== OnPlayerDisconnect codes ==
if(InCP[playerid][Millitary-Base] == 1)
{
UnderAttack[Millitary-Base] = 0;
}
//==========================================
//==========OnPlayerDeath Codes===================
KillTimer(timer[playerid][Millitary-Base]);
KillTimer(CountTime[playerid]);
UnderAttack[Millitary-Base] = 0;
//==========================================
//=======OnPlayerEnterDynamicCP (Main codes!)===========
//You can just copy paste the following in-case you didn't got the call back defined already!
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == CP[Millitary-Base])
{
if(UnderAttack[Millitary-Base] == 1)
{
SendClientMessage(playerid, 0xFF0000FF,"This zone is already being captured!");
}
else if(gTeam[playerid] == tCP[Millitary-Base])
{
SendClientMessage(playerid, 0xFF0000FF,"This zone is already being captured!");
}
else if(gTeam[playerid] == TEAM_NONE)
{
SendClientMessage(playerid, 0xFF0000FF,"You have no team so you cannot capture!");
}
else
{
UnderAttack[Millitary-Base] = 1;
timer[playerid][Millitary-Base] = SetTimerEx("SetCaptureZone", 25000, false,"i",playerid);
CountTime[playerid] = SetTimerEx("CountDown", 1, false,"i", playerid);
iCP[playerid] = Millitary-Base;
InCP[playerid][Millitary-Base] = 1;
Captured[Millitary-Base] = 0;
if(gTeam[playerid] == TEAM_ARMY)
{
GangZoneFlashForAll(Zone[Millitary-Base], ARMY_COLOR);
}
else if(gTeam[playerid] == TEAM_TERRORIST)
{
GangZoneFlashForAll(Zone[Millitary-Base], TERRORIST_COLOR);
}
new string[128], name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string),"%s is trying to capture theMillitary-Base",name);
SendClientMessageToAll(ARMY_COLOR, string);
}
}
return 1;
}
//================================OnPlayerLeaveDynamicCP codes=============================
//You can just copy paste the following in-case you didn't got the call back defined already!
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
if(checkpointid == CP[Millitary-Base])
{
if(Captured[Millitary-Base] == 1)
{
GangZoneStopFlashForAll(Zone[Millitary-Base]);
UnderAttack[Millitary-Base] = 0;
InCP[playerid][Millitary-Base] = 0;
tCP[Millitary-Base] = gTeam[playerid];
if(gTeam[playerid] == TEAM_ARMY)
{
GangZoneShowForAll(Zone[Millitary-Base], ARMY_COLOR);
}
else if(gTeam[playerid] == TEAM_TERRORIST)
{
GangZoneShowForAll(Zone[Millitary-Base], TERRORIST_COLOR);
}
KillTimer(timer[playerid][Millitary-Base]);
KillTimer(CountTime[playerid]);
}
else if(Captured[Millitary-Base] == 0)
{
SendClientMessage(playerid, TERRORIST_COLOR,"You have left the flag you have failed to capture the zone!");
UnderAttack[Millitary-Base] = 0;
InCP[playerid][Millitary-Base] = 0;
GangZoneStopFlashForAll(Zone[Millitary-Base]);
KillTimer(timer[playerid][Millitary-Base]);
KillTimer(CountTime[playerid]);
}
}
return 1;
}
//======================SetCaptureZone function!====================
//You can just copy paste the following under the above callback!
forward SetCaptureZone(playerid);
public SetCaptureZone(playerid)
{
if(iCP[playerid] == Millitary-Base)
{
SetPlayerScore(playerid, GetPlayerScore(playerid)+5);
GivePlayerMoney(playerid, 5000);
SendClientMessage(playerid, ARMY_COLOR,"Congratulations! You have successfully captured the Gas Station! You earned +5 scores and +$5000!");
tCP[Millitary-Base] = gTeam[playerid];
if(gTeam[playerid] == TEAM_ARMY)
{
GangZoneShowForAll(Zone[Millitary-Base], ARMY_COLOR);
}
else if(gTeam[playerid] == TEAM_TERRORIST)
{
GangZoneShowForAll(Zone[Millitary-Base], TERRORIST_COLOR);
}
GangZoneStopFlashForAll(Zone[Millitary-Base]);
Captured[Millitary-Base] = 1;
KillTimer(CountTime[playerid]);
KillTimer(timer[playerid][Millitary-Base]);
}
return 1;
}
//====================CountTime Function======================
//You can just copy paste the following under the above function!
forward CountDown(playerid);
public CountDown(playerid)
{
CountVar[playerid]--;
if(CountVar[playerid] == 0)
{
CountVar[playerid] = 25;
KillTimer(CountTime[playerid]);
}
else
{
new str[124];
format(str, sizeof(str),"~n~~n~~n~~n~~n~~n~~r~%d/~y~25 ~w~Seconds left~n~~g~to capture", CountVar[playerid]);
GameTextForPlayer(playerid, str, 1000, 3);
}
CountTime[playerid] = SetTimerEx("CountDown", 1000, false,"i", playerid);
return 1;
}
How i can fix it ?Thx