SA-MP Forums Archive
Errors that are unjustified - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Errors that are unjustified (/showthread.php?tid=486129)



Errors that are unjustified - Lidor124 - 07.01.2014

Hi all i hope you can help me with these stupid errors:
when i add the command /createbiz errors are show up, but before i add the command /createbiz its compile perfectly
+REP for who success to help

Код:
C:\Users\Mor\Desktop\CGRP v1.03\gamemodes\CGRP.pwn(1383) : error 017: undefined symbol "BizInfo"
C:\Users\Mor\Desktop\CGRP v1.03\gamemodes\CGRP.pwn(1383) : warning 215: expression has no effect
C:\Users\Mor\Desktop\CGRP v1.03\gamemodes\CGRP.pwn(1383) : error 001: expected token: ";", but found "]"
C:\Users\Mor\Desktop\CGRP v1.03\gamemodes\CGRP.pwn(1383) : error 029: invalid expression, assumed zero
C:\Users\Mor\Desktop\CGRP v1.03\gamemodes\CGRP.pwn(1383) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
my enum:

Код:
enum BizInfo
{
	bType,
	bStatus,
	bOwner[32],
	Float:bX,
	Float:bY,
	Float:bZ,
	bPickup,
	bMoney,
	bProducts,
	Text3D:bText,
	bSold,
	bLevel,
	bPrice,
	bAP,
};
new BizInfo[MAX_BIZ][BizInfo];
line 1383:

Код:
stock RBT(bizid)
{
	new string[24];
	if(!BizInfo[bizid][bType]) format(string, sizeof(string), "None"); // line 1383
    else if(BizInfo[bizid][bType] == 1) format(string, sizeof(string), "24/7 Market");
    else if(BizInfo[bizid][bType] == 2) format(string, sizeof(string), "Clothes Shop");
    else if(BizInfo[bizid][bType] == 3) format(string, sizeof(string), "Ammunation");
    else if(BizInfo[bizid][bType] == 4) format(string, sizeof(string), "Club");
    //else if(BizInfo[bizid][bType] == 5) format(string, sizeof(string), "Advertisement Agency");
    else if(BizInfo[bizid][bType] == 5) format(string, sizeof(string), "Adv. Agency");
    else if(BizInfo[bizid][bType] == 6) format(string, sizeof(string), "Fast Food");
    else if(BizInfo[bizid][bType] == 7) format(string, sizeof(string), "Casino");
	return string;
}
/createbiz command:

Код:
CMD:createbiz(playerid, params[])
{
	new type, string[128];
    if(gPlayerLogged{playerid} == 0) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
	if(sscanf(params, "i", type))
	{
		SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createbiz [type]");
		SendClientMessage(playerid, COLOR_GREY, "TYPES: 1) 24/7 | 2) Clothes Shop | 3) Ammunation | 4) Club | 5) Advertisement Agency | 6) Fast Food | 7) Casino");
		return 1;
	}
	if(type < 1 || type > 7) return SendClientMessage(playerid, COLOR_GREY, "Businesses are between 1 and 7.");
	for(new idx=1; idx<MAX_BIZ; idx++)
	{
	    if(!BizInfo[idx][bType])
		{
//			g_bizRobber[idx] = -1;
		    // Getting Business Setup
		    new Float:X, Float:Y, Float:Z;
		    GetPlayerPos(playerid, X, Y, Z);
		    // Making Business
		    BizInfo[idx][bType] = type;
		    BizInfo[idx][bStatus] = 0;
		    format(BizInfo[idx][bOwner], 32, "The State");
		    BizInfo[idx][bX] = X;
		    BizInfo[idx][bY] = Y;
		    BizInfo[idx][bZ] = Z;
		    BizInfo[idx][bMoney] = 0;
		    BizInfo[idx][bProducts] = 0;
		    BizInfo[idx][bSold] = 0;
		    BizInfo[idx][bLevel] = 1;
		    BizInfo[idx][bPrice] = 1000000;
			BizInfo[idx][bPickup] = CreateDynamicPickup(1272, 1, X, Y, Z, 0);
			format(string, sizeof(string), ""CWE"Business of %s\nBusiness type: %s\nThis business is %s\nPrice: $%d, BizID: %d", BizInfo[idx][bOwner], RBT(idx), RBS(idx), BizInfo[idx][bPrice], idx);
			BizInfo[idx][bText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, X, Y, Z, 15);
			format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has created business ID %d.", GetPlayerNameEx(playerid), idx);
			ABroadCast(COLOR_DARKRED, string, 1);
			Log("logs/business.log", string);
			idx = MAX_BIZ;
		}
	}
	return 1;
}



Re: Errors that are unjustified - iJumbo - 07.01.2014

Use different names for array and enum


Re: Errors that are unjustified - offon - 07.01.2014

Could you specify which are 1382, 1383 and 1384 lines?


Re: Errors that are unjustified - Lidor124 - 07.01.2014

Quote:
Originally Posted by offon
Посмотреть сообщение
Could you specify which are 1382, 1383 and 1384 lines?
new string[24]; // 1382
if(!BizInfo[bizid][bType]) format(string, sizeof(string), "None"); // line 1383
else if(BizInfo[bizid][bType] == 1) format(string, sizeof(string), "24/7 Market"); // 1384


Re: Errors that are unjustified - Lidor124 - 07.01.2014

Quote:
Originally Posted by iJumbo
Посмотреть сообщение
Use different names for array and enum
I dont sure what to change, can you give me an example of name to change because i not sure to change enum and array will make a difference in the errors..


Re: Errors that are unjustified - offon - 07.01.2014

He means you should try to change new BizInfo[MAX_BIZ][BizInfo]; to something else.

TIP: Use the 'Replace' function in the Pawno editor to make things faster.


Re: Errors that are unjustified - PowerPC603 - 07.01.2014

You're specifying an array with name "BizInfo", which should use the enum "BizInfo".
This is confusing the compiler.
Rename your enum BitInfo to something else.

Since an enum is similar to a custom type (named this way in other programming languages), I prefer to use T as prefix for my enums (types, or custom types) and A for arrays.
So: enum "TBizInfo" and array "ABizInfo".
You can use your naming convention how you like, but don't create 2 different things with the same name.

Since the enum-name won't be used elsewhere, I suggest to rename the enum and leave the array name as it is.