Error in business system.
#1

Hello guys.
I tried to make Business system with this tutorial: https://sampforum.blast.hk/showthread.php?tid=349466
And it doesn't working.. the code i make is here : http://pastebin.com/uS59Jtsw
Picture of the error: /imageshack/img541/9347/0cvk.png
Someone can try help me fix it? its say the error in line 40-72.
Please help me..
Reply
#2

Without seeing error, we can't Help you.
Show us what error are you getting.
Reply
#3

Quote:
Originally Posted by Avi Raj
Посмотреть сообщение
Without seeing error, we can't Help you.
Show us what error are you getting.
I upload the error : /imageshack/img541/9347/0cvk.png
Can you help me to fix it? its in line 40 - 43
Reply
#4

pawn Код:
new InsideBiz;[MAX_PLAYERS]//This define will be used later to find out what business we are in.
enum bInfo {
    bOwned,
    bPrice,
    bOwner[MAX_PLAYER_NAME],
    bType,
    bLocked,
    bMoney,
    Float:bEntranceX,
    Float:bEntranceY,
    Float:bEntranceZ,
    Float:bEntranceA,
    Float:bExitX,
    Float:bExitY,
    Float:bExitZ,
    Float:bExitA,
    bInt,
    bWorld,
    bInsideInt,
    bInsideWorld,
    bInsideIcon,
    bOutsideIcon,
    bName[128]
}
new BusinessInfo[200][bInfo];//We are creating a define to use for our Enum.
BizID// You'll also have to save this, and load this..I expect you know how to do this.
 
new str[40];
    for(new idx = 1; idx < sizeof(BusinessInfo); idx++)//Creates a loop, that goes through all of the businesses.
    {
        format(str, sizeof(str), BPATH, idx);//formats the file path, with the biz ID
        INI_ParseFile(str, "loadbiz_%s", .bExtra = true, .extra = idx );//This is very hard to explain, but it basically loads the info from the file(More in ****** y_ini tutorial.)
        BusinessInfo[idx][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bEntranceX], BusinessInfo[idx][bEntranceY], BusinessInfo[idx][bEntranceZ], BusinessInfo[idx][bWorld]); //Creates a pickup at the business entrance.
        BusinessInfo[idx][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bExitX], BusinessInfo[idx][bExitY], BusinessInfo[idx][bExitZ], BusinessInfo[idx][bInsideWorld]); //Creates a pickup at the exit(Inside the interior)
    }
    for(new id = 1; id < sizeof(BusinessInfo); id++)//Loops through the businesses.
    {
        if(BusinessInfo[id][bPrice] == 0) break;//Breaks the loop if the price is 0(Meaning it doesn't exist)
        SaveBusiness(id);//Calls the SaveBusiness function.
    }
    forward SaveBusiness(id);
Don't add them wherever you find space in the editor but inside the appropriated callbacks.

Also, it's not:
pawn Код:
new InsideBiz;[MAX_PLAYERS]
but:
pawn Код:
new InsideBiz[MAX_PLAYERS];
and not:
pawn Код:
new BusinessInfo[200][bInfo];//We are creating a define to use for our Enum.
BizID// You'll also have to save this, and load this..I expect you know how to do this.
but:
pawn Код:
new BusinessInfo[200][bInfo];//We are creating a define to use for our Enum.
new BizID;// You'll also have to save this, and load this..I expect you know how to do this.
Add the rest inside the correct callback, it should say where in the tutorial or I guess it's self-explanatory.
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
new InsideBiz;[MAX_PLAYERS]//This define will be used later to find out what business we are in.
enum bInfo {
    bOwned,
    bPrice,
    bOwner[MAX_PLAYER_NAME],
    bType,
    bLocked,
    bMoney,
    Float:bEntranceX,
    Float:bEntranceY,
    Float:bEntranceZ,
    Float:bEntranceA,
    Float:bExitX,
    Float:bExitY,
    Float:bExitZ,
    Float:bExitA,
    bInt,
    bWorld,
    bInsideInt,
    bInsideWorld,
    bInsideIcon,
    bOutsideIcon,
    bName[128]
}
new BusinessInfo[200][bInfo];//We are creating a define to use for our Enum.
BizID// You'll also have to save this, and load this..I expect you know how to do this.
 
