Заказать игровой сервер Контакты (заказать плагин/исправить ошибки/другое) Поиск

[ вход ]
[ последние сообщения ]

  • Страница 1 из 1
  • 1
Форум » SourceMod >> CS:Source >> CSGO » Обсуждение » Опьянение игрока
Опьянение игрока
ILlga80 Дата: Воскресенье, 17.02.2013, 18:03:12 | Сообщение # 1
Сообщений: 57
Репутация: 3 [ +/- ]
Помогите взять функцию пошатывания игрока из lastrequest.sp
Код

#include <sourcemod>

new g_Offset_FOV = -1;
new g_Offset_DefFOV = -1;
#define  NORMAL_VISION  90

public OnPluginStart()
{
   RegConsoleCmd("drunk", Command_Drunk);
     
   g_Offset_FOV = FindSendPropOffs("CBasePlayer", "m_iFOV");
   if (g_Offset_FOV == -1)
   {
    SetFailState("Unable to find offset for FOV.");
   }
   g_Offset_DefFOV = FindSendPropOffs("CBasePlayer", "m_iDefaultFOV");
   if (g_Offset_DefFOV == -1)
   {
    SetFailState("Unable to find offset for default FOV.");
   }
}

stock ShowOverlayToClient(client, const String:overlaypath[])
{
   ClientCommand(client, "r_screenoverlay \"%s\"", overlaypath);
}

public Action:Command_Drunk(client, args)
{
   SetEntData(client, g_Offset_FOV, NORMAL_VISION, 4, true);
   SetEntData(client, g_Offset_DefFOV, NORMAL_VISION, 4, true);
   ShowOverlayToClient(client, "effects/strider_pinch_dudv");
}

Опьянение работает. Нужно еще пошатывание вправо влево(Пьяный бой на ножах в !lr)

Гости не могут скачивать файлы


Сообщение отредактировал ILlga80 - Воскресенье, 17.02.2013, 18:04:01
 
Nailain Дата: Воскресенье, 17.02.2013, 21:00:06 | Сообщение # 2
Сообщений: 19
Репутация: 1 [ +/- ]
я попробовал вот так у меня получилось=)
Код
#include <sourcemod>
#include <sdktools>

new g_Offset_FOV = -1;  
new g_Offset_DefFOV = -1;  
#define  NORMAL_VISION  90  
new Handle:timer_drunk[MAXPLAYERS+1];

public OnPluginStart()  
{  
    RegConsoleCmd("drunk", Command_Drunk);  
       
    g_Offset_FOV = FindSendPropOffs("CBasePlayer", "m_iFOV");  
    if (g_Offset_FOV == -1)  
    {  
     SetFailState("Unable to find offset for FOV.");  
    }  
    g_Offset_DefFOV = FindSendPropOffs("CBasePlayer", "m_iDefaultFOV");  
    if (g_Offset_DefFOV == -1)  
    {  
     SetFailState("Unable to find offset for default FOV.");  
    }  
}  

stock ShowOverlayToClient(client, const String:overlaypath[])  
{  
    ClientCommand(client, "r_screenoverlay \"%s\"", overlaypath);  
}  

public Action:Command_Drunk(client, args)  
{  
  SetEntData(client, g_Offset_FOV, NORMAL_VISION, 4, true);
  SetEntData(client, g_Offset_DefFOV, NORMAL_VISION, 4, true);
  ShowOverlayToClient(client, "effects/strider_pinch_dudv");
  timer_drunk[client] = CreateTimer(1.0, timer_drunk_start, client, TIMER_REPEAT);  
}

