SA-MP Forums Archive
[BUG] With this cmd: - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [BUG] With this cmd: (/showthread.php?tid=546793)



[BUG] With this cmd: - GBLTeam - 17.11.2014

When someone use this /bizsef and type /bizsef deposit -300000 he recive +3000000 ? How...

pawn Код:
CMD:bizsef(playerid, params[])
{
    new value, string[128];
    new idx = PlayerInfo[playerid][pBiz];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Mora da bides najaven za da ja koristis ovaa komanda.");
    if(!PlayerInfo[playerid][pBiz] && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "Ti ne si sopstvenik na biz.");
    if(GetPlayerVirtualWorld(playerid)-100 != idx && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "Ti ne si vnatre vo biznisot.");
    if(GetPlayerVirtualWorld(playerid)-100 != idx && PlayerInfo[playerid][pVBiz])
    {
        idx = PlayerInfo[playerid][pVBiz];
        if(GetPlayerVirtualWorld(playerid)-100 != idx) return SendClientMessage(playerid, COLOR_GREY, "Ti ne si vnatre vo biznisot.");
    }
    if(sscanf(params, "s[32]", params))
    {
        SendClientMessage(playerid, COLOR_WHITE, "[INFO]: /bizsef [opcija]");
        SendClientMessage(playerid, COLOR_GREY, "OPCIJE: withdraw | deposit");
        return 1;
    }
    if(!strcmp(params, "withdraw", false, 8))
    {
        if(sscanf(params, "s[32]i", params, value))
        {
            SendClientMessage(playerid, COLOR_WHITE, "[INFO]: /bizsef withdraw [kolicina]");
            format(string, sizeof(string), "Momentalno ima pari: $%d", BizInfo[idx][bMoney]);
            SendClientMessage(playerid, COLOR_GREY, string);
            return 1;
        }
        if(value > BizInfo[idx][bMoney]) return SendClientMessage(playerid, COLOR_GREY, "Ti nemas tolku pari vo tvojot biznis.");
        BizInfo[idx][bMoney] -= value;
        GiveDodMoney(playerid, -value);
        format(string, sizeof(string), "* %s izvadi pari od svojto biznis.", RPN(playerid));
        SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
        format(string, sizeof(string), " Ti izvadi $%d od tvojot biznis, ostanaa uste: $%d", value, BizInfo[idx][bMoney]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    }
    else if(!strcmp(params, "deposit", false, 7))
    {
        if(sscanf(params, "s[32]i", params, value))
        {
            SendClientMessage(playerid, COLOR_WHITE, "[INFO]: /bizsef deposit [kolicina]");
            format(string, sizeof(string), "Momentalno ima pari: $%d", BizInfo[idx][bMoney]);
            SendClientMessage(playerid, COLOR_GREY, string);
            return 1;
        }
        if(value > PlayerInfo[playerid][pMoney]) return SendClientMessage(playerid, COLOR_GREY, "Ti nemas tolku pari za da stavis vo svojot biznis.");
        BizInfo[idx][bMoney] += value;
        GiveDodMoney(playerid, value);
        format(string, sizeof(string), "* %s gi stavi parite vo biznis sefot.", RPN(playerid));
        SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
        format(string, sizeof(string), " Ti stavi $%d vo biznis sefot, ostanaa uste: $%d", value, BizInfo[idx][bMoney]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    }
    return 1;
}



Re: [BUG] With this cmd: - Youice - 17.11.2014

Here, Try:
pawn Код:
if(value > PlayerInfo[playerid][pMoney] || value < 1)



Re: [BUG] With this cmd: - DavidBilla - 18.11.2014

Show the givedodmoney function