help dynamic rob point
#1

im just trying to make dynamic rob point so the admin can make rob points whenever or where he wants to....im just experimenting here coz i think its possible..unfortunately im not good when it comes to loopings

help me whenever i type /rob to the rob point i make it loops on how many max rob point define

#define MAX_PICK 50

for example im not in a rob point or i failed in robbing the client messages will be seen 50 times in the chat box

here is my /rob command
pawn Код:
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
        {
            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;
            SCM(playerid,-1, "[ROBBERY]: Robbery has failed");
        }
    }
    return 1;
}
this one i used to create auto generated id rob point
pawn Код:
CMD:crob(playerid, params[])
{
    new string[128];
    for(new i=0; i<MAX_PICK; i++)
    {
        if(!PickInfo[i][pPick])
        {
            GetPlayerPos(playerid, PickInfo[i][pX], PickInfo[i][pY], PickInfo[i][pZ]);
            PickInfo[i][pInt] = GetPlayerInterior(playerid);
            PickInfo[i][pVw] = GetPlayerVirtualWorld(playerid);
            PickInfo[i][pPick] = CreateDynamicPickup(1210, 1, PickInfo[i][pX], PickInfo[i][pY], PickInfo[i][pZ]+0.2,PickInfo[i][pVw],PickInfo[i][pInt]);
            format(string, sizeof(string), "ID: %d", i);
            PickInfo[i][pText] = CreateDynamic3DTextLabel(string,-1,PickInfo[i][pX], PickInfo[i][pY], PickInfo[i][pZ]+0.3, 15);
            format(string, sizeof(string), " You have set a robpoint ID %d to your coordinates. (Int: %d | VW: %d)", i, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
            SCM(playerid,COLOR_LIGHTBLUE, string);
            i = MAX_PICK;
        }
    }
    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: 2 Guest(s)