PDA

View Full Version : Error in business system.


Dorlevi1506
13/11/2013, 03:18 PM
Hello guys.
I tried to make Business system with this tutorial: http://forum.sa-mp.com/showthread.php?t=349466
And it doesn't working.. the code i make is here : http://pastebin.com/uS59Jtsw
Picture of the error: http://img541.imageshack.us/img541/9347/0cvk.png
Someone can try help me fix it? its say the error in line 40-72.
Please help me..

Avi Raj
13/11/2013, 03:23 PM
Without seeing error, we can't Help you.
Show us what error are you getting.

Dorlevi1506
13/11/2013, 03:33 PM
Without seeing error, we can't Help you.
Show us what error are you getting.

I upload the error : http://img541.imageshack.us/img541/9347/0cvk.png
Can you help me to fix it? its in line 40 - 43

Konstantinos
13/11/2013, 04:36 PM
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:

new InsideBiz;[MAX_PLAYERS]


but:

new InsideBiz[MAX_PLAYERS];


and not:

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:

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.

Dorlevi1506
13/11/2013, 05:06 PM
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:

new InsideBiz;[MAX_PLAYERS]


but:

new InsideBiz[MAX_PLAYERS];


and not:

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:

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 .. : http://img819.imageshack.us/img819/929/izk6.png
You have skype or something you can help me with that?

Konstantinos
13/11/2013, 05:07 PM
Replace:

new str[40];

to:

new szStr[40];


and replace str to szStr to the rest of the code (if it was used anywhere) as well.

Dorlevi1506
13/11/2013, 05:17 PM
Replace:

new str[40];

to:

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.. http://img826.imageshack.us/img826/3646/z65s.png

Konstantinos
13/11/2013, 05:22 PM
Wow really thanks bro but now i got more 5 errors.. http://img826.imageshack.us/img826/3646/z65s.png


[..]
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.

Dorlevi1506
13/11/2013, 05:27 PM
Using them outside of any callback will result in those errors.

So i cant fix it?

Konstantinos
13/11/2013, 05:30 PM
So i cant fix it?

Read the tutorial again, buddy. It says where you should add the code:


You will need this under public OnGameModeInit():
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():
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.
}

Dorlevi1506
13/11/2013, 05:36 PM
Read the tutorial again, buddy. It says where you should add the code:

I dont find the Ongamemodeinit.. i didn't use it on my GM i used it in filterscript.

Danialdano
13/11/2013, 05:38 PM
Then you put it under OnFilterscriptInit.

Konstantinos
13/11/2013, 05:40 PM
Then use OnFilterScriptInit instead of OnGameModeInit and OnFilterScriptExit instead of OnGameModeExit.

Dorlevi1506
13/11/2013, 05:55 PM
Then use OnFilterScriptInit instead of OnGameModeInit and OnFilterScriptExit instead of OnGameModeExit.

I make this code and now its give me 4 errors : http://img163.imageshack.us/img163/9294/6xen.png

public OnFilterScriptInit()
{
new szStr[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 );
BusinessInfo[idx][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bEntranceX], BusinessInfo[idx][bEntranceY], BusinessInfo[idx][bEntranceZ], BusinessInfo[idx][bWorld]);
BusinessInfo[idx][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bExitX], BusinessInfo[idx][bExitY], BusinessInfo[idx][bExitZ], BusinessInfo[idx][bInsideWorld]);
}
public OnFilterScriptExit()
{
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.
}

Konstantinos
13/11/2013, 05:59 PM
Remember I told you to replace any 'str' to 'szStr' to avoid gettings the warnings from the YSI library? You need to replace it and you never close those callbacks.


public OnFilterScriptInit()
{
new szStr[40];
for(new idx =1 ; idx < sizeof(BusinessInfo); idx++)//Creates a loop, that goes through all of the businesses.
{
format(szStr, sizeof(szStr), BPATH, idx);//formats the file path, with the biz ID
INI_ParseFile(szStr, "loadbiz_%s", .bExtra = true, .extra = idx );
BusinessInfo[idx][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bEntranceX], BusinessInfo[idx][bEntranceY], BusinessInfo[idx][bEntranceZ], BusinessInfo[idx][bWorld]);
BusinessInfo[idx][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bExitX], BusinessInfo[idx][bExitY], BusinessInfo[idx][bExitZ], BusinessInfo[idx][bInsideWorld]);
}
return 1;
}

