Checkpointid
#1

I have this function:
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
I want to use "checkpointid" in a timer:
pawn Код:
PlayerCountTimer[playerid] = SetTimerEx("Count", 1000, true, "i", playerid, checkpointid);
playerid is "i" in the timer, but what is checkpointid, "s", "i" or what?
Reply
#2

i (or d), in the callback is a interger not string.
Reply
#3

pawn Код:
new OilZone;
// ...
OilZone = GangZoneCreate(90, 1332, 288, 1494);
I want to use the gangzone in my timer, this is the code under OnPlayerEnterDynamicCP:
pawn Код:
//
        else if(IsPlayerInDynamicArea(playerid, OilArea))
        {
            GangZoneFlashForAll(OilZone, GetPlayerGangColor(playerid));
            format(string, sizeof(string), "%s", "OilZone");
        }
       
        PlayerCount[playerid] = 30;
        PlayerCountTimer[playerid] = SetTimerEx("GangCount", 1000, true, "iis[128]", playerid,  checkpointid, string);
But when I use the gangzone in my timer it won't work.
Reply
#4

pawn Код:
else if(IsPlayerInDynamicArea(playerid, OilArea))
        {
            GangZoneFlashForAll(OilZone, GetPlayerGangColor(playerid));
        }
       
        PlayerCount[playerid] = 30;
        PlayerCountTimer[playerid] = SetTimerEx("GangCount", 1000, true, "iii", playerid,  checkpointid, OilZone);
Reply
#5

Yes, but I have 4 if's, not only one so I cant set the timer like that.
Reply
#6

So, why not put it in an array instead?

pawn Код:
new OilZone[4];

PlayerCountTimer[playerid] = SetTimerEx("GangCount", 1000, true, "iii", playerid,  checkpointid, OilZone[0]);
Reply
#7

So how would you put it here?
pawn Код:
else if(checkpointid == BigEarCP || checkpointid ==  SnakeCP || checkpointid ==  TeeMotelCP || checkpointid ==  OilCP)
    {
        new string[128];
        if(GangInfo[checkpointid][gAttacked] == 1) return SendClientMessage(playerid, C_RED, "The zone is being captured!");
        if(GangInfo[checkpointid][gOwner] == gTeam[playerid]) return SendClientMessage(playerid, C_LBLUE, "Your team owns this zone.");
       
        GangInfo[checkpointid][gAttacked] = 1;
       
        if(IsPlayerInDynamicArea(playerid, BigEarArea))
        {
            GangZoneFlashForAll(BigEarZone, GetPlayerGangColor(playerid));
            format(string, sizeof(string), "%s", "BigEarZone");
        }
        else if(IsPlayerInDynamicArea(playerid, SnakeArea))
        {
            GangZoneFlashForAll(SnakeZone, GetPlayerGangColor(playerid));
            format(string, sizeof(string), "%s", "SnakeZone");
        }
        else if(IsPlayerInDynamicArea(playerid, TeeMotelArea))
        {
            GangZoneFlashForAll(TeeMotelZone, GetPlayerGangColor(playerid));
            format(string, sizeof(string), "%s", "TeeMotelZone");
        }
        else if(IsPlayerInDynamicArea(playerid, OilArea))
        {
            GangZoneFlashForAll(OilZone, GetPlayerGangColor(playerid));
            format(string, sizeof(string), "%s", "OilZone");
        }
       
        PlayerCount[playerid] = 30;
        PlayerCountTimer[playerid] = SetTimerEx("GangCount", 1000, true, "iis[128]", playerid,  checkpointid, string);
        format(string, sizeof(string), "[ZONE] %s is being taken over!", GetZoneName(checkpointid));
        SendClientMessageToAll(C_LGREEN, string);
    }
Reply
#8

pawn Код:
new capturing[MAX_PLAYERS];//Global

//In the function OnPLayerEnterCp
{
        new pZone;
        if(IsPlayerInDynamicArea(playerid, BigEarArea))
        {
            GangZoneFlashForAll(BigEarZone, GetPlayerGangColor(playerid));
            pZone = BigEarArea;
        }
        else if(IsPlayerInDynamicArea(playerid, SnakeArea))
        {
            GangZoneFlashForAll(SnakeZone, GetPlayerGangColor(playerid));
            pZone = SnakeArea;
        }
        else if(IsPlayerInDynamicArea(playerid, TeeMotelArea))
        {
            GangZoneFlashForAll(TeeMotelZone, GetPlayerGangColor(playerid));
            pZone = TeeMotelArea;

        }
        else if(IsPlayerInDynamicArea(playerid, OilArea))
        {
            GangZoneFlashForAll(OilZone, GetPlayerGangColor(playerid));
            pZone =OilArea;

        }
       
        capturing[playerid] = SetTimerEx("capturezone",30000,false,"ii",playerid,pZone);
}
forward capturezone(playerid,zone);

