help dynamic rob point
#2

For the point part, try returning the SCM, which I've done it. For the failed part, I don't know, it looks alright to me.

EDIT: I've made an array that makes the RobFail to 1 when player failed and sends the client message out of the loops, that might help prevent the repeat. I am not sure, just check this thing and report if have any issues.
pawn Код:
// On top
new RobFail[MAX_PLAYERS];

//On Player Connect
RobFail[playerid] = 0;

CMD:rob(playerid,params[])
{
    for(new i=0; i<MAX_PICK; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid,2,PickInfo[i][pX], PickInfo[i][pY], PickInfo[i][pZ]) && GetPlayerVirtualWorld(playerid) == PickInfo[i][pVw] && GetPlayerInterior(playerid) == PickInfo[i][pInt])
        {
            ApplyAnimation(playerid, "ROB_BANK", "CAT_SAFE_ROB", 4.0, 1, 0, 0,0, 1);
            robtime = SetTimer("robtimer",1000,true);
        }
        else return SCM(playerid,-1,"You are not in a rob point");
    }
    return 1;
}
forward robtimer(playerid);
public robtimer(playerid)
{
    for(new i=0; i<MAX_PICK; i++)
    {
        CountDownVar--;
        new str[128];
        format(str, sizeof(str), "Count Down: %d",CountDownVar);
        GameTextForPlayer(playerid,str,1000,6);
        if(CountDownVar == 0)
        {
            new rand = random(999);
            GiveDrichMoney(playerid,rand);
            format(str,128," %s has robbed %i",GetName(playerid),rand);
            SCM(playerid,-1,str);
            ClearAnimations(playerid);
            KillTimer(robtime);
            CountDownVar = 15;
        }
        else if(!IsPlayerInRangeOfPoint(playerid,1.0,PickInfo[i][pX], PickInfo[i][pY], PickInfo[i][pZ]) || GetPlayerVirtualWorld(playerid) != PickInfo[i][pVw] || GetPlayerInterior(playerid) != PickInfo[i][pInt])
        {
            KillTimer(robtime);
            CountDownVar = 15;
            RobFail[playerid] = 1;
        }
        if(RobFail[playerid] == 1) return SCM(playerid,-1, "[ROBBERY]: Robbery has failed");
    }
    return 1;
}
Reply


Messages In This Thread
help dynamic rob point - by drichie - 04.07.2013, 06:26
Re: help dynamic rob point - by Goldilox - 04.07.2013, 06:56
Re: help dynamic rob point - by GeniusPobs - 04.07.2013, 07:20
Re: help dynamic rob point - by drichie - 04.07.2013, 07:57
Re: help dynamic rob point - by Vince - 04.07.2013, 08:04
Re: help dynamic rob point - by drichie - 04.07.2013, 08:16

Forum Jump:


Users browsing this thread: 1 Guest(s)