Ко всем new добавляем:
Code
new Timer1122[MAX_PLAYERS];
Ко всем forward'ам добавляем:
Code
forward UnSurfCar(carid);
В public OnPlayerDisconnect
Добавляем:
Code
KillTimer(Timer1122[playerid]);
В public OnPlayerStateChange
Добавляем:
Code
if(newstate == PLAYER_STATE_DRIVER)
{
Timer1122[playerid] = SetTimerEx("UnSurfCar",500,1,"i",GetPlayerVehicleID(playerid));
}
if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
{
KillTimer(Timer1122[playerid]);
}
Создаём паблик:
Code
public UnSurfCar(carid)
{
for(new i = 0; i<GetMaxPlayers(); i++)
{
if(GetPlayerSurfingVehicleID(i) == carid)
{
new Float:p[3]; GetPlayerPos(i,p[0],p[1],p[2]);
GetXYInBackOfPlayer(i,p[0],p[1],5.0);
SetPlayerPos(i,p[0],p[1],p[2]);
}
}
return;
}
И в самый конец мода добавляем:
Code
stock GetXYInBackOfPlayer(const playerid, &Float:x, &Float:y, const Float:distance){
new Float:a; GetPlayerPos(playerid, x, y, a); GetPlayerFacingAngle(playerid, a);
if (IsPlayerInAnyVehicle(playerid)) { new vid=GetPlayerVehicleID(playerid);
if (vid>0 && vid<=MAX_VEHICLES)GetVehicleZAngle(vid, a);}
x -= (distance * floatsin(-a, degrees)); y -= (distance * floatcos(-a, degrees));}
Автор: Alessandro_Bruno