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; } |
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 |
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
pawn Код:
Use that to do any action when the player leaves the CP. I didn't understand your question though. |
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;
}