Unreal
Компетентный
Без лишних слов.
Бизнесы вырезка из RLS.
Ко всем new
Добавим в конец мода:
В OnGameModeInit
В OnPlayerDialogResponse
В конец мода ко всем Stock
В OnGameModeExit
Вообще все, команды берите с любых RLS
Файл кидайте в ScriptFiles папку Logs
З.Ы Возможно криво вырезал т.к на скорую руку и из мода сразу в тему, мб что-то упустил, не проверял.
Пишите, исправлю
Бизнесы вырезка из RLS.
Ко всем new
Код:
new enterbiz[MAX_PLAYERS];
enum bInfo{
bOwned,
bOwner[64],
bMessage[128],
bExtortion[24],
Float:bEntranceX,
Float:bEntranceY,
Float:bEntranceZ,
Float:bExitX,
Float:bExitY,
Float:bExitZ,
bBuyPrice,
bEntranceCost,
bTill,
bLocked,
bInterior,
bProducts,
bMaxProducts,
bPriceProd,
Text3D: bLabel,
b2Till,
bCena,
Float:bBarX,
Float:bBarY,
Float:bBarZ,
bMafia,
bZahvat};
new BizzInfo[19][bInfo];
Добавим в конец мода:
Код:
public CustomPickups()
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new enters[256];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, oldposx, oldposy, oldposz);
if(oldposx!=0.0 && oldposy!=0.0 && oldposz!=0.0)
{
for(new b = 0; b < sizeof(BizzInfo); b++)
{
if (PlayerToPoint(1, i,BizzInfo[b][bEntranceX], BizzInfo[b][bEntranceY], BizzInfo[b][bEntranceZ]))
{
if(BizzInfo[b][bOwned] == 0)
{
format(enters,sizeof(enters), "{FFFFFF}Вы действительно хотите приобрести этот бизнес?");
ShowPlayerDialog(i,9828,DIALOG_STYLE_MSGBOX,"Бизнес", enters, "Да", "Нет");
return true;
}
if(PlayerInfo[i][pPbiskey] == 255){}
if(b == 0 || b == 1 || b == 2|| b == 3 ||b == 4 || b == 5 || b == 6)
{
if(enterbiz[i] == 0)
{
if(BizzInfo[b][bLocked] == 1) return SendClientMessage(i, COLOR_GRAD1, "Бизнес закрыт!");
format(enters,sizeof(enters), "{FFFFFF}Желаете войти за $%d?",BizzInfo[b][bEntranceCost]);
ShowPlayerDialog(i,9898,DIALOG_STYLE_MSGBOX,"Вход", enters, "Да", "Нет");
return true;
}
else
{
SetPlayerInterior(i,BizzInfo[b][bInterior]);
SetPlayerPos(i,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]);
PlayerInfo[i][pInt] = BizzInfo[b][bInterior];
SetPlayerVirtualWorld(i,0);
}
if(PlayerInfo[i][pPbiskey] == b)
{
if(BizzInfo[b][bLocked] == 1) return SendClientMessage(i, COLOR_GRAD1, "Бизнес закрыт!");
SetPlayerInterior(i,BizzInfo[b][bInterior]);
SetPlayerPos(i,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]);
PlayerInfo[i][pInt] = BizzInfo[b][bInterior];
SetPlayerVirtualWorld(i,0);
return true;
}
}
else
{
SetPlayerInterior(i,BizzInfo[b][bInterior]);
SetPlayerPos(i,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]);
PlayerInfo[i][pInt] = BizzInfo[b][bInterior];
SetPlayerVirtualWorld(i,0);
}
}
}
}
}
}
return true;
}
Код:
for(new h = 0; h < sizeof(BizzInfo); h++){
new pickups;
if(BizzInfo[h][bOwned] == 0){
AddStaticPickup(19132, 23, BizzInfo[h][bEntranceX], BizzInfo[h][bEntranceY], BizzInfo[h][bEntranceZ]);
pickups++;
format(string2, sizeof(string2), "{00b0ff}%s\n{ffffff}Продаётся\nЦена: {faff00}%d$",BizzInfo[h][bMessage],BizzInfo[h][bBuyPrice]);
BizzInfo[h][bLocked] = 1;
BizzInfo[h][bLabel] = Create3DTextLabel("Используте команду\nв данном месте",COLOR_YELLOW,BizzInfo[h][bBarX],BizzInfo[h][bBarY],BizzInfo[h][bBarZ],20.0,0,1);
BizzInfo[h][bLabel] = Create3DTextLabel(string2,COLOR_YELLOW,BizzInfo[h][bEntranceX], BizzInfo[h][bEntranceY], BizzInfo[h][bEntranceZ],20.0,0,1);}
if(BizzInfo[h][bOwned] == 1){
AddStaticPickup(19132, 23, BizzInfo[h][bEntranceX], BizzInfo[h][bEntranceY], BizzInfo[h][bEntranceZ]);
pickups++;
format(string2,sizeof(string2), "{00b0ff}%s\n{ffffff}Владелец:{5aff00}%s", BizzInfo[h][bMessage], BizzInfo[h][bOwner]);
BizzInfo[h][bLabel] = Create3DTextLabel(string2,-1,BizzInfo[h][bEntranceX], BizzInfo[h][bEntranceY], BizzInfo[h][bEntranceZ],20.0,0,1);}}
LoadBizz();
SetTimer("CustomPickups",1000,1);
Код:
case 141:{
if(response){
new string[256];
for(new i = 0; i < sizeof(BizzInfo); i++){
if(PlayerToPoint(3,playerid,BizzInfo[i][bEntranceX],BizzInfo[i][bEntranceY],BizzInfo[i][bEntranceZ])){
for(new b = 0; b < sizeof(BizzInfo); b++){
if(BizzInfo[b][bLocked] == 1) return SendClientMessage(playerid,COLOR_WHITE,"Бизнес закрыт!");
if(PlayerInfo[playerid][pCash] < BizzInfo[i][bEntranceCost])
{
format(string,sizeof(string),"У вас нет с собой $%d чтобы заплатить за вход",BizzInfo[i][bEntranceCost]);
SendClientMessage(playerid,COLOR_WHITE,string);
return true;}
PlayerInfo[playerid][pCash] -=BizzInfo[i][bEntranceCost];
BizzInfo[i][b2Till] += BizzInfo[i][bEntranceCost];
SetPlayerInterior(playerid,BizzInfo[i][bInterior]);
SetPlayerPos(playerid,BizzInfo[i][bExitX],BizzInfo[i][bExitY],BizzInfo[i][bExitZ]);
PlayerInfo[playerid][pInt] = BizzInfo[i][bInterior];
SetPlayerVirtualWorld(playerid,0);
enterbiz[playerid] = 1;
return true;}}}}}
case 9828:
{
if(response)
{
new string[256];
new sendername[MAX_PLAYER_NAME];
new Float:oldposx, Float:oldposy, Float:oldposz;
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
if(PlayerInfo[playerid][pPbiskey] != 255) return SendClientMessage(playerid, COLOR_WHITE, "У вас уже есть бизнес, введите /sellbiz чтобы его продать.");
for(new b = 0; b < sizeof(BizzInfo); b++)
{
if(PlayerToPoint(2.0, playerid, BizzInfo[b][bEntranceX], BizzInfo[b][bEntranceY], BizzInfo[b][bEntranceZ]) && BizzInfo[b][bOwned] == 0)
{
if(PlayerInfo[playerid][pCash] > BizzInfo[b][bBuyPrice])
{
PlayerInfo[playerid][pPbiskey] = b;
BizzInfo[b][bOwned] = 1;
BizzInfo[b][bLocked] = 0;
BizzInfo[b][bCena] = 100;
BizzInfo[b][bTill] = 0;
BizzInfo[b][b2Till] = 0;
PlayerInfo[playerid][pJob] = 0;
BizzInfo[b][bProducts] = 50;
BizzInfo[b][bEntranceCost] = 100;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(BizzInfo[b][bOwner], sendername, 0, strlen(sendername), 255);
PlayerInfo[playerid][pCash] -=BizzInfo[b][bBuyPrice];
SetPlayerInterior(playerid,BizzInfo[b][bInterior]);
PlayerInfo[playerid][pInt] = BizzInfo[b][bInterior];
SetPlayerPos(playerid,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]);
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pInt] = BizzInfo[b][bInterior];
PlayerInfo[playerid][pLocal] = b+99;
SendClientMessage(playerid, COLOR_GREEN, " Бизнес приобретён");
SendClientMessage(playerid, COLOR_WHITE, "Помощь по бизнесу: /help - Команды сервера - Бизнес");
format(string,sizeof(string), "{00b0ff}%s\n{ffffff}Владелец:{5aff00}%s", BizzInfo[b][bMessage], BizzInfo[b][bOwner]);
Update3DTextLabelText(BizzInfo[b][bLabel], -1, string);
OnPropUpdates();
OnPlayerUpdateRL(playerid);
return true;}
else{
SendClientMessage(playerid, COLOR_WHITE, "На Вашем счету нет столько денег!");
return true;}}}}
else{
return true;}}
Код:
case 9898: {
if(response)
{
for(new i = 0; i < sizeof(BizzInfo); i++)
{
if (PlayerToPoint(3, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
{
if(PlayerInfo[playerid][pCash] < BizzInfo[i][bEntranceCost])
{
SendClientMessage(playerid, COLOR_GRAD1,"У вас нет столько денег");
return true;
}
PlayerInfo[playerid][pCash] -=BizzInfo[i][bEntranceCost];
BizzInfo[i][b2Till] += BizzInfo[i][bEntranceCost];
SetPlayerInterior(playerid,BizzInfo[i][bInterior]);
SetPlayerPos(playerid,BizzInfo[i][bExitX],BizzInfo[i][bExitY],BizzInfo[i][bExitZ]);
PlayerInfo[playerid][pInt] = BizzInfo[i][bInterior];
SetPlayerVirtualWorld(playerid,0);
OnPlayerUpdateRL(playerid);
enterbiz[playerid] = 1;
return true;
}
}
}
else
{
return true;
}
}
Код:
stock SaveHomeSbizz(){
new idx;
new File: file2;
while (idx < sizeof(BizzInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%s|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%f|%f|%f|%d\n",
BizzInfo[idx][bOwned],
BizzInfo[idx][bOwner],
BizzInfo[idx][bMessage],
BizzInfo[idx][bExtortion],
BizzInfo[idx][bEntranceX],
BizzInfo[idx][bEntranceY],
BizzInfo[idx][bEntranceZ],
BizzInfo[idx][bExitX],
BizzInfo[idx][bExitY],
BizzInfo[idx][bExitZ],
BizzInfo[idx][bBuyPrice],
BizzInfo[idx][bEntranceCost],
BizzInfo[idx][bTill],
BizzInfo[idx][bLocked],
BizzInfo[idx][bInterior],
BizzInfo[idx][bProducts],
BizzInfo[idx][bMaxProducts],
BizzInfo[idx][bPriceProd],
BizzInfo[idx][b2Till],
BizzInfo[idx][bCena],
BizzInfo[idx][bBarX],
BizzInfo[idx][bBarY],
BizzInfo[idx][bBarZ],
BizzInfo[idx][bMafia]);
if(idx == 0)
{
file2 = fopen("logs/rezerv/bizz.cfg", io_write);
}
else
{
file2 = fopen("logs/rezerv/bizz.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return true;
}
stock OnPropUpdates()
{
new idx;
new File: file2;
while (idx < sizeof(BizzInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%s|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%f|%f|%f|%d\n",
BizzInfo[idx][bOwned],
BizzInfo[idx][bOwner],
BizzInfo[idx][bMessage],
BizzInfo[idx][bExtortion],
BizzInfo[idx][bEntranceX],
BizzInfo[idx][bEntranceY],
BizzInfo[idx][bEntranceZ],
BizzInfo[idx][bExitX],
BizzInfo[idx][bExitY],
BizzInfo[idx][bExitZ],
BizzInfo[idx][bBuyPrice],
BizzInfo[idx][bEntranceCost],
BizzInfo[idx][bTill],
BizzInfo[idx][bLocked],
BizzInfo[idx][bInterior],
BizzInfo[idx][bProducts],
BizzInfo[idx][bMaxProducts],
BizzInfo[idx][bPriceProd],
BizzInfo[idx][b2Till],
BizzInfo[idx][bCena],
BizzInfo[idx][bBarX],
BizzInfo[idx][bBarY],
BizzInfo[idx][bBarZ],
BizzInfo[idx][bMafia]);
if(idx == 0)
{
file2 = fopen("logs/bizz.cfg", io_write);
}
else
{
file2 = fopen("logs/bizz.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return true;
}
Код:
stock LoadBizz()
{
new arrCoords[24][64];
new strFromFile2[256];
new File: file = fopen("logs/bizz.cfg", io_read);
if (file)
{
new idx;
while (idx < sizeof(BizzInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, '|');
BizzInfo[idx][bOwned] = strval(arrCoords[0]);
strmid(BizzInfo[idx][bOwner], arrCoords[1], 0, strlen(arrCoords[1]), 255);
strmid(BizzInfo[idx][bMessage], arrCoords[2], 0, strlen(arrCoords[2]), 255);
strmid(BizzInfo[idx][bExtortion], arrCoords[3], 0, strlen(arrCoords[3]), 255);
BizzInfo[idx][bEntranceX] = floatstr(arrCoords[4]);
BizzInfo[idx][bEntranceY] = floatstr(arrCoords[5]);
BizzInfo[idx][bEntranceZ] = floatstr(arrCoords[6]);
BizzInfo[idx][bExitX] = floatstr(arrCoords[7]);
BizzInfo[idx][bExitY] = floatstr(arrCoords[8]);
BizzInfo[idx][bExitZ] = floatstr(arrCoords[9]);
BizzInfo[idx][bBuyPrice] = strval(arrCoords[10]);
BizzInfo[idx][bEntranceCost] = strval(arrCoords[11]);
BizzInfo[idx][bTill] = strval(arrCoords[12]);
BizzInfo[idx][bLocked] = strval(arrCoords[13]);
BizzInfo[idx][bInterior] = strval(arrCoords[14]);
BizzInfo[idx][bProducts] = strval(arrCoords[15]);
BizzInfo[idx][bMaxProducts] = strval(arrCoords[16]);
BizzInfo[idx][bPriceProd] = strval(arrCoords[17]);
BizzInfo[idx][b2Till] = strval(arrCoords[18]);
BizzInfo[idx][bCena] = strval(arrCoords[19]);
BizzInfo[idx][bBarX] = floatstr(arrCoords[20]);
BizzInfo[idx][bBarY] = floatstr(arrCoords[21]);
BizzInfo[idx][bBarZ] = floatstr(arrCoords[22]);
BizzInfo[idx][bMafia] = strval(arrCoords[23]);
//BizzInfo[idx][bWorld] = strval(arrCoords[19]);
idx++;
}
fclose(file);
}
return true;
}
PHP:
SaveHomeSbizz();
Вообще все, команды берите с любых RLS
Файл кидайте в ScriptFiles папку Logs
Чтобы видеть скрытое содержание Зарегистрируйтесь на форуме!
З.Ы Возможно криво вырезал т.к на скорую руку и из мода сразу в тему, мб что-то упустил, не проверял.
Пишите, исправлю
