[Pomoc] /buybiz /sellbiz

Započeo Artieâ„¢, Februar 10, 2012, 21:50:55 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 3 gostiju pregledaju ovu temu.

Skripta koju koristim:Ravens RolePlay
Detaljan opis problema:Imam bug kada igrac kupi biznis sa /buybiz  sve  fino i tako proda sa /sellbiz i kada oce ne ki drugi kupiti na /buybiz pise da vec posjeduje biznis i da ga treba prodati i opet idem sellbiz ,pise da je prodan ali nikako da novi kupim :P
Dio skripte:
Evo Buybiz i Sellbiz:   (ako jos nesto treba recite )
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] != 9999)
{
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] == 9999)
{
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, "Nemozete prodati biznis bez dozvole /nalog!");
        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~ Prodali ste vas biznis za~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.");
}
}

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] -> /sellbiz",d,m,y,h,mi,s,sendername);
CommandLog(string);
return 1;
}

Neke slike/video za lakse dobivanje pomoci(neobavezno): /

ja msm da vi ovako trebalo da radi
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] != 9999)
{
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] == 9999)
{
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, "Nemozete prodati biznis bez dozvole /nalog!");
        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~ Prodali ste vas biznis za~n~~g~$%d + $%d", SBizzInfo[bouse][sbBuyPrice], SBizzInfo[bouse][sbTill]);
GameTextForPlayer(playerid, string, 10000, 3);
SBizzInfo[bouse][sbTill] = 0;
PlayerInfo[playerid][pPbiskey] = 9999;
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.");
}
}

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] -> /sellbiz",d,m,y,h,mi,s,sendername);
CommandLog(string);
return 1;
}

probaj ovo:
   

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] != 255)
{
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(PlayerToPoint(2.0, playerid, 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])
{
    Delete3DTextLabel(Text3D:sbizsale);
PlayerInfo[playerid][pPbiskey] = b+100;
SBizzInfo[b][sbOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
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.");
Delete3DTextLabel(Text3D:sbizsale);
                        DateProp(playerid);
OnPropUpdate();
OnPlayerUpdate(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");
return 1;
}
}
}
Poslednja Izmena: Februar 11, 2012, 10:50:22 PRE PODNE od [SAMP]er

Citat: [SAMP]er poslato Februar 11, 2012, 10:48:50 PRE PODNE
probaj ovo:
   

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] != 255)
{
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(PlayerToPoint(2.0, playerid, 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])
{
    Delete3DTextLabel(Text3D:sbizsale);
PlayerInfo[playerid][pPbiskey] = b+100;
SBizzInfo[b][sbOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
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.");
Delete3DTextLabel(Text3D:sbizsale);
                        DateProp(playerid);
OnPropUpdate();
OnPlayerUpdate(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");
return 1;
}
}
}

ja msm da ti to nece funkcionisati jer pogledaj njegove kodove on koristi             
if(PlayerInfo[playerid][pPbiskey] != 9999)
a ti si koristio
if(PlayerInfo[playerid][pPbiskey] != 255)
mogao bi tako nastati problem ako je on u celom gm koristio 9999
Poslednja Izmena: Februar 11, 2012, 11:00:15 PRE PODNE od nemanjatesic96

nemanja ovo tvoje je pomoglo hvala ,ali imam drugi problem kako da stavim spawn money da odredjenu cifru a ne random,ja stavio ono setplayer Money na 500 $ ali ono opet random fura kad se svaki koristnik regustruje neki dobiju i po 2 miliona :P stavuci neki dio skripte ako treba

Citat: â–º[BK:RP]Woozieâ—,, poslato Februar 11, 2012, 21:39:32 POSLE PODNE
nemanja ovo tvoje je pomoglo hvala ,ali imam drugi problem kako da stavim spawn money da odredjenu cifru a ne random,ja stavio ono setplayer Money na 500 $ ali ono opet random fura kad se svaki koristnik regustruje neki dobiju i po 2 miliona :P stavuci neki dio skripte ako treba
http://wiki.sa-mp.com/wiki/GivePlayerMoney
mozda ti to pomogne?

nije pomoglo treba mi da znaci kad igrac se registruje i kad ga spawn da dobije odredjenu sumu novca npr 1000$ ja to stavbim u ono giveplayermoney ali isto kod da nisam radilo mi je kad sam imo GF a u ravensu nece ono samo svakom igracu daje razlicito novca pa nekima i po nekoliko miliona ali msm da je do regular ranka ili tako nesto nemogu rjesii nikako :/