help with time
#1

hi guys i want to do capture the zone with timer for a team i do capture the zones but i need to do
if player in checkpoint he stay 30 sec and he captur can some one help me
Reply
#2

Use something like this under OnPlayerUpdate
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438)) // Your coordinates
    {
       // Use SetTimerEx over here for the player for 30 seconds (30 * 1000) , make a function that they will win the turf and battle!
    }
Reply
#3

I don't remember much from coding but I guess it's something like this.

Код:
// Under main()

new timer[MAX_PLAYERS];

forward timer(playerid);

// Wherever you want, aslong it's under main()

public OnPlayerUpdate(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438)) // Your coordinates
    {
       timer[playerid] = SetTimerEx("timer", 30000, true, "i", playerid);
    }
	return 1;
}

// Bottom of script.

public timer(playerid)
{
    // Code for taking over the turf.
    SendClientMessage(playerid, 0x00FF00AA, "You took the turf!");
    {
               KillTimer(timer[playerid]);
    }
    return 1;
}
Reply
#4

dude i do that he is no't working
PHP код:
public OnGameModeInit()
{
Hospital GangZoneCreate(980.9415,945.9079,1167.788,1132.754);

UsePlayerPedAnims();
    
AddPlayerClass(108,1091.8289,1892.5746,10.8203,181.3648,0,0,0,0,0,0); //Latino (0)
    
AddPlayerClass(206,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0); //Souviet (1)
    
AddPlayerClass(179,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0); //Arabian(2)
    
AddPlayerClass(287,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0); //USA (3)
    
AddPlayerClass(285,-148.1873,1142.0114,19.7422,16.0408,0,0,0,0,0,0); //Europian(4)
    
AddPlayerClass(188,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0); //Japan (5).
    
AddPlayerClass(163,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0); //Taliban(6)

    
CPS1 CreateCheckpoint(-11058.3783,1013.4809,11.00003.020.0); //hospital
    
CPS1 CreateCheckpoint(-11058.3783,1013.4809,11.00003.020.0);
    
CPS1 CreateCheckpoint(-11058.3783,1013.4809,11.00003.020.0);

    
// Don't use these lines if it's a filterscript
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    return 
1;
}

forward timer(playerid);
public 
timer(playerid)
{
    
// Code for taking over the turf.
    
SendClientMessage(playerid0x00FF00AA"You took the turf!");
    {
               
KillTimer(timer[playerid]);
    }
    return 
1;
}

forward Stream();
public 
Stream()
{
    for(new 
iMAX_PLAYERS++) //Loops through 500 players
    
{
      if(
IsPlayerConnected(i)) //Brings the 500 players down to the online ones
      
{
        
PlayerCP[i] = -1;
        for(new 
jCPID 1++) //Loops through all CP's
            
{
                if(
CPDisabled[j] == 0//Checks if the CP is disabled.
                
{
                    if(
IsPlayerInRangeOfPoint(iCPinfo[j][Viewdist], CPinfo[j][CPX], CPinfo[j][CPY], CPinfo[j][CPZ]) && CPActive[i][j] == 1//Is the player in range of a CP
                
{
                
SetPlayerCheckpoint(iCPinfo[j][CPX], CPinfo[j][CPY], CPinfo[j][CPZ], CPinfo[j][Size]);//Sets the player checkpoint
                
PlayerCP[i] = j//Sets the player checkpoint to that in the variable.
                
printf("PCP:%d"j);
           }
                }
            }
        if(
PlayerCP[i] == -1//If there is no CP close enough
            
{
                print(
"NAHBRO");
                
PlayerCP[i] = -1//PlayerCP isn't anything
                
DisablePlayerCheckpoint(i); //Disable any checkpoint visible.
                
continue;
      }
      }
      }
    return 
1;

PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
  if(
PlayerCP[playerid] != -1) return OnPlayerEnterStreamedCheckpoint(playeridPlayerCP[playerid]);
  return 
1;
}

stock OnPlayerEnterStreamedCheckpoint(playeridCPiD)
{
  if(
CPiD == CPS1)
  {
    
GameTextForPlayer(playerid"Stay her to capture hospital!"30003);
timer[playerid] = SetTimerEx("timer"30000true"i"playerid);

        if(
gTeam[playerid]==TEAM_Latino)
        {
        
GangZoneShowForAll(Hospital,0x00F3FFAF);
        
SetPlayerScore(playerid,GetPlayerScore(playerid)+);
        
GivePlayerMoney(playerid,6000);
        
SendClientMessage(playerid,0xFFFFFFFF,"You've capture the zone and receive 500 $ and 5 score");
        
GiveTeamScore(gTeam[playerid]=TEAM_Latino1);
        
SendTeamMessage(COLOR_GREEN"You received 1 Score For a Capture!",TEAM_Latino);
         }
        if(
gTeam[playerid]==TEAM_USA)
        {
        
GangZoneShowForAll(Hospital,0x1400C3FF);
        
SetPlayerScore(playerid,GetPlayerScore(playerid)+);
        
GivePlayerMoney(playerid,6000);
        
SendClientMessage(playerid,0xFFFFFFFF,"You've capture the zone and receive 500 $ and 5 score");
        }
        if(
gTeam[playerid]==TEAM_Arabian)
        {
        
GangZoneShowForAll(Hospital,0xD70000FF);
        
SetPlayerScore(playerid,GetPlayerScore(playerid)+);
        
GivePlayerMoney(playerid,6000);
        
SendClientMessage(playerid,0xFFFFFFFF,"You've capture the zone and receive 500 $ and 5 score");
        }
        if(
gTeam[playerid]==TEAM_Japan)
        {
        
GangZoneShowForAll(Hospital,0xFAFAFFFF);
        
SetPlayerScore(playerid,GetPlayerScore(playerid)+);
        
GivePlayerMoney(playerid,6000);
        
SendClientMessage(playerid,0xFFFFFFFF,"You've capture the zone and receive 500 $ and 5 score");
        }
        if(
gTeam[playerid]==TEAM_Souviet)
        {
        
GangZoneShowForAll(Hospital,0xCA0000FF);
        
SetPlayerScore(playerid,GetPlayerScore(playerid)+);
        
GivePlayerMoney(playerid,6000);
        
SendClientMessage(playerid,0xFFFFFFFF,"You've capture the zone and receive 500 $ and 5 score");
        }
        if(
gTeam[playerid]==TEAM_Europian)
        {
        
GangZoneShowForAll(Hospital,0x005E0089);
        
SetPlayerScore(playerid,GetPlayerScore(playerid)+);
        
GivePlayerMoney(playerid,6000);
        
SendClientMessage(playerid,0xFFFFFFFF,"You've capture the zone and receive 500 $ and 5 score");
        }
  }
  return 
1;

can some one help me
Reply
#5

There's no need for distance checks.

Start a 1 second timer when they enter the CP.
KillTimer when they exit the CP.
var++ on timer
var = 0 on leave
If var == 30 capture it.

Reply
#6

dude you see i do it in my GM , but enything ,and you (you are no't a helper ) so stop making in my apple,i know you hate in my opinion you are no't a helper realy
Reply
#7

please guys some help
Reply
#8

Quote:
Originally Posted by BlacKxStory
Посмотреть сообщение
dude you see i do it in my GM , but enything ,and you (you are no't a helper ) so stop making in my apple,i know you hate in my opinion you are no't a helper realy
Translation please.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)