This msg keeps repeating
#4

ye, coz you didnt add a check for WHEN the message should be sent. assuming a robbery needs 30 seconds (so thats the initial countdown), a switch/case will do fine:
pawn Код:
public pRobTimer(playerid)
{
    pRobCount[playerid]--;
    new rbgt[128];
    format(rbgt, sizeof(rbgt), "Robbery ~g~in progress.~r~Do NOT leave the checkpoint.~y~Time left: ~g~%i", pRobCount[playerid]);
    GameTextForPlayer(playerid, rbgt, 1000, 5);
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    new copmsg[170];
    format(copmsg, sizeof(copmsg), "- WARNING ALL COPS: Robbery in progress by %s (%d) - Location: %s",name,playerid,zones[current_zone][zone_name]);
    switch(pRobCount[playerid])
    {
        case 29://case 25://?//assuming your countdown starts at 30, then pRobCount[playerid]--;, so send the message 1 second after the player triggered the timer, thats 29 hehe. hm. why not send the message 5 seconds later, so theplayer can take a breath first? ^^
        {
            for(new i=0;i<MAX_PLAYERS;i++)
            {
                if(!IsPlayerConnected(i))continue;
                new current_zone;
                current_zone = player_zone[i];
                if(gTeam[i] == TEAM_COP)
                {
                    SendClientMessage(i, COLOR_BLUE, copmsg);
                }
            }
        }
        case 0:
        {
            KillTimer(pRobTimerID[playerid]);
            new plwl = GetPlayerWantedLevel(playerid);
            plwl = GetPlayerWantedLevel(playerid);
            SetPlayerWantedLevel(playerid,plwl +2);
            new robmoney = 10500 + random(50000);
            GivePlayerMoney(playerid,robmoney);
            new string2[135];
            format(string2, sizeof(string2), "- SUCCESS ROBBERY - Wanted Level %d - Robbed %i$",plwl,robmoney);
            SendClientMessage(playerid,red,string2);
            GameTextForPlayer(playerid, "Robbery ~r~COMPLETE.", 3000, 5);
            new file[128];
            new pname[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pname, sizeof(pname));
            format(file, sizeof(file), SERVER_USER_FILE, pname);
            TotalRobberies += PlayerInfo[playerid][pRobberies];
            PlayerInfo[playerid][pRobberies] = dini_Int(file, "Robberies");
            SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
            new string3[135];
            new current_zone;
            current_zone = player_zone[playerid];
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            format(string3, sizeof(string3), "- ROBBERY - %s (%d) has robbed %i$ from %s",name,playerid,robmoney,zones[current_zone][zone_name]);
            SendClientMessageToAll(COLOR_WHITE,string3);
        }
    }
    return 1;
}
now feel free to add a default:{GameTextForPlayer(playerid,"seconds left: format(%d,pRobCount[playerid]blabla)
}
Reply


Messages In This Thread
This msg keeps repeating - by Face9000 - 28.01.2012, 21:52
Re: This msg keeps repeating - by MP2 - 28.01.2012, 22:21
Re: This msg keeps repeating - by Face9000 - 28.01.2012, 22:52
Re: This msg keeps repeating - by Babul - 29.01.2012, 01:40

Forum Jump:


Users browsing this thread: 3 Guest(s)