[Help] Business System
#1

My Business System not working at Buy Biz. I'm not know why but when i'm /buybiz it isn't appear anything and this have error not working please help me
Reply
#2

We don't have the technology of guessing codes yet.
Reply
#3

Quote:
Originally Posted by Necip
Посмотреть сообщение
We don't have the technology of guessing codes yet.
fingers crossed it will be one day soon :P
Reply
#4

Give codes here...
Reply
#5

Quote:

CMD:muacuahang(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 100.0, 1109.0, 1537.0, 5.0) && PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_WHITE, "You cannot use this command in this area!");
new string[128];
new playername[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
new Floatldposx, Floatldposy, Floatldposz;
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new b = 0; b < sizeof(BizInfo); b++)
{
if(IsPlayerInRangeOfPoint(playerid,2.0,BizInfo[b][bExteriorX], BizInfo[b][bExteriorY], BizInfo[b][bExteriorZ]) )
{
if( BizInfo[b][bOwned] == 0 )
{
if(PlayerInfo[playerid][pLevel] < BizInfo[b][bLevel])
{
format(string, sizeof(string), " Ban can phai Level %s moi co the mua duoc ", BizInfo[b][bLevel]);
SendClientMessageEx(playerid, COLOR_GRAD5, string);
return 1;
}
if(PlayerInfo[playerid][pBizkey] == INVALID_BIZ_ID)
{

if(GetPlayerCash(playerid) > BizInfo[b][bValue])
{
PlayerInfo[playerid][pBizkey] = b;
BizInfo[b][bOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(BizInfo[b][bOwner], sendername, 0, strlen(sendername), 255);
GivePlayerCash(playerid,-BizInfo[b][bValue]);
SetPlayerInterior(playerid,BizInfo[b][bHInteriorWorld]);
SetPlayerPos(playerid,BizInfo[b][bInteriorX],BizInfo[b][bInteriorY],BizInfo[b][bInteriorZ]);
GameTextForPlayer(playerid, "~w~Chao Mung~n~ Ban co the ra ngoai bang cach go /exit.", 5000, 3);
PlayerInfo[playerid][pInt] = BizInfo[b][bHInteriorWorld];
SendClientMessageEx(playerid, COLOR_WHITE, " Chuc mung ban da mua thanh cong !");
SendClientMessageEx(playerid, COLOR_WHITE, " Go /trogiup de xem cac lenh ve Biz!");
SaveBizs();
OnPlayerStatsUpdate(playerid);
PlayerInfo[playerid][pVW] = b+6000;
SetPlayerVirtualWorld(playerid, b+6000);
DestroyDynamicPickup(BizInfo[b][bPickupID]);
BizInfo[b][bPickupID] = CreateDynamicPickup(1274, 23, BizInfo[b][bExteriorX], BizInfo[b][bExteriorY], BizInfo[b][bExteriorZ]);
format(string, sizeof(string), " Cua hang da duoc so huu tu\n %s\nLevel: %d\nID: %d\n{41FEEB}/enter neu muon vao trong ",BizInfo[b][bOwner],BizInfo[b][bLevel],b);
UpdateDynamic3DTextLabelText(BizInfo[b][bTextID], COLOR_1BLUE, string);
format(string,sizeof(string),"%s (IP: %s) has bought biz ID %d for $%d.",GetPlayerNameEx(playerid),GetPlayerIpEx(play erid),b,BizInfo[b][bValue]);
Log("logs/cuahang.log", string);
if(BizInfo[b][bCustomInterior] == 1) Player_StreamPrep(playerid, BizInfo[b][bInteriorX],BizInfo[b][bInteriorY],BizInfo[b][bInteriorZ], FREEZE_TIME);
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, " You don't have the cash for that!");
return 1;
}
}
else if(PlayerInfo[playerid][pBizkey2] == INVALID_BIZ_ID)
{
if(GetPlayerCash(playerid) > BizInfo[b][bValue])
{
PlayerInfo[playerid][pBizkey2] = b;
BizInfo[b][bOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(BizInfo[b][bOwner], sendername, 0, strlen(sendername), 255);
GivePlayerCash(playerid,-BizInfo[b][bValue]);
SetPlayerInterior(playerid,BizInfo[b][bHInteriorWorld]);
SetPlayerPos(playerid,BizInfo[b][bInteriorX],BizInfo[b][bInteriorY],BizInfo[b][bInteriorZ]);
GameTextForPlayer(playerid, "~w~Welcome Business~n~You can exit at any time by moving to this door and typing /exit.", 5000, 3);
PlayerInfo[playerid][pInt] = BizInfo[b][bHInteriorWorld];
SendClientMessageEx(playerid, COLOR_WHITE, "Congratulations on your new purchase!");
SendClientMessageEx(playerid, COLOR_WHITE, "Type /help to review the property help section!");
SaveBizs();
OnPlayerStatsUpdate(playerid);
PlayerInfo[playerid][pVW] = b+6000;
SetPlayerVirtualWorld(playerid, b+6000);
DestroyDynamicPickup(BizInfo[b][bPickupID]);
BizInfo[b][bPickupID] = CreateDynamicPickup(1273, 23, BizInfo[b][bExteriorX], BizInfo[b][bExteriorY], BizInfo[b][bExteriorZ]);
format(string, sizeof(string), "This house is owned by\n %s\nLevel: %d\nID: %d",BizInfo[b][bOwner],BizInfo[b][bLevel],b);
UpdateDynamic3DTextLabelText(BizInfo[b][bTextID], COLOR_1BLUE, string);
format(string,sizeof(string),"%s (IP: %s) has bought biz ID %d for $%d.",GetPlayerNameEx(playerid),GetPlayerIpEx(play erid),b,BizInfo[b][bValue]);
Log("logs/cuahang.log", string);
if(BizInfo[b][bCustomInterior] == 1) Player_StreamPrep(playerid, BizInfo[b][bInteriorX],BizInfo[b][bInteriorY],BizInfo[b][bInteriorZ], FREEZE_TIME);
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, " You don't have the cash for that!");
return 1;
}
}
}
else
{
SendClientMessageEx( playerid, COLOR_WHITE, "This house is owned." );
}
}
}
return 1;
}