public OnFilterScriptExit()
{
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.
}
return 1;
}

Dorlevi1506
13/11/2013, 06:04 PM
Remember I told you to replace any 'str' to 'szStr' to avoid gettings the warnings from the YSI library? You need to replace it and you never close those callbacks.


public OnFilterScriptInit()
{
new szStr[40];
for(new idx =1 ; idx < sizeof(BusinessInfo); idx++)//Creates a loop, that goes through all of the businesses.
{
format(szStr, sizeof(szStr), BPATH, idx);//formats the file path, with the biz ID
INI_ParseFile(szStr, "loadbiz_%s", .bExtra = true, .extra = idx );
BusinessInfo[idx][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bEntranceX], BusinessInfo[idx][bEntranceY], BusinessInfo[idx][bEntranceZ], BusinessInfo[idx][bWorld]);
BusinessInfo[idx][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bExitX], BusinessInfo[idx][bExitY], BusinessInfo[idx][bExitZ], BusinessInfo[idx][bInsideWorld]);
}
return 1;
}

public OnFilterScriptExit()
{
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.
}
return 1;
}


Im already tried but its give me 13 errors : http://img826.imageshack.us/img826/9396/mp65.png
So what to do?

Konstantinos
13/11/2013, 06:07 PM
You need to include streamer and sscanf.


#include <a_samp>
#include <YSI\y_commands>
#include <YSI\y_ini>
#include <sscanf>
#include <streamer>


And of course to get streamer plugin file and include file. Same for the sscanf plugin file and sscanf2 include file.

* Include files into pawno\include folder.

You'll also need an enum and an array for PlayerInfo, the user wrote the tutorial said that:

Put this under your PlayerInfo enum:
BizID// You'll also have to save this, and load this..I expect you know how to do this.

Dorlevi1506
13/11/2013, 06:14 PM
You need to include streamer and sscanf.


#include <a_samp>
#include <YSI\y_commands>
#include <YSI\y_ini>
#include <sscanf>
#include <streamer>


And of course to get streamer plugin file and include file. Same for the sscanf plugin file and sscanf2 include file.

* Include files into pawno\include folder.

You'll also need an enum and an array for PlayerInfo.

Yeah but its still with 4 errors. : http://img801.imageshack.us/img801/2610/ssjz.png

Line of the errors
line - 300-307

