23.04.2012, 13:21
Hi everyone!
So, I have a problem with a script (raven's Roleplay 4.2) Since when i type /buybiz and it says "You already own a business" but when try to /sellbiz it says "you don't own any business" Any ideas? I am desperate.
+ Rep will be given to the man that helps me.
Here is the code
So, I have a problem with a script (raven's Roleplay 4.2) Since when i type /buybiz and it says "You already own a business" but when try to /sellbiz it says "you don't own any business" Any ideas? I am desperate.
+ Rep will be given to the man that helps me.
Here is the code
PHP код:
//----------------------------------[BIZZ]-----------------------------------------------
if(strcmp(cmd, "/buybiz", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
if(PlayerInfo[playerid][pPbiskey] != 9998)
{
SendClientMessage(playerid, COLOR_WHITE, " You already own a business, type /sellbiz if you want to buy this one.");
return 1;
}
for(new b = 0; b < sizeof(SBizzInfo); b++)
{
if(IsPlayerInRangeOfPoint(playerid, 2, SBizzInfo[b][sbEntranceX], SBizzInfo[b][sbEntranceY], SBizzInfo[b][sbEntranceZ]) && SBizzInfo[b][sbOwned] == 0)
{
if(PlayerInfo[playerid][pLevel] < SBizzInfo[b][sbLevelNeeded])
{
format(string, sizeof(string), "You Must Be Level %d To Purchase This",SBizzInfo[b][sbLevelNeeded]);
SendClientMessage(playerid, COLOR_GRAD5, string);
return 1;
}
if(GetPlayerMoney(playerid) > SBizzInfo[b][sbBuyPrice])
{
if(PlayerInfo[playerid][pPassport] == 1)
{
PlayerInfo[playerid][pPbiskey] = b+100;
SBizzInfo[b][sbOwned] = 1;
strmid(SBizzInfo[b][sbOwner], sendername, 0, strlen(sendername), 255);
SafeGivePlayerMoney(playerid,-SBizzInfo[b][sbBuyPrice]);
PlayerPlayMusic(playerid);
SendClientMessage(playerid, COLOR_WHITE, "Congratulations, On Your New Purchase.");
SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new business help section.");
OnPropUpdate(3,b);
OnPlayerUpdateEx(playerid);
OnPropTextdrawUpdate(3, b);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /buybiz",d,m,y,h,mi,s,sendername);
CommandLog(string);
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "* For security reasons, a passport is needed to buy a business!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");
return 1;
}
}
}
for(new b = 0; b < sizeof(BizzInfo); b++)
{
if(IsPlayerInRangeOfPoint(playerid, 2, BizzInfo[b][bEntranceX], BizzInfo[b][bEntranceY], BizzInfo[b][bEntranceZ]) && BizzInfo[b][bOwned] == 0)
{
if(PlayerInfo[playerid][pLevel] < BizzInfo[b][bLevelNeeded])
{
format(string, sizeof(string), "You Must Be Level %d To Purchase This",BizzInfo[b][bLevelNeeded]);
SendClientMessage(playerid, COLOR_GRAD5, string);
return 1;
}
if(GetPlayerMoney(playerid) > BizzInfo[b][bBuyPrice])
{
PlayerInfo[playerid][pPbiskey] = b;
BizzInfo[b][bOwned] = 1;
strmid(BizzInfo[b][bOwner], sendername, 0, strlen(sendername), 255);
SafeGivePlayerMoney(playerid,-BizzInfo[b][bBuyPrice]);
PlayerPlayMusic(playerid);
SafeSetPlayerInterior(playerid,BizzInfo[b][bInterior]);
SetPlayerVirtualWorld(playerid,BizzInfo[b][bVirWorld]);
PlayerInfo[playerid][pInteriorNr] = BizzInfo[b][bInteriorNr];
SafeSetPlayerPos(playerid,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]);
GameTextForPlayer(playerid, "~w~Welcome~n~You can exit at any time by moving to this door and typing /exit", 5000, 3);
PlayerInfo[playerid][pLocal] = b ;
SendClientMessage(playerid, COLOR_WHITE, "Congratulations, On Your New Purchase.");
SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new business help section.");
OnPropUpdate(2,b);
OnPlayerUpdateEx(playerid);
OnPropTextdrawUpdate(2, b);
BizzEntered[playerid] = b;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");
return 1;
}
}
}
}
return 1;
}
if(strcmp(cmd, "/sellbiz", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pPbiskey] == 9998)
{
SendClientMessage(playerid, COLOR_WHITE, "* You don't own a bizz.");
return 1;
}
if(PlayerInfo[playerid][pMarried] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "* You are Married, can't sell the Bizz !");
return 1;
}
if(CanSellBizz[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "You can't sell the bizz without first authorizing it at /account panel!");
return 1;
}
if(PlayerInfo[playerid][pPbiskey] >= 100 && strcmp(playername, SBizzInfo[PlayerInfo[playerid][pPbiskey]-100][sbOwner], true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey]-100;
SafeGivePlayerMoney(playerid,SBizzInfo[bouse][sbBuyPrice]);
SafeGivePlayerMoney(playerid,SBizzInfo[bouse][sbTill]);
SBizzInfo[bouse][sbLocked] = 1;
SBizzInfo[bouse][sbOwned] = 0;
strmid(SBizzInfo[bouse][sbOwner], "The State", 0, strlen("The State"), 255);
strmid(SBizzInfo[bouse][sbExtortion], "No-one", 0, strlen("No-one"), 255);
//ConsumingMoney[playerid] = 1;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d + $%d", SBizzInfo[bouse][sbBuyPrice], SBizzInfo[bouse][sbTill]);
GameTextForPlayer(playerid, string, 10000, 3);
SBizzInfo[bouse][sbTill] = 0;
PlayerInfo[playerid][pPbiskey] = 255;
OnPropUpdate(3,bouse);
OnPlayerUpdateEx(playerid);
OnPropTextdrawUpdate(3, bouse);
return 1;
}
if(strcmp(playername, BizzInfo[PlayerInfo[playerid][pPbiskey]][bOwner], true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey];
BizzInfo[bouse][bLocked] = 1;
BizzInfo[bouse][bOwned] = 0;
strmid(BizzInfo[bouse][bOwner], "The State", 0, strlen("The State"), 255);
strmid(BizzInfo[bouse][bExtortion], "No-one", 0, strlen("No-one"), 255);
//ConsumingMoney[playerid] = 1;
SafeGivePlayerMoney(playerid,BizzInfo[bouse][bBuyPrice]);
SafeGivePlayerMoney(playerid,BizzInfo[bouse][bTill]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d + $%d", BizzInfo[bouse][bBuyPrice], BizzInfo[bouse][bTill]);
GameTextForPlayer(playerid, string, 10000, 3);
BizzInfo[bouse][bTill] = 0;
PlayerInfo[playerid][pPbiskey] = 9999;
OnPropUpdate(2, bouse);
OnPlayerUpdateEx(playerid);
OnPropTextdrawUpdate(2, bouse);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You don't own a business.");
}
}