On Player Pick up Zone!
#1

Guys i Finally Did This. But i am not getting It. It is showing too many times that > " wait in zone 30 sec. wait in zone 30 sec. wait in zone 30 sec." And after 30 sec. It is too many time giving Scores. What the problem.
And when i left the pickup the checkpoint was not disappearing...

pawn Код:
new breifcase6;
new gangzone5;

public OnGameModeInit()
{
gangzone5 = GangZoneCreate(-392.1586, 1499.8591, -263.7490, 1630.3291);
breifcase6 = CreatePickup(1210, 23, -316.7369, 1594.6285, 75.6609, -1);
return;1
}

public OnPlayerSpawn(playerid)
{
SetPlayerMapIcon(playerid,0,-316.7369,1594.6285,75.6609,53,19,2);
return;1
}

public OnPlayerEnterCheckpoint(playerid)
{
    if(Checkpoint[playerid] == 1)
    {
    timer[playerid] = SetTimerEx("SetZone",30000,false,"i",playerid);
    SendClientMessage(playerid,RED,"Wait For 30 Sec. Don't leave Marker or Capturing will be Failed");
    }

    return 1;
}

forward SetZone(playerid);
public SetZone(playerid)
{
    SetPlayerScore(playerid, GetPlayerScore(playerid) + 3);
    GivePlayerMoney(playerid,3000);
    SendClientMessage(playerid,GREEN,"Congratulation! You have Gained 3 Scores & 3000$ Money ");
    DisablePlayerCheckpoint(playerid);
    SetGangZone(playerid);
    return 1;
}
forward SetGangZone(playerid);
public SetGangZone(playerid)
{
    if(gTeam[playerid] == TEAM_PAKISTAN)
    {
    GangZoneShowForAll(gangzone5,GREENA);
   
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"Server News: %s has captured Satellite For Pakistan",pName);
    SendClientMessageToAll(0x008000AA,string);
    }
   
    if(gTeam[playerid] == TEAM_GERMANY)
    {
    GangZoneShowForAll(gangzone5,ORANGEA);
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"Server News: %s has captured Satellite For Germany",pName);
    SendClientMessageToAll(0x008000AA,string);
    }
   
    if(gTeam[playerid] == TEAM_USA)
    {
    GangZoneShowForAll(gangzone5,BLUEA);
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"Server News: %s has captured Satellite For USA",pName);
    SendClientMessageToAll(0x008000AA,string);
    }
   
    if(gTeam[playerid] == TEAM_RUSSIA)
    {
    GangZoneShowForAll(gangzone5,REDA);
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"Server News: %s has captured Satellite For RUSSIA",pName);
    SendClientMessageToAll(0x008000AA,string);
    }
   
    if(gTeam[playerid] == TEAM_INDIA)
    {
    GangZoneShowForAll(gangzone5,YELLOWA);
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"Server News: %s has captured Satellite For INDIA",pName);
    SendClientMessageToAll(0x008000AA,string);
    }
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    KillTimer(timer[playerid]);
    SendClientMessage(playerid,RED,"Capturing Zone Failed You have Left the Marker. ");
    DisablePlayerCheckpoint(playerid);
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == breifcase5)
    {
        ShowPlayerDialog(playerid, 2345, DIALOG_STYLE_LIST, "UDC Base Breifcase Menu", "Health {$2000}\nArmour {$2500}\nDesert Eagle {$3000}\nShotgun {$5000}\nSawn-Off Shotgun {$9000}\nCombat Shotgun {$10000}\nMicro SMG {$3000}\nMP5 {$4000}\nM4 {$6000}\nCountry Rifle {$6500}\nSniper Rifle {$7000}", "Purchase", "Cancel");
        return 1;
    }
    if(pickupid == breifcase6)
    {
    Checkpoint[playerid] = 1;
    SetPlayerCheckpoint(playerid, -316.7369,1594.6285,75.6609,13.9541);
   
    return 1;
    }
}
Reply
#2

Any one. please help. I edited the Above post. now there is very little 2 Problems.

1 = That when you pick up pickup then checkpoint start showing up. Which is great. But it Say 10000 of times after every second that "Wait For 30 Sec. Don't leave Marker or Capturing will be Failed". And After 30 Sec it Show 1000 of Times "Congratulation! You have Gained 3 Scores & 3000$ Money". And give too many scores and Money.

2 = When you leave checkpoint, it disappear. Which is great cuz i add "DisablePlayerCheckpoint(playerid);". But after 30 sec zone become ours while i was not on pickup. And there was no checkpoint...

Please Help Me. please Please. please
Reply
#3

The problem comes from OnPlayerPickUpPickup, it gets called repeatedly, so it sets the checkpoint many times and you will see many messages.

You should check Checkpoint[playerid] before doing anything

pawn Код:
public OnPlayerLeaveCheckpoint(playerid)
{
    if(Checkpoint[playerid] == 1)
    {
        KillTimer(timer[playerid]);
        SendClientMessage(playerid,RED,"Capturing Zone Failed You have Left the Marker. ");
        DisablePlayerCheckpoint(playerid);
    }
    return 1;
}
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == breifcase6)
    {
        if(Checkpoint[playerid] != 1)
        {
            Checkpoint[playerid] = 1;
            SetPlayerCheckpoint(playerid, -316.7369,1594.6285,75.6609,13.9541);
            return 1;
        }
    }
}
Reply
#4

You were making multiple Checkpoint when player was picking up briefcase.
ERROR :
pawn Код:
if(pickupid == breifcase6)
    {
    Checkpoint[playerid] = 1;
    SetPlayerCheckpoint(playerid, -316.7369,1594.6285,75.6609,13.9541);

    return 1;
    }
Solution :
pawn Код:
if(pickupid == breifcase6)
    {
    if(Checkpoint[playerid] == 1) return 0;
    Checkpoint[playerid] = 1;
    SetPlayerCheckpoint(playerid, -316.7369,1594.6285,75.6609,2);
    return 1;
    }
pawn Код:
public OnGameModeInit()
{

    for(new i = 0;i<MAX_PLAYERS;++i)
        Checkpoint[i] = 0;
    return 1;
}
Reply
#5

@MadMan: Now it is perfect. but one Thing. When i left the checkpoint and when it disappear than , when i came back to capture it again it is not showing checkpoint. And is not capturing.....

@Roxxor: I'll check yours.

Edit: Roxxor same as Madman... It got problem...
Reply
#6

Reset Checkpoint[playerid] here

pawn Код:
public OnPlayerLeaveCheckpoint(playerid)
{
    if(Checkpoint[playerid] == 1)
    {
        KillTimer(timer[playerid]);
        SendClientMessage(playerid,RED,"Capturing Zone Failed You have Left the Marker. ");
        DisablePlayerCheckpoint(playerid);
        Checkpoint[playerid] = 0;
    }
    return 1;
}
Reply
#7

Will this code can use after capturing. Cuz After capturing i also use disable capture point code..

Edit:
One More but very little problem. A single team can capture same zone soo many time. But thats now good. i want if PAKISTAN capture that zone. than he can't capture it again...
Reply
#8

Yes, you should always set Checkpoint[playerid] to 0 after using DisablePlayerCheckpoint.
Reply
#9

One More but very little problem. A single team can capture same zone soo many time. But thats now good. i want if PAKISTAN capture that zone. than he can't capture it again...
Reply
#10

I think he can solve that with another pickup type, for example type 2. Pick it and it disappears.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)