Erik
Участник
- Сообщения
- 67
- Реакции
- 16
Хотел написать плагин для ядра JWP чтоб через меню можно было спаунить мячик и удалять его и предел был в один мяч, но я не смог этого сделать и дошел только до того чтоб заспаунить мячик и то выдает ошибки и я не могу разобраться, кто сможет помочь?
#include <sourcemod>
#include <sdktools>
#include <jwp>
#pragma semicolon 1
#include <sdkhooks>
#include <cstrike>
new trace;
#pragma newdecls required
#define PLUGIN_VERSION "1.0.0"
#define DROPEN "door_aim_open"
#define MODEL_BALL "models/props/de_dust/hr_dust/dust_soccerball/dust_soccer_ball001.mdl"
public void OnPluginStart()
{
if (JWP_IsStarted()) JWP_Started();
LoadTranslations("jwp_modules.phrases");
}
public void JWP_Started()
{
JWP_AddToMainMenu(DROPEN, OnFuncDrOpenDisplay, OnFuncDrOpenSelect);
}
public void OnPluginEnd()
{
JWP_RemoveFromMainMenu();
}
public bool OnFuncDrOpenDisplay(int client, char[] buffer, int maxlength, int style)
{
Format(buffer, maxlength, "%T", "DoorAimControl_Menu_Open", LANG_SERVER);
return true;
}
public bool OnFuncDrOpenSelect(int client)
{
if (!JWP_IsFlood(client, 3))
DoorManip(client, true);
JWP_ShowMainMenu(client);
return true;
}
void DoorManip(int client, bool open)
{
float vOrigin[3], vAngles[3];
GetClientEyePosition(client, vOrigin);
GetClientEyeAngles(client, vAngles);
trace = TR_TraceRayFilter(vOrigin, vAngles, MASK_SOLID, RayType_Infinite, TraceEntityFilterPlayer);
if(TR_DidHit(trace))
{
TR_GetEndPosition(vOrigin, trace);
CloseHandle(trace);
return;
}
CloseHandle(trace);
int ball = CreateEntityByName("prop_physics_multiplayer");
DispatchKeyValue(ball, "model", MODEL_BALL);
DispatchKeyValue(ball, "physicsmode", "2");
DispatchSpawn(ball);
TeleportEntity(ball, NULL_VECTOR, NULL_VECTOR, NULL_VECTOR);
}
public bool TraceEntityFilterPlayer(entity, contentsMask)
{
return entity > MaxClients;
}
#include <sourcemod>
#include <sdktools>
#include <jwp>
#pragma semicolon 1
#include <sdkhooks>
#include <cstrike>
new trace;
#pragma newdecls required
#define PLUGIN_VERSION "1.0.0"
#define DROPEN "door_aim_open"
#define MODEL_BALL "models/props/de_dust/hr_dust/dust_soccerball/dust_soccer_ball001.mdl"
public void OnPluginStart()
{
if (JWP_IsStarted()) JWP_Started();
LoadTranslations("jwp_modules.phrases");
}
public void JWP_Started()
{
JWP_AddToMainMenu(DROPEN, OnFuncDrOpenDisplay, OnFuncDrOpenSelect);
}
public void OnPluginEnd()
{
JWP_RemoveFromMainMenu();
}
public bool OnFuncDrOpenDisplay(int client, char[] buffer, int maxlength, int style)
{
Format(buffer, maxlength, "%T", "DoorAimControl_Menu_Open", LANG_SERVER);
return true;
}
public bool OnFuncDrOpenSelect(int client)
{
if (!JWP_IsFlood(client, 3))
DoorManip(client, true);
JWP_ShowMainMenu(client);
return true;
}
void DoorManip(int client, bool open)
{
float vOrigin[3], vAngles[3];
GetClientEyePosition(client, vOrigin);
GetClientEyeAngles(client, vAngles);
trace = TR_TraceRayFilter(vOrigin, vAngles, MASK_SOLID, RayType_Infinite, TraceEntityFilterPlayer);
if(TR_DidHit(trace))
{
TR_GetEndPosition(vOrigin, trace);
CloseHandle(trace);
return;
}
CloseHandle(trace);
int ball = CreateEntityByName("prop_physics_multiplayer");
DispatchKeyValue(ball, "model", MODEL_BALL);
DispatchKeyValue(ball, "physicsmode", "2");
DispatchSpawn(ball);
TeleportEntity(ball, NULL_VECTOR, NULL_VECTOR, NULL_VECTOR);
}
public bool TraceEntityFilterPlayer(entity, contentsMask)
{
return entity > MaxClients;
}