Jump to content
  • 0

eroare job truck


Ale Alecs

Question

Ma numesc: McShooteR

Problema intalnita:Nu imi merge jobul Trucking /sellprods /load /buyprods
Poze :http://postimg.org/gallery/e3ysy068/04f693aa/

Am incercat sa rezolv ceva dar nu a mers

if(strcmp(cmd, "/load", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new tmpcar = GetPlayerVehicleID(playerid);
            if(!IsATruck(tmpcar))
            {
                GameTextForPlayer(playerid, "~r~You are not in a delivery truck", 5000, 1);
                return 1;
            }
            format(string, sizeof(string), "Products: %d.", PlayerInfo[playerid][pTruckLoad]);
            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
        }
        return 1;
    }

    if(strcmp(cmd, "/buyprods", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new tmpcar = GetPlayerVehicleID(playerid);
            if(PlayerToPoint(70.0, playerid, 2468.4919,-2092.9902,13.5469))
            {
                if(IsATruck(tmpcar))
                {
                    if(PlayerInfo[playerid][pTruckLoad] < 200)
                    {
                        tmp = strtok(cmdtext, idx);
                        if(!strlen(tmp))
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /buyprods [1-200]");
                            return 1;
                        }
                        new amount = strval(tmp);
                        if(amount < 1 || amount > 200) { SendClientMessage(playerid, COLOR_GREY, "   Can't buy less then 1 Product or more then 200 !"); return 1; }
                        new cost = amount*50;
                        if(GetPlayerMoney(playerid) > cost)
                        {
                            PlayerInfo[playerid][pTruckLoad] += amount;
                            format(string, sizeof(string), "You bought %d Products for $%d.", amount,cost);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            SafeGivePlayerMoney(playerid,-cost);
                            return 1;
                        }
                        else
                        {
                            format(string, sizeof(string), "You cant afford %d Products at $%d !", amount,cost);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, "You cannot carry more then 200 products at a time");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Products.");
                    return 1;
                }
            }
        }
        return 1;
    }

    if(strcmp(cmd, "/sellprods", true) == 0)
    {
        new cashmade;
        new tmpcar;
        if(IsPlayerConnected(playerid))
        {
            tmpcar = GetPlayerVehicleID(playerid);
            if(!IsATruck(tmpcar))
            {
                GameTextForPlayer(playerid, "~r~You are not in a delivery truck", 5000, 1);
                return 1;
            }
            if(PlayerInfo[playerid][pTruckLoad] == 0)
            {
                GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
                format(string, sizeof(string), "Products: %d.", PlayerInfo[playerid][pTruckLoad]);
                SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                return 1;
            }
            for(new i = 0; i < sizeof(BizzInfo); i++)
            {
                if (IsPlayerInRangeOfPoint(playerid, 10,BizzInfo[bEntranceX], BizzInfo[bEntranceY], BizzInfo[bEntranceZ]))
                {
                    //printf("Found House :%d",i);
                    for(new l = PlayerInfo[playerid][pTruckLoad]; l > 0; l--)
                    {
                        if(BizzInfo[bProducts] == BizzInfo[bMaxProducts])
                        {
                            GameTextForPlayer(playerid, "~r~Our stores are full", 5000, 1);
                            format(string, sizeof(string), "Cash Earned $%d.", cashmade);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            format(string, sizeof(string), "Products: %d.", PlayerInfo[playerid][pTruckLoad]);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            return 1;
                        }
                        if(BizzInfo[bPriceProd] > BizzInfo[bTill])
                        {
                            GameTextForPlayer(playerid, "~r~We Cant Afford The Deal", 5000, 1);
                            format(string, sizeof(string), "Cash Earned $%d.", cashmade);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            format(string, sizeof(string), "Products: %d.", PlayerInfo[playerid][pTruckLoad]);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            return 1;
                        }
Edited by Ale Alecs
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.