Jump to content
  • 0

Problema trucker


Sealand123

Question

Problema intalnita (descriere): Salut, nu merg comenzile la trucker cand dau /loadprod, /sellprods si /buyprods zice unknown command si nu se intampla nimic altceva desi sunt in masina de trucker si am jobul de trucker.
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul:

if(strcmp(cmd, "/loadprod", 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;
            }
            else
            {
                format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
            }
        }
        return 1;
    }

    if(strcmp(cmd, "/buyprods", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new tmpcar = GetPlayerVehicleID(playerid);
            new compcost = 20;
            if(IsPlayerInRangeOfPoint(playerid, 70, 2468.4919,-2092.9902,13.5469))
            {
                if(IsATruck(tmpcar))
                {
                    if(PlayerHaul[tmpcar][pLoad] < PlayerHaul[tmpcar][pCapasity])
                    {
                        new amount;
                        tmp = strtok(cmdtext, idx);
                        if(!strlen(tmp))
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /buyprods [amount]");
                            return 1;
                        }
                        amount = strval(tmp);
                        if(amount < 1 || amount > 500) { SendClientMessage(playerid, COLOR_GREY, "   Can't buy less then 1 Product or more then 500!"); return 1; }
                        new check= PlayerHaul[tmpcar][pLoad] + amount;
                        if(check > PlayerHaul[tmpcar][pCapasity])
                        {
                            format(string, sizeof(string), "   You went over the Truck Products Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pLoad]);
                            SendClientMessage(playerid, COLOR_GREY, string);
                            return 1;
                        }
                        new cost = amount*compcost;
                        if(GetPlayerMoney(playerid) >= cost)
                        {
                            PlayerHaul[tmpcar][pLoad] += amount;
                            format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            format(string, sizeof(string), "You bought %d Products for $%d.", amount,cost);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            SafeGivePlayerMoney(playerid,-cost);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            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
                    {
                            format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Products.");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You are not in trucker place.");
                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(PlayerHaul[tmpcar][pLoad] == 0)
            {
                GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
                format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                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 = PlayerHaul[tmpcar][pLoad]; 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/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            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/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            return 1;
                        }
                        PlayerHaul[tmpcar][pLoad]--;
                        BizzInfo[bProducts]++;
                        cashmade = cashmade+BizzInfo[bPriceProd];
                        //ConsumingMoney[playerid] = 1;
                        SafeGivePlayerMoney(playerid,BizzInfo[bPriceProd]);
                        BizzInfo[bTill] -= BizzInfo[bPriceProd];
                        if(PlayerHaul[tmpcar][pLoad] == 0)
                        {
                            GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
                            format(string, sizeof(string), "Cash Earned $%d.", cashmade);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            return 1;
                        }
                    }
                    OnPropUpdate(3,i);
                    return 1;
                }
            }
        }
        for(new i = 0; i < sizeof(SBizzInfo); i++)
        {
            if (IsPlayerInRangeOfPoint(playerid, 10,SBizzInfo[sbEntranceX], SBizzInfo[sbEntranceY], SBizzInfo[sbEntranceZ]))
            {
                //printf("Found House :%d",i);
                for(new l = PlayerHaul[tmpcar][pLoad]; l > 0; l--)
                {
                    if(SBizzInfo[sbProducts] == SBizzInfo[sbMaxProducts])
                    {
                        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/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                        return 1;
                    }
                    if(SBizzInfo[sbPriceProd] > SBizzInfo[sbTill])
                    {
                        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/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                        return 1;
                    }
                    PlayerHaul[tmpcar][pLoad]--;
                    SBizzInfo[sbProducts]++;
                    cashmade = cashmade+SBizzInfo[sbPriceProd];
                    //ConsumingMoney[playerid] = 1;
                    SafeGivePlayerMoney(playerid,SBizzInfo[sbPriceProd]);
                    SBizzInfo[sbTill] -= SBizzInfo[sbPriceProd];
                    if(PlayerHaul[tmpcar][pLoad] == 0)
                    {
                        GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
                        format(string, sizeof(string), "Cash Earned $%d.", cashmade);
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                        format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                        return 1;
                    }
                }
                OnPropUpdate(3,i);
                return 1;
            }
        }
        GameTextForPlayer(playerid, "~r~To Far From A Business", 5000, 1);
        return 1;
    }

Imagini / Video (optional):-
Ati incercat sa rezolvati singur?: la /loadprods nu era asa si am modificat cum se vede sus dar tot nu merge


    if(strcmp(cmd, "/loadprod", 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/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
        }
        return 1;
    }
Edited by Sealand123
Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0

Intra pe server, mergi la masinile de la job-ul trucker si scrie comanda /dl , uita-te la id-ul lor apoi in gamemode la public OnGamemodeInit cauta liniile de genul 

PlayerHaul[218][pCapasity] = 250;
PlayerHaul[219][pCapasity] = 250;
PlayerHaul[220][pCapasity] = 250;

Apoi cauta linia :

new PlayerHaul[250][pHaul];
si in loc din numarul de paranteza treci id-ul de la ultima masina de job trucker + 1 , de exemplu, daca ultimul id era 300 tu treci in paranteza 301 .

 

P.S : Numarul din paranteza e trecut la mine in gamemode, la tine probabil e altul, asa ca-ti recomand sa cauti doar

new PlayerHaul[
Edited by NoNamed
  • Upvote 2
Link to comment
Share on other sites

  • 0

nu am decat strcmd

 

am cautat ctrl F  "#include"

si asta e tot

#include <a_samp>
#include <core>
#include <float>
#include <time>
#include <file>
#include <utils>
#include <morphinc>
#include <a_npc>
#include <streamer>
#include <Dini>
#include <dutils>

 

si mai sunt niste chestii paramas

#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
dcmd_ips(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
    {
        if(!strlen(params))
            return SendClientMessage(playerid, COLOR_GREY, "USAGE: /ips [playerid]");

        new player1, playername[MAX_PLAYER_NAME], str[128];
        player1 = strval(params);

        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
        {
            GetPlayerName(player1, playername, sizeof(playername));
            format(str,sizeof(str),"IPs Used for %s (%d) are: %s", playername, player1, dini_Get("LARP/Users/Aliases/ips.txt",playername) );
            return SendClientMessage(playerid,COLOR_GREY,str);
        }
        else return SendClientMessage(playerid, COLOR_GREY, "* Player is not connected or is yourself");
    }
    else return SendClientMessage(playerid,COLOR_GREY,"* ERROR: You are not a high enough level to use this command");
}

dar nu stiu de ce sunt

 

Am pus la toate acea stea si bara " /*  */ " si tot asa face

Edited by Sealand123
Link to comment
Share on other sites

  • 0

Asta fiindca nu ai procesor pe dcmd,ai doar pe strcmp dupa cum ai spus.In filterscripts ai ceva comenzi cu DCMD ZCMD sau alt procesor inafara de strcmp?

if(strcmp(cmd, "/ips", true) == 0)
{
  if(PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
  {
    if(!strlen(params))
      return SendClientMessage(playerid, COLOR_GREY, "USAGE: /ips [playerid]");

    new player1, playername[MAX_PLAYER_NAME], str[128];
    player1 = strval(params);

    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
    {
      GetPlayerName(player1, playername, sizeof(playername));
      format(str,sizeof(str),"IPs Used for %s (%d) are: %s", playername, player1, dini_Get("LARP/Users/Aliases/ips.txt",playername) );
      return SendClientMessage(playerid,COLOR_GREY,str);
    }
    else return SendClientMessage(playerid, COLOR_GREY, "* Player is not connected or is yourself");
  }
  else return SendClientMessage(playerid,COLOR_GREY,"* ERROR: You are not a high enough level to use this command");
}
Edited by Adrian_Petre

 

 

Link to comment
Share on other sites

  • 0

Salut, Sealand asta ai la onplayercommand text, nu?

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(xgoto, 5, cmdtext);
    dcmd(gpsfind, 7, cmdtext);
    dcmd(attach,6,cmdtext);
    dcmd(unattach,8,cmdtext);
    dcmd(acheckcode,10,cmdtext);
    dcmd(alias,5,cmdtext);
    dcmd(ips,3,cmdtext);
    dcmd(getips,6,cmdtext);
    dcmd(getaliases,10,cmdtext);
    dcmd(unban,5,cmdtext);
    dcmd(saveeverything,14,cmdtext);
    new string[512 char];
    new playermoney;
    new sendername[MAX_PLAYER_NAME];
    new giveplayer[MAX_PLAYER_NAME];
    new playername[MAX_PLAYER_NAME];
     new cmd[128];
    new tmp[128];
    new dancestyle;
    new giveplayerid, moneys, idx;
    new idcar = GetPlayerVehicleID(playerid);
    new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
    cmd = strtok(cmdtext, idx);
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new y5, m5, d5;
    new h5,mi5,s5;
    getdate(y5,m5,d5);
    gettime(h5,mi5,s5);
    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> %s",d5,m5,y5,h5,mi5,s5,sendername,cmdtext);
    AllCommandLog(string);

    if(PlayerInfo[playerid][pAdmin] == 0) Commands[playerid] ++;
    if(Commands[playerid] >= 1)
    {
        KillTimer(CommandsTimer[playerid]);
        CommandsTimer[playerid] = SetTimerEx("ResetCommands",1500,false,"i",playerid);
    }
    if(Commands[playerid] == 5) SendClientMessage(playerid, COLOR_LIGHTBLUE,"* Slow it down or you will be kicked!");
    if(Commands[playerid] == 10)
    {

Daca da atunci sterge  acele dcmd(xgoto, 5, cmdtext); si incearca.

Edited by Selby
Link to comment
Share on other sites

  • 0

Tot nu merge

public OnPlayerCommandText(playerid, cmdtext[])
{
//    dcmd(xgoto, 5, cmdtext);
  //  dcmd(gpsfind, 7, cmdtext);
//  dcmd(getips,6,cmdtext);
  //dcmd(unattach,8,cmdtext);
//    dcmd(acheckcode,10,cmdtext);
//    dcmd(alias,5,cmdtext);
//    dcmd(ips,3,cmdtext);
//  dcmd(attach,6,cmdtext);

//    dcmd(getaliases,10,cmdtext);
//    dcmd(unban,5,cmdtext);
//    dcmd(saveeverything,14,cmdtext);
    new string[512 char];

 

Link to comment
Share on other sites

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.