20.10.2013, 11:45
I have a problem
If i try to make new biz and i try to set same interior that other biz has it cant let me have same interior on multiple business. EX: Business 1 has int 1, I try to edit Business 2 to int 1, but if i /exit business i tp to business 1.
If i try to make new biz and i try to set same interior that other biz has it cant let me have same interior on multiple business. EX: Business 1 has int 1, I try to edit Business 2 to int 1, but if i /exit business i tp to business 1.
pawn Код:
CMD:bedit(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 4)
{
SendClientMessageEx(playerid, COLOR_RED, "You are not authorized to use that command!");
return 1;
}
new choice[32],bizid,ammount;
if(sscanf(params,"s[32]dD",choice,bizid,ammount))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /bedit [name] [bizid] [(optional)ammount]");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, Price, Robprice, Input, Type, Lock");
return 1;
}
if(bizid > 500 || bizid < 0) return SendClientMessageEx( playerid, COLOR_WHITE, "Biz id must be from 0 till 500");
if(strcmp(choice,"interior",true) == 0)
{
GetPlayerPos(playerid,BizInfo[bizid][bInteriorX],BizInfo[bizid][bInteriorY],BizInfo[bizid][bInteriorZ]);
GetPlayerFacingAngle(playerid,BizInfo[bizid][bInteriorA]);
BizInfo[bizid][bInterior] = GetPlayerInterior(playerid);
BizInfo[bizid][bInteriorVw] = bizid+5000;
BizInfo[bizid][bLock] = 1;
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the interior!" );
if(BizInfo[bizid][bOwned] != 1 && BizInfo[bizid][bOwned] != 0)
{
BizInfo[bizid][bOwned] = 0;
format(BizInfo[bizid][bOwner],128,"Nobody");
strmid(BizInfo[bizid][bName],"Unnamed",0,7,255);
BizInfo[bizid][bLock] = 1;
}
SaveBiz();
LoadBiz();
return 1;
}
else if(strcmp(choice,"exterior",true) == 0)
{
GetPlayerPos(playerid,BizInfo[bizid][bExteriorX],BizInfo[bizid][bExteriorY],BizInfo[bizid][bExteriorZ]);
GetPlayerFacingAngle(playerid,BizInfo[bizid][bExteriorA]);
BizInfo[bizid][bExteriorVw] = GetPlayerVirtualWorld(playerid);
BizInfo[bizid][bLock] = 1;
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the exterior!" );
if(BizInfo[bizid][bOwned] != 1 && BizInfo[bizid][bOwned] != 0)
{
BizInfo[bizid][bOwned] = 0;
format(BizInfo[bizid][bOwner],128,"Nobody");
strmid(BizInfo[bizid][bName],"Unnamed",0,7,255);
BizInfo[bizid][bLock] = 1;
}
SaveBiz();
LoadBiz();
}
else if(strcmp(choice,"price",true) == 0)
{
BizInfo[bizid][bPrice] = ammount;
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the price!" );
if(BizInfo[bizid][bOwned] != 1 && BizInfo[bizid][bOwned] != 0)
{
BizInfo[bizid][bOwned] = 0;
format(BizInfo[bizid][bOwner],128,"Nobody");
strmid(BizInfo[bizid][bName],"Unnamed",0,7,255);
BizInfo[bizid][bLock] = 1;
}
SaveBiz();
LoadBiz();
}
else if(strcmp(choice,"robprice",true) == 0)
{
BizInfo[bizid][bRobPrice] = ammount;
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the rob price!" );
if(BizInfo[bizid][bOwned] != 1 && BizInfo[bizid][bOwned] != 0)
{
BizInfo[bizid][bOwned] = 0;
format(BizInfo[bizid][bOwner],128,"Nobody");
strmid(BizInfo[bizid][bName],"Unnamed",0,7,255);
BizInfo[bizid][bLock] = 1;
}
SaveBiz();
LoadBiz();
}
else if(strcmp(choice,"input",true) == 0)
{
BizInfo[bizid][bInput] = ammount;
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the input(biz money) value !");
if(BizInfo[bizid][bOwned] != 1 && BizInfo[bizid][bOwned] != 0)
{
BizInfo[bizid][bOwned] = 0;
format(BizInfo[bizid][bOwner],128,"Nobody");
strmid(BizInfo[bizid][bName],"Unnamed",0,7,255);
BizInfo[bizid][bLock] = 1;
}
SaveBiz();
LoadBiz();
}
else if(strcmp(choice,"type",true) == 0)
{
if(ammount < 1 || ammount > 4) return SendClientMessageEx( playerid, COLOR_WHITE, "Business types: 1 clothes shop / 2 ammunation / 3 crack lab / 4 resturant");
BizInfo[bizid][bType] = ammount;
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the type !");
if(BizInfo[bizid][bOwned] != 1 && BizInfo[bizid][bOwned] != 0)
{
BizInfo[bizid][bOwned] = 0;
format(BizInfo[bizid][bOwner],128,"Nobody");
strmid(BizInfo[bizid][bName],"Unnamed",0,7,255);
BizInfo[bizid][bLock] = 1;
}
SaveBiz();
LoadBiz();
}
else if(strcmp(choice,"lock",true) == 0)
{
if(ammount != 1 && ammount == 0) return SendClientMessage(playerid,COLOR_WHITE,"Ammount must be 1/2");
if(ammount == 1)
{
BizInfo[bizid][bLock] = 1;
GameTextForPlayer(playerid,"~g~ Business ~r~ Locked",2000,3);
SaveBiz();
}else{
BizInfo[bizid][bLock] = 0;
GameTextForPlayer(playerid,"~g~ Business ~r~ Unlocked",2000,3);
SaveBiz();
}
}
return 1;
}