Hey I want make some thing with my biz system , I got that ready on script from edited script by me :
Код:
CMD:buybiz(playerid, params[])
{
#pragma unused params
new string[256], businesstype[128];
if(PlayerInfo[playerid][pPbiskey] == INVALID_BIZZ_ID)
{
for(new b = 0; b < sizeof(BizzInfo); b++)
{
if(IsPlayerInRangeOfPoint( playerid, 5, BizzInfo[b][bEntranceX], BizzInfo[b][bEntranceY], BizzInfo[b][bEntranceZ]) )
{
if(strcmp(BizzInfo[b][bOwner], "Nobody", true) == 0 )
{
if(BizzInfo[b][bBuyPrice] == -1)
{
SendClientMessage( playerid, COLOR_GREY, "This Business isn't purchasable." );
}
else
{
if(GetPlayerCash(playerid) > BizzInfo[b][bBuyPrice])
{
if(PlayerInfo[playerid][pLevel] > BizzInfo[b][bLevelNeeded])
{
if(BizzInfo[b][bType] > 0)
{
if(BizzInfo[b][bType] == 1) { businesstype = "24-7";}
else if(BizzInfo[b][bType] == 2) { businesstype = "Bank";}
else if(BizzInfo[b][bType] == 3) { businesstype = "Club";}
else if(BizzInfo[b][bType] == 4) { businesstype = "Ammunation";}
else if(BizzInfo[b][bType] == 5) { businesstype = "Casino";}
else if(BizzInfo[b][bType] == 6) { businesstype = "Restaurant";}
}
else
{
businesstype = "Not Available";
}
//SetPlayerPos(playerid,BizzInfo[b][bExitX], BizzInfo[b][bExitY], BizzInfo[b][bExitZ]);
GameTextForPlayer(playerid, "~w~Business Purchased~n~You can enter the business by using /enter..", 5000, 3);
//SetPlayerInterior(playerid,BizzInfo[b][bIntID]);
SendClientMessageEx(playerid, COLOR_WHITE, "Congratulations on your new purchase!");
SendClientMessageEx(playerid, COLOR_WHITE, "Type /help to review the property help section!");
OnPlayerStatsUpdate(playerid);
GivePlayerCash(playerid,-BizzInfo[b][bBuyPrice]);
format( BizzInfo[b][bOwner], MAX_PLAYER_NAME, "%s", GetPlayerNameEx(playerid));
GameTextForPlayer(playerid, "~g~Business Purchased!", 5000, 1);
PlayerInfo[playerid][pPbiskey] = b;
BizzInfo[b][bOwned] = 1;
format(string, sizeof(string), "{0000FF}[Business]{F0CC00}\nOwner: %s\n%s\nEntrance Fee: $%d\nID: %d", BizzInfo[b][bOwner], BizzInfo[b][bMessage],BizzInfo[b][bEntranceCost], b);
UpdateDynamic3DTextLabelText(BizzInfo[b][bTextID], COLOR_DCHAT, string);
SaveBizz();
new ip[32];
GetPlayerIp(playerid,ip,sizeof(ip));
format(string,sizeof(string),"%s (IP: %s) has bought biz ID %d for $%d.",GetPlayerNameEx(playerid),ip,b,BizzInfo[b][bBuyPrice]);
Log("logs/biz.log", string);
}
else
{
SendClientMessage( playerid, COLOR_GREY, "Your level isn't higher to buy this Business!" );
}
}
else
{
SendClientMessage( playerid, COLOR_GREY, "You do not have enough money to purchase this Business!" );
}
}
}
else
{
SendClientMessage( playerid, COLOR_GREY, "This Business is not for sale!" );
}
}
}
}
else
{
SendClientMessage( playerid, COLOR_GREY, "You already own a Business!" );
}
return 1;
CMD:bizinfo(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
new bouse = PlayerInfo[playerid][pPbiskey];
if(bouse == INVALID_BIZZ_ID)
{
SendClientMessage(playerid, COLOR_WHITE, " You don't own a Business!");
return 1;
}
else
{
PrintBizInfo(playerid,bouse);
}
}
return 1;
}
CMD:bizhelp(playerid, params[])
{
SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
SendClientMessageEx(playerid, COLOR_WHITE,"*** BIZ HELP *** - type a command for more infomation.");
SendClientMessageEx(playerid, COLOR_GRAD3,"*** BIZ *** /buybiz /sellbiz /bizlock /bizname /bizfee /bizinfo");
SendClientMessageEx(playerid, COLOR_GRAD3,"*** BIZ *** /setbankpercent /bankpercent /bizdeposit /bizwithdraw");
return 1;
}
CMD:bizwithdraw(playerid, params[])
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
new string[128], amount, choice[32];
if(sscanf(params, "s[32]d", choice, amount))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /bizwithdraw [name] [amount]");
SendClientMessageEx(playerid, COLOR_GRAD2, "Available Names: Cash");
return 1;
}
if( GetPlayerVirtualWorld(playerid) == PlayerInfo[playerid][pPbiskey]+6000 )
{
if(PlayerInfo[playerid][pPbiskey] != INVALID_BIZZ_ID && strcmp(playername, BizzInfo[PlayerInfo[playerid][pPbiskey]][bOwner], true) == 0)
{
if(strcmp(choice, "Cash", true, strlen(choice)) == 0)
{
if(amount < 1)
{
SendClientMessageEx(playerid, COLOR_WHITE, "You can't withdraw less than one.");
return 1;
}
if( BizzInfo[PlayerInfo[playerid][pPbiskey]][bTill] >= amount )
{
BizzInfo[PlayerInfo[playerid][pPbiskey]][bTill]-=amount;
SetPVarInt(playerid, "Cash", GetPVarInt(playerid, "Cash")+amount);
format(string, sizeof(string), "You have withdrawn $%d from your business money safe.", amount);
SendClientMessageEx(playerid, COLOR_YELLOW, string);
format(string,sizeof(string), "* %s withdraws some money from their business safe.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SaveBizz();
new ip[32];
GetPlayerIp(playerid,ip,sizeof(ip));
format(string,sizeof(string),"%s (IP: %s) has withdrawn $%d from their business (biz ID %d).",GetPlayerNameEx(playerid),ip,amount,PlayerInfo[playerid][pPbiskey]);
Log("logs/biz.log", string);
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You don't have enough money to withdraw.");
}
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /bizwithdraw [name] [amount]");
SendClientMessageEx(playerid, COLOR_GRAD2, "Available Names: Cash");
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You're not in any business");
return 1;
}
return 1;
}
CMD:bizlock(playerid, params[]) {
if(PlayerInfo[playerid][pPbiskey] != INVALID_BIZZ_ID && (IsPlayerInRangeOfPoint(playerid, 2.0, BizzInfo[PlayerInfo[playerid][pPbiskey]][bEntranceX], BizzInfo[PlayerInfo[playerid][pPbiskey]][bEntranceY], BizzInfo[PlayerInfo[playerid][pPbiskey]][bEntranceZ]) || IsPlayerInRangeOfPoint(playerid, 2.0, BizzInfo[PlayerInfo[playerid][pPbiskey]][bExitX], BizzInfo[PlayerInfo[playerid][pPbiskey]][bExitY], BizzInfo[PlayerInfo[playerid][pPbiskey]][bExitZ]))) {
new
szMessage[30 + MAX_PLAYER_NAME];
if(BizzInfo[PlayerInfo[playerid][pPbiskey]][bLocked] == 1)
{
BizzInfo[PlayerInfo[playerid][pPbiskey]][bLocked] = 0;
format(szMessage, sizeof(szMessage), "* %s has unlocked their house.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
BizzInfo[PlayerInfo[playerid][pPbiskey]][bLocked] = 1;
format(szMessage, sizeof(szMessage), "* %s has locked their business.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else SendClientMessageEx(playerid, COLOR_GRAD2, "You either don't own a house, or are not at one of them.");
return 1;
}
CMD:bizedit(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 4)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
return 1;
}
new string[128], choice[32], bizid, amount, businesstype[128];
if(sscanf(params, "s[32]dD", choice, bizid, amount))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /bizedit [name] [houseid] [(Optional)amount]");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, Level, Type, Price");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: Prods, Locked");
return 1;
}
if(strcmp(choice, "interior", true) == 0)
{
BizzInfo[bizid][bInteriorID] = GetPlayerInterior( playerid );
GetPlayerPos( playerid, BizzInfo[bizid][bExitX], BizzInfo[bizid][bExitY], BizzInfo[bizid][bExitZ]);
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the interior!" );
SaveBizz();
format(string, sizeof(string), "%s has edited BizID %d's Interior.", GetPlayerNameEx(playerid), bizid);
Log("logs/bedit.log", string);
return 1;
}
else if(strcmp(choice, "exterior", true) == 0)
{
GetPlayerPos( playerid, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]);
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the exterior!" );
DestroyDynamicPickup(BizzInfo[bizid][bPickupID]);
//BizzInfo[bizid][bLocked] = 1;
format(string, sizeof(string), "%s has edited BizID %d's Exterior.", GetPlayerNameEx(playerid), bizid);
Log("logs/bedit.log", string);
SaveBizz();
if(BizzInfo[bizid][bOwned] == 1)
{
DestroyDynamic3DTextLabel(BizzInfo[bizid][bTextID]);
BizzInfo[bizid][bPickupID] = CreateDynamicPickup(1274, 23, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ], 0, -1, -1, 150.0 );
format(string, sizeof(string), "{0000FF}[Business]{F0CC00}\nOwner: %s\n%s\nEntrance Fee: $%d\nID: %d", BizzInfo[bizid][bOwner], BizzInfo[bizid][bMessage],BizzInfo[bizid][bEntranceCost], bizid);
BizzInfo[bizid][bTextID] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0,-1,-1, 100.0);
//Streamer_UpdateEx(playerid, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]);
}
else
{
DestroyDynamic3DTextLabel(BizzInfo[bizid][bTextID]);
BizzInfo[bizid][bPickupID] = CreateDynamicPickup(1274, 23, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ], 0, -1, -1, 150.0 );
format(string, sizeof(string), "{0000FF}[%s For Sale]{F0CC00}\nPrice: $%d\nLevel: %d\nID: %d\nTo buy type /buybiz", businesstype,BizzInfo[bizid][bBuyPrice],BizzInfo[bizid][bLevelNeeded], bizid);
BizzInfo[bizid][bTextID] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0,-1,-1, 100.0);
//Streamer_UpdateEx(playerid, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]);
}
}
else if(strcmp(choice, "level", true) == 0)
{
BizzInfo[bizid][bLevelNeeded] = amount;
format(string, sizeof(string), "You have set the house level to %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);
if(BizzInfo[bizid][bOwned] == 0)
{
format(string, sizeof(string), "{0000FF}[%s For Sale]{F0CC00}\nPrice: $%d\nLevel: %d\nID: %d\nTo buy type /buybiz", businesstype,BizzInfo[bizid][bBuyPrice],BizzInfo[bizid][bLevelNeeded], bizid);
UpdateDynamic3DTextLabelText(BizzInfo[bizid][bTextID], COLOR_DCHAT, string);
}
else
{
format(string, sizeof(string), "{0000FF}[Business]{F0CC00}\nOwner: %s\n%s\nEntrance Fee: $%d\nID: %d", BizzInfo[bizid][bOwner], BizzInfo[bizid][bMessage],BizzInfo[bizid][bEntranceCost], bizid);
UpdateDynamic3DTextLabelText(BizzInfo[bizid][bTextID], COLOR_DCHAT, string);
}
format(string, sizeof(string), "%s has edited BizID %d's Level to %d.", GetPlayerNameEx(playerid), bizid, amount);
Log("logs/bedit.log", string);
}
else if(strcmp(choice, "price", true) == 0)
{
BizzInfo[bizid][bBuyPrice] = amount;
format(string, sizeof(string), "You have set the biz price to $%d.", amount );
SendClientMessageEx(playerid, COLOR_WHITE, string);
if(BizzInfo[bizid][bOwned] == 0)
{
format(string, sizeof(string), "{0000FF}[%s For Sale]{F0CC00}\nPrice: $%d\nLevel: %d\nID: %d\nTo buy type /buybiz", businesstype,BizzInfo[bizid][bBuyPrice],BizzInfo[bizid][bLevelNeeded], bizid);
UpdateDynamic3DTextLabelText(BizzInfo[bizid][bTextID], COLOR_DCHAT, string);
}
format(string, sizeof(string), "%s has edited BizID %d's Price to $%d.", GetPlayerNameEx(playerid), amount);
Log("logs/bedit.log", string);
}
else if(strcmp(choice, "type", true) == 0)
{
switch(amount)
{
case 1:
{
businesstype = "24-7";
BizzInfo[bizid][bType] = 1;
}
case 2:
{
businesstype = "Bank";
BizzInfo[bizid][bType] = 2;
}
case 3:
{
businesstype = "Club";
BizzInfo[bizid][bType] = 3;
}
case 4:
{
businesstype = "Ammunation";
BizzInfo[bizid][bType] = 4;
}
case 5:
{
businesstype = "Restaurant";
BizzInfo[bizid][bType] = 6;
}
case 6:
{
businesstype = "Casino";
BizzInfo[bizid][bType] = 7;
}
case 7:
{
businesstype = "Bar";
BizzInfo[bizid][bType] = 8;
}
case 8:
{
businesstype = "Clothes Shop";
BizzInfo[bizid][bType] = 9;
}
case 9:
{
businesstype = "Sex Shop";
BizzInfo[bizid][bType] = 10;
}
}
if(BizzInfo[bizid][bOwned] ==0)
{
format(string, sizeof(string), "{0000FF}[%s For Sale]{F0CC00}\nPrice: $%d\nLevel: %d\nID: %d\nTo buy type /buybiz", businesstype,BizzInfo[bizid][bBuyPrice],BizzInfo[bizid][bLevelNeeded], bizid);
UpdateDynamic3DTextLabelText(BizzInfo[bizid][bTextID], COLOR_DCHAT, string);
}
format(string, sizeof(string), "%s has edited BizID %d's Type to %d.", GetPlayerNameEx(playerid), bizid, amount);
Log("logs/bedit.log", string);
}
SaveBizz();
}
}
I want make all the commands on /bizhelp works , /bizwithdraw doesnt work cause when I buy for example this should to enter money to the bizbalance but its not , U can try that also , I want make /bizdeposit , /bizbalance , /bizfee , and /bizname and /setbankpercent /bankpercent /buyproducts. All the rest fixed...
And if you see and can and see a problem in one of these commands fix it please.
Please I must that will work , One more thing when I do /bizedit and make exterior thats tell me I succed do it and Unknown command , Somone told me its about Debug but IDK whats that means... TY ...!