And SaveBizs();
Quote:

stock SaveBizs()
{
new
szFileStr[1024],
File: fHandle = fopen("bizz.cfg", io_write);

for(new iIndex; iIndex < MAX_BIZ; iIndex++) {
format(szFileStr, sizeof(szFileStr), "%d|%d|%d|%s|%s|%f|%f|%f|%f|%f|%f|%f|%f|%d|%d|%d|% d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%f|%f\r\n ",
BizInfo[iIndex][bOwned],
BizInfo[iIndex][bLevel],
BizInfo[iIndex][bHInteriorWorld],
BizInfo[iIndex][bOwner],
BizInfo[iIndex][bExteriorX],
BizInfo[iIndex][bExteriorY],
BizInfo[iIndex][bExteriorZ],
BizInfo[iIndex][bExteriorR],
BizInfo[iIndex][bInteriorX],
BizInfo[iIndex][bInteriorY],
BizInfo[iIndex][bInteriorZ],
BizInfo[iIndex][bInteriorR],
BizInfo[iIndex][bLock],
BizInfo[iIndex][bRentable],
BizInfo[iIndex][bValue],
BizInfo[iIndex][bSafeMoney],
BizInfo[iIndex][bPot],
BizInfo[iIndex][bCrack],
BizInfo[iIndex][bMaterials],
BizInfo[iIndex][bGLUpgrade],
BizInfo[iIndex][bPickupID],
BizInfo[iIndex][bCustomInterior],
BizInfo[iIndex][bCustomExterior],
BizInfo[iIndex][bExteriorA],
BizInfo[iIndex][bInteriorA]
);
fwrite(fHandle, szFileStr);
}
return fclose(fHandle);
}

stock RehashBiz(bizid)
{
printf("[RehashBiz] Dang xoa BizID %d tu may chu...", bizid);
DestroyPickupEx(BizInfo[bizid][bPickupID]);
if(IsValidDynamic3DTextLabel(BizInfo[bizid][bTextID])) DestroyDynamic3DTextLabel(BizInfo[bizid][bTextID]);
BizInfo[bizid][bSQLId] = -1;
BizInfo[bizid][bOwned] = 0;
BizInfo[bizid][bLevel] = 0;
BizInfo[bizid][bHInteriorWorld] = 0;
BizInfo[bizid][bExteriorX] = 0.0;
BizInfo[bizid][bExteriorY] = 0.0;
BizInfo[bizid][bExteriorZ] = 0.0;
BizInfo[bizid][bExteriorR] = 0.0;
BizInfo[bizid][bInteriorX] = 0.0;
BizInfo[bizid][bInteriorY] = 0.0;
BizInfo[bizid][bInteriorZ] = 0.0;
BizInfo[bizid][bInteriorR] = 0.0;
BizInfo[bizid][bLock] = 0;
BizInfo[bizid][bRentable] = 0;
BizInfo[bizid][bValue] = 0;
BizInfo[bizid][bSafeMoney] = 0;
BizInfo[bizid][bPot] = 0;
BizInfo[bizid][bCrack] = 0;
BizInfo[bizid][bMaterials] = 0;
BizInfo[bizid][bGLUpgrade] = 0;
BizInfo[bizid][bCustomInterior] = 0;
BizInfo[bizid][bCustomExterior] = 0;
BizInfo[bizid][bExteriorA] = 0;
BizInfo[bizid][bInteriorA] = 0;
SaveBizs();
}

