Robbery
#1

OK, here is the problem, I have made a robbery system as in there is a checkpoint within an interior like the burger place (burger shot) where you can step inside the checkpoint do /robburger and you start robbing.

I have a total of 2 bugs which is getting on my nerves.
  • After robbing you can go back into the checkpoint and it will give you money auto ( i think just for id 1+ )
  • I have a textdraw showing how much you have robbed and it should hide within 3 secs. works for id 0 but not id 1 +
All the code to do with the robbery
pawn Код:
stock ShowMoneyGain(playerid)
{
    SetTimer("destroyrob", 3000, false);
    TextDrawShowForPlayer(playerid, moneyhere);
    return 1;
}

forward destroyrob(playerid);
public destroyrob(playerid)
{
    TextDrawHideForPlayer(playerid, moneyhere);
    return 1;
}

CMD:robburger(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5.0, 379.0827,-65.4114,1001.5078))
    {
            if(RobbedR == false)
            {
                countn[playerid]=12;
                dstimer[playerid]=SetTimerEx("Rob",1000,true,"i",playerid);
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "This store has been robbed recently. Please try again");
            }
            return 1;
   }
    return 1;
}

public Rob(playerid)
{
    if(IsPlayerInDynamicCP(playerid, burgerrob))
    {
        countn[playerid]--;
        new string[128];
        format(string, sizeof(string), "Attempting robbery~n~~b~%i~n~~r~Stay in the checkpoint", countn[playerid]);
        TextDrawSetString(robbery, string);
        TextDrawShowForPlayer(playerid, robbery);
    }
    if(countn[playerid] <= 0)
    {
        if(IsPlayerInDynamicCP(playerid, burgerrob))
        {
            RobbedR = true;
            SetTimer("RR", 300000, true);
            new money = random(50000);
            GivePlayerMoney(playerid, money);
            new rob[128];
            format(rob, sizeof(rob), "~g~Robbed $%i", money);
            TextDrawSetString(moneyhere, rob);
            KillTimer(dstimer[playerid]);
            ShowMoneyGain(playerid);
            TextDrawHideForPlayer(playerid, robbery);
        }
    }
    return 1;
}
forward RR();
public RR()
{
    RobbedR = false;
    return 1;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == burgerrob) {
        SendClientMessage(playerid, COLOR_ORANGE, "Use /robburger To rob this store");
        return 1;
    }
    return 1;
}
Reply


Messages In This Thread
Robbery - by thefatshizms - 26.09.2012, 16:13
Re: Robbery - by Anak - 27.09.2012, 08:57
Re: Robbery - by Ballu Miaa - 27.09.2012, 09:13

Forum Jump:


Users browsing this thread: 1 Guest(s)