18.10.2015, 04:06
Hey there, I have this Biz script from Union Gaming RP script. I edited it quite good, ( cause My scripting levels are kindda low ) - I just want the /lock command to be used by admins where all the Biz's are unlocked or locked at the same time. Here is the cmd:lock,
Код:
CMD:lock(playerid, params[])
{
new string[128], idx, done, lockdone;
if(!IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use command.");
if(PlayerInfo[playerid][pBiz])
{
idx = PlayerInfo[playerid][pBiz];
if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[PlayerInfo[playerid][pBiz]][bX], BizInfo[PlayerInfo[playerid][pBiz]][bY], BizInfo[PlayerInfo[playerid][pBiz]][bZ]))
{
if(!BizInfo[PlayerInfo[playerid][pBiz]][bStatus])
{
BizInfo[PlayerInfo[playerid][pBiz]][bStatus] = 1;
format(string, sizeof(string), "Business of %s\nBusiness type: %s\n%s", BizInfo[idx][bOwner], RBT(idx), RBS(idx));
UpdateDynamic3DTextLabelText(BizInfo[PlayerInfo[playerid][pBiz]][bText], COLOR_WHITE, string);
format(string, sizeof(string), "* %s takes out their business keys and unlocks it.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
GameTextForPlayer(playerid, "~g~Business Unlocked", 3500, 3);
}
else if(BizInfo[PlayerInfo[playerid][pBiz]][bStatus])
{
BizInfo[PlayerInfo[playerid][pBiz]][bStatus] = 0;
format(string, sizeof(string), "Business of %s\nBusiness type: %s\n%s", BizInfo[idx][bOwner], RBT(idx), RBS(idx));
UpdateDynamic3DTextLabelText(BizInfo[PlayerInfo[playerid][pBiz]][bText], COLOR_WHITE, string);
format(string, sizeof(string), "* %s takes out their business keys and locks it.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
GameTextForPlayer(playerid, "~r~Business Locked", 3500, 3);
}
done = 1;
lockdone = 1;
}
}
if(PlayerInfo[playerid][pVBiz] && !done)
{
idx = PlayerInfo[playerid][pVBiz];
if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]))
{
if(!BizInfo[idx][bStatus])
{
BizInfo[idx][bStatus] = 1;
format(string, sizeof(string), "Business of %s\nBusiness type: %s\n%s", BizInfo[idx][bOwner], RBT(idx), RBS(idx));
UpdateDynamic3DTextLabelText(BizInfo[idx][bText], COLOR_WHITE, string);
format(string, sizeof(string), "* %s takes out their business keys and unlocks it.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
GameTextForPlayer(playerid, "~g~Business Unlocked", 3500, 3);
}
else if(BizInfo[idx][bStatus])
{
BizInfo[idx][bStatus] = 0;
format(string, sizeof(string), "Business of %s\nBusiness type: %s\n%s", BizInfo[idx][bOwner], RBT(idx), RBS(idx));
UpdateDynamic3DTextLabelText(BizInfo[idx][bText], COLOR_WHITE, string);
format(string, sizeof(string), "* %s takes out their business keys and locks it.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
GameTextForPlayer(playerid, "~r~Business Locked", 3500, 3);
}
done = 1;
lockdone = 1;
}
}