stock RehashBizs()
{
printf("[RehashBiz] Dang xoa cua hang tu may chu...");
for(new i = 0; i < MAX_BIZ; i++)
{
DestroyPickupEx(BizInfo[i][bPickupID]);
if(IsValidDynamic3DTextLabel(BizInfo[i][bTextID])) DestroyDynamic3DTextLabel(BizInfo[i][bTextID]);
BizInfo[i][bSQLId] = -1;
BizInfo[i][bOwned] = 0;
BizInfo[i][bLevel] = 0;
BizInfo[i][bHInteriorWorld] = 0;
BizInfo[i][bExteriorX] = 0.0;
BizInfo[i][bExteriorY] = 0.0;
BizInfo[i][bExteriorZ] = 0.0;
BizInfo[i][bExteriorR] = 0.0;
BizInfo[i][bInteriorX] = 0.0;
BizInfo[i][bInteriorY] = 0.0;
BizInfo[i][bInteriorZ] = 0.0;
BizInfo[i][bInteriorR] = 0.0;
BizInfo[i][bLock] = 0;
BizInfo[i][bRentable] = 0;
BizInfo[i][bValue] = 0;
BizInfo[i][bSafeMoney] = 0;
BizInfo[i][bPot] = 0;
BizInfo[i][bCrack] = 0;
BizInfo[i][bMaterials] = 0;
BizInfo[i][bGLUpgrade] = 0;
BizInfo[i][bCustomInterior] = 0;
BizInfo[i][bCustomExterior] = 0;
BizInfo[i][bExteriorA] = 0;
BizInfo[i][bInteriorA] = 0;
}
LoadBizs();
}

stock LoadBiz(bizid)
{
new string[128];
printf("[LoadBiz] Loading BizID %d's data from database...", bizid);
format(string, sizeof(string), "SELECT * FROM `businesses` WHERE `id`=%d",bizid+1); // Array starts at zero, MySQL starts at one.
mysql_function_query(MainPipeline, string, true, "OnLoadBiz", "i", bizid);
}

forward OnLoadBiz(index);
public OnLoadBiz(index)
{
new string[64];
new rows, fields;
cache_get_data(rows, fields, MainPipeline);

for(new field;field<fields;field++)
{
cache_get_row(index, field, string, MainPipeline);
switch(field)
{
case 0: BizInfo[index][bSQLId] = strval(string);
case 1: BizInfo[index][bOwned] = strval(string);
case 2: BizInfo[index][bLevel] = strval(string);
case 3: BizInfo[index][bHInteriorWorld] = strval(string);
case 4: format(BizInfo[index][bOwner], 24, "%s", string);
case 5: BizInfo[index][bExteriorX] = floatstr(string);
case 6: BizInfo[index][bExteriorY] = floatstr(string);
case 7: BizInfo[index][bExteriorZ] = floatstr(string);
case 8: BizInfo[index][bExteriorR] = floatstr(string);
case 9: BizInfo[index][bInteriorX] = floatstr(string);
case 10: BizInfo[index][bInteriorY] = floatstr(string);
case 11: BizInfo[index][bInteriorZ] = floatstr(string);
case 12: BizInfo[index][bInteriorR] = floatstr(string);
case 13: BizInfo[index][bLock] = strval(string);
case 14: BizInfo[index][bRentable] = strval(string);
case 15: BizInfo[index][bValue] = strval(string);
case 16: BizInfo[index][bSafeMoney] = strval(string);
case 17: BizInfo[index][bPot] = strval(string);
case 18: BizInfo[index][bCrack] = strval(string);
case 19: BizInfo[index][bMaterials] = strval(string);
case 20: BizInfo[index][bGLUpgrade] = strval(string);
case 21: BizInfo[index][bPickupID] = strval(string);
case 22: BizInfo[index][bCustomInterior] = strval(string);
case 23: BizInfo[index][bCustomExterior] = strval(string);
case 24: BizInfo[index][bExteriorA] = floatstr(string);
case 25: BizInfo[index][bInteriorA] = floatstr(string);
}
}
if(BizInfo[index][bOwned]) {
if(!BizInfo[index][bRentable]) format(string, sizeof(string), "Cua hang nay duoc so huu boi\n%s\nCap: %d\nID: %d",BizInfo[index][bOwner], BizInfo[index][bLevel], index);
}
else format(string, sizeof(string), "Cua hang nay dang\n duoc ban!\nGia: $%d\n Cap: %d\nID: %d\nNeu muon so huu go lenh /muacuahang",BizInfo[index][bValue],BizInfo[index][bLevel],index);

BizInfo[index][bPickupID] = CreatePickupEx(1274, 23, BizInfo[index][bExteriorX], BizInfo[index][bExteriorY], BizInfo[index][bExteriorZ]);
BizInfo[index][bTextID] = CreateDynamic3DTextLabel(string, COLOR_1BLUE, BizInfo[index][bExteriorX], BizInfo[index][bExteriorY], BizInfo[index][bExteriorZ]+0.5,10.0, .testlos = 1, .streamdistance = 10.0);
return 1;
}

