SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 17/02/2013, 03:08 AM   #1
Dex007HLH
Big Clucker
 
Dex007HLH's Avatar
 
Join Date: Nov 2010
Location: Somewhere infront of a computer.
Posts: 121
Reputation: 2
Default Timer is not killing checkpoint

Well... it kills the checkpoint only for id 0 :/ not for the rest of the players
Code:
public OnPlayerEnterCheckpoint(playerid)
{

	if(gTeam[playerid] == TEAM_RED) {
    bomb = SetTimer("bomb2", 10000, false);
    SendClientMessageToAll(0xDEEE20FF, "The bomb is being planted, it will take 10 seconds to activate it");
    

	}

	else if(gTeam[playerid] == TEAM_BLUE) {
	    GameTextForPlayer(playerid,
		   "Don't let the terrorists plant a bomb here",
		   6000,5);
	}

    return 1;
}

public bomb2(playerid)
{
        SendClientMessageToAll(0xDEEE20FF, "The bomb has been planted, you have 10 seconds to run away");
        CreateObject(1654,2636.1999512,-2094.5000000,12.6000004,272.8234863,314.9780273,134.0114746); //object(dynamite) (1)
        CreateObject(1654,2636.1999512,-2095.1000977,12.6000004,272.8234863,314.9780273,17.2614746); //object(dynamite) (2)
        CreateObject(1654,2636.3000488,-2094.8000488,12.6000004,272.8234863,314.9780273,285.0114746); //object(dynamite) (3)
        DisablePlayerCheckpoint(playerid);
	SetTimer("exp",10000,false);
        SetTimer("exp2",12000,false);
        SetTimer("exp3",15000,false);
        
}
__________________
This signature was made in 5.706 seconds
Dex007HLH is offline   Reply With Quote
Old 17/02/2013, 04:08 PM   #2
Dex007HLH
Big Clucker
 
Dex007HLH's Avatar
 
Join Date: Nov 2010
Location: Somewhere infront of a computer.
Posts: 121
Reputation: 2
Default Respuesta: Timer is not killing checkpoint

bump* come on help me!
__________________
This signature was made in 5.706 seconds
Dex007HLH is offline   Reply With Quote
Old 17/02/2013, 04:11 PM   #3
DaRk_RaiN
Gangsta
 
DaRk_RaiN's Avatar
 
Join Date: Sep 2012
Posts: 973
Reputation: 207
Default Re: Timer is not killing checkpoint

That's because you need to SetTimerEx
pawn Code:
public OnPlayerEnterCheckpoint(playerid)
{

    if(gTeam[playerid] == TEAM_RED) {
    bomb = SetTimerEx("bomb2",10000,0,"i",playerid);
    SendClientMessageToAll(0xDEEE20FF, "The bomb is being planted, it will take 10 seconds to activate it");


    }

    else if(gTeam[playerid] == TEAM_BLUE) {
        GameTextForPlayer(playerid,
           "Don't let the terrorists plant a bomb here",
           6000,5);
    }

    return 1;
}

public bomb2(playerid)
{
        SendClientMessageToAll(0xDEEE20FF, "The bomb has been planted, you have 10 seconds to run away");
        CreateObject(1654,2636.1999512,-2094.5000000,12.6000004,272.8234863,314.9780273,134.0114746); //object(dynamite) (1)
        CreateObject(1654,2636.1999512,-2095.1000977,12.6000004,272.8234863,314.9780273,17.2614746); //object(dynamite) (2)
        CreateObject(1654,2636.3000488,-2094.8000488,12.6000004,272.8234863,314.9780273,285.0114746); //object(dynamite) (3)
        DisablePlayerCheckpoint(playerid);
        //If these three timers also affect a specific player, change them to SetTimerEx, same method.
        SetTimer("exp",10000,false);
        SetTimer("exp2",12000,false);
        SetTimer("exp3",15000,false);

}
DaRk_RaiN is offline   Reply With Quote
Old 17/02/2013, 04:18 PM   #4
Dex007HLH
Big Clucker
 
Dex007HLH's Avatar
 
Join Date: Nov 2010
Location: Somewhere infront of a computer.
Posts: 121
Reputation: 2
Default Respuesta: Timer is not killing checkpoint

But with SetTimerEx it will only set a timer for the guy who planted the bomb, and that's not what I want!
Isn't SetTimer a global thing?
__________________
This signature was made in 5.706 seconds
Dex007HLH is offline   Reply With Quote
Old 17/02/2013, 04:23 PM   #5
DaRk_RaiN
Gangsta
 
DaRk_RaiN's Avatar
 
Join Date: Sep 2012
Posts: 973
Reputation: 207
Default Re: Timer is not killing checkpoint

Oh, then you'd have to make a loop, here:
pawn Code:
public OnPlayerEnterCheckpoint(playerid)
{

    if(gTeam[playerid] == TEAM_RED) {
    bomb = SetTimer("bomb2", 10000, false);
    SendClientMessageToAll(0xDEEE20FF, "The bomb is being planted, it will take 10 seconds to activate it");


    }

    else if(gTeam[playerid] == TEAM_BLUE) {
        GameTextForPlayer(playerid,
           "Don't let the terrorists plant a bomb here",
           6000,5);
    }

    return 1;
}

public bomb2()
{
        for(new i = 0; i < MAX_PLAYERS; i++)//This loop through all players.
        {
        SendClientMessageToAll(0xDEEE20FF, "The bomb has been planted, you have 10 seconds to run away");
        CreateObject(1654,2636.1999512,-2094.5000000,12.6000004,272.8234863,314.9780273,134.0114746); //object(dynamite) (1)
        CreateObject(1654,2636.1999512,-2095.1000977,12.6000004,272.8234863,314.9780273,17.2614746); //object(dynamite) (2)
        CreateObject(1654,2636.3000488,-2094.8000488,12.6000004,272.8234863,314.9780273,285.0114746); //object(dynamite) (3)
        DisablePlayerCheckpoint(i);
        SetTimer("exp",10000,false);
        SetTimer("exp2",12000,false);
        SetTimer("exp3",15000,false);
        }

}
DaRk_RaiN is offline   Reply With Quote
Old 17/02/2013, 04:29 PM   #6
Dex007HLH
Big Clucker
 
Dex007HLH's Avatar
 
Join Date: Nov 2010
Location: Somewhere infront of a computer.
Posts: 121
Reputation: 2
Default Respuesta: Timer is not killing checkpoint

It worked, thank you!
Can you explain me what is a loop and what it does?
__________________
This signature was made in 5.706 seconds
Dex007HLH is offline   Reply With Quote
Old 17/02/2013, 04:30 PM   #7
Scenario
Godfather
 
Scenario's Avatar
 
Join Date: Feb 2010
Location: Heaven
Posts: 7,801
Reputation: 701
Default Re: Timer is not killing checkpoint

I'd rather not try to explain it myself, so here: http://whatis.techtarget.com/definition/loop
Scenario is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Killing a Checkpoint xXRealLegitXx Scripting Help 21 17/02/2013 02:44 AM
Help please on Killing a Timer, it won't die! jakejohnsonusa Scripting Help 8 25/11/2012 02:34 PM
My timer isn't killing! cloudysky Scripting Help 0 05/06/2012 06:13 PM
Killing a timer on repeat. Robert_Crawford Scripting Help 20 04/03/2012 06:50 AM
about killing timer's shady91 Help Archive 3 27/03/2010 09:55 PM


All times are GMT. The time now is 05:49 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.