Вопросы

Limom4ik
Новичок

Нашел я скрипт для сервера, называется машина времени(она перемещается между двумя мирами gta) так вот, сижу голову ломаю как сделать 2 таких машины? Приглагаю код:

Спойлер

#include <a_samp>

#define COLOR_YELLOW 0xFFFF00FF
#define KNOWNCOLOR_KHAKI 0xF0E68CFF

new Float:P[3];

new Fire[MAX_VEHICLES][4];

new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new G[MAX_VEHICLES];
new Time[MAX_VEHICLES];
new Weather = 2;//ïîãîäêà â íàñòîÿùåì âðåìåíè.
new delorian;
new bool:Block = false;
new Toplivo;
new Poloniy[MAX_PLAYERS];

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Äîê, òû õî÷åøü ñêàçàòü, ÷òî òû èçîáðåë ìàøèíó âðåìåíè?");
    print("--------------------------------------\n");
    SetTimer("SpeedUpdate",100,1);
    delorian = CreateVehicle(496,2096.4307,1283.8900,10.5248,178.8482,7,7,60);
    SetVehicleNumberPlate(delorian, "ENB");
    Textdraw0 = TextDrawCreate(542.000000,387.000000,"Generator: Off");
    Textdraw1 = TextDrawCreate(542.000000,405.000000,"Speed:188");
    TextDrawUseBox(Textdraw0,1);
    TextDrawBoxColor(Textdraw0,0x00000066);
    TextDrawTextSize(Textdraw0,617.000000,2.000000);
    TextDrawUseBox(Textdraw1,1);
    TextDrawBoxColor(Textdraw1,0x00000066);
    TextDrawTextSize(Textdraw1,617.000000,0.000000);
    TextDrawAlignment(Textdraw0,0);
    TextDrawAlignment(Textdraw1,0);
    TextDrawBackgroundColor(Textdraw0,0x000000ff);
    TextDrawBackgroundColor(Textdraw1,0x000000ff);
    TextDrawFont(Textdraw0,1);
    TextDrawLetterSize(Textdraw0,0.199999,1.500000);
    TextDrawFont(Textdraw1,1);
    TextDrawLetterSize(Textdraw1,0.399999,1.000000);
    TextDrawColor(Textdraw0,0xffff00ff);
    TextDrawColor(Textdraw1,0xffff00ff);
    TextDrawSetOutline(Textdraw0,1);
    TextDrawSetOutline(Textdraw1,1);
    TextDrawSetProportional(Textdraw0,1);
    TextDrawSetProportional(Textdraw1,1);
    TextDrawSetShadow(Textdraw0,1);
    TextDrawSetShadow(Textdraw1,1);
    Textdraw2 = TextDrawCreate(542.000000,418.000000,"Plutonium:Yes");
    TextDrawUseBox(Textdraw2,1);
    TextDrawBoxColor(Textdraw2,0x00000066);
    TextDrawTextSize(Textdraw2,617.000000,-1.000000);
    TextDrawAlignment(Textdraw2,0);
    TextDrawBackgroundColor(Textdraw2,0x000000ff);
    TextDrawFont(Textdraw2,1);
    TextDrawLetterSize(Textdraw2,0.299999,1.000000);
    TextDrawColor(Textdraw2,0xffff00ff);
    TextDrawSetOutline(Textdraw2,1);
    TextDrawSetProportional(Textdraw2,1);
    TextDrawSetShadow(Textdraw2,1);
    return 1;
}

public OnFilterScriptExit()
{
    DestroyVehicle(delorian);
    TextDrawHideForAll(Textdraw0);
    TextDrawHideForAll(Textdraw1);
    TextDrawHideForAll(Textdraw2);
    TextDrawDestroy(Textdraw0);
    TextDrawDestroy(Textdraw1);
    TextDrawDestroy(Textdraw2);
    for(new i; i < GetMaxPlayers(); i++)DeleteFire(i);
    print("Ìàøèíà âðåìåíè âûãðóæåíà");
    return 1;
}


forward SpeedUpdate();