public Action:timer_drunk_start(Handle:timer, any:client)  
{
  new Float:anglesplayer[3];
  GetEntPropVector(client, Prop_Send, "m_angRotation", anglesplayer);
  new value = GetRandomInt(1, 5);
  switch (value)
  {
  case 1:
   {
   anglesplayer[0] += 0.0;
   anglesplayer[1] += 0.0;
   anglesplayer[2] += 45.0;
   TeleportEntity(client, NULL_VECTOR, anglesplayer, NULL_VECTOR);
   }
  case 2:
   {
   anglesplayer[0] += 0.0;
   anglesplayer[1] += 0.0;
   anglesplayer[2] -= 45.0;
   TeleportEntity(client, NULL_VECTOR, anglesplayer, NULL_VECTOR);
   }
  case 3:
   {
   anglesplayer[0] += 0.0;
   anglesplayer[1] += 0.0;
   anglesplayer[2] = 0.0;
   TeleportEntity(client, NULL_VECTOR, anglesplayer, NULL_VECTOR);
   }
  case 4:
   {
   anglesplayer[0] += 0.0;
   anglesplayer[1] += 0.0;
   anglesplayer[2] += 25.0;
   TeleportEntity(client, NULL_VECTOR, anglesplayer, NULL_VECTOR);
   }
  case 5:
   {
   anglesplayer[0] += 0.0;
   anglesplayer[1] += 0.0;
   anglesplayer[2] -= 25.0;
   TeleportEntity(client, NULL_VECTOR, anglesplayer, NULL_VECTOR);
   }
  }
  TeleportEntity(client, NULL_VECTOR, anglesplayer, NULL_VECTOR);
}
 
ILlga80 Дата: Понедельник, 18.02.2013, 18:04:52 | Сообщение # 3
Сообщений: 57
Репутация: 3 [ +/- ]
Nailain, Спасибо! Только почему наклоны :D не отключаются в конце раунда, хотя оверлей опьянения отключается
И в логи не забывает подарочек дарить
Код

L 02/18/2013 - 08:04:15: Info (map "de_dust2") (file "errors_20130218.log")
L 02/18/2013 - 08:04:15: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 08:04:15: [SM] Displaying call stack trace for plugin "cdrunk.smx":
L 02/18/2013 - 08:04:15: [SM]   [0]  Line 41, cdrunk.sp::timer_drunk_start()
L 02/18/2013 - 08:04:16: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 08:04:16: [SM] Displaying call stack trace for plugin "cdrunk.smx":

Добавлено (18.02.2013, 18:04:52)
---------------------------------------------
Ну помогите кто нибудь plach



Сообщение отредактировал ILlga80 - Понедельник, 18.02.2013, 05:08:02
 
Nailain Дата: Понедельник, 18.02.2013, 20:32:52 | Сообщение # 4
Сообщений: 19
Репутация: 1 [ +/- ]
Код
#include <sourcemod>
#include <sdktools>

new g_Offset_FOV = -1;  
new g_Offset_DefFOV = -1;  
#define  NORMAL_VISION  90  
new Handle:timer_drunk[MAXPLAYERS+1];

public OnPluginStart()  
{  
  HookEvent("round_end", Event_Onround_end);
    RegConsoleCmd("drunk", Command_Drunk);  
       
    g_Offset_FOV = FindSendPropOffs("CBasePlayer", "m_iFOV");  
    if (g_Offset_FOV == -1)  
    {  
     SetFailState("Unable to find offset for FOV.");  
    }  
    g_Offset_DefFOV = FindSendPropOffs("CBasePlayer", "m_iDefaultFOV");  
    if (g_Offset_DefFOV == -1)  
    {  
     SetFailState("Unable to find offset for default FOV.");  
    }  
}

stock ShowOverlayToClient(client, const String:overlaypath[])  
{  
    ClientCommand(client, "r_screenoverlay \"%s\"", overlaypath);  
}  

public Action:Command_Drunk(client, args)  
{  
  SetEntData(client, g_Offset_FOV, NORMAL_VISION, 4, true);
  SetEntData(client, g_Offset_DefFOV, NORMAL_VISION, 4, true);
  ShowOverlayToClient(client, "effects/strider_pinch_dudv");
  timer_drunk[client] = CreateTimer(1.0, timer_drunk_start, client, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);  
}

