#define MAX_BUSINESS 50
enum bInfo
{
bID,
bName,
bOwner[MAX_PLAYER_NAME],
bPrice,
bInterior,
bVirtualWorld,
Float:bX,
Float:bY,
Float:bZ,
}
new BizInfo[MAX_BUSINESS][bInfo];
new BizCount = 0;
stock CreateBusiness(BizName[], BizPrice, Float:X, Float:Y, Float:Z, Interior = 0, VirtualWorld = 0)
{
new string[51];
BizInfo[bID] = BizCount; //The first error is here, I know that I can't do that, but how do I set the ID?
BizCount++;
new str[51];
format(str, sizeof(str), "%s", BizName);
BizInfo[bID][bName] = str; //This is the second error line
BizInfo[bID][bPrice] = BizPrice;
BizInfo[bID][bX] = X;
BizInfo[bID][bY] = Y;
BizInfo[bID][bZ] = Z;
BizInfo[bID][bOwner] = "No Owner"; //And this is the third ! Why can't I set that array as a string?
BizInfo[bID][bInterior] = Interior;
BizInfo[bID][bVirtualWorld] = VirtualWorld;
format(string,sizeof(string),"Businesses/Biz%d.biz.ini", BizInfo[bID]);
INI_Open(string);
INI_WriteString("Name", BizInfo[bID][bName]);
INI_WriteInt("Price", BizInfo[bID][bPrice]);
INI_WriteInt("Interior", BizInfo[bID][bInterior]);
INI_WriteInt("VirtualWorld", BizInfo[bID][bVirtualWorld]);
INI_WriteFloat("X", BizInfo[bID][bX]);
INI_WriteFloat("Y", BizInfo[bID][bY]);
INI_WriteFloat("Z", BizInfo[bID][bZ]);
INI_WriteString("Owner", BizInfo[bID][bOwner]);
INI_Save();
INI_Close();
return bID;
}
C:\Users\Salvastrazzullo\Desktop\sa-mp 0.3c Server\gamemodes\SLARP.pwn(3066) : error 033: array must be indexed (variable "BizInfo") C:\Users\Salvastrazzullo\Desktop\sa-mp 0.3c Server\gamemodes\SLARP.pwn(3072) : error 006: must be assigned to an array C:\Users\Salvastrazzullo\Desktop\sa-mp 0.3c Server\gamemodes\SLARP.pwn(3077) : error 047: array sizes do not match, or destination array is too small Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 3 Errors.
new BizInfo[MAX_BUSINESS][bInfo]; |
BizInfo[bID] = BizCount; |
BizCount++;
BizInfo[BizCount][bID] = BizCount;
BizInfo[bID][bName] = str;
strins(BizInfo[bID][bName], str, 0, strlen(str));
if(strcmp(cmdtext, "/creabiz", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return 1;
tmp = strtok(cmdtext,idx);
if(!strval(tmp)) return SendClientMessage(playerid, COLOR_RED, "USO: /creabiz [Costo].");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
new int = GetPlayerInterior(playerid);
new vw = GetPlayerVirtualWorld(playerid);
CreateBusiness("Il Mio Business", strval(tmp), X, Y, Z, int, vw);
return 1;
}
if(!IsPlayerAdmin(playerid)) return 1;
if(!strval(tmp)) return SendClientMessage(playerid, COLOR_RED, "USO: /creabiz [Costo].");
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[180];
new tmp[180];
new index;
cmd = strtok(cmdtext,idx);
if(strcmp(cmdtext, "/createbiz", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return 1;
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USO: /createbiz [Price].");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
new int = GetPlayerInterior(playerid);
new vw = GetPlayerVirtualWorld(playerid);
CreateBusiness("Il Mio Business", strval(tmp), X, Y, Z, int, vw);
return 1;
}
return GameTextForPlayer(playerid,"~r~Comando Inesistente",1000,5);
}