diff options
Diffstat (limited to 'sourcemod/scripting')
| -rw-r--r-- | sourcemod/scripting/bot2player_public.sp | 14 | ||||
| -rw-r--r-- | sourcemod/scripting/setpos_setang.sp | 70 |
2 files changed, 83 insertions, 1 deletions
diff --git a/sourcemod/scripting/bot2player_public.sp b/sourcemod/scripting/bot2player_public.sp index a9ca0b3..b9a2be6 100644 --- a/sourcemod/scripting/bot2player_public.sp +++ b/sourcemod/scripting/bot2player_public.sp @@ -229,7 +229,19 @@ public Action:OnPlayerRunCmd(iClient, &buttons, &impulse, Float:vel[3], Float:an SetConVarInt(NoEndRoundHandle, 1) } ForcePlayerSuicide(iTarget) + + // note(cristeigabriel): seems to fix getting stuck while + // in position that requires crouching + int ducked; + int ducking; + ducked = GetEntProp(iTarget, Prop_Send, "m_bDucked", 1); + ducking = GetEntProp(iTarget, Prop_Send, "m_bDucking", 1); + CS_RespawnPlayer(iClient) + + SetEntProp(iClient, Prop_Send, "m_bDucked", ducked, 1); + SetEntProp(iClient, Prop_Send, "m_bDucking", ducking, 1); + TeleportEntity(iClient, iTargetOrigin, iTargetAngles, NULL_VECTOR) SetConVarInt(NoEndRoundHandle, 0) PrintToChatAll("%N took control of %N", iClient, iTarget) @@ -459,4 +471,4 @@ public EpicFail(String:FailReason[]) PrintToServer("[%s] - Fatal Error: %s", PLUGIN_NAME, FailReason) SetFailState("[%s] - Fatal Error: %s", PLUGIN_NAME, FailReason) } -//End of
\ No newline at end of file +//End of diff --git a/sourcemod/scripting/setpos_setang.sp b/sourcemod/scripting/setpos_setang.sp new file mode 100644 index 0000000..1dc8dbb --- /dev/null +++ b/sourcemod/scripting/setpos_setang.sp @@ -0,0 +1,70 @@ +#include <sourcemod> +#include <cstrike> +#include <smlib> + +new const String:PLUGIN_NAME[] = "setpos/setang for player" +new const String:PLUGIN_AUTHOR[] = "cristeigabriel" +new const String:PLUGIN_DESCRIPTION[] = "setpos_player, setang_player" +new const String:PLUGIN_VERSION[] = "0" + +public Plugin:myinfo = { + name = PLUGIN_NAME, + author = PLUGIN_AUTHOR, + description = PLUGIN_DESCRIPTION, + version = PLUGIN_VERSION, +} + +public void OnPluginStart() { + RegAdminCmd("setposang_player", SetPosAngPlayer, ADMFLAG_GENERIC); +} + +public Action SetPosAngPlayer(int client, int args) { + if (args != 7) { + PrintToConsole(client, "setposang_player: not enough arguments"); + return Plugin_Continue; + } + + char name[32]; + int target = -1, i, j = 0; + float pos[3]; + float ang[3]; + + GetCmdArg(1, name, sizeof(name)); + for (i = 1; i <= MaxClients; i++) { + if (!IsClientConnected(i)) { + continue; + } + + char curname[32]; + + GetClientName(i, curname, sizeof(curname)); + if (StrEqual(name, curname)) { + target = i; + break; + } + } + + if (target == -1) { + PrintToConsole(client, "setpos_exact: no such target \"%s\"", name); + return Plugin_Continue; + } + + for (i = 2; i < 5; i++) { + char arg[128]; + + GetCmdArg(i, arg, sizeof(arg)); + pos[j++] = StringToFloat(arg); + } + + for (j = 0, i = 5; i <= 7; i++) { + char arg[128]; + + GetCmdArg(i, arg, sizeof(arg)); + ang[j++] = StringToFloat(arg); + } + + TeleportEntity(target, pos, ang, NULL_VECTOR); + + return Plugin_Handled; +} + |