public Action:timer_drunk_start(Handle:timer, any:client)  
{
  new Float:anglesplayer[3];
  GetEntPropVector(client, Prop_Send, "m_angRotation", anglesplayer);
  new value = GetRandomInt(1, 5);
  switch (value)
  {
  case 1:
   {
   anglesplayer[0] += 0.0;
   anglesplayer[1] += 0.0;
   anglesplayer[2] += 45.0;
   TeleportEntity(client, NULL_VECTOR, anglesplayer, NULL_VECTOR);
   return Plugin_Handled;
   }
  case 2:
   {
   anglesplayer[0] += 0.0;
   anglesplayer[1] += 0.0;
   anglesplayer[2] -= 45.0;
   TeleportEntity(client, NULL_VECTOR, anglesplayer, NULL_VECTOR);
   return Plugin_Handled;
   }
  case 3:
   {
   anglesplayer[0] += 0.0;
   anglesplayer[1] += 0.0;
   anglesplayer[2] = 0.0;
   TeleportEntity(client, NULL_VECTOR, anglesplayer, NULL_VECTOR);
   return Plugin_Handled;
   }
  case 4:
   {
   anglesplayer[0] += 0.0;
   anglesplayer[1] += 0.0;
   anglesplayer[2] += 25.0;
   TeleportEntity(client, NULL_VECTOR, anglesplayer, NULL_VECTOR);
   return Plugin_Handled;
   }
  case 5:
   {
   anglesplayer[0] += 0.0;
   anglesplayer[1] += 0.0;
   anglesplayer[2] -= 25.0;
   TeleportEntity(client, NULL_VECTOR, anglesplayer, NULL_VECTOR);
   return Plugin_Handled;
   }
  }
  return Plugin_Stop;
}

public Event_Onround_end(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
ShowOverlayToClient(client, "");
KillTimer(timer_drunk[client]);  
new Float:anglesplayer[3];
GetEntPropVector(client, Prop_Send, "m_angRotation", anglesplayer);
anglesplayer[0] += 0.0;
anglesplayer[1] += 0.0;
anglesplayer[2] = 0.0;
}
 
ILlga80 Дата: Понедельник, 18.02.2013, 20:43:32 | Сообщение # 5
Сообщений: 57
Репутация: 3 [ +/- ]
Nailain, plach plach plach plach plach
Код

L 02/18/2013 - 23:44:58: SourceMod error session started
L 02/18/2013 - 23:44:58: Info (map "de_dust2") (file "errors_20130218.log")
L 02/18/2013 - 23:44:58: [SM] Native "ClientCommand" reported: Client index 0 is invalid
L 02/18/2013 - 23:44:58: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:44:58: [SM]   [0]  Line 28, ccdrunk.sp::ShowOverlayToClient()
L 02/18/2013 - 23:44:58: [SM]   [1]  Line 93, ccdrunk.sp::Event_Onround_end()
L 02/18/2013 - 23:45:25: [SM] Native "ClientCommand" reported: Client index 0 is invalid
L 02/18/2013 - 23:45:25: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:25: [SM]   [0]  Line 28, ccdrunk.sp::ShowOverlayToClient()
L 02/18/2013 - 23:45:25: [SM]   [1]  Line 93, ccdrunk.sp::Event_Onround_end()
L 02/18/2013 - 23:45:26: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:26: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:26: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:27: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:27: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:27: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:42: [SM] Native "ClientCommand" reported: Client index 0 is invalid
L 02/18/2013 - 23:45:42: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:42: [SM]   [0]  Line 28, ccdrunk.sp::ShowOverlayToClient()
L 02/18/2013 - 23:45:42: [SM]   [1]  Line 93, ccdrunk.sp::Event_Onround_end()
L 02/18/2013 - 23:45:43: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:43: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:43: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:44: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:44: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:44: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:45: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:45: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:45: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:46: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:46: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:46: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:47: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:47: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:47: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:48: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:48: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:48: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:49: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:49: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:49: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:50: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:50: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:50: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:51: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:51: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:51: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:52: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:52: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:52: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:53: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:53: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:53: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:54: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:54: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:54: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:55: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:55: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:55: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()
L 02/18/2013 - 23:45:56: [SM] Native "GetEntPropVector" reported: Entity 1 (1) is invalid
L 02/18/2013 - 23:45:56: [SM] Displaying call stack trace for plugin "ccdrunk.smx":
L 02/18/2013 - 23:45:56: [SM]   [0]  Line 42, ccdrunk.sp::timer_drunk_start()

 
Nailain Дата: Понедельник, 18.02.2013, 21:53:48 | Сообщение # 6
Сообщений: 19
Репутация: 1 [ +/- ]
лог обозначает что не может найти клиента