new str[40];
    for(new idx = 1; idx < sizeof(BusinessInfo); idx++)//Creates a loop, that goes through all of the businesses.
    {
        format(str, sizeof(str), BPATH, idx);//formats the file path, with the biz ID
        INI_ParseFile(str, "loadbiz_%s", .bExtra = true, .extra = idx );//This is very hard to explain, but it basically loads the info from the file(More in ****** y_ini tutorial.)
        BusinessInfo[idx][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bEntranceX], BusinessInfo[idx][bEntranceY], BusinessInfo[idx][bEntranceZ], BusinessInfo[idx][bWorld]); //Creates a pickup at the business entrance.
        BusinessInfo[idx][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bExitX], BusinessInfo[idx][bExitY], BusinessInfo[idx][bExitZ], BusinessInfo[idx][bInsideWorld]); //Creates a pickup at the exit(Inside the interior)
    }
    for(new id = 1; id < sizeof(BusinessInfo); id++)//Loops through the businesses.
    {
        if(BusinessInfo[id][bPrice] == 0) break;//Breaks the loop if the price is 0(Meaning it doesn't exist)
        SaveBusiness(id);//Calls the SaveBusiness function.
    }
    forward SaveBusiness(id);
Don't add them wherever you find space in the editor but inside the appropriated callbacks.

Also, it's not:
pawn Код:
new InsideBiz;[MAX_PLAYERS]
but:
pawn Код:
new InsideBiz[MAX_PLAYERS];
and not:
pawn Код:
new BusinessInfo[200][bInfo];//We are creating a define to use for our Enum.
BizID// You'll also have to save this, and load this..I expect you know how to do this.
but:
pawn Код:
new BusinessInfo[200][bInfo];//We are creating a define to use for our Enum.
new BizID;// You'll also have to save this, and load this..I expect you know how to do this.
Add the rest inside the correct callback, it should say where in the tutorial or I guess it's self-explanatory.
Thanks, it's fixed the line 41-42 but now i have more errors .. : /imageshack/img819/929/izk6.png
You have skype or something you can help me with that?
Reply
#6

Replace:
pawn Код:
new str[40];
to:
pawn Код:
new szStr[40];
and replace str to szStr to the rest of the code (if it was used anywhere) as well.
Reply
#7

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Replace:
pawn Код:
new str[40];
to:
pawn Код:
new szStr[40];
and replace str to szStr to the rest of the code (if it was used anywhere) as well.
Wow really thanks bro but now i got more 5 errors.. /imageshack/img826/3646/z65s.png
Reply
#8

Quote:
Originally Posted by Dorlevi1506
Посмотреть сообщение
Wow really thanks bro but now i got more 5 errors.. /imageshack/img826/3646/z65s.png
Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
[..]
Don't add them wherever you find space in the editor but inside the appropriated callbacks.
[..]
Add the rest inside the correct callback, it should say where in the tutorial or I guess it's self-explanatory.
Using them outside of any callback will result in those errors.
Reply
#9

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Using them outside of any callback will result in those errors.
So i cant fix it?
Reply
#10

Quote:
Originally Posted by Dorlevi1506
Посмотреть сообщение
So i cant fix it?
Read the tutorial again, buddy. It says where you should add the code:

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
You will need this under public OnGameModeInit():
pawn Код:
new str[40];
    for(new idx = 1; idx < sizeof(BusinessInfo); idx++)//Creates a loop, that goes through all of the businesses.
    {
        format(str, sizeof(str), BPATH, idx);//formats the file path, with the biz ID
        INI_ParseFile(str, "loadbiz_%s", .bExtra = true, .extra = idx );//This is very hard to explain, but it basically loads the info from the file(More in ****** y_ini tutorial.)
        BusinessInfo[idx][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bEntranceX], BusinessInfo[idx][bEntranceY], BusinessInfo[idx][bEntranceZ], BusinessInfo[idx][bWorld]); //Creates a pickup at the business entrance.
        BusinessInfo[idx][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bExitX], BusinessInfo[idx][bExitY], BusinessInfo[idx][bExitZ], BusinessInfo[idx][bInsideWorld]); //Creates a pickup at the exit(Inside the interior)
    }
You will need this under public OnGameModeExit():
pawn Код:
for(new id = 1; id < sizeof(BusinessInfo); id++)//Loops through the businesses.
    {
        if(BusinessInfo[id][bPrice] == 0) break;//Breaks the loop if the price is 0(Meaning it doesn't exist)
        SaveBusiness(id);//Calls the SaveBusiness function.
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)