Первый шаг: Определение команды
Код: Выделить всё
#define TEAM_ONE 1
#define TEAM_TWO 2
new PlayerTeam[MAX_PLAYERS];//мы будем использовать это вниз
new car1;//Команда один автомобиль
new car2;//Команда два автомобиля
Второй шаг: Создание транспортных средств
Вы можете использовать любой редактор для транспортных средств или оставить как есть
Код: Выделить всё
AddStaticVehicleEx(470,-1632.75170898,1294.86474609,7.14550352,138.00000000,-1,-1,15);
Теперь перейти в "OnGameModeInt" или "OnFilterScriptInt" и добавить следующее:
Код: Выделить всё
car1 = AddStaticVehicleEx(470,-1632.75170898,1294.86474609,7.14550352,138.00000000,-1,-1,15);
car2 = AddStaticVehicleEx(447,-1690.72692871,1380.04211426,14.88139153,224.00000000,-1,-1,15);
Третий шаг: Ввод Транспорт
Вы можете использовать GameText For Player или может также использовать TextDraw или SendClientMessage.
Идём в "OnPlayerStateChange" и добавляем:
Код: Выделить всё
new vehicleid;//Defining Vehicle id
if(newstate == PLAYER_STATE_DRIVER)//проверки того, что STATE_DRIVER или нет
{
vehicleid = GetPlayerVehicleID(playerid);
if(gTeam[playerid] == TEAM_ONE && vehicleid == car2)//Команда 1 и 2 авто
{
GameTextForPlayer(playerid, "Enemy Vehicle! ~g~Take it Back to your Spawn", 3000, 5);
SetPlayerCheckpoint(playerid, 2241.1335,-1318.9760,23.9844, 7.0);
SendClientMessageToAll(playerid,-1,"Первая команда пытается украсть автомобиль группы два");
}
else if(gTeam[playerid] == TEAM_ONE && vehicleid == car1)//Команды автомобиля
{
GameTextForPlayer(playerid, "You Need to Protect This From your Enemy", 3000, 5);
RemovePlayerFromVehicle(playerid); // player out of vehicle
}
else if(gTeam[playerid] == TEAM_TWO && vehicleid == car1)//team 2 and Car 1
{
GameTextForPlayer(playerid, "Enemy Vehicle! ~g~Take it Back to your Spawn", 3000, 5);
SetPlayerCheckpoint(playerid, 2241.1335,-1318.9760,23.9844, 7.0);
SendClientMessageToAll(playerid,-1,"Team Two is trying to Steal Team One's Car");
else if(gTeam[playerid] == TEAM_TWO && vehicleid == car2)//team 2 car 2
{
GameTextForPlayer(playerid, "You Need to Protect This From your Enemy", 3000, 5);
RemovePlayerFromVehicle(playerid); // Игрок из автомобиля
}
}
}
Последний 4-й Шаг: Награды
Код: Выделить всё
public OnPlayerEnterCheckpoint(playerid)
{
new playervehicleid = GetPlayerVehicleID(playerid);//Playerid = GetPlayerVehicle ID Easier for me
if(gTeam[playerid] == TEAM_ONE)//Получение, что, если игрок из команды 1
{
if(playervehicleid == car2)//получить, что если автомобиль автомобиль 2
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);//giving 5 score
GameTextForAll("~g~Team ~w~One ~g~Captured the Vehicle!", 3000, 5);//рассказывая всем, что одна команда сделали это
PlaySoundForAll(1185, 0.0, 0.0, 0.0);//играет звук для победителей
SetVehicleToRespawn(car2);//respawn автомобиля
}
}
else if(gTeam[playerid] == TEAM_TWO)//получение игроков команды
{
if(playervehicleid == car1)//получаем, что если игрок находится в машине 1
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);//giving the score
GameTextForAll("~r~Team ~w~Two ~g~wins!", 3000, 5);//Gametext за все, что команды две победы
PlaySoundForAll(1185, 0.0, 0.0, 0.0);//звучит для победителей
GameTextForAll("~g~Team ~w~Two ~g~Captured the Vehicle!", 3000, 5);//
рассказывая всем, что команда Два сделал это
SetVehicleToRespawn(car1);//respawn автомобиля
}
}
return 1;
}
Исправление ошибки в PlayPlayerSound (звук)
Код: Выделить всё
PlayPlayerSound(sound)
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) PlayerPlaySound(i,sound,0,0,0);
}
}