1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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;
}
|