Добавлено (18.02.2013, 21:53:48)
---------------------------------------------
это после смены карты? или раунда?

 
Scarface_slv Дата: Вторник, 19.02.2013, 00:59:44 | Сообщение # 7
Сообщений: 737
Репутация: 61 [ +/- ]
Скорее всего после смерти игрока
 
ILlga80 Дата: Вторник, 19.02.2013, 04:45:50 | Сообщение # 8
Сообщений: 57
Репутация: 3 [ +/- ]
Цитата (Scarface_slv)
Скорее всего после смерти игрока

именно
 
Nailain Дата: Вторник, 19.02.2013, 09:35:34 | Сообщение # 9
Сообщений: 19
Репутация: 1 [ +/- ]
ну создай событие чтобы после смерти игрока убивался таймер и оверлей и экран чтобы восстанавливался используй вот это

Код
anglesplayer[0] += 0.0;  
anglesplayer[1] += 0.0;  
anglesplayer[2] = 0.0;
 
TEIN Дата: Вторник, 19.02.2013, 10:44:27 | Сообщение # 10
Сообщений: 563
Репутация: 78 [ +/- ]
Nailain
Entity
 
Nailain Дата: Вторник, 19.02.2013, 12:04:05 | Сообщение # 11
Сообщений: 19
Репутация: 1 [ +/- ]
о боже по предыдущему скрипту не судьба догадаться как написать))
Код
  
new client = GetClientOfUserId(GetEventInt(event, "userid"));  
new Float:anglesplayer[3];  
   GetEntPropVector(client, Prop_Send, "m_angRotation", anglesplayer);  
   new value = GetRandomInt(1, 5);  
   switch (value)  
   {  
   case 1:  
    {  
    anglesplayer[0] += 0.0;  
    anglesplayer[1] += 0.0;  
    anglesplayer[2] += 45.0;  
    TeleportEntity(client, NULL_VECTOR, anglesplayer, NULL_VECTOR);
 
Scarface_slv Дата: Вторник, 19.02.2013, 13:28:27 | Сообщение # 12
Сообщений: 737
Репутация: 61 [ +/- ]
И еще если игрок опьянен и вышел, нужно удалить таймер
 
ILlga80 Дата: Вторник, 19.02.2013, 13:43:49 | Сообщение # 13
Сообщений: 57
Репутация: 3 [ +/- ]
Scarface_slv, показал бы klas
 
Scarface_slv Дата: Вторник, 19.02.2013, 13:52:41 | Сообщение # 14
Сообщений: 737
Репутация: 61 [ +/- ]
добавишь в код и все)
Код

public OnClientDisconnect(client)
{
         if (timer_drunk[client] != INVALID_HANDLE)
         {
             KillTimer(timer_drunk[client]);
             timer_drunk[client] = INVALID_HANDLE;
         }
}

и можешь добавить проверку жив ли игрок IsPlayerAlive(client) если нет удаляй таймер
а и в коде Event_Onround_end забыли добавить TeleportEntity(client, NULL_VECTOR, anglesplayer, NULL_VECTOR);
и там нужен цикл..
в общем на попробуй этот:

Гости не могут скачивать файлы


Сообщение отредактировал Scarface_slv - Вторник, 19.02.2013, 14:26:40
 
ILlga80 Дата: Вторник, 19.02.2013, 15:07:20 | Сообщение # 15
Сообщений: 57
Репутация: 3 [ +/- ]
Scarface_slv, Вроде работает.Спасибо потестим.
 
Форум » SourceMod >> CS:Source >> CSGO » Обсуждение » Опьянение игрока
  • Страница 1 из 1
  • 1
Поиск: