Den_Wilson
Умник
Ко всем new добавляем:
Ко всем forward'ам добавляем:
В public OnPlayerDisconnect
Добавляем:
В public OnPlayerStateChange
Добавляем:
Создаём паблик:
И в самый конец мода добавляем:
Спасибо за внимание, на этом урок закончен.
От + не откажусь.
PHP:
new Timer1122[MAX_PLAYERS];
PHP:
forward UnSurfCar(carid);
Добавляем:
PHP:
KillTimer(Timer1122[playerid]);
Добавляем:
PHP:
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]);
}
PHP:
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;
}
PHP:
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));}
От + не откажусь.