public SpeedUpdate()
{
    new string[128]; // îáúÿâëÿåì îäíîìåðíûé ìàññèâ
    for(new i; i<GetMaxPlayers(); i++) // îáúÿâëÿåì öèêë
    {
        if((GetPlayerState(i) == PLAYER_STATE_DRIVER) && GetPlayerVehicleID(i) == delorian) // Åñëè èãðîê - âîäèòåëü ÒÑ
        {
            if(Toplivo > 0)TextDrawSetString(Textdraw2, "Plutonium:Yes");
            else if(Toplivo == 0)TextDrawSetString(Textdraw2, "Plutonium:No");
            
            if(G[delorian] == 1)TextDrawSetString(Textdraw0, "Generator: On");
            else if(G[delorian] == 0)TextDrawSetString(Textdraw0, "Generator: Off");
            format(string, sizeof string, "Speed:%d",GetVehicleSpeed(i));
            TextDrawSetString(Textdraw1, string);
            if((GetVehicleSpeed(i) >= 88 && G[delorian] == 1)&& Block == false)
            {
               Block = true;
               EffectFire(i);
               if(Time[delorian] == 0)SetTimerEx("Tele",1300,0,"d",i);
               else if(Time[delorian] == 1)SetTimerEx("TeleNaz",1300,0,"d",i);
            }
        }
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    if(vehicleid == delorian)
    {
       SetVehicleVirtualWorld(delorian,0);
       SetVehicleNumberPlate(delorian, "ENB");
       Toplivo = 0;
       G[delorian] = 0;
    }
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    if(vehicleid == delorian)SendClientMessage(killerid,KNOWNCOLOR_KHAKI,"Âîò îíà è óíè÷òîæåíà Äîê... Êàê òû è õîòåë.");
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/plutonium", cmdtext, true, 10) == 0)
    {
           if(Poloniy[playerid] > 0) return SendClientMessage(playerid,COLOR_YELLOW,"Ó âàñ óæå åñòü ïëóòîíèé");
           if(GetPlayerMoney(playerid) > 0)
           {
              GivePlayerMoney(playerid, 0);
              Poloniy[playerid] = 1;
              SendClientMessage(playerid,COLOR_YELLOW,"Çàðÿä ïëóòîíèÿ óñïåøíî êóïëåí. Çàðÿäêà â äåëîðèàí ïðîèçîéäåò âî âðåìÿ âêëþ÷åíèÿ íàêîïèòåëÿ");
           }
           else return SendClientMessage(playerid,KNOWNCOLOR_KHAKI,"Ïëóòîíèé äëÿ ïóòåøåñòâèÿ 2 ðàçà ñòîèò 0$");
           return 1;
    }
    return 0;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{

     if(newkeys == 4 && (GetPlayerVehicleID(playerid) == delorian && GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
     {
       if(G[delorian] == 1)
       {
         G[delorian] = 0;
         Block = false;
         SendClientMessage(playerid,COLOR_YELLOW,"Ïîòîêîâûé íàêîïèòåëü îòêëþ÷åí");
         return 1;
       }
       else if(G[delorian] == 0)
       {
       if(Toplivo > 0)
       {
         G[delorian] = 1;
         Block = false;
         SendClientMessage(playerid,COLOR_YELLOW,"Ïîòîêîâûé íàêîïèòåëü âêëþ÷åí");
         return 1;
       }
       else if(Toplivo < 1)
       {
         if(Poloniy[playerid] > 0)
         {
           G[delorian] = 1;
           Block = false;
           Poloniy[playerid] = 0;
           SendClientMessage(playerid,COLOR_YELLOW,"Ïîòîêîâûé íàêîïèòåëü âêëþ÷åí.");
           SendClientMessage(playerid,COLOR_YELLOW,"Çàðÿä ïëóòîíèÿ çàðÿæåí â äåëîðèàí.");
           Toplivo += 2;
         }
         else return SendClientMessage(playerid,KNOWNCOLOR_KHAKI,"Íåò çàðÿäà ïëóòîíèÿ. Êóïèòå åãî êîìàíäîé /plutonium.");
       }
       }
     }
     return 1;
}


forward EffectFire(playerid);

public EffectFire(playerid)
{
        Fire[delorian][0] = CreateObject(18694,0,0,0,0,0,0);
        Fire[delorian][1] = CreateObject(18694,0,0,0,0,0,0);
        Fire[delorian][2] = CreateObject(18694,0,0,0,0,0,0);
        Fire[delorian][3] = CreateObject(18694,0,0,0,0,0,0);
        AttachObjectToVehicle(Fire[delorian][0], delorian, -0.8, 2.0, -2.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(Fire[delorian][1], delorian, 0.8, 2.0, -2.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(Fire[delorian][2], delorian, -0.8, -2.0, -2.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(Fire[delorian][3], delorian, 0.8, -2.0, -2.0, 0.0, 0.0, 0.0);
        return 1;
}

forward DeleteFire(playerid);

public DeleteFire(playerid)
{
        for(new i; i < 5; i++)DestroyObject(Fire[delorian]);
        return 1;
}


new Passenger;

forward Tele(playerid);

public Tele(playerid)
{
   if(GetVehicleSpeed(playerid) >= 88)
   {
        new seat;
        for(new i; i < GetMaxPlayers(); i++)
        {
           if((GetPlayerState(i) != PLAYER_STATE_DRIVER) && GetPlayerVehicleID(i) == delorian)
           {
              Passenger = 1;
              seat = GetPlayerVehicleSeat(i);
           }
        }
        SetPlayerWeather(playerid,random(15));
        G[delorian] = 0;
        Time[delorian] = 1;
        Block = false;
        SetVehicleHealth(delorian,50000);
        GetVehiclePos(delorian,P[0],P[1],P[2]);
        CreateExplosion(P[0],P[1],P[2],10,0.0);
        SetVehicleHealth(delorian,1000);
        SetVehicleVirtualWorld(delorian,12);
        if(Toplivo > 0)Toplivo --;
        SetPlayerVirtualWorld(playerid,12);
        PutPlayerInVehicle(playerid,delorian,0);
        if(Passenger == 1)
        {
           for(new i; i < GetMaxPlayers(); i++)
           {
             if((GetPlayerState(i) != PLAYER_STATE_DRIVER) && GetPlayerVehicleID(i) == delorian)
             {
               SetPlayerVirtualWorld(i,12);
               SetPlayerWeather(i,random(15));
               PutPlayerInVehicle(i,delorian,seat);
             }
           }
           SetVehicleSpeed(delorian,203);
        }
        Passenger = 0;
        DeleteFire(playerid);
   }
   else
   {
      DeleteFire(playerid);
      Block = false;
   }
   return 1;
}


forward TeleNaz(playerid);

public TeleNaz(playerid)
{
   if(GetVehicleSpeed(playerid) >= 88)
   {
        new seat;
        for(new i; i < GetMaxPlayers(); i++)
        {
           if((GetPlayerState(i) != PLAYER_STATE_DRIVER) && GetPlayerVehicleID(i) == delorian)
           {
              Passenger = 1;
              seat = GetPlayerVehicleSeat(i);
           }
        }
        SetPlayerWeather(playerid,Weather);
        G[delorian] = 0;
        Time[delorian] = 0;
        Block = false;
        SetVehicleHealth(delorian,50000);
        GetVehiclePos(delorian,P[0],P[1],P[2]);
        CreateExplosion(P[0],P[1],P[2],10,0.0);
        SetVehicleHealth(delorian,1000);
        SetVehicleVirtualWorld(delorian,0);
        if(Toplivo > 0)Toplivo --;
        SetPlayerVirtualWorld(playerid,0);
        PutPlayerInVehicle(playerid,delorian,0);
        if(Passenger == 1)
        {
           for(new i; i < GetMaxPlayers(); i++)
           {
             if((GetPlayerState(i) != PLAYER_STATE_DRIVER) && GetPlayerVehicleID(i) == delorian)
             {
               SetPlayerVirtualWorld(i,0);
               SetPlayerWeather(i,random(15));
               PutPlayerInVehicle(i,delorian,seat);
             }
           }
           SetVehicleSpeed(delorian,203);
        }
        Passenger = 0;
        DeleteFire(playerid);
   }
   else
   {
      DeleteFire(playerid);
      Block = false;
   }
   return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == delorian)
    {
        TextDrawShowForPlayer(playerid, Textdraw0);
        TextDrawShowForPlayer(playerid, Textdraw1);
        TextDrawShowForPlayer(playerid, Textdraw2);
        SendClientMessage(playerid,COLOR_YELLOW,"Äîáðî ïîæàëîâàòü â ìàøèíó âðåìåíè. Äëÿ ïóòåøåñòâèÿ âî âðåìåíè âêëþ÷èòå ïîòîêîâûé íàêîïèòåëü.");
        SendClientMessage(playerid,COLOR_YELLOW,"Íàêîïèòåëü âêëþ÷àåòñÿ íà ALT. Ðàçãîíÿéòåñü äî 88 íà ñïèäîìåòðå è îòïðàâëÿéòåñü â ïðîøëîå. ");
    }
    if(newstate == PLAYER_STATE_ONFOOT)
    {
       TextDrawHideForPlayer(playerid, Textdraw0);
       TextDrawHideForPlayer(playerid, Textdraw1);
       TextDrawHideForPlayer(playerid, Textdraw2);
    }
    return 1;
}
stock GetVehicleSpeed(playerid)
{
    new Float:ST[4];
    if(IsPlayerInAnyVehicle(playerid))
    GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 150.3;
    return floatround(ST[3]);
}
stock SetVehicleSpeed(vehicleid,mph)
{
    new Float:Vx, Float:Vy, Float:Vz ,Float:speeds, Float:multiple;
    GetVehicleVelocity(vehicleid,Vx,Vy,Vz);
    speeds = floatsqroot(Vx*Vx + Vy*Vy + Vz*Vz);
    if(speeds > 0)
    {
        multiple = (mph / (speeds * 250));
        return (vehicleid, Vx*multiple, Vy*multiple, Vz*multiple);
    }
    return 0;
}
 

 

 

Отредактировано пользователем odosenok
Причина: загрузил код под спойлер и в тег "Код".

Заметка от Cawfee , создано

Пожалуйста, ознакомьтесь с информацией о том, как правильно выкладывать код.

Поделиться сообщением


Ссылка на сообщение

2 ответа на этот вопрос

  • 0
PRоFeSSoR
Разработчик Forever RolePlay | CR:MP 0.3.7

Будьте добры скопировать все заново на русской раскладке и вставить. 

Так же могу доработать за деньги, обращайтесь в лс форумника или студии.

Поделиться сообщением


Ссылка на сообщение
  • 0
Limom4ik
Новичок
20 часов назад, PRоFeSSoR сказал:

Будьте добры скопировать все заново на русской раскладке и вставить. 

Так же могу доработать за деньги, обращайтесь в лс форумника или студии.

Спойлер

#include <a_samp>

#define COLOR_YELLOW 0xFFFF00FF
#define KNOWNCOLOR_KHAKI 0xF0E68CFF

new Float:P[3];

new Fire[MAX_VEHICLES][4];



new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new G[MAX_VEHICLES];
new Time[MAX_VEHICLES];
new Weather = 2;//погодка в настоящем времени.
new delorian;
new bool:Block = false;
new Toplivo;
new Poloniy[MAX_PLAYERS];

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Док, ты хочешь сказать, что ты изобрел машину времени?");
	print("--------------------------------------\n");
	SetTimer("SpeedUpdate",100,1);
	delorian = CreateVehicle(496,2096.4307,1283.8900,10.5248,178.8482,7,7,60);
	SetVehicleNumberPlate(delorian, "ENB");
	Textdraw0 = TextDrawCreate(542.000000,387.000000,"Generator: Off");
	Textdraw1 = TextDrawCreate(542.000000,405.000000,"Speed:188");
	TextDrawUseBox(Textdraw0,1);
	TextDrawBoxColor(Textdraw0,0x00000066);
	TextDrawTextSize(Textdraw0,617.000000,2.000000);
	TextDrawUseBox(Textdraw1,1);
	TextDrawBoxColor(Textdraw1,0x00000066);
	TextDrawTextSize(Textdraw1,617.000000,0.000000);
	TextDrawAlignment(Textdraw0,0);
	TextDrawAlignment(Textdraw1,0);
	TextDrawBackgroundColor(Textdraw0,0x000000ff);
	TextDrawBackgroundColor(Textdraw1,0x000000ff);
	TextDrawFont(Textdraw0,1);
	TextDrawLetterSize(Textdraw0,0.199999,1.500000);
	TextDrawFont(Textdraw1,1);
	TextDrawLetterSize(Textdraw1,0.399999,1.000000);
	TextDrawColor(Textdraw0,0xffff00ff);
	TextDrawColor(Textdraw1,0xffff00ff);
	TextDrawSetOutline(Textdraw0,1);
	TextDrawSetOutline(Textdraw1,1);
	TextDrawSetProportional(Textdraw0,1);
	TextDrawSetProportional(Textdraw1,1);
	TextDrawSetShadow(Textdraw0,1);
	TextDrawSetShadow(Textdraw1,1);
	Textdraw2 = TextDrawCreate(542.000000,418.000000,"Plutonium:Yes");
	TextDrawUseBox(Textdraw2,1);
	TextDrawBoxColor(Textdraw2,0x00000066);
	TextDrawTextSize(Textdraw2,617.000000,-1.000000);
	TextDrawAlignment(Textdraw2,0);
	TextDrawBackgroundColor(Textdraw2,0x000000ff);
	TextDrawFont(Textdraw2,1);
	TextDrawLetterSize(Textdraw2,0.299999,1.000000);
	TextDrawColor(Textdraw2,0xffff00ff);
	TextDrawSetOutline(Textdraw2,1);
	TextDrawSetProportional(Textdraw2,1);
	TextDrawSetShadow(Textdraw2,1);
	return 1;
}

public OnFilterScriptExit()
{
	DestroyVehicle(delorian);
	TextDrawHideForAll(Textdraw0);
	TextDrawHideForAll(Textdraw1);
	TextDrawHideForAll(Textdraw2);
	TextDrawDestroy(Textdraw0);
	TextDrawDestroy(Textdraw1);
	TextDrawDestroy(Textdraw2);
	for(new i; i < GetMaxPlayers(); i++)DeleteFire(i);
	print("Машина времени выгружена");
	return 1;
}


forward SpeedUpdate();

public SpeedUpdate()
{
    new string[128]; // объявляем одномерный массив
    for(new i; i<GetMaxPlayers(); i++) // объявляем цикл
    {
        if((GetPlayerState(i) == PLAYER_STATE_DRIVER) && GetPlayerVehicleID(i) == delorian) // Если игрок - водитель ТС
        {
            if(Toplivo > 0)TextDrawSetString(Textdraw2, "Plutonium:Yes");
            else if(Toplivo == 0)TextDrawSetString(Textdraw2, "Plutonium:No");
            
            if(G[delorian] == 1)TextDrawSetString(Textdraw0, "Generator: On");
            else if(G[delorian] == 0)TextDrawSetString(Textdraw0, "Generator: Off");
			format(string, sizeof string, "Speed:%d",GetVehicleSpeed(i));
			TextDrawSetString(Textdraw1, string);
			if((GetVehicleSpeed(i) >= 88 && G[delorian] == 1)&& Block == false)
			{
               Block = true;
               EffectFire(i);
               if(Time[delorian] == 0)SetTimerEx("Tele",1300,0,"d",i);
               else if(Time[delorian] == 1)SetTimerEx("TeleNaz",1300,0,"d",i);
			}
        }
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
	if(vehicleid == delorian)
	{
	   SetVehicleVirtualWorld(delorian,0);
	   SetVehicleNumberPlate(delorian, "ENB");
	   Toplivo = 0;
	   G[delorian] = 0;
    }
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	if(vehicleid == delorian)SendClientMessage(killerid,KNOWNCOLOR_KHAKI,"Вот она и уничтожена Док... Как ты и хотел.");
	return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/plutonium", cmdtext, true, 10) == 0)
	{
		   if(Poloniy[playerid] > 0) return SendClientMessage(playerid,COLOR_YELLOW,"У вас уже есть плутоний");
		   if(GetPlayerMoney(playerid) > 0)
		   {
			  GivePlayerMoney(playerid, 0);
			  Poloniy[playerid] = 1;
			  SendClientMessage(playerid,COLOR_YELLOW,"Заряд плутония успешно куплен. Зарядка в делориан произойдет во время включения накопителя");
		   }
		   else return SendClientMessage(playerid,KNOWNCOLOR_KHAKI,"Плутоний для путешествия 2 раза стоит 0$");
		   return 1;
	}
	return 0;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{

	 if(newkeys == 4 && (GetPlayerVehicleID(playerid) == delorian && GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
	 {
	   if(G[delorian] == 1)
	   {
		 G[delorian] = 0;
		 Block = false;
		 SendClientMessage(playerid,COLOR_YELLOW,"Потоковый накопитель отключен");
		 return 1;
	   }
	   else if(G[delorian] == 0)
	   {
	   if(Toplivo > 0)
	   {
         G[delorian] = 1;
         Block = false;
         SendClientMessage(playerid,COLOR_YELLOW,"Потоковый накопитель включен");
         return 1;
	   }
	   else if(Toplivo < 1)
	   {
		 if(Poloniy[playerid] > 0)
		 {
		   G[delorian] = 1;
           Block = false;
           Poloniy[playerid] = 0;
           SendClientMessage(playerid,COLOR_YELLOW,"Потоковый накопитель включен.");
           SendClientMessage(playerid,COLOR_YELLOW,"Заряд плутония заряжен в делориан.");
           Toplivo += 2;
		 }
		 else return SendClientMessage(playerid,KNOWNCOLOR_KHAKI,"Нет заряда плутония. Купите его командой /plutonium.");
	   }
	   }
     }
	 return 1;
}


forward EffectFire(playerid);

public EffectFire(playerid)
{
        Fire[delorian][0] = CreateObject(18694,0,0,0,0,0,0);
        Fire[delorian][1] = CreateObject(18694,0,0,0,0,0,0);
        Fire[delorian][2] = CreateObject(18694,0,0,0,0,0,0);
        Fire[delorian][3] = CreateObject(18694,0,0,0,0,0,0);
        AttachObjectToVehicle(Fire[delorian][0], delorian, -0.8, 2.0, -2.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(Fire[delorian][1], delorian, 0.8, 2.0, -2.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(Fire[delorian][2], delorian, -0.8, -2.0, -2.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(Fire[delorian][3], delorian, 0.8, -2.0, -2.0, 0.0, 0.0, 0.0);
	    return 1;
}

forward DeleteFire(playerid);

public DeleteFire(playerid)
{
        for(new i; i < 5; i++)DestroyObject(Fire[delorian][i]);
	    return 1;
}


new Passenger;

forward Tele(playerid);

public Tele(playerid)
{
   if(GetVehicleSpeed(playerid) >= 88)
   {
		new seat;
		for(new i; i < GetMaxPlayers(); i++)
	    {
	       if((GetPlayerState(i) != PLAYER_STATE_DRIVER) && GetPlayerVehicleID(i) == delorian)
	       {
		      Passenger = 1;
		      seat = GetPlayerVehicleSeat(i);
           }
        }
        SetPlayerWeather(playerid,random(15));
        G[delorian] = 0;
        Time[delorian] = 1;
        Block = false;
        SetVehicleHealth(delorian,50000);
        GetVehiclePos(delorian,P[0],P[1],P[2]);
        CreateExplosion(P[0],P[1],P[2],10,0.0);
        SetVehicleHealth(delorian,1000);
        SetVehicleVirtualWorld(delorian,12);
        if(Toplivo > 0)Toplivo --;
        SetPlayerVirtualWorld(playerid,12);
        PutPlayerInVehicle(playerid,delorian,0);
        if(Passenger == 1)
        {
           for(new i; i < GetMaxPlayers(); i++)
	       {
             if((GetPlayerState(i) != PLAYER_STATE_DRIVER) && GetPlayerVehicleID(i) == delorian)
	         {
               SetPlayerVirtualWorld(i,12);
               SetPlayerWeather(i,random(15));
               PutPlayerInVehicle(i,delorian,seat);
             }
           }
           SetVehicleSpeed(delorian,203);
        }
        Passenger = 0;
        DeleteFire(playerid);
   }
   else
   {
      DeleteFire(playerid);
      Block = false;
   }
   return 1;
}


forward TeleNaz(playerid);

public TeleNaz(playerid)
{
   if(GetVehicleSpeed(playerid) >= 88)
   {
		new seat;
		for(new i; i < GetMaxPlayers(); i++)
	    {
	       if((GetPlayerState(i) != PLAYER_STATE_DRIVER) && GetPlayerVehicleID(i) == delorian)
	       {
		      Passenger = 1;
		      seat = GetPlayerVehicleSeat(i);
           }
        }
        SetPlayerWeather(playerid,Weather);
        G[delorian] = 0;
        Time[delorian] = 0;
        Block = false;
        SetVehicleHealth(delorian,50000);
        GetVehiclePos(delorian,P[0],P[1],P[2]);
        CreateExplosion(P[0],P[1],P[2],10,0.0);
        SetVehicleHealth(delorian,1000);
        SetVehicleVirtualWorld(delorian,0);
        if(Toplivo > 0)Toplivo --;
        SetPlayerVirtualWorld(playerid,0);
        PutPlayerInVehicle(playerid,delorian,0);
        if(Passenger == 1)
        {
           for(new i; i < GetMaxPlayers(); i++)
	       {
             if((GetPlayerState(i) != PLAYER_STATE_DRIVER) && GetPlayerVehicleID(i) == delorian)
	         {
               SetPlayerVirtualWorld(i,0);
               SetPlayerWeather(i,random(15));
               PutPlayerInVehicle(i,delorian,seat);
             }
           }
           SetVehicleSpeed(delorian,203);
        }
		Passenger = 0;
        DeleteFire(playerid);
   }
   else
   {
      DeleteFire(playerid);
      Block = false;
   }
   return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == delorian)
    {
	    TextDrawShowForPlayer(playerid, Textdraw0);
	    TextDrawShowForPlayer(playerid, Textdraw1);
	    TextDrawShowForPlayer(playerid, Textdraw2);
	    SendClientMessage(playerid,COLOR_YELLOW,"Добро пожаловать в машину времени. Для путешествия во времени включите потоковый накопитель.");
	    SendClientMessage(playerid,COLOR_YELLOW,"Накопитель включается на ALT. Разгоняйтесь до 88 на спидометре и отправляйтесь в прошлое. ");
	}
    if(newstate == PLAYER_STATE_ONFOOT)
	{
	   TextDrawHideForPlayer(playerid, Textdraw0);
	   TextDrawHideForPlayer(playerid, Textdraw1);
	   TextDrawHideForPlayer(playerid, Textdraw2);
	}
	return 1;
}
stock GetVehicleSpeed(playerid)
{
    new Float:ST[4];
    if(IsPlayerInAnyVehicle(playerid))
	GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
	else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 150.3;
    return floatround(ST[3]);
}
stock SetVehicleSpeed(vehicleid,mph)
{
    new Float:Vx, Float:Vy, Float:Vz ,Float:speeds, Float:multiple;
    GetVehicleVelocity(vehicleid,Vx,Vy,Vz);
    speeds = floatsqroot(Vx*Vx + Vy*Vy + Vz*Vz);
    if(speeds > 0)
    {
        multiple = (mph / (speeds * 250));
        return SetVehicleVelocity(vehicleid, Vx*multiple, Vy*multiple, Vz*multiple);
    }
    return 0;
}

 

 

Поделиться сообщением


Ссылка на сообщение
Гость
Эта тема закрыта для публикации ответов.
  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

  • Похожий контент

    • patrickk
      От patrickk
      Всем привет, решил написать dm сервер и довольно хорошим получился, даже на голову выше Goat dm. Оставил не решенную проблему тем что  у меня есть 4 локации с rp run и cj run ну а как добавить cj бег на те локации не знаю и как эта система работает. Надеюсь мне помогут знающие люди
    • Samolet
      От Samolet
      Здраствуйте, cоздаю копию Arizona на ОМП, опен мультиплеер, загрузил и подключил бд, но сервер не хочет вот лог :[2026-10-20T21:03:32+0300] [Info] Log file reloaded. Starting open.mp server (1.5.8.3079) from commit c6759bd8d265171ae3d86598895a23d5a8d92a3b Loading component $CAPI.so Successfully loaded component C-API (1.5.8.3079) with UID 10467dd8d4c56fc6 Loading component LegacyConfig.so Successfully loaded component LegacyConfig (1.5.8.3079) with UID 24ef6216838f9ffc Loading component NPCs.so Successfully loaded component NPCs (1.5.8.3079) with UID 3d0e59e87f4e90bc Loading component Recordings.so Successfully loaded component Recordings (1.5.8.3079) with UID 871144d399f5f613 Loading component Checkpoints.so Successfully loaded component Checkpoints (1.5.8.3079) with UID 44a937350d611dde Loading component TextDraws.so Successfully loaded component TextDraws (1.5.8.3079) with UID 9b5dc2b1d15c992a Loading component Pawn.so Successfully loaded component Pawn (1.5.8.3079) with UID 78906cd9f19c36a6 Loading component GangZones.so Successfully loaded component GangZones (1.5.8.3079) with UID b3351d11ee8d8056 Loading component Actors.so Successfully loaded component Actors (1.5.8.3079) with UID c81ca021eae2ad5c Loading component Pickups.so Successfully loaded component Pickups (1.5.8.3079) with UID cf304faa363dd971 Loading component Dialogs.so Successfully loaded component Dialogs (1.5.8.3079) with UID 44a111350d611dde Loading component Objects.so Successfully loaded component Objects (1.5.8.3079) with UID 59f8415f72da6160 Loading component Console.so Successfully loaded component Console (1.5.8.3079) with UID bfa24e49d0c95ee4 Loading component TextLabels.so Successfully loaded component TextLabels (1.5.8.3079) with UID a0c57ea80a009742 Loading component Variables.so Successfully loaded component Variables (1.5.8.3079) with UID 75e121848bc01fa2 Loading component Databases.so Successfully loaded component Databases (1.5.8.3079) with UID 80092e7eb5821a96 Loading component LegacyNetwork.so Successfully loaded component RakNetLegacyNetwork (1.5.8.3079) with UID ea9799fd79cf8442 Loading component CustomModels.so Successfully loaded component CustomModels (1.5.8.3079) with UID 15e3cb1e7c77ffff Loading component Menus.so Successfully loaded component Menus (1.5.8.3079) with UID 621e219eb97ee0b2 Loading component Vehicles.so Successfully loaded component Vehicles (1.5.8.3079) with UID 3f1f62ee9e22ab19 Loading component Classes.so Successfully loaded component Classes (1.5.8.3079) with UID 8cfb3183976da208 Loading component Timers.so Successfully loaded component Timers (1.5.8.3079) with UID 2ad8124c5ea257a3 Loaded 22 component(s) from /home/gs113492/components Executing Server Config... [2026-10-20T21:03:33+0300] [Info] Loading plugin: crashdetect.so [2026-10-20T21:03:33+0300] [Info] CrashDetect plugin 4.19 [2026-10-20T21:03:33+0300] [Info] Loading plugin: mapandreas.so [2026-10-20T21:03:33+0300] [Info] Loading plugin: streamer.so [2026-10-20T21:03:33+0300] [Info] *** Streamer Plugin v2.9.4 by Incognito loaded *** [2026-10-20T21:03:33+0300] [Info] Loading plugin: sscanf.so [2026-10-20T21:03:33+0300] [Info] [2026-10-20T21:03:33+0300] [Info] =============================== [2026-10-20T21:03:33+0300] [Info] sscanf plugin loaded. [2026-10-20T21:03:33+0300] [Info] Version: 2.8.3 [2026-10-20T21:03:33+0300] [Info] (c) 2018 Alex "Y_Less" Cole [2026-10-20T21:03:33+0300] [Info] =============================== [2026-10-20T21:03:33+0300] [Info] Loading plugin: TOTP.so [2026-10-20T21:03:33+0300] [Info] TOTP plugin v1.0.1 by Games loaded. [2026-10-20T21:03:33+0300] [Info] Loading plugin: mysql_static.so [2026-10-20T21:03:33+0300] [Info] >> plugin.mysql: R39-6 successfully loaded. [2026-10-20T21:03:33+0300] [Info] Loading plugin: libpawn_json.so [2026-10-20T21:03:34+0300] [Error] Function not registered: YSF_SetTickRate [2026-10-20T21:03:34+0300] [Error] Function not registered: PC_Init [2026-10-20T21:03:34+0300] [Info] [debug] Run time error 19: "File or function is not found" [2026-10-20T21:03:34+0300] [Info] [debug] PC_Init [2026-10-20T21:03:34+0300] [Info] [debug] YSF_SetTickRate [2026-10-20T21:03:34+0300] [Error] File or function is not found [2026-10-20T21:03:34+0300] [Error] Function not registered: PC_RegAlias [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_GetWriteOffset [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_Reset [2026-10-20T21:03:34+0300] [Error] Function not registered: PR_RegHandler [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_Delete [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_New [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_ResetReadPointer [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_SetWriteOffset [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_IgnoreBits [2026-10-20T21:03:34+0300] [Error] Function not registered: PR_Init [2026-10-20T21:03:34+0300] [Error] Function not registered: PR_SendRPC [2026-10-20T21:03:34+0300] [Error] Function not registered: PR_SendPacket [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_WriteValue [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_GetNumberOfBytesUsed [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_ReadValue [2026-10-20T21:03:34+0300] [Error] Function not registered: PC_Init [2026-10-20T21:03:34+0300] [Info] [debug] Run time error 19: "File or function is not found" [2026-10-20T21:03:34+0300] [Info] [debug] PC_Init [2026-10-20T21:03:34+0300] [Info] [debug] BS_ReadValue [2026-10-20T21:03:34+0300] [Info] [debug] BS_GetNumberOfBytesUsed [2026-10-20T21:03:34+0300] [Info] [debug] BS_WriteValue [2026-10-20T21:03:34+0300] [Info] [debug] PR_SendPacket [2026-10-20T21:03:34+0300] [Info] [debug] PR_SendRPC [2026-10-20T21:03:34+0300] [Info] [debug] PR_Init [2026-10-20T21:03:34+0300] [Info] [debug] BS_IgnoreBits [2026-10-20T21:03:34+0300] [Info] [debug] BS_SetWriteOffset [2026-10-20T21:03:34+0300] [Info] [debug] BS_ResetReadPointer [2026-10-20T21:03:34+0300] [Info] [debug] BS_New [2026-10-20T21:03:34+0300] [Info] [debug] BS_Delete [2026-10-20T21:03:34+0300] [Info] [debug] PR_RegHandler [2026-10-20T21:03:34+0300] [Info] [debug] BS_Reset [2026-10-20T21:03:34+0300] [Info] [debug] BS_GetWriteOffset [2026-10-20T21:03:34+0300] [Info] [debug] PC_RegAlias [2026-10-20T21:03:34+0300] [Error] File or function is not found [2026-10-20T21:03:34+0300] [Info] [debug] Run time error 19: "File or function is not found" [2026-10-20T21:03:34+0300] [Info] [debug] PC_Init [2026-10-20T21:03:34+0300] [Info] [debug] YSF_SetTickRate [2026-10-20T21:03:34+0300] [Error] File or function is not found [2026-10-20T21:03:34+0300] [Info] [debug] Run time error 19: "File or function is not found" [2026-10-20T21:03:34+0300] [Info] [debug] PC_Init [2026-10-20T21:03:34+0300] [Info] [debug] BS_ReadValue [2026-10-20T21:03:34+0300] [Info] [debug] BS_GetNumberOfBytesUsed [2026-10-20T21:03:34+0300] [Info] [debug] BS_WriteValue [2026-10-20T21:03:34+0300] [Info] [debug] PR_SendPacket [2026-10-20T21:03:34+0300] [Info] [debug] PR_SendRPC [2026-10-20T21:03:34+0300] [Info] [debug] PR_Init [2026-10-20T21:03:34+0300] [Info] [debug] BS_IgnoreBits [2026-10-20T21:03:34+0300] [Info] [debug] BS_SetWriteOffset [2026-10-20T21:03:34+0300] [Info] [debug] BS_ResetReadPointer [2026-10-20T21:03:34+0300] [Info] [debug] BS_New [2026-10-20T21:03:34+0300] [Info] [debug] BS_Delete [2026-10-20T21:03:34+0300] [Info] [debug] PR_RegHandler [2026-10-20T21:03:34+0300] [Info] [debug] BS_Reset [2026-10-20T21:03:34+0300] [Info] [debug] BS_GetWriteOffset [2026-10-20T21:03:34+0300] [Info] [debug] PC_RegAlias [2026-10-20T21:03:34+0300] [Info] Legacy Network started on ***.**.**.***:2717. Помогите пожалуйста