[Include] GBug - Форум Cheat-Master.ru
  • Страница 1 из 1
  • 1
Модератор форума: Phoenixxx_Czar, Getbackthere, [CM]OlegEhtler  
[Include] GBug
Herro[CM] Дата: Среда, 09.09.2015, 20:53 | Сообщение # 1
Бывалый
Сообщений: 425
Статус: Offline
Данный include предотвращает телепортирование пассажира в машину на расстояние


Include
Код
#include <YSI\y_hooks>
   
#define MAX_VEHICLE_MOVE_RADIUS 2.0 // The distance a vehicle can move by for passengers to warp inside
   
enum E_GBUG
{
         Float:gbug_playerpos[3],
         Float:gbug_vehpos[3],
         gbug_playerenteringveh,
         gbug_pentervtick
         
}
new gBugPlayerData[MAX_PLAYERS][E_GBUG];
   
Hook:gbug_OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
         if(!ispassenger || gBugPlayerData[playerid][gbug_playerenteringveh] != 0) return 1;
         gBugPlayerData[playerid][gbug_pentervtick] = GetTickCount();
         GetPlayerPos(playerid, gBugPlayerData[playerid][gbug_playerpos][0], gBugPlayerData[playerid][gbug_playerpos][1], gBugPlayerData[playerid][gbug_playerpos][2]);
         GetVehiclePos(vehicleid, gBugPlayerData[playerid][gbug_vehpos][0], gBugPlayerData[playerid][gbug_vehpos][1], gBugPlayerData[playerid][gbug_vehpos][2]);
         gBugPlayerData[playerid][gbug_playerenteringveh] = 1;
         //SendClientMessage(playerid, -1, "Starting to enter vehicle..");
         return 1;
}
   
Hook:gbug_OnPlayerStateChange(playerid, newstate, oldstate)
{
         if(newstate == 3) // Entered vehicle
         {
                 if((gBugPlayerData[playerid][gbug_playerenteringveh] == 1 || gBugPlayerData[playerid][gbug_playerenteringveh] == 2) && GetVehicleDistanceFromPoint(GetPlayerVehicleID(playerid), gBugPlayerData[playerid][gbug_vehpos][0], gBugPlayerData[playerid][gbug_vehpos][1], gBugPlayerData[playerid][gbug_vehpos][2]) > MAX_VEHICLE_MOVE_RADIUS)
                 {
                         SetPlayerPos(playerid, gBugPlayerData[playerid][gbug_playerpos][0], gBugPlayerData[playerid][gbug_playerpos][1], gBugPlayerData[playerid][gbug_playerpos][2]);
                         gBugPlayerData[playerid][gbug_playerenteringveh] = 0;
                         //SendClientMessage(playerid, -1, "Entry denied");
                         GameTextForPlayer(playerid, "~R~entry denied", 3000, 3);
                 }
                 else
                 {
                         gBugPlayerData[playerid][gbug_playerenteringveh] = 0;
                         //SendClientMessage(playerid, -1, "Entry accepted");
                 }
         }
         return 1;
}
   
stock gbug_PutPlayerInVehicle(playerid, vehicleid, seatid)
{
         gBugPlayerData[playerid][gbug_playerenteringveh] = 0;
         PutPlayerInVehicle(playerid, vehicleid, seatid);
         return 1;
}
   
#if defined _ALS_PutPlayerInVehicle
         #undef PutPlayerInVehicle
#else
         #define _ALS_PutPlayerInVehicle
#endif
#define PutPlayerInVehicle  gbug_PutPlayerInVehicle
   