stock LoadBizs()
{
printf("[LoadBusiness] Loading data from database...");
mysql_function_query(MainPipeline, "SELECT * FROM `businesses`", true, "OnLoadBizs", "");
}

forward OnLoadBizs();
public OnLoadBizs()
{
new string[512], iIndex;
new rows, fields;
cache_get_data(rows, fields, MainPipeline);
while(iIndex<rows)
{
for(new field;field<fields;field++)
{
cache_get_row(iIndex, field, string, MainPipeline);
switch(field)
{
case 0: BizInfo[iIndex][bSQLId] = strval(string);
case 1: BizInfo[iIndex][bOwned] = strval(string);
case 2: BizInfo[iIndex][bLevel] = strval(string);
case 3: BizInfo[iIndex][bHInteriorWorld] = strval(string);
case 4: format(BizInfo[iIndex][bOwner], 24, "%s", string);
case 5: BizInfo[iIndex][bExteriorX] = floatstr(string);
case 6: BizInfo[iIndex][bExteriorY] = floatstr(string);
case 7: BizInfo[iIndex][bExteriorZ] = floatstr(string);
case 8: BizInfo[iIndex][bExteriorR] = floatstr(string);
case 9: BizInfo[iIndex][bInteriorX] = floatstr(string);
case 10: BizInfo[iIndex][bInteriorY] = floatstr(string);
case 11: BizInfo[iIndex][bInteriorZ] = floatstr(string);
case 12: BizInfo[iIndex][bInteriorR] = floatstr(string);
case 13: BizInfo[iIndex][bLock] = strval(string);
case 14: BizInfo[iIndex][bRentable] = strval(string);
case 15: BizInfo[iIndex][bValue] = strval(string);
case 16: BizInfo[iIndex][bSafeMoney] = strval(string);
case 17: BizInfo[iIndex][bPot] = strval(string);
case 18: BizInfo[iIndex][bCrack] = strval(string);
case 19: BizInfo[iIndex][bMaterials] = strval(string);
case 20: BizInfo[iIndex][bGLUpgrade] = strval(string);
case 21: BizInfo[iIndex][bPickupID] = strval(string);
case 22: BizInfo[iIndex][bCustomInterior] = strval(string);
case 23: BizInfo[iIndex][bCustomExterior] = strval(string);
case 24: BizInfo[iIndex][bExteriorA] = floatstr(string);
case 25: BizInfo[iIndex][bInteriorA] = floatstr(string);
}
}
if(BizInfo[iIndex][bOwned]) {

if(!BizInfo[iIndex][bRentable]) format(string, sizeof(string), "Cua hang duoc so huu boi\n%s\nLevel: %d\nID: %d",BizInfo[iIndex][bOwner], BizInfo[iIndex][bLevel], iIndex);
}
else format(string, sizeof(string), "Cua hang nay dang \nduoc ban!\nGia: $%d\n Level: %d\nID: %d\nDe so huu no go lenh /muacuahang",BizInfo[iIndex][bValue],BizInfo[iIndex][bLevel],iIndex);

BizInfo[iIndex][bPickupID] = CreatePickupEx(1274, 23, BizInfo[iIndex][bExteriorX], BizInfo[iIndex][bExteriorY], BizInfo[iIndex][bExteriorZ]);
BizInfo[iIndex][bTextID] = CreateDynamic3DTextLabel(string, COLOR_1BLUE, BizInfo[iIndex][bExteriorX], BizInfo[iIndex][bExteriorY], BizInfo[iIndex][bExteriorZ]+0.5,10.0, .testlos = 1, .streamdistance = 10.0);
iIndex++;
}
if(iIndex > 0) printf("[LoadBusiness] %d cua hang da duoc cong khai/tai.", iIndex);
else printf("[LoadBusiness] Khong co cua hang nao de tai.");
return 1;
}

Here
Reply
#6

every body else ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)