Job Trucker Problem
#1

Hey all
I can't work with trucker job on my server
http://postimg.org/gallery/e3ysy068/04f693aa/
Код:
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[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
                {
                    //printf("Found House :%d",i);
                    for(new l = PlayerInfo[playerid][pTruckLoad]; l > 0; l--)
                    {
                        if(BizzInfo[i][bProducts] == BizzInfo[i][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[i][bPriceProd] > BizzInfo[i][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;
                        }
Reply
#2

Download mine !.
Reply
#3

We cannot help you without the code. Start with finding "you are not in a delivery truck" in your script and post the code related to it here.
Reply
#4

I edit the post
Reply
#5

This could be Godfather edit , i were having this problem before .. tell me exactly what you are trying to do and what is the problem i'll solve it for you ..
Reply
#6

MCZOFT i can't deliver prods look here : http://postimg.org/gallery/e3ysy068/04f693aa/
Reply
#7

Okay it's Easy , Look in your script something like that ,

PHP код:
Public IsATruck 
or
PHP код:
Stock IsATruck 
Post it and i'll tell you how to fix that ..
Reply
#8

public IsATruck(carid)
{
if(carid >= 108 && carid <= 111)
{
return 1;
}
return 0;
Reply
#9

then it's Raven's Roleplay Script mmmmmmmm

then how you are waiting the server to understand this

PHP код:
  if(IsATruck(tmpcar)) 
??

add this to your script



PHP код:

public IsATruck(carid)
{
    new 
GetVehicleModel(carid);
    if(
== (vehicleid)|| == (vehicleid)|| == (vehicleid)|| == (vehicleid))
    {
        return 
1;
    }
    return 
0;

for Example , vehicles id i'll allow them to load with Truck are 1 2 and 3 i'll do like this



PHP код:
public IsATruck(carid)
{
    new 
GetVehicleModel(carid);
    if(
== 1|| == 2|| == 3)
    {
        return 
1;
    }
    return 
0;

this will work 100% , if there anything eles tell it
Reply
#10

pawn Код:
if(strcmp(cmd, "/load", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new tmpcar = GetPlayerVehicleID(playerid);
            if(!tmpcar == 515 || !tmpcar == 514 || !tmpcar == 403)
            {
                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(tmpcar == 515 || tmpcar == 514 || tmpcar == 403)
                {
                    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[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
                {
                    //printf("Found House :%d",i);
                    for(new l = PlayerInfo[playerid][pTruckLoad]; l > 0; l--)
                    {
                        if(BizzInfo[i][bProducts] == BizzInfo[i][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[i][bPriceProd] > BizzInfo[i][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;
                        }
Shall work, most easy way though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)