А не проще bind прописать команду !block тем игрокам которые играют.. когда нужна подсадка нажал кнопку.. не нужно вторую кнопку..Здравствуйте, возник вопрос, возможно ли реализовать коллизию игроков таким образом, чтобы они проходили друг сквозю друга, но подсадки при этом работали. Т.е. ноги одного взаимодействовали с головой другого?
есть такие игроки, которые встают прямо в тебя и пишут эту команду, и получается ты заблокирован, не можешь двигаться.А не проще bind прописать команду !block тем игрокам которые играют.. когда нужна подсадка нажал кнопку.. не нужно вторую кнопку..
Привет попробуй этот плагин он отключает коллизию между игроками, но оставляет возможность подсадок.Здравствуйте, возник вопрос, возможно ли реализовать коллизию игроков таким образом, чтобы они проходили друг сквозю друга, но подсадки при этом работали. Т.е. ноги одного взаимодействовали с головой другого?
есть исходник?Привет попробуй этот плагин он отключает коллизию между игроками, но оставляет возможность подсадок.
Привет, можешь скинуть исходник пожалуйстаПривет попробуй этот плагин он отключает коллизию между игроками, но оставляет возможность подсадок.
Стоит использовать SetEntityCollisionGroupПривет попробуй этот плагин он отключает коллизию между игроками, но оставляет возможность подсадок.
Держи отпиши сюда если решил свою проблему.((:Привет, можешь скинуть исходник пожалуйста
#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "Player Collision",
author = "Alley",
version = "1.0"
};
public OnPluginStart()
{
HookEvent("player_spawn", OnPlayerSpawn);
HookEvent("player_death", OnPlayerDeath);
CreateTimer(0.1, Timer_GameFrame, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
}
public Action Timer_GameFrame(Handle timer)
{
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || IsFakeClient(i))
continue;
CheckPlayerBoosting(i);
}
return Plugin_Continue;
}
void CheckPlayerBoosting(int client)
{
float posClient[3];
float posOther[3];
GetClientAbsOrigin(client, posClient);
for (int i = 1; i <= MaxClients; i++)
{
if (i == client || !IsClientInGame(i) || IsFakeClient(i))
continue;
GetClientAbsOrigin(i, posOther);
if (FloatAbs(posClient[2] - posOther[2]) > 50.0 && FloatAbs(posClient[2] - posOther[2]) < 80.0)
{
SetEntityCollisionGroup(client, 5);
LogMessage("Player %d collision state changed to normal for boosting.", client);
return;
}
}
SetEntityCollisionGroup(client, 2);
LogMessage("Player %d collision state changed to no collision.", client);
}
public void OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
int client = GetEventInt(event, "userid");
int entity = GetClientOfUserId(client);
SetEntityCollisionGroup(entity, 2);
LogMessage("Player %d spawned with no collision.", client);
}
public void OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
int client = GetEventInt(event, "userid");
int entity = GetClientOfUserId(client);
SetEntityCollisionGroup(entity, 5);
LogMessage("Player %d died and collision restored.", client);
}
Если прыгнуть находясь в игроке, или на игроке, то ты застрянешьДержи отпиши сюда если решил свою проблему.((:
C-подобный:#include <sourcemod> #include <sdktools> public Plugin:myinfo = { name = "Player Collision", author = "Alley", version = "1.0" }; public OnPluginStart() { HookEvent("player_spawn", OnPlayerSpawn); HookEvent("player_death", OnPlayerDeath); CreateTimer(0.1, Timer_GameFrame, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE); } public Action Timer_GameFrame(Handle timer) { for (int i = 1; i <= MaxClients; i++) { if (!IsClientInGame(i) || IsFakeClient(i)) continue; CheckPlayerBoosting(i); } return Plugin_Continue; } void CheckPlayerBoosting(int client) { float posClient[3]; float posOther[3]; GetClientAbsOrigin(client, posClient); for (int i = 1; i <= MaxClients; i++) { if (i == client || !IsClientInGame(i) || IsFakeClient(i)) continue; GetClientAbsOrigin(i, posOther); if (FloatAbs(posClient[2] - posOther[2]) > 50.0 && FloatAbs(posClient[2] - posOther[2]) < 80.0) { SetEntityCollisionGroup(client, 5); LogMessage("Player %d collision state changed to normal for boosting.", client); return; } } SetEntityCollisionGroup(client, 2); LogMessage("Player %d collision state changed to no collision.", client); } public void OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) { int client = GetEventInt(event, "userid"); int entity = GetClientOfUserId(client); SetEntityCollisionGroup(entity, 2); LogMessage("Player %d spawned with no collision.", client); } public void OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) { int client = GetEventInt(event, "userid"); int entity = GetClientOfUserId(client); SetEntityCollisionGroup(entity, 5); LogMessage("Player %d died and collision restored.", client); }
Я обновил его, чтобы улучшить взаимодействие между игроками и предотвратить подобные ситуации. Теперь, если игрок находится на определенной высоте относительно другого, его коллизия будет отключена, чтобы избежать застревания. Попробуй протестировать его если будут проблемы пиши сюда.Если прыгнуть находясь в игроке, или на игроке, то ты застрянешь
#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "Player Collision",
author = "Alley",
version = "1.0"
};
public OnPluginStart()
{
HookEvent("player_spawn", OnPlayerSpawn);
HookEvent("player_death", OnPlayerDeath);
CreateTimer(0.1, Timer_GameFrame, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
}
public Action Timer_GameFrame(Handle timer)
{
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || IsFakeClient(i))
continue;
CheckPlayerBoosting(i);
}
return Plugin_Continue;
}
void CheckPlayerBoosting(int client)
{
float posClient[3];
GetClientAbsOrigin(client, posClient);
int flags = GetClientHealth(client);
bool isJumping = (flags < 100);
for (int i = 1; i <= MaxClients; i++)
{
if (i == client || !IsClientInGame(i) || IsFakeClient(i))
continue;
float posOther[3];
GetClientAbsOrigin(i, posOther);
float heightDifference = FloatAbs(posClient[2] - posOther[2]);
if (heightDifference > 50.0 && heightDifference < 80.0 && !isJumping)
{
SetEntityCollisionGroup(client, 5);
return;
}
}
SetEntityCollisionGroup(client, 2);
}
public void OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
int client = GetEventInt(event, "userid");
int entity = GetClientOfUserId(client);
SetEntityCollisionGroup(entity, 2);
}
public void OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
int client = GetEventInt(event, "userid");
int entity = GetClientOfUserId(client);
SetEntityCollisionGroup(entity, 5);
}
Ничего не изменилосьЯ обновил его, чтобы улучшить взаимодействие между игроками и предотвратить подобные ситуации. Теперь, если игрок находится на определенной высоте относительно другого, его коллизия будет отключена, чтобы избежать застревания. Попробуй протестировать его если будут проблемы пиши сюда.
C-подобный:#include <sourcemod> #include <sdktools> public Plugin:myinfo = { name = "Player Collision", author = "Alley", version = "1.0" }; public OnPluginStart() { HookEvent("player_spawn", OnPlayerSpawn); HookEvent("player_death", OnPlayerDeath); CreateTimer(0.1, Timer_GameFrame, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE); } public Action Timer_GameFrame(Handle timer) { for (int i = 1; i <= MaxClients; i++) { if (!IsClientInGame(i) || IsFakeClient(i)) continue; CheckPlayerBoosting(i); } return Plugin_Continue; } void CheckPlayerBoosting(int client) { float posClient[3]; GetClientAbsOrigin(client, posClient); int flags = GetClientHealth(client); bool isJumping = (flags < 100); for (int i = 1; i <= MaxClients; i++) { if (i == client || !IsClientInGame(i) || IsFakeClient(i)) continue; float posOther[3]; GetClientAbsOrigin(i, posOther); float heightDifference = FloatAbs(posClient[2] - posOther[2]); if (heightDifference > 50.0 && heightDifference < 80.0 && !isJumping) { SetEntityCollisionGroup(client, 5); return; } } SetEntityCollisionGroup(client, 2); } public void OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) { int client = GetEventInt(event, "userid"); int entity = GetClientOfUserId(client); SetEntityCollisionGroup(entity, 2); } public void OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) { int client = GetEventInt(event, "userid"); int entity = GetClientOfUserId(client); SetEntityCollisionGroup(entity, 5); }
Добавил обработчик прыжков попробуйНичего не изменилось
#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "Player Collision",
author = "Alley",
version = "1.0"
};
public OnPluginStart()
{
HookEvent("player_spawn", OnPlayerSpawn);
HookEvent("player_death", OnPlayerDeath);
HookEvent("player_jump", OnPlayerJump);
CreateTimer(0.1, Timer_GameFrame, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
}
public Action Timer_GameFrame(Handle timer)
{
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || IsFakeClient(i))
continue;
CheckPlayerBoosting(i);
}
return Plugin_Continue;
}
void CheckPlayerBoosting(int client)
{
float posClient[3];
float posOther[3];
GetClientAbsOrigin(client, posClient);
for (int i = 1; i <= MaxClients; i++)
{
if (i == client || !IsClientInGame(i) || IsFakeClient(i))
continue;
GetClientAbsOrigin(i, posOther);
if (FloatAbs(posClient[2] - posOther[2]) > 50.0 && FloatAbs(posClient[2] - posOther[2]) < 80.0)
{
SetEntityCollisionGroup(client, 5);
return;
}
}
SetEntityCollisionGroup(client, 2);
}
public void OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
int client = GetEventInt(event, "userid");
int entity = GetClientOfUserId(client);
SetEntityCollisionGroup(entity, 2);
}
public void OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
int client = GetEventInt(event, "userid");
int entity = GetClientOfUserId(client);
SetEntityCollisionGroup(entity, 5);
}
public void OnPlayerJump(Handle:event, const String:name[], bool:dontBroadcast)
{
int client = GetEventInt(event, "userid");
SetEntityCollisionGroup(client, 2);
}
Ничего не изменилосьДобавил обработчик прыжков попробуй
C-подобный:#include <sourcemod> #include <sdktools> public Plugin:myinfo = { name = "Player Collision", author = "Alley", version = "1.0" }; public OnPluginStart() { HookEvent("player_spawn", OnPlayerSpawn); HookEvent("player_death", OnPlayerDeath); HookEvent("player_jump", OnPlayerJump); CreateTimer(0.1, Timer_GameFrame, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE); } public Action Timer_GameFrame(Handle timer) { for (int i = 1; i <= MaxClients; i++) { if (!IsClientInGame(i) || IsFakeClient(i)) continue; CheckPlayerBoosting(i); } return Plugin_Continue; } void CheckPlayerBoosting(int client) { float posClient[3]; float posOther[3]; GetClientAbsOrigin(client, posClient); for (int i = 1; i <= MaxClients; i++) { if (i == client || !IsClientInGame(i) || IsFakeClient(i)) continue; GetClientAbsOrigin(i, posOther); if (FloatAbs(posClient[2] - posOther[2]) > 50.0 && FloatAbs(posClient[2] - posOther[2]) < 80.0) { SetEntityCollisionGroup(client, 5); return; } } SetEntityCollisionGroup(client, 2); } public void OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) { int client = GetEventInt(event, "userid"); int entity = GetClientOfUserId(client); SetEntityCollisionGroup(entity, 2); } public void OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) { int client = GetEventInt(event, "userid"); int entity = GetClientOfUserId(client); SetEntityCollisionGroup(entity, 5); } public void OnPlayerJump(Handle:event, const String:name[], bool:dontBroadcast) { int client = GetEventInt(event, "userid"); SetEntityCollisionGroup(client, 2); }
Ничего не изменилось
0: DONT_COLLIDE — нет столкновений с другими игроками.
1: COLLISION — обычное столкновение, игроки могут толкать друг друга.
2: NO_COLLIDE — игрок проходит сквозь других, но может взаимодействовать с другими механиками (например, подъем).
5: PASSABLE — игроки могут проходить друг сквозь друга, но могут взаимодействовать в определенных ситуациях.
Если возникнут проблемы, попробуй заменить номера групп на другие, чтобы найти наиболее подходящий вариант для твоего сервера.
#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "Player Collision",
author = "Alley",
version = "1.1"
};
public OnPluginStart()
{
HookEvent("player_spawn", OnPlayerSpawn);
HookEvent("player_death", OnPlayerDeath);
HookEvent("player_jump", OnPlayerJump);
CreateTimer(0.1, Timer_GameFrame, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
}
public Action Timer_GameFrame(Handle timer)
{
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || IsFakeClient(i))
continue;
CheckPlayerBoosting(i);
}
return Plugin_Continue;
}
void CheckPlayerBoosting(int client)
{
float posClient[3];
float posOther[3];
GetClientAbsOrigin(client, posClient);
for (int i = 1; i <= MaxClients; i++)
{
if (i == client || !IsClientInGame(i) || IsFakeClient(i))
continue;
GetClientAbsOrigin(i, posOther);
if (FloatAbs(posClient[2] - posOther[2]) > 50.0 && FloatAbs(posClient[2] - posOther[2]) < 80.0)
{
SetEntityCollisionGroup(client, 5);
return;
}
}
SetEntityCollisionGroup(client, 2);
}
public void OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
int client = GetEventInt(event, "userid");
int entity = GetClientOfUserId(client);
SetEntityCollisionGroup(entity, 2);
}
public void OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
int client = GetEventInt(event, "userid");
int entity = GetClientOfUserId(client);
SetEntityCollisionGroup(entity, 5);
}
public void OnPlayerJump(Handle:event, const String:name[], bool:dontBroadcast)
{
int client = GetEventInt(event, "userid");
SetEntityCollisionGroup(client, 2);
}