Hook:gbug_OnPlayerUpdate(playerid)
{
         if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_ENTER_VEHICLE && gBugPlayerData[playerid][gbug_playerenteringveh] == 0) // OnPlayerEnterVehicle wasn't called, tsk tsk tsk
         {
                 gBugPlayerData[playerid][gbug_pentervtick] = GetTickCount();
                 GetPlayerPos(playerid, gBugPlayerData[playerid][gbug_playerpos][0], gBugPlayerData[playerid][gbug_playerpos][1], gBugPlayerData[playerid][gbug_playerpos][2]);
                 gBugPlayerData[playerid][gbug_playerenteringveh] = 1;
                 //SendClientMessage(playerid, -1, "Starting to enter vehicle..");
                 return 1;
         }
   
         if(gBugPlayerData[playerid][gbug_playerenteringveh] == 0) return 1; // Not handling
         
         if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_ENTER_VEHICLE && gBugPlayerData[playerid][gbug_playerenteringveh] != 3 && GetTickCount()-gBugPlayerData[playerid][gbug_pentervtick] > 321)
         {
                 {
                         gBugPlayerData[playerid][gbug_playerenteringveh] = 0;
                         //SendClientMessage(playerid, -1, "Cancelled entry while running to door: special action");
                 }
                 return 1;
         }
   
         new Float:x, Float:y, Float:z;
         GetPlayerVelocity(playerid, x, y, z);
   
         if(gBugPlayerData[playerid][gbug_playerenteringveh] == 3 && GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_ENTER_VEHICLE)
         {
                 gBugPlayerData[playerid][gbug_playerenteringveh] = 0;
                 //SendClientMessage(playerid, -1, "Cancelled entry while stepping in (special action)");
                 return 1;
         }
         
         if(x == 0 && y == 0 && z == 0) // Standing still, did they get in?
         {
                 if(gBugPlayerData[playerid][gbug_playerenteringveh] != 3)
                 {
                         if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_ENTER_VEHICLE && GetTickCount()-gBugPlayerData[playerid][gbug_pentervtick] > 321)
                         {
                    if(gBugPlayerData[playerid][gbug_playerenteringveh] == 2) // Stepping in
                    {
                    gBugPlayerData[playerid][gbug_playerenteringveh] = 3;
                    //SendClientMessage(playerid, -1, "Stepping in");
                    }
                    else
                    {
                    gBugPlayerData[playerid][gbug_playerenteringveh] = 2; // Stepping in?
                    //SendClientMessage(playerid, -1, "Stepping in?");
                    gBugPlayerData[playerid][gbug_pentervtick] = GetTickCount();
                    }
                         }
                         else if(GetTickCount()-gBugPlayerData[playerid][gbug_pentervtick] > 321) // Cancelled entry
                         {
                    gBugPlayerData[playerid][gbug_playerenteringveh] = 0;
                    //SendClientMessage(playerid, -1, "Cancelled entry while running to door (special action)");
                         }
                 }
         }
         return 1;
}


Предупреждение! Требуется наличие YSI\y_hooks
Автор: MP2


Когда нет знания, есть мнение.
Surex Дата: Суббота, 02.07.2016, 14:03 | Сообщение # 2
Боец
Сообщений: 137
Статус: Offline
полезно!

Плисс Дата: Вторник, 19.07.2016, 21:26 | Сообщение # 3
Боец
Сообщений: 70
Статус: Offline
Кросс,полезная темка!
SlowsizeCM Дата: Суббота, 28.01.2017, 23:34 | Сообщение # 4
Боец
Сообщений: 78
Статус: Offline
Полезно!
slivЧИК Дата: Четверг, 06.04.2017, 15:03 | Сообщение # 5
Боец
Сообщений: 81
Статус: Offline
Полезно.. +

100 дней на CM [✔] 10 репутации на CM [✔] Новичок [✔]
150 дней на CM [✔] 25 репутации на CM [✔] Любитель [✔]
200 дней на CM [✔] 50 репутации на CM [✔] Боец [✔]
309 дней на CM [✔] 100 репутации на CM [✔] Боец(х2) [✔]
[CM]Kooki Дата: Пятница, 21.04.2017, 17:25 | Сообщение # 6
Новичок
Сообщений: 24
Статус: Offline
Полезно +
[CM]Riddle Дата: Пятница, 30.06.2017, 00:54 | Сообщение # 7
Боец
Сообщений: 148
Статус: Offline
Полезно. А если собейтом тпшиться работать будет?
  • Страница 1 из 1
  • 1
Поиск: