iMorgan
Дебютант
Всех приветствую! Перейду сразу к делу. Спонтанно решил написать мануал конвоя.Что такое конвой? Это когда тебя ведут за собой
И так, преступим!
И так, преступим!
добавим к new:
PHP:
new Convoi[MAX_PLAYERS];
PHP:
new GotPVar = GetPVarInt(playerid, "TempConvoi");
if(Convoi[playerid] != INVALID_PLAYER_ID)
{
SetPVarInt(Convoi[playerid], "TempConvoi", -1);
KillTimer(TimerForPlayer[playerid]);
TimerForPlayer[playerid] = INVALID_PLAYER_ID;
Convoi[playerid] = INVALID_PLAYER_ID;
}
else if(GotPVar != -1)
{
SetPVarInt(playerid, "TempConvoi", -1);
KillTimer(TimerForPlayer[GotPVar]);
TimerForPlayer[GotPVar] = INVALID_PLAYER_ID;
Convoi[GotPVar] = INVALID_PLAYER_ID;
}
PHP:
new GotPVar = GetPVarInt(playerid, "VrConvoi");
if(Convoi[playerid] != INVALID_PLAYER_ID)
{
SetPVarInt(Convoi[playerid], "VrConvoi", -1);
KillTimer(TimerForPlayer[playerid]);
SendClientMessage(Convoi[playerid], COLOR_SERVERA, "Ваш заключенный мертв");
TimerForPlayer[playerid] = INVALID_PLAYER_ID;
Convoi[playerid] = INVALID_PLAYER_ID;
}
else if(GotPVar != -1)
{
SetPVarInt(playerid, "TempConvoi", -1);
KillTimer(TimerForPlayer[GotPVar]);
SendClientMessage(Convoi[playerid], COLOR_SERVERA, "Ваш конвой мертв");
TimerForPlayer[GotPVar] = INVALID_PLAYER_ID;
Convoi[GotPVar] = INVALID_PLAYER_ID;
}
PHP:
publics: ConvoiToPlayer(playerid)
{
static AnimShot[MAX_PLAYERS];
if(!IsPlayerConnected(Convoi[playerid]))
{
KillTimer(TimerForPlayer[playerid]);
TimerForPlayer[playerid] = INVALID_PLAYER_ID;
Convoi[playerid] = INVALID_PLAYER_ID;
TogglePlayerControllable(playerid, 1);
ClearAnimations(playerid);
AnimShot[playerid] = false;
SendClientMessage(playerid, COLOR_SERVERA, "Вы свободны, конвой покинул сервер");
return 1;
}
else if(!IsPlayerConnected(playerid))
{
SetPVarInt(Convoi[playerid], "TempConvoi", -1);
KillTimer(TimerForPlayer[playerid]);
TimerForPlayer[playerid] = INVALID_PLAYER_ID;
AnimShot[playerid] = false;
SendClientMessage(Convoi[playerid], COLOR_SERVERA, "Арестованный покинул сервер");
Convoi[playerid] = INVALID_PLAYER_ID;
return 1;
}
else if(Convoi[playerid] == INVALID_PLAYER_ID)
{
KillTimer(TimerForPlayer[playerid]);
TimerForPlayer[playerid] = INVALID_PLAYER_ID;
AnimShot[playerid] = false;
SendClientMessage(playerid, COLOR_SERVERA, "С вашим конвоем произошла беда (Умер)");
TogglePlayerControllable(playerid, 1);
ClearAnimations(playerid);
return 1;
}
else if(IsPlayerInAnyVehicle(playerid))
{
SetPVarInt(Convoi[playerid], "TempConvoi", -1);
KillTimer(TimerForPlayer[playerid]);
TimerForPlayer[playerid] = INVALID_PLAYER_ID;
AnimShot[playerid] = false;
SendClientMessage(Convoi[playerid], COLOR_SERVERA, "Ваш заключенный в машине. Конвой прерван");
Convoi[playerid] = INVALID_PLAYER_ID;
return 1;
}
else if(GetPlayerVirtualWorld(Convoi[playerid]) != GetPlayerVirtualWorld(playerid) || GetPlayerInterior(Convoi[playerid]) != GetPlayerInterior(playerid))
{
new Float: X, Float: Y, Float: Z;
GetPlayerPos(Convoi[playerid], X, Y, Z);
SetPlayerPosEx(playerid, X, Y, Z);
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(Convoi[playerid]));
SetPlayerInterior(playerid, GetPlayerInterior(Convoi[playerid]));
TogglePlayerControllable(playerid, 0);
AnimShot[playerid] = false;
return 1;
}
new Float: GotDistance = GetDistanceBetweenPlayers(playerid, Convoi[playerid]);
if(GotDistance < 0.95)
{
TogglePlayerControllable(playerid, 0);
SetPlayerToFacePlayer(playerid, Convoi[playerid]);
AnimShot[playerid] = false;
return 1;
}
else if(GotDistance > 10.0)
{
SetPVarInt(Convoi[playerid], "TempConvoi", -1);
SendClientMessage(Convoi[playerid], COLOR_SERVERA, "Вы ушли слишком далеко. Конвой остановлен");
SendClientMessage(playerid, COLOR_SERVERA, "Ваш конвой ушёл слишком далеко. Вы свободны!");
TogglePlayerControllable(playerid, 1);
ClearAnimations(playerid);
KillTimer(TimerForPlayer[playerid]);
TimerForPlayer[playerid] = INVALID_PLAYER_ID;
Convoi[playerid] = INVALID_PLAYER_ID;
return 1;
}
else
{
TogglePlayerControllable(playerid, 1);
SetPlayerToFacePlayer(playerid, Convoi[playerid]);
ApplyAnimation(playerid, "ped", "WALK_civi", 6.0, 1, 1, 1, 1, 0, 1);
}
return 1;
}
PHP:
CMD:follow(playerid,params[]);
{
if(pData[playerid][pFraction] == Номер фракции)
{
if(sscanf(params,"d",params[0])) return SCM(playerid,COLOR_SERVERA, "/follow [id игрока]");
if(playerid == params[0]) return SendClientMessage(playerid, COLOR_SERVERA, "Вы указали свой ID");
if(GetPlayerDistanceToPlayer(playerid,params[0]) > 3.0 || GetPlayerVirtualWorld(playerid) != GetPlayerVirtualWorld(params[0])) return SendClientMessage(playerid,COLOR_SERVERA, "Вы далеко друг от друга");
else if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_SEVERA, "Заключенный в машине");
{
SetPVarInt(playerid, "TempConvoi", -1);
Convoi[params[0]] = INVALID_PLAYER_ID;
KillTimer(TimerForPlayer[params[0]]);
TimerForPlayer[params[0]] = INVALID_PLAYER_ID;
ClearAnimations(playerid);
TogglePlayerControllable(params[0], 1);
SendClientMessage(playerid, COLOR_SERVERA, "Вы сняли конвой с игрока");
return SendClientMessage(params[0], COLOR_SERVERA, "С вас был снят конвой");
}
if(GetPVarInt(playerid, "TempConvoi") != -1) return SendClientMessage(playerid, 0xAA3333AA, "Вы не можете сопровождать одновременно 2-х людей");
Convoi[params[0]] = playerid;
SetPVarInt(playerid, "TempConvoi", params[0]);
TimerForPlayer[params[0]] = SetTimerEx("ConvoiToPlayer", 1000, 1, "i", params[0]);
SendClientMessage(playerid, COLOR_SERVERA, "Вы начали сопровождать ирока");
SendClientMessage(params[0], COLOR_SERVERA, "Вас взяли под конвой");
}
return true;
}
Понравился Мануал, ставь +
Последнее редактирование модератором:
