Jeka1999
Умник
Ко всем new добавляем:
И ещё:
В public OnGameModeExit добавим:
В public OnGameModeInit:
И чуть ниже тоже в public OnGameModeInit:
Создадим сами объекты гаражей (OnGameModeInit)
Ко всем коммандам OnPlayerCommandText:
Следующая команда:
Создадим паблик в конце мода:
И еще:
Автор работы Medison
PHP:
new garage1;
new garage2;
new garage3;
new garage4;
new garage5;
new garage6;
new garage7;
new garage8;
new garage9;
new garage10;
new garage11;
new garage12;
new garage13;
new garage14;
PHP:
new Text3D:GARAGES[25];
new GarageInfo[25][gInfo];
PHP:
SaveGarage();
PHP:
LoadGarage();
PHP:
new text[128];
for(new h = 0; h < sizeof(GarageInfo); h++)
{
if(GarageInfo[h][gOwned] == 1)
{
format(text, sizeof(text), "%s \n Владелец: %s ",GarageInfo[h][gMessage],GarageInfo[h][gOwner]);
}
else
{
format(text, sizeof(text), "%s \n Продается \n Стоимость: $%d ",GarageInfo[h][gMessage],GarageInfo[h][gBuyPrice]);
}
GARAGES[h] = CreateDynamic3DTextLabel(text, COLOR_LIGHTRED, GarageInfo[h][gEntranceX], GarageInfo[h][gEntranceY], GarageInfo[h][gEntranceZ]+0.75,20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
}
PHP:
CreateObject(17950,1499.3559570313,-1486.1999511719,14.801565170288,0,0,180);
CreateObject(17950,1506.4881591797,-1486.1999511719,14.803000450134,0,0,180);
CreateObject(17950,1513.6527099609,-1486.1999511719,14.803999900818,0,0,180);
CreateObject(17950,1520.7587890625,-1486.1999511719,14.803400039673,0,0,179.99450683594);
CreateObject(17950,1527.8992919922,-1486.1999511719,14.803000450134,0,0,180);
CreateObject(17950,1535.0299072266,-1486.1999511719,14.810000419617,0,0,179.99450683594);
CreateObject(17950,1542.1708984375,-1486.1999511719,14.801164627075,0,0,179.99450683594);
CreateObject(17950,1551.3522949219,-1503.3924560547,14.809371948242,0,0,89.994506835938);
CreateObject(17950,1551.3522949219,-1496.2099609375,14.805358886719,0,0,89.494506835938);
CreateObject(17950,1560.1518554688,-1496.2307128906,14.809425354004,0,0,269.25);
CreateObject(17950,1560.1149902344,-1503.4578857422,14.809440612793,0,0,269.24743652344);
CreateObject(17950,1560.0689697266,-1510.6296386719,14.806112289429,0,0,269.24743652344);
CreateObject(17950,1560.0090332031,-1517.7648925781,14.806112289429,0,0,270);
CreateObject(17950,1559.9251708984,-1524.9033203125,14.806112289429,0,0,270);
garage1 = CreateObject(7891,1564.3150634766,-1524.8387451172,14.019672393799,0,0,0);
garage2 =CreateObject(7891,1564.3669433594,-1517.740234375,14.019672393799,0,0,0);
garage3 =CreateObject(7891,1564.3828125,-1510.560546875,14.019672393799,0,0,0);
garage4 =CreateObject(7891,1564.4260253906,-1503.7352294922,14.019672393799,0,0,0);
garage5 =CreateObject(7891,1564.4633789063,-1496.1608886719,14.019672393799,0,0,0);
garage6 =CreateObject(7891,1547.2352294922,-1503.0943603516,14.019672393799,0,0,0);
garage7 =CreateObject(7891,1547.2856445313,-1496.2419433594,14.019672393799,0,0,0);
garage8 =CreateObject(7891,1542.087890625,-1490.3194580078,14.019672393799,0,0,90);
garage9 =CreateObject(7891,1535.0943603516,-1490.2561035156,14.019672393799,0,0,90);
garage10 =CreateObject(7891,1527.9077148438,-1490.2917480469,14.019672393799,0,0,90);
garage11 =CreateObject(7891,1520.7154541016,-1490.3228759766,14.019672393799,0,0,90);
garage12 =CreateObject(7891,1513.5593261719,-1490.1380615234,14.019672393799,0,0,90);
garage13 =CreateObject(7891,1506.4013671875,-1490.3400878906,14.019672393799,0,0,90);
garage14 =CreateObject(7891,1499.5157470703,-1490.2075195313,14.019672393799,0,0,90);
PHP:
if(strcmp(cmd, "/garageopen", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new i = 0; i < sizeof(GarageInfo); i++)
{
if (PlayerToPoint(3, playerid,GarageInfo[i][gEntranceX], GarageInfo[i][gEntranceY], GarageInfo[i][gEntranceZ]))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(strcmp(sendername, GarageInfo[i][gOwner], true) == 0)
{
if(PlayerToPoint(3,playerid,1564.9673,-1521.4608,13.5478))// Гараж 1
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
MoveObject(garage1,1564.3150634766,-1524.8387451172,10.219692230225,1.0);
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
SaveGarage();
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
MoveObject(garage1,1564.3150634766,-1524.8387451172,14.019672393799,1.0);
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
SaveGarage();
return 1;
}
}
if(PlayerToPoint(3,playerid,1565.0839,-1514.5587,13.5533))// Гараж 2
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
MoveObject(garage2,1564.3669433594,-1517.740234375,10.219692230225,1.0 );
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
MoveObject(garage2,1564.3669433594,-1517.740234375,14.019672393799 ,1.0);
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
}
if(PlayerToPoint(3,playerid,1565.1310,-1507.1455,13.5551))// Гараж 3
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
MoveObject(garage3,1564.3828125,-1510.560546875,10.219692230225,1.0 );
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
MoveObject(garage3,1564.3828125,-1510.560546875,14.019672393799,1.0 );
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
}
if(PlayerToPoint(3,playerid,1565.1655,-1499.7600,13.5575))// Гараж 4
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
MoveObject(garage4,1564.4260253906,-1503.7352294922,10.219692230225,1.0 );
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
MoveObject(garage4,1564.4260253906,-1503.7352294922,14.019672393799,1.0 );
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
}
if(PlayerToPoint(3,playerid,1565.1267,-1493.0179,13.5575))// Гараж 5
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage5,1564.4633789063,-1496.1608886719,10.219692230225,1.0);
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage5, 1564.4633789063,-1496.1608886719,14.019672393799,1.0);
return 1;
}
}
if(PlayerToPoint(3,playerid,1546.4457,-1500.0793,13.5547))// Гараж 6
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage6,1547.2352294922,-1503.0943603516,10.219692230225 ,1.0);
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage6,1547.2352294922,-1503.0943603516,14.019672393799 ,1.0);
return 1;
}
}
if(PlayerToPoint(3,playerid,1546.3441,-1492.8171,13.5547))// Гараж 7
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage7,1547.2856445313,-1496.2419433594,10.219692230225 ,1.0);
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage7,1547.2856445313,-1496.2419433594,14.019672393799 ,1.0);
return 1;
}
}
if(PlayerToPoint(3,playerid,1538.2357,-1491.3818,13.5608))// Гараж 8
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage8,1542.087890625,-1490.3194580078,10.219692230225,1.0 );
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage8, 1542.087890625,-1490.3194580078,14.019672393799,1.0);
return 1;
}
}
if(PlayerToPoint(3,playerid,1531.3519,-1491.4126,13.5608))// Гараж 9
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage9, 1535.0943603516,-1490.2561035156,10.219692230225,1.0);
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage9, 1535.0943603516,-1490.2561035156,14.019672393799,1.0);
return 1;
}
}
if(PlayerToPoint(3,playerid,1524.0123,-1491.3462,13.5608))// Гараж 10
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage10,1527.9077148438,-1490.2917480469,10.219692230225 ,1.0);
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage10,1527.9077148438,-1490.2917480469,14.019672393799,1.0 );
return 1;
}
}
if(PlayerToPoint(3,playerid,1517.2207,-1491.4475,13.5609))// Гараж 11
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage11,1520.7154541016,-1490.3228759766,10.219692230225,1.0 );
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage11,1520.7154541016,-1490.3228759766,14.019672393799,1.0 );
return 1;
}
}
if(PlayerToPoint(3,playerid,1509.7026,-1491.0603,13.5607))// Гараж 12
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage12,1513.5593261719,-1490.1380615234,10.219692230225,1.0 );
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage12,1513.5593261719,-1490.1380615234,14.019672393799,1.0 );
return 1;
}
}
if(PlayerToPoint(3,playerid,1503.1354,-1491.3903,13.5608))// Гараж 13
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage13,1506.4013671875,-1490.3400878906,10.219692230225,1.0 );
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage13,1506.4013671875,-1490.3400878906,14.019672393799,1.0 );
return 1;
}
}
if(PlayerToPoint(3,playerid,1496.0372,-1491.1788,13.5535))// Гараж 14
{
if(GarageInfo[i][gLocked] == 1)
{
GarageInfo[i][gLocked] = 0;
GameTextForPlayer(playerid, "~w~Garage ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage14,1499.5157470703,-1490.2075195313,10.219692230225,1.0 );
return 1;
}
if(GarageInfo[i][gLocked] == 0)
{
GarageInfo[i][gLocked] = 1;
GameTextForPlayer(playerid, "~w~Garage ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
MoveObject(garage14,1499.5157470703,-1490.2075195313,14.019672393799,1.0 );
return 1;
}
}
}
else
{
GameTextForPlayer(playerid, "~r~You Dont Have A Key", 5000, 6);
return 1;
}
}
}
}
return 1;
}
PHP:
if(strcmp(cmd, "/creategarage", true) == 0)
{
if (PlayerInfo[playerid][pAdmin] >= 4)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, " Команда: - /creategarage [ид]");
return 1;
}
new id = strval(tmp);
tmp = strtok(cmdtext, idx);
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
GarageInfo[id][gEntranceX] = x;
GarageInfo[id][gEntranceY] = y;
GarageInfo[id][gEntranceZ] = z;
SaveGarage();
SendClientMessage(playerid, COLOR_WHITE, " Гараж перенесён");
return 1;
}
}
PHP:
if(strcmp(cmd, "/garage", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 871.63726800,2019.44152800,11.51383100))
{
if(PlayerInfo[playerid][pFMember] == 5)
{
if(emegar1o == 0)
{
MoveDynamicObject(emegar1, 871.63726800,2019.44152800,13.51383100, 1.0);
emegar1o = 1;
return 1;
}
else if(emegar1o == 1)
{
MoveDynamicObject(emegar1, 871.63726800,2019.44152800,11.31386500, 1.0);
emegar1o = 0;
return 1;
}
}
}
if(IsPlayerInRangeOfPoint(playerid, 3.0, 875.60998500,2032.74890100,11.01383900))
{
if(PlayerInfo[playerid][pFMember] == 5)
{
if(emegar2o == 0)
{
MoveDynamicObject(emegar2, 875.60998500,2032.74890100,13.01383900, 1.0);
emegar2o = 1;
return 1;
}
else if(emegar2o == 1)
{
MoveDynamicObject(emegar2, 875.60998500,2032.74890100,11.33886400, 1.0);
emegar2o = 0;
return 1;
}
}
}
if(IsPlayerInRangeOfPoint(playerid, 3.0, 883.66790800,2000.85937500,11.46380900))
{
if(PlayerInfo[playerid][pFMember] == 5)
{
if(emegar3o == 0)
{
MoveDynamicObject(emegar3, 883.66790800,2000.85937500,13.46380900, 1.0);
emegar3o = 1;
return 1;
}
else if(emegar3o == 1)
{
MoveDynamicObject(emegar3, 883.66790800,2000.85937500,11.31384200, 1.0);
emegar3o = 0;
return 1;
}
}
}
if(IsPlayerInRangeOfPoint(playerid, 3.0, 870.35479700,2004.81787100,11.33886400))
{
if(PlayerInfo[playerid][pFMember] == 5)
{
if(emegar4o == 0)
{
MoveDynamicObject(emegar4, 870.35479700,2004.76782200,12.98883900, 1.0);
emegar4o = 1;
return 1;
}
else if(emegar4o == 1)
{
MoveDynamicObject(emegar4, 870.35479700,2004.81787100,11.33886400, 1.0);
emegar4o = 0;
return 1;
}
}
}
}
PHP:
if(strcmp(cmd, "/setgarageowner", true) == 0)
{
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "ИНФО: /setgarageowner [ID/Имя]");
return 1;
}
if(IsPlayerConnected(playerid))
{
if(IsPlayerConnected(giveplayerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
GetPlayerName(giveplayerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new sb = 0; sb < sizeof(GarageInfo); sb++)
{
if(PlayerToPoint(2.0, playerid, GarageInfo[sb][gEntranceX], GarageInfo[sb][gEntranceY], GarageInfo[sb][gEntranceZ]) && GarageInfo[sb][gOwned] == 0)
{
if(PlayerInfo[playerid][pJob] != 13)
{
SendClientMessage(playerid, COLOR_WHITE, "Вы не можете провести данную операцию.");
return 1;
}
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
new account = PlayerInfo[giveplayerid][pAccount];
if(account > GarageInfo[sb][gBuyPrice])
{
GarageInfo[sb][gOwned] = 1;
GetPlayerName(giveplayerid, sendername, sizeof(sendername));
strmid(GarageInfo[sb][gOwner], sendername, 0, strlen(sendername), 32);
PlayerInfo[giveplayerid][pAccount] = account - GarageInfo[sb][gBuyPrice];
Economica[Economic] += GarageInfo[sb][gBuyPrice];
ScriptMoney[giveplayerid] = 1;
Treasury += GarageInfo[sb][gBuyPrice];
PlayerPlayMusic(giveplayerid);
SendClientMessage(giveplayerid, COLOR_WHITE, "Поздравляем! Теперь Вы владелец этого Гаража!");
SendClientMessage(giveplayerid, COLOR_WHITE, "Введите /help чтобы узнать побольше.");
format(string, sizeof(string), "* Вы успешно продали гараж %s за $%d", sendername, GarageInfo[sb][gBuyPrice]);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Вы приобрели гараж стоимостью $%d. Эта сумма снята с Вашего счёта.", GarageInfo[sb][gBuyPrice]);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
ScriptMoney[playerid] = 1;
SaveGarage();
SavePlayer(giveplayerid);
new text[128];
format(text, sizeof(text), "%s \n Владелец: %s ",GarageInfo[sb][gMessage],GarageInfo[sb][gOwner]);
UpdateDynamic3DTextLabelText(GARAGES[sb], COLOR_LIGHTRED, text);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "У Игрока на счету не достаточно денег!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Этот человек далеко от вас!");
return 1;
}
}
}
}
return 1;
}
return 1;
}
PHP:
if(strcmp(cmd, "/asellgarage", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "ИНФО: /asellgarage [garageid]");
return 1;
}
new sbiz = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 4 && AdminDuty[playerid] == 1)
{
GarageInfo[sbiz][gLocked] = 1;
GarageInfo[sbiz][gOwned] = 0;
strmid(GarageInfo[sbiz][gOwner], "The State", 0, strlen("The State"), 16);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~You have sold the Garage");
GameTextForPlayer(playerid, string, 10000, 3);
OnPropUpdate();
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Вы не администратор.");
}
}
return 1;
}
PHP:
if(strcmp(cmd, "/sellgarage", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
for(new i = 0; i < sizeof(GarageInfo); i++)
{
if (PlayerToPoint(3, playerid,GarageInfo[i][gEntranceX], GarageInfo[i][gEntranceY], GarageInfo[i][gEntranceZ]))
{
if(strcmp(sendername, SBizzInfo[i][sbOwner], true) == 0)
{
new ppay = GarageInfo[i][gBuyPrice];
GivePlayerCash(playerid, ppay);
Economica[Economic] -= ppay;
ScriptMoney[playerid] = 1;
GarageInfo[i][gLocked] = 1;
GarageInfo[i][gOwned] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(GarageInfo[i][gOwner], "The State", 0, strlen("The State"), 16);
ConsumingMoney[playerid] = 1;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SaveGarage();
SavePlayer(giveplayerid);
new text[128];
format(text, sizeof(text), "%s \n Продаётся \n Стоимость: $%d ",GarageInfo[i][gMessage],GarageInfo[i][gBuyPrice]);
UpdateDynamic3DTextLabelText(GARAGES[i], COLOR_LIGHTRED, text);
return 1;
}
}
}
}
return 1;
}
PHP:
forward LoadGarage();
public LoadGarage()
{
new arrCoords[8][64];
new strFromFile2[256];
new File: file = fopen("garage.cfg", io_read);
if (file)
{
new idx;
while (idx < sizeof(GarageInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, '|');
GarageInfo[idx][gOwned] = strval(arrCoords[0]);
strmid(GarageInfo[idx][gOwner], arrCoords[1], 0, strlen(arrCoords[1]), 32);
strmid(GarageInfo[idx][gMessage], arrCoords[2], 0, strlen(arrCoords[2]), 64);
GarageInfo[idx][gEntranceX] = floatstr(arrCoords[3]);
GarageInfo[idx][gEntranceY] = floatstr(arrCoords[4]);
GarageInfo[idx][gEntranceZ] = floatstr(arrCoords[5]);
GarageInfo[idx][gBuyPrice] = strval(arrCoords[6]);
GarageInfo[idx][gLocked] = strval(arrCoords[7]);
idx++;
}
fclose(file);
}
return 1;
}
forward SaveGarage();
public SaveGarage()
{
new idx;
new File: file2;
idx = 0;
while (idx < sizeof(GarageInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%f|%f|%f|%d|%d\n",
GarageInfo[idx][gOwned],
GarageInfo[idx][gOwner],
GarageInfo[idx][gMessage],
GarageInfo[idx][gEntranceX],
GarageInfo[idx][gEntranceY],
GarageInfo[idx][gEntranceZ],
GarageInfo[idx][gBuyPrice],
GarageInfo[idx][gLocked]);
if(idx == 0)
{
file2 = fopen("garage.cfg", io_write);
}
else
{
file2 = fopen("garage.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
}
PHP:
public Garage1Close()
{
MoveObject(garage1,2461.255,-1424.460,24.435,2.2);
return 1;
}
public Garage2Close()
{
MoveObject(garage2,2461.281,-1413.446,24.435,2.2);
return 1;
}
public Garage3Close()
{
MoveObject(garage3,2313.632,-1261.989,24.123,2.2);
return 1;
}
public Garage4Close()
{
MoveObject(garage4,2313.582,-1267.486,24.623,2.2);
return 1;
}
public Garage5Close()
{
MoveObject(garage5,2313.490,-1272.941,24.642,2.2);
return 1;
}
public Garage6Close()
{
MoveObject(garage6,2313.630,-1278.531,24.623,2.2);
return 1;
}
public Garage7Close()
{
MoveObject(garage7,447.696,-1349.644,15.326,2.2);
return 1;
}
public Garage8Close()
{
MoveObject(garage8,443.955,-1351.923,15.320,2.2);
return 1;
}
public Garage9Close()
{
MoveObject(garage9,440.169,-1354.298,15.265,2.2);
return 1;
}
public Garage10Close()
{
MoveObject(garage10,436.200,-1356.762,15.235,2.2);
return 1;
}
public Garage11Close()
{
MoveObject(garage11,432.395,-1359.044,15.254,2.2);
return 1;
}
public Garage12Close()
{
MoveObject(garage12,428.629,-1361.364,15.274,2.2);
return 1;
}
public Garage13Close()
{
MoveObject(garage13,485.073,-1326.906,15.916,2.2);
return 1;
}
Последнее редактирование:
