02.04.2013, 18:00
Решил недавно данную проблему но она появилась снова!Только теперь не могут ездить LCN и Russian Mafia...
Всё нормально но не могу понять что такое:
Переменные!
Проверка на мафию
Загрузка каров из файла:
Загрузка из файла
public OnPlayerStateChange
Всё нормально но не могу понять что такое:
Переменные!
PHP код:
new RmInfo[8][gInfo];
new rmcar[8];
new lcnInfo[8][gInfo];
new lcncar[8];
PHP код:
if(carid >= rmcar[0] && carid <= rmcar[7])
{
}
else
{
if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
{
SendClientMessage(playerid,COLOR_WHITE,"{f9b0b0}x {FFFFFF}10Вы не можете управлять данным транспортом!");
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
}
}
if(carid >= lcncar[0] && carid <= lcncar[7])
{
}
else
{
if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5)
{
SendClientMessage(playerid,COLOR_WHITE,"{f9b0b0}x {FFFFFF}8Вы не можете управлять данным транспортом!");
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
}
}
PHP код:
Loadlcn();
print("Динамическое авто La Cosa Nostre загружено.");
lcncar[0] = CreateVehicle(lcnInfo[0][gModel], lcnInfo[0][gPosX], lcnInfo[0][gPosY], lcnInfo[0][gPosZ], lcnInfo[0][gAngle], lcnInfo[0][gColor1], lcnInfo[0][gColor2],600);
lcncar[1] = CreateVehicle(lcnInfo[1][gModel], lcnInfo[1][gPosX], lcnInfo[1][gPosY], lcnInfo[1][gPosZ], lcnInfo[1][gAngle], lcnInfo[1][gColor1], lcnInfo[1][gColor2],600);
lcncar[2] = CreateVehicle(lcnInfo[2][gModel], lcnInfo[2][gPosX], lcnInfo[2][gPosY], lcnInfo[2][gPosZ], lcnInfo[2][gAngle], lcnInfo[2][gColor1], lcnInfo[2][gColor2],600);
lcncar[3] = CreateVehicle(lcnInfo[3][gModel], lcnInfo[3][gPosX], lcnInfo[3][gPosY], lcnInfo[3][gPosZ], lcnInfo[3][gAngle], lcnInfo[3][gColor1], lcnInfo[3][gColor2],600);
lcncar[4] = CreateVehicle(lcnInfo[4][gModel], lcnInfo[4][gPosX], lcnInfo[4][gPosY], lcnInfo[4][gPosZ], lcnInfo[4][gAngle], lcnInfo[4][gColor1], lcnInfo[4][gColor2],600);
lcncar[5] = CreateVehicle(lcnInfo[5][gModel], lcnInfo[5][gPosX], lcnInfo[5][gPosY], lcnInfo[5][gPosZ], lcnInfo[5][gAngle], lcnInfo[5][gColor1], lcnInfo[5][gColor2],600);
lcncar[6] = CreateVehicle(lcnInfo[6][gModel], lcnInfo[6][gPosX], lcnInfo[6][gPosY], lcnInfo[6][gPosZ], lcnInfo[6][gAngle], lcnInfo[6][gColor1], lcnInfo[6][gColor2],600);
lcncar[7] = CreateVehicle(lcnInfo[7][gModel], lcnInfo[7][gPosX], lcnInfo[7][gPosY], lcnInfo[7][gPosZ], lcnInfo[7][gAngle], lcnInfo[7][gColor1], lcnInfo[7][gColor2],600);
//=============================================================================================================================================================
LoadRm();
print("Динамическое авто Russian Mafia загружено.");
rmcar[0] = CreateVehicle(RmInfo[0][gModel], RmInfo[0][gPosX], RmInfo[0][gPosY], RmInfo[0][gPosZ], RmInfo[0][gAngle], RmInfo[0][gColor1], RmInfo[0][gColor2],600);
rmcar[1] = CreateVehicle(RmInfo[1][gModel], RmInfo[1][gPosX], RmInfo[1][gPosY], RmInfo[1][gPosZ], RmInfo[1][gAngle], RmInfo[1][gColor1], RmInfo[1][gColor2],600);
rmcar[2] = CreateVehicle(RmInfo[2][gModel], RmInfo[2][gPosX], RmInfo[2][gPosY], RmInfo[2][gPosZ], RmInfo[2][gAngle], RmInfo[2][gColor1], RmInfo[2][gColor2],600);
rmcar[3] = CreateVehicle(RmInfo[3][gModel], RmInfo[3][gPosX], RmInfo[3][gPosY], RmInfo[3][gPosZ], RmInfo[3][gAngle], RmInfo[3][gColor1], RmInfo[3][gColor2],600);
rmcar[4] = CreateVehicle(RmInfo[4][gModel], RmInfo[4][gPosX], RmInfo[4][gPosY], RmInfo[4][gPosZ], RmInfo[4][gAngle], RmInfo[4][gColor1], RmInfo[4][gColor2],600);
rmcar[5] = CreateVehicle(RmInfo[5][gModel], RmInfo[5][gPosX], RmInfo[5][gPosY], RmInfo[5][gPosZ], RmInfo[5][gAngle], RmInfo[5][gColor1], RmInfo[5][gColor2],600);
rmcar[6] = CreateVehicle(RmInfo[6][gModel], RmInfo[6][gPosX], RmInfo[6][gPosY], RmInfo[6][gPosZ], RmInfo[6][gAngle], RmInfo[6][gColor1], RmInfo[6][gColor2],600);
rmcar[7] = CreateVehicle(RmInfo[7][gModel], RmInfo[7][gPosX], RmInfo[7][gPosY], RmInfo[7][gPosZ], RmInfo[7][gAngle], RmInfo[7][gColor1], RmInfo[7][gColor2],600);
PHP код:
stock LoadRm()
{
new arrCoords[9][64];
new strFromFile2[128];
new File: file = fopen("gangs/rmc.cfg", io_read);
if (file)
{
new idx;
while (idx < 8)
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
RmInfo[idx][gModel] = strval(arrCoords[0]);
RmInfo[idx][gPosX] = floatstr(arrCoords[1]);
RmInfo[idx][gPosY] = floatstr(arrCoords[2]);
RmInfo[idx][gPosZ] = floatstr(arrCoords[3]);
RmInfo[idx][gAngle] = floatstr(arrCoords[4]);
RmInfo[idx][gColor1] = strval(arrCoords[5]);
RmInfo[idx][gColor2] = strval(arrCoords[6]);
idx++;
}
fclose(file);
}
return 1;
}
stock SaveRussian()
{
new idx;
new File: file2;
while (idx < 8)
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d\n",
RmInfo[idx][gModel],
RmInfo[idx][gPosX],
RmInfo[idx][gPosY],
RmInfo[idx][gPosZ],
RmInfo[idx][gAngle],
RmInfo[idx][gColor1],
RmInfo[idx][gColor2]);
if(idx == 0)
{
file2 = fopen("gangs/rms.cfg", io_write);
}
else
{
file2 = fopen("gangs/rms.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
PHP код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(IsPlayerNPC(playerid))return true;
new string[70];
new caridi = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(IsAPlane(caridi) || IsABoat(caridi) || IsABycicle(caridi)){}
else{SendClientMessage(playerid,COLOR_WHITE,"{AFEEEE}• {FFFFFF}Для управления автомобилем используйте {AFEEEE}левый CTRL");}
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
new carid = GetPlayerVehicleID(i);
if(carid >= avt1 && carid <= avt2)
{
if(PlayerInfo[playerid][pJob] == 14)
{
SendClientMessage(playerid,COLOR_WHITE,"{b3f9b0}/route {FFFFFF}- Выбрать маршрут");
SendClientMessage(playerid,COLOR_WHITE,"{b3f9b0}/fare {FFFFFF}- Установить тариф");
ShowPlayerDialog(playerid,23040,DIALOG_STYLE_LIST,"Выберите Маршрут","{bbbbbb}» {FFFFFF}Вокзал ЛС - АШ\n{bbbbbb}» {FFFFFF}Внутригородской ЛС\n{bbbbbb}» {FFFFFF}АШ - Вокзал ЛС","Ок","Отмена");
}
}
}
if(newstate == PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 574 && !GetPVarInt(playerid, "sweeper_work"))
{
ShowPlayerDialog(playerid,SWEEPER_DIALOG_ID,DIALOG_STYLE_MSGBOX,"{7CFC00}Работа","Начать работу уборщика улиц?\nДанная работа принесет заработок\nВ размере {7CFC00}$400","Начать","Отклонить");
}
if(oldstate == PLAYER_STATE_DRIVER && GetPVarInt(playerid, "sweeper_work"))
{
StopSweeperWork(playerid);
}
new model = GetVehicleModel(caridi);
if(model >=596 && model <=599)
{
PyxiTime[playerid] = 5;
new gun,ammo;
GetPlayerWeaponData(playerid,3,gun,ammo);
if(PlayerInfo[playerid][pGun3] == 0 && gun == 0)
PlayerInfo[playerid][pGun3] = 25;
PlayerInfo[playerid][pAmmo3] +=5;
}
gLastCar[playerid] = caridi;
CarEnter(playerid,caridi);
if(gTeam[playerid] >= 3)
{
if(PlayerSpec[playerid] != -1 && PlayerSpectateID[PlayerSpec[playerid]] != -1)
{
PlayerSpectateVehicle(PlayerSpec[playerid], caridi);
}
}
new carid = GetPlayerVehicleID(playerid);
TextDrawShowForPlayer(playerid, benzz[playerid]);
TextDrawShowForPlayer(playerid, Textdraw2);
TextDrawShowForPlayer(playerid, Textdraw3);
TextDrawShowForPlayer(playerid, Textdraw4);
TextDrawShowForPlayer(playerid, Textdraw5);
TextDrawShowForPlayer(playerid, Textdraw0);
TextDrawShowForPlayer(playerid, vname[playerid]);
format(string, sizeof(string), "%s (id %d)", VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400],carid);
TextDrawSetString(vname[playerid], string);
if(Gas[caridi] == 0)
{
format(string,sizeof(string),"~r~E ~r~II ~g~ F");
TextDrawSetString(benzz[playerid], string);
}
if(Gas[caridi] >= 1 ||Gas[caridi] <= 10)
{
format(string,sizeof(string),"~r~E ~r~II ~g~ F");
TextDrawSetString(benzz[playerid], string);
}
if(Gas[caridi] >= 11 || Gas[caridi] <= 20)
{
format(string,sizeof(string),"~r~E ~r~III ~g~ F");
TextDrawSetString(benzz[playerid], string);
}
if(Gas[caridi] >= 21 || Gas[caridi] <= 30)
{
format(string,sizeof(string),"~r~E ~y~IIII~r~ ~g~ F");
TextDrawSetString(benzz[playerid], string);
}
if(Gas[caridi] >= 31 || Gas[caridi] <= 40)
{
format(string,sizeof(string),"~r~E ~y~IIIII~r~ ~g~ F");
TextDrawSetString(benzz[playerid], string);
}
if(Gas[caridi] >= 41 || Gas[caridi] <= 50)
{
format(string,sizeof(string),"~r~E ~y~IIIIII~r~ ~g~ F");
TextDrawSetString(benzz[playerid], string);
}
if(Gas[caridi] >= 51 || Gas[caridi] <= 60)
{
format(string,sizeof(string),"~r~E ~y~IIIIIII~r~ ~g~ F");
TextDrawSetString(benzz[playerid], string);
}
if(Gas[caridi] >= 61 || Gas[caridi] <= 70)
{
format(string,sizeof(string),"~r~E ~y~IIIIIIIII~r~ ~g~ F");
TextDrawSetString(benzz[playerid], string);
}
if(Gas[caridi] >= 71 || Gas[caridi] <= 80)
{
format(string,sizeof(string),"~r~E ~g~IIIIIIIIIIII~r~ ~g~ F");
TextDrawSetString(benzz[playerid], string);
}
if(Gas[caridi] >= 81 || Gas[caridi] <= 90)
{
format(string,sizeof(string),"~r~E ~g~IIIIIIIIIIIIIIII~r~ ~g~ F");
TextDrawSetString(benzz[playerid], string);
}
if(Gas[caridi] >= 200)
{
format(string,sizeof(string),"~r~E ~g~IIIIIIIIIIIIIIIIIIII~g~ F");
TextDrawSetString(benzz[playerid], string);
}
}
else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
TextDrawHideForPlayer(playerid, benzz[playerid]);
TextDrawHideForPlayer(playerid, Textdraw2);
TextDrawHideForPlayer(playerid, Textdraw3);
TextDrawHideForPlayer(playerid, Textdraw4);
TextDrawHideForPlayer(playerid, Textdraw5);
TextDrawHideForPlayer(playerid, Textdraw0);
TextDrawHideForPlayer(playerid, vname[playerid]);
}
if(newstate == PLAYER_STATE_DRIVER)
{
new model = GetPlayerVehicleSeat(playerid);
if(model != 128)
{
if(!model)
{
model = GetVehicleModel(GetPlayerVehicleID(playerid));
if(!(400 <= model <= 611) || MaxPassengers[model - 400 >>> 3] >>> ((model - 400 & 7) << 2) & 0xF == 15) return Kick(playerid);
}
else return Kick(playerid);
}
}
else if(newstate == PLAYER_STATE_PASSENGER)
{
new model = GetVehicleModel(GetPlayerVehicleID(playerid));
if(400 <= model <= 611)
{
model -= 400;
new seat = GetPlayerVehicleSeat(playerid);
if(seat != 128)
{
model = (MaxPassengers[model >>> 3] >>> ((model & 7) << 2)) & 0xF;
if(!model || model == 15) return Kick(playerid);
else if(!(0 < seat <= model)) return Kick(playerid);
}
else return Kick(playerid);
}
}
if(newstate == PLAYER_STATE_ONFOOT)
{
KillTimer(limtimer);
Limiter[playerid] = 0;
if(PlayerKarting[playerid] > 0 && PlayerInKart[playerid] > 0)
{
PlayerInKart[playerid] = 0;
KartingPlayers --;
}
if(PlayerSpec[playerid] != -1 && PlayerSpectateID[PlayerSpec[playerid]] != -1)
{
PlayerSpectatePlayer(PlayerSpec[playerid], playerid);
}
if(TransportDuty[playerid] > 0)
{
if(TransportDuty[playerid] == 1)
{
TaxiDrivers -= 1;
}
else if(TransportDuty[playerid] == 2)
{
BusDrivers -= 1;
}
TransportDuty[playerid] = 0;
Delete3DTextLabel(nTaxi3DText[GetPlayerVehicleID(playerid)]);
format(string, sizeof(string), "Работа закончена, Заработная плата: $%d.", TransportMoney[playerid]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
NormMoney[playerid] = 2;
AntiMoney[playerid] = AntiMoney[playerid] + TransportMoney[playerid];
GiveMoney(playerid, TransportMoney[playerid]);
ConsumingMoney[playerid] = 1; TransportValue[playerid] = 0; TransportMoney[playerid] = 0;
}
if(TransportCost[playerid] > 0 && TransportDriver[playerid] < 999)
{
if(IsPlayerConnected(TransportDriver[playerid]))
{
TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
TransportTime[TransportDriver[playerid]] = 0;
TransportCost[TransportDriver[playerid]] = 0;
format(string, sizeof(string), "~w~The ride cost~n~~r~$%d",TransportCost[playerid]);
GameTextForPlayer(playerid, string, 5000, 1);
format(string, sizeof(string), "~w~Passenger left the car~n~~g~Earned $%d",TransportCost[playerid]);
GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
NormMoney[playerid] = 2;
AntiMoney[playerid] = AntiMoney[playerid] - TransportCost[playerid];
GiveMoney(playerid, -TransportCost[playerid]);
TransportCost[playerid] = 0;
TransportTime[playerid] = 0;
TransportDriver[playerid] = 999;
}
}
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
}
if(newstate == PLAYER_STATE_PASSENGER)
{
if(GetVehicleModel(caridi) == 592)
{
SetPlayerPos(playerid, 1891.4706,-8156.8750,5.4471);
SetPlayerFacingAngle(playerid, 0);
SetCameraBehindPlayer(playerid);
IsInShml[playerid] = 1;
}
if(caridi == 751)
{
SetPlayerPos(playerid, 2516.4,-1555.3,2335.6);
furgon[playerid] = 1;
}
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(PlayerSpec[playerid] != -1 && PlayerSpectateID[PlayerSpec[playerid]] != -1)
{
PlayerSpectateVehicle(PlayerSpec[playerid], caridi);
}
new vehicleid = GetPlayerVehicleID(playerid);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0)
{
if(GetPlayerMoney(playerid) < TransportValue[i])
{
format(string, sizeof(string), "Вам нужно $%d для того чтобы сесть.", TransportValue[i]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
RemovePlayerFromVehicle(playerid);
}
else
{
if(TransportDuty[i] == 1)
{
format(string, sizeof(string), "• {FFFFFF}Вы заплатили $%d Таксисту.", TransportValue[i]);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "• {FFFFFF}Пассажир %s сел в ваше Такси.", name);
SendClientMessage(i, COLOR_YELLOW, string);
new drivername[MAX_PLAYER_NAME];
GetPlayerName(i,drivername,sizeof(drivername));
TransportTime[i] = 1;
TransportTime[playerid] = 1;
TaxiVzyat[playerid] = 0;
TransportCost[playerid] = TransportValue[i];
TransportCost[i] = TransportValue[i];
TransportDriver[playerid] = i;
}
else if(TransportDuty[i] == 2)
{
format(string, sizeof(string), "• {FFFFFF}Вы заплатили $%d водителю автобуса.", TransportValue[i]);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "• {FFFFFF}Пассажир %s вошел в Ваш автобус.", name);
SendClientMessage(i, COLOR_YELLOW, string);
}
else if(TransportDuty[i] == 3)
{
format(string, sizeof(string), "• {FFFFFF}Вы заплатили $%d машинисту трамвая.", TransportValue[i]);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "• {FFFFFF}Пассажир %s зашёл в ваш трамвай.", name);
SendClientMessage(i, COLOR_YELLOW, string);
}
NormMoney[playerid] = 2;
AntiMoney[playerid] = AntiMoney[playerid] - TransportValue[i];
GiveMoney(playerid, - TransportValue[i]);
TransportMoney[i] += TransportValue[i];
}
}
}
}
}
if(newstate == PLAYER_STATE_WASTED)
{
if(WantedLevel[playerid] >= 1)
{
new count;
if(count == 1)
{
PlayerInfo[playerid][pWantedDeaths] += 1;
PlayerInfo[playerid][pJailed] = 1;
PlayerInfo[playerid][pJailTime] = (WantedLevel[playerid])*(600);
format(string, sizeof(string), "Вы находитесь в Тюрьме в течении {b3f9b0}%d", PlayerInfo[playerid][pJailTime]);
SendClientMessage(playerid, COLOR_WHITE, string);
WantedPoints[playerid] = 0;
WantedLevel[playerid] = 0;
}
}
}
if(newstate == PLAYER_STATE_DRIVER)
{
new newcar = GetPlayerVehicleID(playerid);
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
if(IsABoat(newcar))
{
if(PlayerInfo[playerid][pBoatLic] < 1)
{
SendClientMessage(playerid, COLOR_WHITE, "{f9b0b0}x {FFFFFF}У Вас нет лицензии на управление водным транспортом!");
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
}
}
else if(IsAPlane(newcar))
{
if(PlayerInfo[playerid][pFlyLic] < 1)
{
if(TakingLesson[playerid] == 1) { }
else {
SendClientMessage(playerid, COLOR_WHITE, "{f9b0b0}x {FFFFFF}У Вас нет лицензии на управление воздушным транспортом!");
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
}
}
}
else
{
if(PlayerInfo[playerid][pCarLic] < 1)
{
if(IsACar(newcar))
{
if(TakingLesson[playerid] == 1) { }
else {
SendClientMessage(playerid, COLOR_WHITE, "{f9b0b0}x {FFFFFF}У Вас нет прав!");
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
}
}
}
}
gLastCar[playerid] = newcar;
gLastDriver[newcar] = playerid;
}
if(ProdTruck(caridi))
{
format(string, sizeof(string), "Продукты: %d/%d.", PlayerHaul[caridi-prodtruck[0]][pLoad],PlayerHaul[caridi-prodtruck[0]][pCapasity]);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
SendClientMessage(playerid, COLOR_WHITE, "{b3f9b0}Закупите товар на складе и развезите его по бизнесам");
SendClientMessage(playerid, COLOR_WHITE, "{b3f9b0}Команды: /buyprods /sellprods.");
}
if(newstate == PLAYER_STATE_SPAWNED)
{
new Float: lwx, Float:lwy, Float:lwz;
GetPlayerPos(playerid, lwx, lwy, lwz);
if((lwz > 530.0 && PlayerInfo[playerid][pInt] == 0) || PlayerToPoint(1000.0, playerid, -1041.9,-1868.4,79.1))
{
SetPlayerSpawn(playerid);
}
WantedPoints[playerid] = 0;
WantedLevel[playerid] = 0;
if(PlayerInfo[playerid][pDonate] > 1) { SetPlayerHealthAC(playerid, 100.0); }
else { SetPlayerHealthAC(playerid, PlayerInfo[playerid][pSHealth]); }
MedicBill[playerid] = 1;
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
gPlayerSpawned[playerid] = 1;
SafeTime[playerid] = 60;
}
return true;
}