public capturezone(playerid,zone)
{
    switch (zone)
    {
        case BigEarArea :
        case SnakeArea :
        case TeeMotelArea :
        case OilArea :
    }
 //Capture Gangzone
}

OnPlayerLeaveDynamicCP(playerid,CPID)//or whatever this is called
{
    KillTimer(capturing[playerid]);
}
Reply
#9

Okay, I have this:
pawn Код:
forward OnPlayerEnterDynamicCP(playerid, checkpointid);
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == A51CP || checkpointid == AIRCP || checkpointid ==  DESCP || checkpointid ==  FOCCP)
    {
        ShowPlayerDialog(playerid, D_SHOP, DIALOG_STYLE_LIST, " .:: Reality shop ::.", "Health ($2500)\nArmor ($3000)\nKnife ($500)\nChainsaw ($1000)\nDeagle ($1500)\nCombat Shotgun ($3500)\nMP5 ($2000)\nM4 ($3500)\nKatana ($1000)", "Buy", "Cancel");
    }
    else if(checkpointid == BigEarCP || checkpointid ==  SnakeCP || checkpointid ==  TeeMotelCP || checkpointid ==  OilCP)
    {
        new string[128], pZone;
        if(GangInfo[checkpointid][gAttacked] == 1) return SendClientMessage(playerid, C_RED, "The zone is being captured!");
        if(GangInfo[checkpointid][gOwner] == gTeam[playerid]) return SendClientMessage(playerid, C_LBLUE, "Your team owns this zone.");
       
        GangInfo[checkpointid][gAttacked] = 1;
       
        if(IsPlayerInDynamicArea(playerid, BigEarArea))
        {
            GangZoneFlashForAll(BigEarZone, GetPlayerGangColor(playerid));
            pZone = BigEarArea;
        }
        else if(IsPlayerInDynamicArea(playerid, SnakeArea))
        {
            GangZoneFlashForAll(SnakeZone, GetPlayerGangColor(playerid));
            pZone = SnakeArea;
        }
        else if(IsPlayerInDynamicArea(playerid, TeeMotelArea))
        {
            GangZoneFlashForAll(TeeMotelZone, GetPlayerGangColor(playerid));
            pZone = TeeMotelArea;
        }
        else if(IsPlayerInDynamicArea(playerid, OilArea))
        {
            GangZoneFlashForAll(OilZone, GetPlayerGangColor(playerid));
            pZone = OilArea;
        }
       
        PlayerCount[playerid] = 30;
        PlayerCountTimer[playerid] = SetTimerEx("GangCount", 1000, true, "iii", playerid,  checkpointid, pZone);
        format(string, sizeof(string), "[ZONE] %s is being taken over!", GetZoneName(checkpointid));
        SendClientMessageToAll(C_LGREEN, string);
    }
    return 1;
}
And:
pawn Код:
forward GangCount(playerid, checkpointid, zonename);
public GangCount(playerid, checkpointid, zonename)
{
    new time[16];
    format(time, sizeof(time), "~g~%i..", PlayerCount[playerid]);
    GameTextForPlayer(playerid, time, 1000, 3);
   
    PlayerCount[playerid] --;
    if(PlayerCount[playerid] == 0)
    {
        SendClientMessageToAll(C_GREY, "debug");// this is being sent ingame
        GangInfo[checkpointid][gAttacked] = 0;
        GangInfo[checkpointid][gOwner] = gTeam[playerid];
       
        GangZoneStopFlashForAll(zonename);
        GangZoneShowForAll(zonename, GetPlayerGangColor(playerid));
   
        KillTimer(PlayerCountTimer[playerid]);
    }
    return 1;
}
But the zone won't stop flashing, what's the problem?
Reply
#10

pawn Код:
SetTimerEx("GangCount", 1000, true, "iii", playerid,  checkpointid, pZone);
The timer is a repeating timer, therefore, you must kill it after it has been executed maybe like 10 times.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)