Herro[CM] |
Дата: Вторник, 08.09.2015, 23:41 | Сообщение # 1
|
Бывалый
Сообщений: 425
Статус: Offline
|
Довольно удобная система создания пикапа телепорта на сервере
Функция: Код CreatePortal(Float:X, Float:Y, Float:Z, Float:A, Int, Virt, Float:ToX, Float:ToY, Float:ToZ, Float:ToA, ToInt, ToVirt, Key = -1)
Float:X, Float:Y, Float:Z, Float:A, - Координаты входа по осям X/Y/Z а так же угол поворота игрока. Int - интерьер входа Virt - мир, по умолчанию виртуальный мир = 0. Float:ToX, Float:ToY, Float:ToZ, Float:ToA, - Координаты выхода по осям X/Y/Z а так же угол поворота игрока ToInt - интерьер выхода ToVirt - виртуальный мир Key = использование клавиш для входа, если клавиша не указана то пройдет без нажатия клавиш.
Forward (код запихнуть в любое место, до функции.) Код forward OnPlayerPortal(playerid, portalid, side);
Настройки:
Код #define pps_Model 1318 - Модель пикапа #define pps_Type 1 - Тип пикапа #define pps_Deact 1500 - Время неактивного пикапа #define MAX_PORTALS - Максимальное количество точек телепорта
Сам include
Код #if defined _PPS_included #endinput #endif #define _PPS_included #define pps_Model 1318 // Модель пикапа #define pps_Type 1 // Тип пикапа #define pps_Deact 1500 // Время деактивации после прохода через портал (мс) #define MAX_PORTALS 100 // Максимальное кол-во порталов static pps_number = 0; enum ppsData { pps_id, Float:pps_X, Float:pps_Y, Float:pps_Z, Float:pps_A, pps_Int, pps_Virt, pps_Toid, Float:pps_ToX, Float:pps_ToY, Float:pps_ToZ, Float:pps_ToA, pps_ToInt, pps_ToVirt, pps_Key, } new ppsInfo[MAX_PORTALS][ppsData]; forward pps_PickupDeactivationTime(playerid); forward OnPlayerPortal(playerid, portalid, side); public OnPlayerPickUpPickup(playerid, pickupid) { if(!pps_number) { if(funcidx("pps_OnPlayerPickUpPickup") != -1) return CallLocalFunction("pps_OnPlayerPickUpPickup", "ii", playerid, pickupid); return 1; } for(new num = 0; num <= pps_number; num++) { if(ppsInfo[num][pps_Key] != -1) continue; if(pickupid == ppsInfo[num][pps_id] && GetPVarInt(playerid, "pps_Deactivation") == 0) { SetPlayerPos(playerid, ppsInfo[num][pps_ToX], ppsInfo[num][pps_ToY], ppsInfo[num][pps_ToZ]); SetPlayerFacingAngle(playerid, ppsInfo[num][pps_ToA]); SetPlayerInterior(playerid, ppsInfo[num][pps_ToInt]); SetPlayerVirtualWorld(playerid, ppsInfo[num][pps_ToVirt]); SetPVarInt(playerid, "pps_Deactivation", 1), SetTimerEx("pps_PickupDeactivationTime", pps_Deact, false, "i", playerid); if(funcidx("OnPlayerPortal") != -1) CallLocalFunction("OnPlayerPortal", "iii", playerid, num, 1); break; } else if(pickupid == ppsInfo[num][pps_Toid] && GetPVarInt(playerid, "pps_Deactivation") == 0) { SetPlayerPos(playerid, ppsInfo[num][pps_X], ppsInfo[num][pps_Y], ppsInfo[num][pps_Z]); SetPlayerFacingAngle(playerid, ppsInfo[num][pps_A]); SetPlayerInterior(playerid, ppsInfo[num][pps_Int]); SetPlayerVirtualWorld(playerid, ppsInfo[num][pps_Virt]); SetPVarInt(playerid, "pps_Deactivation", 1), SetTimerEx("pps_PickupDeactivationTime", pps_Deact, false, "i", playerid); if(funcidx("OnPlayerPortal") != -1) CallLocalFunction("OnPlayerPortal", "iii", playerid, num, 0); break; } } if(funcidx("pps_OnPlayerPickUpPickup") != -1) return CallLocalFunction("pps_OnPlayerPickUpPickup", "ii", playerid, pickupid); return 1; } public pps_PickupDeactivationTime(playerid) { SetPVarInt(playerid, "pps_Deactivation", 0); return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(!pps_number) { if(funcidx("pps_OnPlayerKeyStateChange") != -1) return CallLocalFunction("pps_OnPlayerKeyStateChange", "iii", playerid, newkeys, oldkeys); return 1; } for(new num = 0; num <= pps_number; num++) { if(newkeys & ppsInfo[num][pps_Key]) { if(ppsInfo[num][pps_Key] == -1) continue; if(IsPlayerInRangeOfPoint(playerid, 1.0, ppsInfo[num][pps_X], ppsInfo[num][pps_Y], ppsInfo[num][pps_Z]) && GetPlayerVirtualWorld(playerid) == ppsInfo[num][pps_Virt]) { SetPlayerInterior(playerid, ppsInfo[num][pps_ToInt]); SetPlayerPos(playerid, ppsInfo[num][pps_ToX], ppsInfo[num][pps_ToY], ppsInfo[num][pps_ToZ]); SetPlayerFacingAngle(playerid, ppsInfo[num][pps_ToA]); SetPlayerVirtualWorld(playerid, ppsInfo[num][pps_ToVirt]); if(funcidx("OnPlayerPortal") != -1) CallLocalFunction("OnPlayerPortal", "iii", playerid, num, 1); break; } else if(IsPlayerInRangeOfPoint(playerid, 1.0, ppsInfo[num][pps_ToX], ppsInfo[num][pps_ToY], ppsInfo[num][pps_ToZ]) && GetPlayerVirtualWorld(playerid) == ppsInfo[num][pps_ToVirt]) { SetPlayerPos(playerid, ppsInfo[num][pps_X], ppsInfo[num][pps_Y], ppsInfo[num][pps_Z]); SetPlayerFacingAngle(playerid, ppsInfo[num][pps_A]); SetPlayerInterior(playerid, ppsInfo[num][pps_Int]); SetPlayerVirtualWorld(playerid, ppsInfo[num][pps_Virt]); if(funcidx("OnPlayerPortal") != -1) CallLocalFunction("OnPlayerPortal", "iii", playerid, num, 0); break; } } } if(funcidx("pps_OnPlayerKeyStateChange") != -1) return CallLocalFunction("pps_OnPlayerKeyStateChange", "iii", playerid, newkeys, oldkeys); return 1; } stock CreatePortal(Float:X, Float:Y, Float:Z, Float:A, Int, Virt, Float:ToX, Float:ToY, Float:ToZ, Float:ToA, ToInt, ToVirt, Key = -1) { pps_number++; ppsInfo[pps_number][pps_Key] = Key; ppsInfo[pps_number][pps_id] = CreatePickup(pps_Model, pps_Type, X, Y, Z, Virt); ppsInfo[pps_number][pps_Toid] = CreatePickup(pps_Model, pps_Type, ToX, ToY, ToZ, ToVirt); ppsInfo[pps_number][pps_X] = X, ppsInfo[pps_number][pps_Y] = Y, ppsInfo[pps_number][pps_Z] = Z, ppsInfo[pps_number][pps_A] = A; ppsInfo[pps_number][pps_Int] = Int, ppsInfo[pps_number][pps_Virt] = Virt; ppsInfo[pps_number][pps_ToX] = ToX, ppsInfo[pps_number][pps_ToY] = ToY, ppsInfo[pps_number][pps_ToZ] = ToZ, ppsInfo[pps_number][pps_ToA] = ToA; ppsInfo[pps_number][pps_ToInt] = ToInt, ppsInfo[pps_number][pps_ToVirt] = ToVirt; return pps_number; } #if defined _ALS_OnPlayerPickUpPickup #undef OnPlayerPickUpPickup #else #define _ALS_OnPlayerPickUpPickup #endif #define OnPlayerPickUpPickup pps_OnPlayerPickUpPickup forward pps_OnPlayerPickUpPickup(playerid, newkeys, oldkeys); #if defined _ALS_OnPlayerKeyStateChange #undef OnPlayerKeyStateChange #else #define _ALS_OnPlayerKeyStateChange #endif #define OnPlayerKeyStateChange pps_OnPlayerKeyStateChange forward pps_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
Автор: _[Bupyc]_
Когда нет знания, есть мнение.
|
|
|
|