enum EIllegalBizInteriors {
Float:EIBX,
Float:EIBY,
Float:EIBZ,
Float:EIBAngle,
EIBInterior,
EIBName[32],
EIBPrice,
};
new IBInteriors[][EIllegalBizInteriors] = {{422.571838, 2536.541503, 10.000000, 86.274101, 10, "Small House", 500000}};
illegalBizOnGameModeInit() {
query[0] = 0;
format(query, sizeof(query), "SELECT `ibiz`.`id`,`ibiz`.`name`,`ibiz`.`ownertype`,`ibiz`.`owner`,`c`.`username`,`ibiz`.`x`,`ibiz`.`y`,`ibiz`.`z`,`ibiz`.`interiortype`,`ibiz`.`closed`,`ibiz`.`till`,`ibiz`.`matsa`,`ibiz`.`matsb`,`ibiz`.`matsc`,`ibiz`.`pot`,`ibiz`.`coke`,`ibiz`.`meth`,`ibiz`.`gunprofit`,`ibiz`.`drugprofit` FROM `illegalbiz` AS `ibiz` LEFT JOIN `characters` AS `c` ON `owner` = `c`.`id`");
mysql_function_query(g_mysql_handle, query, true, "OnLoadIllegalBiz", "");
}
iBizTryEnter(playerid) {
for(new i=0;i<MAX_ILLEGAL_BIZ;i++) {
if(IllegalBusinesses[i][EIllegalBiz_SQLID] != 0) {
new interior = IllegalBusinesses[i][EIllegalBiz_Interior];
if(IsPlayerInRangeOfPoint(playerid,1.5,IllegalBusinesses[i][EIllegalBiz_X], IllegalBusinesses[i][EIllegalBiz_Y], IllegalBusinesses[i][EIllegalBiz_Z])) {
if(IllegalBusinesses[i][EIllegalBiz_Closed] == 0) {
HintMessage(playerid, COLOR_LIGHTGREEN, "(( Do /buy to buy things ))");
SetPlayerPos(playerid, IBInteriors[interior][EIBX],IBInteriors[interior][EIBY],IBInteriors[interior][EIBZ]);
SetPlayerInterior(playerid, IBInteriors[interior][EIBInterior]);
SetPlayerVirtualWorld(playerid, IllegalBusinesses[i][EIllegalBiz_SQLID]+25000);
SetPlayerFacingAngle(playerid, IBInteriors[interior][EIBAngle]);
}
} else if(IsPlayerInRangeOfPoint(playerid,1.5,IBInteriors[interior][EIBX],IBInteriors[interior][EIBY],IBInteriors[interior][EIBZ])) {
if(GetPlayerVirtualWorld(playerid) == IllegalBusinesses[i][EIllegalBiz_SQLID]+25000) {
SetPlayerPos(playerid, IllegalBusinesses[i][EIllegalBiz_X], IllegalBusinesses[i][EIllegalBiz_Y], IllegalBusinesses[i][EIllegalBiz_Z]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
}
}
}
}
}
YCMD:makeibiz(playerid, params[], help) {
if(help) {
SendClientMessage(playerid, X11_WHITE, "Creates an illegal business");
return 1;
}
new name[32];
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(!sscanf(params,"s[32]", name)) {
createIllegalBusiness(X,Y,Z,10,name);
} else {
SendClientMessage(playerid, X11_WHITE, "USAGE: /makeibiz [name]");
}
return 1;
}
forward OnCreateIllegalBiz();
public OnCreateIllegalBiz() {
new id = mysql_insert_id();
format(query, sizeof(query), "SELECT `ibiz`.`id`,`ibiz`.`name`,`ibiz`.`ownertype`,`ibiz`.`owner`,`c`.`username`,`ibiz`.`x`,`ibiz`.`y`,`ibiz`.`z`,`ibiz`.`interiortype`,`ibiz`.`closed`,`ibiz`.`till`,`ibiz`.`matsa`,`ibiz`.`matsb`,`ibiz`.`matsc`,`ibiz`.`pot`,`ibiz`.`coke`,`ibiz`.`meth`,`ibiz`.`gunprofit`,`ibiz`.`drugprofit` FROM `illegalbiz` AS `ibiz` LEFT JOIN `characters` AS `c` ON `owner` = `c`.`id` WHERE `ibiz`.`id` = %d",id);
mysql_function_query(g_mysql_handle, query, true, "OnLoadIllegalBiz", "");
format(query, sizeof(query), "[AdmNotice]: Illegal Business ID: %d",id);
ABroadcast(X11_RED,query,EAdminFlags_BusinessAdmin);
}
createIllegalBusiness(Float:X,Float:Y,Float:Z,interior,name[]) {
new name_esc[(32*2)+1];
mysql_real_escape_string(name, name_esc);
format(query, sizeof(query), "INSERT INTO `illegalbiz` SET `name` = \"%s\", `x` = %f, `y` = %f, `z` = %f,`interiortype` = %d",name_esc,X,Y,Z,interior);
mysql_function_query(g_mysql_handle, query, true, "OnCreateIllegalBiz", "");
}
setIBizName(sbiz, name[]) {
new name_esc[(32*2)+1];
mysql_real_escape_string(name, name_esc);
format(IllegalBusinesses[sbiz][EIllegalBiz_Name], 32, "%s", name);
format(query, sizeof(query), "UPDATE `illegalbiz` SET `name` = \"%s\" WHERE `id` = %d",name_esc,IllegalBusinesses[sbiz][EIllegalBiz_SQLID]);
mysql_function_query(g_mysql_handle, query, true, "EmptyCallback", "");
new biztext[128];
format(biztext, sizeof(biztext), "{FF0000}%s",IllegalBusinesses[sbiz][EIllegalBiz_Name]);
UpdateDynamic3DTextLabelText(IllegalBusinesses[sbiz][EIllegalBiz_3DText], COLOR_LIGHTGREEN, biztext);
}
format(query, sizeof(query), "SELECT `ibiz`.`id`,`ibiz`.`name`,`ibiz`.`ownertype`,`ibiz`.`owner`,`c`.`username`,`ibiz`.`x`,`ibiz`.`y`,`ibiz`.`z`,`ibiz`.`interiortype`,`ibiz`.`closed`,`ibiz`.`till`,`ibiz`.`matsa`,`ibiz`.`matsb`,`ibiz`.`matsc`,`ibiz`.`pot`,`ibiz`.`coke`,`ibiz`.`meth`,`ibiz`.`gunprofit`,`ibiz`.`drugprofit` FROM `illegalbiz` AS `ibiz` LEFT JOIN `characters` AS `c` ON `owner` = `c`.`id` WHERE `ibiz`.`id` = %d",id)
Does it even creates for you the pickup icon and the text of the business? and does the business table appears in your database?
EDIT: I also guess that this line is fucked up PHP код:
|
Okay it is either in creation, or either in the /enter cmd itself, Show me the /enter command (part of businesses) and show me how do you set an interior for the biz.
|
iBizTryEnter(playerid) {
for(new i=0;i<MAX_ILLEGAL_BIZ;i++) {
if(IllegalBusinesses[i][EIllegalBiz_SQLID] != 0) {
new interior = IllegalBusinesses[i][EIllegalBiz_Interior];
if(IsPlayerInRangeOfPoint(playerid,1.5,IllegalBusinesses[i][EIllegalBiz_X], IllegalBusinesses[i][EIllegalBiz_Y], IllegalBusinesses[i][EIllegalBiz_Z])) {
if(IllegalBusinesses[i][EIllegalBiz_Closed] == 0) {
HintMessage(playerid, COLOR_LIGHTGREEN, "(( Do /buy to buy things ))");
SetPlayerPos(playerid, IBInteriors[interior][EIBX],IBInteriors[interior][EIBY],IBInteriors[interior][EIBZ]);
SetPlayerInterior(playerid, IBInteriors[interior][EIBInterior]);
SetPlayerVirtualWorld(playerid, IllegalBusinesses[i][EIllegalBiz_SQLID]+25000);
SetPlayerFacingAngle(playerid, IBInteriors[interior][EIBAngle]);
}
forward OnLoadIllegalBiz();
public OnLoadIllegalBiz() {
new rows, fields;
new id_string[32];
cache_get_data(rows, fields);
if(rows > MAX_ILLEGAL_BIZ) {
printf("Warning: Increase MAX_ILLEGAL_BIZ to %d\n",rows);
}
for(new i=0;i<rows;i++) {
new slot = findFreeIllegalBiz();
if(slot == -1) {
printf("IllegalBusinesses IS FULL!\n");
continue;
}
cache_get_row(i, 0, id_string);
IllegalBusinesses[slot][EIllegalBiz_SQLID] = strval(id_string);
cache_get_row(i, 1, IllegalBusinesses[slot][EIllegalBiz_Name]);
cache_get_row(i, 2, id_string);
IllegalBusinesses[slot][EIllegalBiz_OwnerType] = strval(id_string);
cache_get_row(i, 3, id_string);
IllegalBusinesses[slot][EIllegalBiz_OwnerSQLID] = strval(id_string);
if(IllegalBusinesses[slot][EIllegalBiz_OwnerType] == 1) {
cache_get_row(i, 4, IllegalBusinesses[slot][EIllegalBiz_Ownername]);
}
new Float:X, Float:Y, Float:Z,intid;
cache_get_row(i, 5, id_string);
X = floatstr(id_string);
cache_get_row(i, 6, id_string);
Y = floatstr(id_string);
cache_get_row(i, 7, id_string);
Z = floatstr(id_string);
cache_get_row(i, 8, id_string);
intid = strval(id_string);
cache_get_row(i, 9, id_string);
IllegalBusinesses[slot][EIllegalBiz_Closed] = strval(id_string);
cache_get_row(i, 10, id_string);
IllegalBusinesses[slot][EIllegalBiz_Till] = strval(id_string);
cache_get_row(i, 11, id_string);
IllegalBusinesses[slot][EIllegalBiz_Mats][0] = strval(id_string);
cache_get_row(i, 12, id_string);
IllegalBusinesses[slot][EIllegalBiz_Mats][1] = strval(id_string);
cache_get_row(i, 13, id_string);
IllegalBusinesses[slot][EIllegalBiz_Mats][2] = strval(id_string);
cache_get_row(i, 14, id_string);
IllegalBusinesses[slot][EIllegalBiz_Drugs][0] = strval(id_string);
cache_get_row(i, 15, id_string);
IllegalBusinesses[slot][EIllegalBiz_Drugs][1] = strval(id_string);
cache_get_row(i, 16, id_string);
IllegalBusinesses[slot][EIllegalBiz_Drugs][2] = strval(id_string);
cache_get_row(i, 17, id_string);
IllegalBusinesses[slot][EIllegalBiz_GunProfit] = strval(id_string);
cache_get_row(i, 18, id_string);
IllegalBusinesses[slot][EIllegalBiz_DrugProfit] = strval(id_string);
IllegalBusinesses[slot][EIllegalBiz_X] = X;
IllegalBusinesses[slot][EIllegalBiz_Y] = Y;
IllegalBusinesses[slot][EIllegalBiz_Z] = Z;
IllegalBusinesses[slot][EIllegalBiz_Interior] = intid;
new biztext[128];
format(biztext, sizeof(biztext), "{FF0000}%s",IllegalBusinesses[slot][EIllegalBiz_Name]);
IllegalBusinesses[slot][EIllegalBiz_PickupID] = CreateDynamicPickup(1254, 16, X, Y, Z);
IllegalBusinesses[slot][EIllegalBiz_3DText] = CreateDynamic3DTextLabel(biztext, getPointColour(i), X, Y, Z+1.0, 10.0);
}
}