Turf Wars A little Help
#1

Hello, I made my own Turf Wars System .... It has a Timer That on player Enter Checkpoint he Waits for 15 sec to Take Over the Turf .
But iwant to make it like after 15 sec he starts to take over turf he waits for 1 min .and he have to stay in the zone ALIVE for 1 min .
Any hints for that ?
Quote:

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == GrovePoint[GZONE])
{
// if(tCP[GZONE] == gTeam[playerid]) return SendClientMessage(playerid,0xFFFFFF,"This is already captured by your team.");
if(gTeam[playerid] == tCP[GZONE]) return SendClientMessage(playerid,0xFFFFFF,"This turf is already captured by your team.");
timer[playerid][GZONE] = SetTimerEx("SetZone",15000,false,"i",playerid);
SendClientMessage(playerid,0xFFFFFF,"Wait for 15 sec to start a Turf war Against Groves");
iCP[playerid] = GZONE;
}
/* if(checkpointid == Checkpoint[GAS])
{
if(tCP[GAS] == gTeam[playerid]) return SendClientMessage(playerid,0xFFFFFF,"This is already captured by your team.");
timer[playerid][GAS] = SetTimerEx("SetZone",2000,false,"i",playerid);
SendClientMessage(playerid,0xFFFFFF,"You enter GAS CP");
iCP[playerid] = GAS;
}
*/
return 1;
}

public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
if(checkpointid == GrovePoint[GZONE])
{
KillTimer(timer[playerid][GZONE]);
iCP[playerid] = -1;//None
}
/* if(checkpointid == Checkpoint[GAS])
{
KillTimer(timer[playerid][GAS]);
SendClientMessage(playerid,0xFFFFFF,"You left GAS CP");
iCP[playerid] = -1;
}
*/
return 1;
}
forward SetZone(playerid);
public SetZone(playerid)
{
//SetPlayerScore(playerid, GetPlayerScore(playerid) + 3);
//GivePlayerMoney(playerid,3000);
SendClientMessage(playerid,COLOR_GREEN,"You started a Turf War Against Groves Stay in the Zone For 1 Min To take Over ");
// SetGangZone(playerid);
return 1;
}
forward SetGangZone(playerid);public SetGangZone(playerid)
{
if(gTeam[playerid] == TEAM_GROVE)
{
GangZoneShowForAll(GroveZone[GZONE],COLOR_GREEN);

new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"Grove %s Has Taken Back Their Turf ",pName);
SendClientMessageToAll(0x008000AA,string);
}

if(gTeam[playerid] == TEAM_AZTECA)
{
GangZoneShowForAll(GroveZone[GZONE],COLOR_LIGHTBLUE);
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"Aezateca %s Has Started a Turf War In Grove (Turf id '1')",pName);
SendClientMessageToAll(0x008000AA,string);
}

if(gTeam[playerid] == TEAM_POLICE)
{
GangZoneShowForAll(GroveZone[GZONE],COLOR_BLUE);
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"Police %s Has Started a Turf War In Grove (Turf id '1')",pName);
SendClientMessageToAll(0x008000AA,string);
}

if(gTeam[playerid] == TEAM_BALLAS)
{
GangZoneShowForAll(GroveZone[GZONE],COLOR_PURPLE);
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"Balla %s Has Started a Turf War In Grove (Turf id '1')",pName);
SendClientMessageToAll(0x008000AA,string);
}

if(gTeam[playerid] == TEAM_TRIADS)
{
GangZoneShowForAll(GroveZone[GZONE],RED);
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"Triad %s Has Started a Turf War In Grove (Turf id '1')",pName);
SendClientMessageToAll(0x008000AA,string);
}

if(gTeam[playerid] == TEAM_VAGOS)
{
GangZoneShowForAll(GroveZone[GZONE],COLOR_YELLOW);

new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"Vago %s Has Started a Turf War In Grove (Turf id '1')",pName);
SendClientMessageToAll(0x008000AA,string);
}

if(gTeam[playerid] == TEAM_DANANG)
{
GangZoneShowForAll(GroveZone[GZONE],COLOR_OLIVE);
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"DaNang %s Has Started a Turf War In Grove (Turf id '1')",pName);
SendClientMessageToAll(0x008000AA,string);
}

if(gTeam[playerid] == TEAM_MAFIA)
{
GangZoneShowForAll(GroveZone[GZONE],COLOR_MAROON);
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"Mafia %s Has Started a Turf War In Grove (Turf id '1')",pName);
SendClientMessageToAll(0x008000AA,string);
}

return 1;
}

Reply
#2

Adjust the Timers to what you think should be okay to use.

https://sampwiki.blast.hk/wiki/SetTimer

And use KillTimer(timername) to kill the timer on playerdeath :P
Reply
#3

Quote:
Originally Posted by airplanesimen
Посмотреть сообщение
Adjust the Timers to what you think should be okay to use.

https://sampwiki.blast.hk/wiki/SetTimer

And use KillTimer(timername) to kill the timer on playerdeath :P
And what about The Zone IFPlayerLeaveZone or somthin ??
Reply
#4

pawn Код:
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
??

Use that to do any action when the player leaves the CP. I didn't understand your question though.
Reply
#5

Quote:
Originally Posted by airplanesimen
Посмотреть сообщение
pawn Код:
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
??

Use that to do any action when the player leaves the CP. I didn't understand your question though.
Brah i am using A Gang Zone After 15 Sec He can leave The Checkpoint but not Zone is he Leaves the Gang Zone he fails to take over
Reply
#6

You have to use OnPlayerUpdate to check if he's still in the area
pawn Код:
OnPlayerUpdate(playerid)
{
if(!IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY) && Capturing[playerid] == 1 )//the coords of the gang zone
{
KillTimer(SetZone);//The timer that will set the zone ect..
SendClientMessage(playerid,-1,"You fail to capture the zone Don't leave the area!");
}
return 1;
}
Note:You need to make a variable to detect that the player has started a gang war, its should start when the players enters the CP and stps when he leaves it, else it will be bugged
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)