PDA

View Full Version : Createbiz help


Alex_T
10/11/2013, 09:07 PM
CMD:createbiz(playerid, params[])
{
new type, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
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) Bar");
return 1;
}
if(type < 1 || type > 7) return SendClientMessage(playerid, COLOR_GREY, "Businesses are between 1 and 5.");
for(new idx=1; idx<MAX_BIZ; idx++)
{
if(!BizInfo[idx][bType])
{
// 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] = 200000;
BizInfo[idx][bPickup] = CreateDynamicPickup(1272, 1, X, Y, Z, 0);
format(string, sizeof(string), "Owner: %s\nBusiness Type: %s\nStatus: For Sale\nPrice: $%d", BizInfo[idx][bOwner], RBT(idx), BizInfo[idx][bPrice]);
BizInfo[idx][bText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, X, Y, Z, 15);
format(string, sizeof(string), "AdmWarn: %s has created business ID %d.", RPN(playerid), idx);
SendAdminMessage(COLOR_DARKRED, 1, string);
Log("logs/business.log", string);
idx = MAX_BIZ;
}
}
return 1;
}




for(new idx=1; idx<MAX_BIZ; idx++)
{
if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
{
if(!BizInfo[idx][bStatus] && PlayerInfo[playerid][pBiz] != idx && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "This business is closed.");
if(BizInfo[idx][bType] == 1) // 24/7 Business
{
SetPlayerPos(playerid, -27.3025,-57.6649,1003.5469);
SetPlayerFacingAngle(playerid, 357.5915);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, 6);
SetPlayerVirtualWorld(playerid, idx+100);
format(string, sizeof(string), "** Welcome to %s's 24/7 Market (( /prices & /buy )) **", BizInfo[idx][bOwner]);
SendClientMessage(playerid, COLOR_ORANGE, string);
}
else if(BizInfo[idx][bType] == 2) // Clothes Shop Business
{
SetPlayerPos(playerid, 207.0638,-139.9965,1003.5078);
SetPlayerFacingAngle(playerid, 356.3849);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, 3);
SetPlayerVirtualWorld(playerid, idx+100);
format(string, sizeof(string), "** Welcome to %s's Clothes Shop (( /buyclothes & /buytoys )) **", BizInfo[idx][bOwner]);
SendClientMessage(playerid, COLOR_ORANGE, string);
}
else if(BizInfo[idx][bType] == 3) // Ammunation Business
{
SetPlayerPos(playerid, 285.8044,-85.9956,1001.5229);
SetPlayerFacingAngle(playerid, 358.9898);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, 4);
SetPlayerVirtualWorld(playerid, idx+100);
format(string, sizeof(string), "** Welcome to %s's Ammunation (( /prices & /buy )) **", BizInfo[idx][bOwner]);
SendClientMessage(playerid, COLOR_ORANGE, string);
}
else if(BizInfo[idx][bType] == 4) // Club Business
{
SetPlayerPos(playerid, 493.4252,-24.3061,1000.6797);
SetPlayerFacingAngle(playerid, 0.2432);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, 17);
SetPlayerVirtualWorld(playerid, idx+100);
format(string, sizeof(string), "** Welcome to %s's Club (( /prices & /buy )) **", BizInfo[idx][bOwner]);
SendClientMessage(playerid, COLOR_ORANGE, string);
}
else if(BizInfo[idx][bType] == 5) // Advertisement Agency
{
SetPlayerPos(playerid, 834.1631,7.4883,1004.1797);
SetPlayerFacingAngle(playerid, 86.7239);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, 3);
SetPlayerVirtualWorld(playerid, idx+100);
format(string, sizeof(string), "** Welcome to %s's Advertisement Agency (( /ad )) **", BizInfo[idx][bOwner]);
SendClientMessage(playerid, COLOR_ORANGE, string);
}
else if(BizInfo[idx][bType] == 7) // Bar
{
SetPlayerPos(playerid, 229.2923,1400.9720,27.7656);
SetPlayerFacingAngle(playerid, 86.7239);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, 18);
SetPlayerVirtualWorld(playerid, idx+100);
format(string, sizeof(string), "** Welcome to %s's Advertisement Agency (( /ad )) **", BizInfo[idx][bOwner]);
SendClientMessage(playerid, COLOR_ORANGE, string);
}
else if(BizInfo[idx][bType] == 6) // Fast Food
{
SetPlayerPos(playerid, 372.3830,-133.2579,1001.4922);
SetPlayerFacingAngle(playerid, 0.4216);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, 5);
SetPlayerVirtualWorld(playerid, idx+100);
format(string, sizeof(string), "** Welcome to %s's Fast Food (( /prices /buy )) **", BizInfo[idx][bOwner]);
SendClientMessage(playerid, COLOR_ORANGE, string);
}
}
else if(IsPlayerInRangeOfPoint(playerid, 2, -27.3025,-57.6649,1003.5469) || IsPlayerInRangeOfPoint(playerid, 2, 207.0638,-139.9965,1003.5078) || IsPlayerInRangeOfPoint(playerid, 2, 285.8044,-85.9956,1001.5229) || IsPlayerInRangeOfPoint(playerid, 2, 493.4252,-24.3061,1000.6797) || IsPlayerInRangeOfPoint(playerid, 2, 834.1631,7.4883,1004.1797) || IsPlayerInRangeOfPoint(playerid, 2, 372.3830,-133.2579,1001.4922)) // 24/7 || Clothes Shop || Ammunation || Club || Advertisement Agency || FastFood
{
idx = GetPlayerVirtualWorld(playerid)-100;
if(!done && idx < MAX_BIZ && BizInfo[idx][bType])
{
SetPlayerPos(playerid, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
}
done = 1;
return 1;
}

I want it so I can add the bars. But Currently the bars interior does not work.

Loot
10/11/2013, 11:24 PM
I'm not sure what are you asking but, if you have wrong coordinates of an interior go to http://weedarr.wikidot.com/interior and find another interior, grab the x/y/z and interior number from there and set as follows:

else if(BizInfo[idx][bType] == 7) // Bar
{
SetPlayerPos(playerid, x, y, z); // x/y/z here
SetPlayerFacingAngle(playerid, 86.7239);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, int); // interior here
SetPlayerVirtualWorld(playerid, idx+100);
format(string, sizeof(string), "** Welcome to %s's Advertisement Agency (( /ad )) **", BizInfo[idx][bOwner]);
SendClientMessage(playerid, COLOR_ORANGE, string);
}