Whats wrong with my timer
#1

had this working with no timer, pulling random amount between 250 and 450, like this
pawn Код:
COMMAND:rob(playerid, params[])
{
    if(GetPlayerWeapon(playerid) > 22)
    {

        new biz = GetClosestBiz(playerid);
        if(biz == -1) { biz = in_biz[playerid]; }
        if(biz > -1)
        {

            if(BizInfo[biz][bBank] > 0)
            {
                if(IsInStore(playerid))
                {
                   
                    SetTimerEx("RobStore",10000,false,"i",playerid);
                    ApplyAnimation(playerid,"PED","gang_gunstand",4.0,0,1,1,0,10000,1);
                    SendClientMessage(playerid,COLOR_RED,"You have started robbing this store.");
                    new loot = randomEx(250,420);
                    SendMoney(playerid,loot);
                    TakeBizMoney(biz,loot);
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid,COLOR_WHITE,"This Business Has No Money.")
            }
            return 1;
        }
        else
        {
            SendClientMessage(playerid,COLOR_RED,"You are not in a store.");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You do not have a weapon.");
        return 1;
    }
    return 1;
}
stock randomEx(min,max)
{
    return min + random ( max - min );
}
i then tried to add timer in so player would get money until the end of the time but pawn compiler crashes unable to compile. this is what the timer looked like

pawn Код:
forward RobStore(playerid);

COMMAND:rob(playerid, params[])
{
    if(GetPlayerWeapon(playerid) > 22)
    {

        new biz = GetClosestBiz(playerid);
        if(biz == -1) { biz = in_biz[playerid]; }
        if(biz > -1)
        {

            if(BizInfo[biz][bBank] > 0)
            {
                if(IsInStore(playerid))
                {
                    new robtime;
                    robtime = randomEx(45000,90000);
                    SetTimerEx("RobStore",robtime,false,"i",playerid);
                    ApplyAnimation(playerid,"PED","gang_gunstand",4.0,0,1,1,0,robtime,1);
                    SendClientMessage(playerid,COLOR_RED,"You have started robbing this store.");
                   
                   
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid,COLOR_WHITE,"This business has no money.");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid,COLOR_RED,"You are not in a store.");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You do not have a weapon.");
        return 1;
    }
    return 1;
}


public RobStore(playerid);
{
    new biz = GetClosestBiz(playerid);
    new loot = randomEx(250,420);
    SendMoney(playerid,loot);
    TakeBizMoney(biz,loot);
    return 1;
}
stock randomEx(min,max)
{
    return min + random ( max - min );
}
again Thanks in advanced
Reply
#2

Try this.

pawn Код:
if(GetPlayerWeapon(playerid) > 22)
    {

        new biz = GetClosestBiz(playerid);
        if(biz == -1) { biz = in_biz[playerid]; }
        if(biz > -1)
        {

            if(BizInfo[biz][bBank] > 0)
            {
                if(IsInStore(playerid))
                {
                    new robtime;
                    robtime = randomEx(45000,90000);
                    SetTimerEx("RobStore",robtime,false,"i",playerid);
                    ApplyAnimation(playerid,"PED","gang_gunstand",4.0,0,1,1,0,robtime,1);
                    SendClientMessage(playerid,COLOR_RED,"You have started robbing this store.");
                   
                   
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid,COLOR_WHITE,"This business has no money.");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid,COLOR_RED,"You are not in a store.");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You do not have a weapon.");
        return 1;
    }
    return 1;
 }
}
You missed a closing bracet from GetPlayerWeapon I believe.
Reply
#3

it is the second script that is not working the top one works jsut fine but has no timer set to give player money after the time has past
Reply
#4

im sorry i found what your talking about i fixed the bracket and it still wont compile not even getting errors
Reply
#5

I counted 4 useless return's in that code.
Reply
#6

public RobStore(playerid);

there is no ";" at the end
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)