YCMD:lockbiz(playerid, params[])
{
new id = IsPlayerNearBizEnt(playerid);//Uses the function to find if player is near a biz!
if(id != PlayerInfo[playerid][BizID]) return SCM(playerid, COLOR_GREY, "This isn't your biz!");
if(BusinessInfo[id][bLocked] == 1)
{
BusinessInfo[id][bLocked] = 0;
GameTextForPlayer(playerid, "Biz ~g~unlocked!", 3000, 3);
}


Line 223

YCMD:deletebiz(playerid, params[])
{


Line - 147

YCMD:createbiz(playerid, params[])
{

Konstantinos
13/11/2013, 06:19 PM
Change:

(playerid, params[])

to:

(playerid, params[], help)


You also didn't create the PlayerInfo like we said. Because I didn't read the tutorial I told you to declare it as:

new BizID;

Remove it and replace it with:

enum Player_Enum
{
BizID,
Money,
Skin
};

new PlayerInfo[MAX_PLAYERS][Player_Enum];


Reset those variables in OnPlayerConnect.

Dorlevi1506
13/11/2013, 06:27 PM
Change:

(playerid, params[])

to:

(playerid, params[], help)


You also didn't create the PlayerInfo like we said. Because I didn't read the tutorial I told you to declare it as:

new BizID;

Remove it and replace it with:

enum Player_Enum
{
BizID,
Money,
Skin
};

new PlayerInfo[MAX_PLAYERS][Player_Enum];


Reset those variables in OnPlayerConnect.

Wow dude really thanks, now i got one error! : http://img845.imageshack.us/img845/3796/osgy.png

Line - 25-35

#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_RED 0xAA3333AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_BLACK 0x000001FF
#define COLOR_BLUE 0x007BD0FF
#define COLOR_LIGHTORANGE 0xFFA100FF
#define COLOR_FLASH 0xFF000080

Konstantinos
13/11/2013, 06:35 PM
sscanf is already defined. Make sure you do not include sscanf more than once or you used the stock function of it (an old one - not recommended). What are your includes?

Dorlevi1506
13/11/2013, 06:40 PM
sscanf is already defined. Make sure you do not include sscanf more than once or you used the stock function of it (an old one - not recommended). What are your includes?

I got on my include folder :
http://img823.imageshack.us/img823/5126/h2oe.png

How can i check the version?

Konstantinos
13/11/2013, 06:46 PM
Remove that sscanf.inc file and keep only sscanf2.inc

I also meant if you did not include sscanf more than once in the script and the includes of the script, not in include folders.

Dorlevi1506
13/11/2013, 06:48 PM
Remove that sscanf.inc file and keep only sscanf2.inc

I also meant if you did not include sscanf more than once in the script and the includes of the script, not in include folders.


#include <a_samp>
#include <YSI\y_commands>
#include <YSI\y_ini>
#include <sscanf>
#include <streamer>
#include <sscanf2>


This what i use in the script.

Konstantinos
13/11/2013, 06:50 PM
#include <a_samp>
#include <YSI\y_commands>
#include <YSI\y_ini>
#include <sscanf>
#include <streamer>
#include <sscanf2>


This what i use in the script.

You include sscanf twice. The first one (sscanf.inc) is the old so remove it from the pawno\include folder completely (not to get confused with it).

And replace to:

#include <a_samp>
#include <YSI\y_commands>
#include <YSI\y_ini>
#include <sscanf2>
#include <streamer>

Dorlevi1506
13/11/2013, 06:53 PM
You include sscanf twice. The first one (sscanf.inc) is the old so remove it from the pawno\include folder completely (not to get confused with it).

And replace to:

#include <a_samp>
#include <YSI\y_commands>
#include <YSI\y_ini>
#include <sscanf2>
#include <streamer>


I did.
And now i got warning and one error : http://img11.imageshack.us/img11/2800/aas8.png

Line of the error :

BusinessInfo[id][bLocked] = 0;
BusinessInfo[id][bOwned] = 1;
BusinessInfo[id][bOwner] = RemoveUnderScore(playerid);

SendClientMessage(playerid, COLOR_YELLOW, "Congratulations on your new biz! Use /bizhelp to get help, or /ask!");
return 1;

Konstantinos
13/11/2013, 07:03 PM
Add this at the bottom (the fault is by the one who wrote the tutorial..):

stock RemoveUnderScore(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}

To the commands you do not use help or params at all, use #pragma unused.

For example, there's a command that you don't use help.

YCMD:announce(playerid, params[], help)
{
#pragma unused help
if(!isnull(params)) GameTextForAll(params, 2500, 4);
return 1;
}


If you don't use params too, then use: #pragma unused params

Dorlevi1506
13/11/2013, 07:07 PM
Add this at the bottom (the fault is by the one who wrote the tutorial..):

stock RemoveUnderScore(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}

To the commands you do not use help or params at all, use #pragma unused.

For example, there's a command that you don't use help.

YCMD:announce(playerid, params[], help)
{
#pragma unused help
if(!isnull(params)) GameTextForAll(params, 2500, 4);
return 1;
}


If you don't use params too, then use: #pragma unused params

You mean like that?

YCMD:announce(playerid, params[], help)
{
#pragma unused help
#pragma unused params
if(!isnull(params)) GameTextForAll(params, 2500, 4);
return 1;
}


and i didnt understand what you said about

stock RemoveUnderScore(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}

Konstantinos
13/11/2013, 07:11 PM
Kind of, but the command is wrong because you use params in the isnull check. A better example would be:


YCMD:testme(playerid, params[], help)
{
#pragma unused help
#pragma unused params
SendClientMessage(playerid, -1, "The command works!");
return 1;
}


Neither params, nor help is used.


Just paste that stock about RemoveUnderScore at the bottom of the script.

Dorlevi1506
13/11/2013, 07:16 PM
Kind of, but the command is wrong because you use params in the isnull check. A better example would be:


YCMD:testme(playerid, params[], help)
{
#pragma unused help
#pragma unused params
SendClientMessage(playerid, -1, "The command works!");
return 1;
}


Neither params, nor help is used.


Just paste that stock about RemoveUnderScore at the bottom of the script.

That working .
Now about the error, i dont understand how to fix it.. http://img46.imageshack.us/img46/5080/1c86.png
can you fix the lines and send me please?
Also im admin and i cant create biz


YCMD:buybiz(playerid, params[], help)
{
#pragma unused help
#pragma unused params
new id = IsPlayerNearBizEnt(playerid);

if(id == -1 || id == 0) return SendClientMessage(playerid, COLOR_GREY, "You are not near a biz");

if(BusinessInfo[id][bOwned] != 0 || BusinessInfo[id][bPrice] == 0) return SendClientMessage(playerid, COLOR_GREY, "This biz is not for sale.");

if(PlayerInfo[playerid][BizID] != 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You already own a biz.");

if(PlayerInfo[playerid][Money] < BusinessInfo[id][bPrice]) return SendClientMessage(playerid, COLOR_LIGHTRED, "Sorry, you can not afford this biz.");

PlayerInfo[playerid][BizID] = id;
PlayerInfo[playerid][Money] -= BusinessInfo[id][bPrice];
GivePlayerMoney(playerid, -BusinessInfo[id][bPrice]);

BusinessInfo[id][bLocked] = 0;
BusinessInfo[id][bOwned] = 1;
BusinessInfo[id][bOwner] = RemoveUnderScore(playerid);

SendClientMessage(playerid, COLOR_YELLOW, "Congratulations on your new biz! Use /bizhelp to get help, or /ask!");
return 1;
}

Konstantinos
13/11/2013, 07:23 PM
Paste this:

stock RemoveUnderScore(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}


at the bottom of the script.

Dorlevi1506
13/11/2013, 07:48 PM
Paste this:

stock RemoveUnderScore(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}


at the bottom of the script.

Thank you bro really thanks its working not errors but the admin commands of biz dont working for admin.
Like /createbiz it's a roleplay script, in my GM its work like this : if (PlayerInfo[playerid][pAdmin] >= 1)

YCMD:createbiz(playerid, params[], help)
{
#pragma unused help
#pragma unused params
if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_GREY, "You aren't authorized to use this command!");//Checks if player is a RCON admin..Change this with your admin system.

new price, level, id, int, world, string[128], Float:Xi, Float:Yi, Float:Zi, inti;//All the new defines we will need.
if(sscanf(params, "dddfff", price, level, inti, Xi, Yi, Zi)) return SendClientMessage(playerid, COLOR_GREY, "YCMD: /createbiz [price] [type] [interior] [X] [Y] [Z]");//d stands for integer, f stands for float.

if(level < 0 || level > 4) return SendClientMessage(playerid, COLOR_GREY, "YCMD: Type cannot go below 0, or above 10.");//

if(price < 10000) return SendClientMessage(playerid, COLOR_GREY, "YCMD: Price cannot go below $10,000.");// Check if the price is below 1000, if it is it will return a message saying it.

for(new h = 1;h < sizeof(BusinessInfo);h++)//Loops through all the businesses
{
if(BusinessInfo[h][bPrice] == 0)//Checks if the price of a business is 0.
{
id = h;
break;//It stops looping if it is.
}
}
new Float:X,Float:Y,Float:Z,Float:A;//More new defines.
GetPlayerPos(playerid, X, Y, Z);//Gets your player position, and saves it into floats.
GetPlayerFacingAngle(playerid, A);//Gets your facing angle, and saves it into a float.
int = GetPlayerInterior(playerid);//Gets your interior, and saves it into a integer.
world = GetPlayerVirtualWorld(playerid);//Gets your Virtual World, and saves it into a integer
BusinessInfo[id][bInsideInt] = inti;
BusinessInfo[id][bExitX] = Xi;
BusinessInfo[id][bExitY] = Yi;
BusinessInfo[id][bExitZ] = Zi;

BusinessInfo[id][bOwned] = 0;
BusinessInfo[id][bPrice] = price;
BusinessInfo[id][bType] = level;
BusinessInfo[id][bEntranceX] = X;
BusinessInfo[id][bEntranceY] = Y;
BusinessInfo[id][bEntranceZ] = Z;
BusinessInfo[id][bEntranceA] = A;
BusinessInfo[id][bLocked] = 1;

BusinessInfo[id][bInt] =int;
BusinessInfo[id][bWorld] =world;
BusinessInfo[id][bInsideWorld] =id;

format(string, sizeof(string), "None");
strmid(BusinessInfo[id][bName], string, 0, strlen(string), 255);

if(BusinessInfo[id][bOutsideIcon]) DestroyDynamicPickup(BusinessInfo[id][bOutsideIcon]);
if(BusinessInfo[id][bInsideIcon]) DestroyDynamicPickup(BusinessInfo[id][bInsideIcon]);
BusinessInfo[id][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[id][bEntranceX], BusinessInfo[id][bEntranceY], BusinessInfo[id][bEntranceZ], BusinessInfo[id][bWorld]);//Creates a pickup at your location
BusinessInfo[id][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[id][bExitX], BusinessInfo[id][bExitY], BusinessInfo[id][bExitZ], BusinessInfo[id][bInsideWorld]);//Creates a pickup at your location
new file4[40];
format(file4, sizeof(file4), BPATH, id);
new INI:File = INI_Open(file4);
INI_SetTag(File,"data");
INI_WriteInt(File,"bOwned", BusinessInfo[id][bOwned]);
INI_WriteInt(File,"bPrice", BusinessInfo[id][bPrice]);
INI_WriteString(File,"bOwner", BusinessInfo[id][bOwner]);
INI_WriteInt(File,"bType", BusinessInfo[id][bType]);
INI_WriteInt(File,"bLocked", BusinessInfo[id][bLocked]);
INI_WriteInt(File,"bMoney", BusinessInfo[id][bMoney]);
INI_WriteFloat(File,"bEntranceX", BusinessInfo[id][bEntranceX]);
INI_WriteFloat(File,"bEntranceY", BusinessInfo[id][bEntranceY]);
INI_WriteFloat(File,"bEntranceZ", BusinessInfo[id][bEntranceZ]);
INI_WriteFloat(File,"bEntranceA", BusinessInfo[id][bEntranceA]);
INI_WriteFloat(File,"bExitX", BusinessInfo[id][bExitX]);
INI_WriteFloat(File,"bExitY", BusinessInfo[id][bExitY]);
INI_WriteFloat(File,"bExitZ", BusinessInfo[id][bExitZ]);
INI_WriteFloat(File,"bExitA", BusinessInfo[id][bExitA]);
INI_WriteInt(File,"bInt", BusinessInfo[id][bInt]);
INI_WriteInt(File,"bWorld", BusinessInfo[id][bWorld]);
INI_WriteInt(File,"bInsideInt", BusinessInfo[id][bInsideInt]);
INI_WriteInt(File,"bInsideWorld", BusinessInfo[id][bInsideWorld]);
INI_WriteString(File,"bName", BusinessInfo[id][bName]);
INI_Close(File);
return 1;
}

Konstantinos
13/11/2013, 08:37 PM
You cannot have into your gamemode:

PlayerInfo[playerid][pAdmin]

and read the admin level from the filterscript like that. The only thing you can do is using PVar for the admin level so the two modes can "communicate" each other.

Also #pragma unused is for those symbols are never used and in the command you posted, only help is not used. As you can see 4 lines after this: #pragma unused params
you used the params:

if(sscanf(params, "dddfff", price, level, inti, Xi, Yi, Zi))


So keep only:

#pragma unused help

Dorlevi1506
14/11/2013, 03:44 AM
You cannot have into your gamemode:

PlayerInfo[playerid][pAdmin]

and read the admin level from the filterscript like that. The only thing you can do is using PVar for the admin level so the two modes can "communicate" each other.

Also #pragma unused is for those symbols are never used and in the command you posted, only help is not used. As you can see 4 lines after this: #pragma unused params
you used the params:

if(sscanf(params, "dddfff", price, level, inti, Xi, Yi, Zi))


So keep only:

#pragma unused help


So you mean i need use just the "#pragma unused help" in the commands?


YCMD:createbiz(playerid, params[], help)
{
#pragma unused help
if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_GREY, "You aren't authorized to use this command!");//Checks if player is a RCON admin..Change this with your admin system.

new price, level, id, int, world, string[128], Float:Xi, Float:Yi, Float:Zi, inti;//All the new defines we will need.
if(sscanf(params, "dddfff", price, level, inti, Xi, Yi, Zi)) return SendClientMessage(playerid, COLOR_GREY, "YCMD: /createbiz [price] [type] [interior] [X] [Y] [Z]");//d stands for integer, f stands for float.

if(level < 0 || level > 4) return SendClientMessage(playerid, COLOR_GREY, "YCMD: Type cannot go below 0, or above 10.");//

if(price < 10000) return SendClientMessage(playerid, COLOR_GREY, "YCMD: Price cannot go below $10,000.");// Check if the price is below 1000, if it is it will return a message saying it.

for(new h = 1;h < sizeof(BusinessInfo);h++)//Loops through all the businesses
{
if(BusinessInfo[h][bPrice] == 0)//Checks if the price of a business is 0.
{
id = h;
break;//It stops looping if it is.
}
}
new Float:X,Float:Y,Float:Z,Float:A;//More new defines.
GetPlayerPos(playerid, X, Y, Z);//Gets your player position, and saves it into floats.
GetPlayerFacingAngle(playerid, A);//Gets your facing angle, and saves it into a float.
int = GetPlayerInterior(playerid);//Gets your interior, and saves it into a integer.
world = GetPlayerVirtualWorld(playerid);//Gets your Virtual World, and saves it into a integer
BusinessInfo[id][bInsideInt] = inti;
BusinessInfo[id][bExitX] = Xi;
BusinessInfo[id][bExitY] = Yi;
BusinessInfo[id][bExitZ] = Zi;

BusinessInfo[id][bOwned] = 0;
BusinessInfo[id][bPrice] = price;
BusinessInfo[id][bType] = level;
BusinessInfo[id][bEntranceX] = X;
BusinessInfo[id][bEntranceY] = Y;
BusinessInfo[id][bEntranceZ] = Z;
BusinessInfo[id][bEntranceA] = A;
BusinessInfo[id][bLocked] = 1;

BusinessInfo[id][bInt] =int;
BusinessInfo[id][bWorld] =world;
BusinessInfo[id][bInsideWorld] =id;

format(string, sizeof(string), "None");
strmid(BusinessInfo[id][bName], string, 0, strlen(string), 255);

if(BusinessInfo[id][bOutsideIcon]) DestroyDynamicPickup(BusinessInfo[id][bOutsideIcon]);
if(BusinessInfo[id][bInsideIcon]) DestroyDynamicPickup(BusinessInfo[id][bInsideIcon]);
BusinessInfo[id][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[id][bEntranceX], BusinessInfo[id][bEntranceY], BusinessInfo[id][bEntranceZ], BusinessInfo[id][bWorld]);//Creates a pickup at your location
BusinessInfo[id][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[id][bExitX], BusinessInfo[id][bExitY], BusinessInfo[id][bExitZ], BusinessInfo[id][bInsideWorld]);//Creates a pickup at your location
new file4[40];
format(file4, sizeof(file4), BPATH, id);
new INI:File = INI_Open(file4);
INI_SetTag(File,"data");
INI_WriteInt(File,"bOwned", BusinessInfo[id][bOwned]);
INI_WriteInt(File,"bPrice", BusinessInfo[id][bPrice]);
INI_WriteString(File,"bOwner", BusinessInfo[id][bOwner]);
INI_WriteInt(File,"bType", BusinessInfo[id][bType]);
INI_WriteInt(File,"bLocked", BusinessInfo[id][bLocked]);
INI_WriteInt(File,"bMoney", BusinessInfo[id][bMoney]);
INI_WriteFloat(File,"bEntranceX", BusinessInfo[id][bEntranceX]);
INI_WriteFloat(File,"bEntranceY", BusinessInfo[id][bEntranceY]);
INI_WriteFloat(File,"bEntranceZ", BusinessInfo[id][bEntranceZ]);
INI_WriteFloat(File,"bEntranceA", BusinessInfo[id][bEntranceA]);
INI_WriteFloat(File,"bExitX", BusinessInfo[id][bExitX]);
INI_WriteFloat(File,"bExitY", BusinessInfo[id][bExitY]);
INI_WriteFloat(File,"bExitZ", BusinessInfo[id][bExitZ]);
INI_WriteFloat(File,"bExitA", BusinessInfo[id][bExitA]);
INI_WriteInt(File,"bInt", BusinessInfo[id][bInt]);
INI_WriteInt(File,"bWorld", BusinessInfo[id][bWorld]);
INI_WriteInt(File,"bInsideInt", BusinessInfo[id][bInsideInt]);
INI_WriteInt(File,"bInsideWorld", BusinessInfo[id][bInsideWorld]);
INI_WriteString(File,"bName", BusinessInfo[id][bName]);
INI_Close(File);
return 1;
}

Konstantinos
14/11/2013, 09:35 AM
The command has parameters: playerid, params, help.

The parameter is not used at all in a command will give the warning that the symbol is never used "".

So let's take a look at the code inside /createbiz command:

playerid is used:

if(!IsPlayerAdmin(playerid))


and in other lines as well.

params is used:

if(sscanf(params, "dddfff", price, level, inti, Xi, Yi, Zi))

and help is not used, you cannot find it anywhere so the conclusion is that help is not used therebefore:

#pragma unused help


If the command does not use params at all, then do the same thing for params (using #pragma unused).

Dorlevi1506
14/11/2013, 09:51 AM
The command has parameters: playerid, params, help.

The parameter is not used at all in a command will give the warning that the symbol is never used "".

So let's take a look at the code inside /createbiz command:

playerid is used:

if(!IsPlayerAdmin(playerid))


and in other lines as well.

params is used:

if(sscanf(params, "dddfff", price, level, inti, Xi, Yi, Zi))

and help is not used, you cannot find it anywhere so the conclusion is that help is not used therebefore:

#pragma unused help


If the command does not use params at all, then do the same thing for params (using #pragma unused).

Im sorry, i didnt understand what to do..
What to change? how to make this command for admin i delete #pragma unused params

Konstantinos
14/11/2013, 10:02 AM
I explained it as simple as I could, one last try.


YCMD:cmds(playerid, params[], help)
{
// code..
return 1;
}


You see the part "// code.."? The code of the command exists there. If you find "params" in that, then it uses params and you do NOT use "#pragma unused params". If you find "help" in that, then it uses help and you do NOT use "#pragma unused help".

The symbol you will not find in the code, you'll need to use #pragma unused symbol_name_here

---

If you still get confused, then do not use the pragma at all and compile. The one will give you warning about symbol is never used "params" or "help", add the #pragma unused symbol_name_here in the line the compiler gives.

Dorlevi1506
14/11/2013, 10:14 AM
I explained it as simple as I could, one last try.


YCMD:cmds(playerid, params[], help)
{
// code..
return 1;
}


You see the part "// code.."? The code of the command exists there. If you find "params" in that, then it uses params and you do NOT use "#pragma unused params". If you find "help" in that, then it uses help and you do NOT use "#pragma unused help".

The symbol you will not find in the code, you'll need to use #pragma unused symbol_name_here

---

If you still get confused, then do not use the pragma at all and compile. The one will give you warning about symbol is never used "params" or "help", add the #pragma unused symbol_name_here in the line the compiler gives.


When i puts #pragma unused symbol_name_here like that :

YCMD:createbiz(playerid, params[], help)
{
#pragma unused help
#pragma unused symbol_name_here
if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_GREY, "You aren't authorized to use this command!");//Checks if player is a RCON admin..Change this with your admin system.

new price, level, id, int, world, string[128], Float:Xi, Float:Yi, Float:Zi, inti;//All the new defines we will need.
if(sscanf(params, "dddfff", price, level, inti, Xi, Yi, Zi)) return SendClientMessage(playerid, COLOR_GREY, "YCMD: /createbiz [price] [type] [interior] [X] [Y] [Z]");//d stands for integer, f stands for float.

if(level < 0 || level > 4) return SendClientMessage(playerid, COLOR_GREY, "YCMD: Type cannot go below 0, or above 10.");//

if(price < 10000) return SendClientMessage(playerid, COLOR_GREY, "YCMD: Price cannot go below $10,000.");// Check if the price is below 1000, if it is it will return a message saying it.

for(new h = 1;h < sizeof(BusinessInfo);h++)//Loops through all the businesses
{
if(BusinessInfo[h][bPrice] == 0)//Checks if the price of a business is 0.
{
id = h;
break;//It stops looping if it is.
}
}
new Float:X,Float:Y,Float:Z,Float:A;//More new defines.
GetPlayerPos(playerid, X, Y, Z);//Gets your player position, and saves it into floats.
GetPlayerFacingAngle(playerid, A);//Gets your facing angle, and saves it into a float.
int = GetPlayerInterior(playerid);//Gets your interior, and saves it into a integer.
world = GetPlayerVirtualWorld(playerid);//Gets your Virtual World, and saves it into a integer
BusinessInfo[id][bInsideInt] = inti;
BusinessInfo[id][bExitX] = Xi;
BusinessInfo[id][bExitY] = Yi;
BusinessInfo[id][bExitZ] = Zi;

BusinessInfo[id][bOwned] = 0;
BusinessInfo[id][bPrice] = price;
BusinessInfo[id][bType] = level;
BusinessInfo[id][bEntranceX] = X;
BusinessInfo[id][bEntranceY] = Y;
BusinessInfo[id][bEntranceZ] = Z;
BusinessInfo[id][bEntranceA] = A;
BusinessInfo[id][bLocked] = 1;

BusinessInfo[id][bInt] =int;
BusinessInfo[id][bWorld] =world;
BusinessInfo[id][bInsideWorld] =id;

format(string, sizeof(string), "None");
strmid(BusinessInfo[id][bName], string, 0, strlen(string), 255);

if(BusinessInfo[id][bOutsideIcon]) DestroyDynamicPickup(BusinessInfo[id][bOutsideIcon]);
if(BusinessInfo[id][bInsideIcon]) DestroyDynamicPickup(BusinessInfo[id][bInsideIcon]);
BusinessInfo[id][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[id][bEntranceX], BusinessInfo[id][bEntranceY], BusinessInfo[id][bEntranceZ], BusinessInfo[id][bWorld]);//Creates a pickup at your location
BusinessInfo[id][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[id][bExitX], BusinessInfo[id][bExitY], BusinessInfo[id][bExitZ], BusinessInfo[id][bInsideWorld]);//Creates a pickup at your location
new file4[40];
format(file4, sizeof(file4), BPATH, id);
new INI:File = INI_Open(file4);
INI_SetTag(File,"data");
INI_WriteInt(File,"bOwned", BusinessInfo[id][bOwned]);
INI_WriteInt(File,"bPrice", BusinessInfo[id][bPrice]);
INI_WriteString(File,"bOwner", BusinessInfo[id][bOwner]);
INI_WriteInt(File,"bType", BusinessInfo[id][bType]);
INI_WriteInt(File,"bLocked", BusinessInfo[id][bLocked]);
INI_WriteInt(File,"bMoney", BusinessInfo[id][bMoney]);
INI_WriteFloat(File,"bEntranceX", BusinessInfo[id][bEntranceX]);
INI_WriteFloat(File,"bEntranceY", BusinessInfo[id][bEntranceY]);
INI_WriteFloat(File,"bEntranceZ", BusinessInfo[id][bEntranceZ]);
INI_WriteFloat(File,"bEntranceA", BusinessInfo[id][bEntranceA]);
INI_WriteFloat(File,"bExitX", BusinessInfo[id][bExitX]);
INI_WriteFloat(File,"bExitY", BusinessInfo[id][bExitY]);
INI_WriteFloat(File,"bExitZ", BusinessInfo[id][bExitZ]);
INI_WriteFloat(File,"bExitA", BusinessInfo[id][bExitA]);
INI_WriteInt(File,"bInt", BusinessInfo[id][bInt]);
INI_WriteInt(File,"bWorld", BusinessInfo[id][bWorld]);
INI_WriteInt(File,"bInsideInt", BusinessInfo[id][bInsideInt]);
INI_WriteInt(File,"bInsideWorld", BusinessInfo[id][bInsideWorld]);
INI_WriteString(File,"bName", BusinessInfo[id][bName]);
INI_Close(File);
return 1;
}

It's give me error. can you edit the code and send me new replace?
Or maybe you got skype or Teamviewer and you can help me finish that?

Konstantinos
14/11/2013, 10:16 AM
It was self-explanatory that you need to replace the symbol_name_here with the name of the symbol..

Keep only: #pragma unused help to that command.

Dorlevi1506
14/11/2013, 10:18 AM
It was self-explanatory that you need to replace the symbol_name_here with the name of the symbol..

Keep only: #pragma unused help to that command.

I did, but its still dont working for admins.

Konstantinos
14/11/2013, 10:20 AM
I did, but its still dont working for admins.

The command is only for RCON admins.

Dorlevi1506
14/11/2013, 10:24 AM
The command is only for RCON admins.

Oh, thank you dude for helping :D
You are awesom.