forked from tsx-eu/csgo-roleplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
roleplay_armurerie.sp
187 lines (160 loc) · 5.16 KB
/
roleplay_armurerie.sp
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
* Cette oeuvre, création, site ou texte est sous licence Creative Commons Attribution
* - Pas d’Utilisation Commerciale
* - Partage dans les Mêmes Conditions 4.0 International.
* Pour accéder à une copie de cette licence, merci de vous rendre à l'adresse suivante
* http://creativecommons.org/licenses/by-nc-sa/4.0/ .
*
* Merci de respecter le travail fourni par le ou les auteurs
* https://www.ts-x.eu/ - [email protected]
*/
#pragma semicolon 1
#include <sourcemod>
#include <colors_csgo> // https://forums.alliedmods.net/showthread.php?p=2205447#post2205447
#include <smlib> // https://github.com/bcserv/smlib
#define __LAST_REV__ "v:0.1.1"
#pragma newdecls required
#include <roleplay.inc> // https://www.ts-x.eu
//#define DEBUG
public Plugin myinfo = {
name = "Jobs: Armurerier", author = "KoSSoLaX",
description = "RolePlay - Jobs: Armurerier",
version = __LAST_REV__, url = "https://www.ts-x.eu"
};
float vecNull[3];
int g_cBeam;
// ----------------------------------------------------------------------------
public void OnPluginStart() {
RegServerCmd("rp_giveitem", Cmd_GiveItem, "RP-ITEM", FCVAR_UNREGISTERED);
RegServerCmd("rp_giveitem_pvp", Cmd_GiveItemPvP, "RP-ITEM", FCVAR_UNREGISTERED);
RegServerCmd("rp_item_balltype", Cmd_ItemBallType, "RP-ITEM", FCVAR_UNREGISTERED);
}
public void OnMapStart() {
g_cBeam = PrecacheModel("materials/sprites/laserbeam.vmt");
}
// ----------------------------------------------------------------------------
public Action Cmd_GiveItem(int args) {
#if defined DEBUG
PrintToServer("Cmd_GiveItem");
#endif
char Arg1[64];
GetCmdArg(1, Arg1, sizeof(Arg1));
int client = GetCmdArgInt(2);
int wpnID = GivePlayerItem(client, Arg1);
rp_SetClientWeaponSkin(client, wpnID);
}
public Action Cmd_GiveItemPvP(int args) {
#if defined DEBUG
PrintToServer("Cmd_GiveItemPvP");
#endif
char Arg1[64];
GetCmdArg(1, Arg1, sizeof(Arg1));
int client = GetCmdArgInt(2);
int wpnID = GivePlayerItem(client, Arg1);
rp_SetClientWeaponSkin(client, wpnID);
int group = rp_GetClientGroupID(client);
rp_SetWeaponGroupID(wpnID, group);
}
// ----------------------------------------------------------------------------
public Action Cmd_ItemBallType(int args) {
#if defined DEBUG
PrintToServer("Cmd_ItemBallType");
#endif
char arg1[32];
GetCmdArg(1, arg1, sizeof(arg1));
int client = GetCmdArgInt(2);
int wepid = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
int item_id = GetCmdArgInt(args);
if( !IsValidEntity(wepid) ) {
ITEM_CANCEL(client, item_id);
return Plugin_Handled;
}
char classname[64];
GetEdictClassname(wepid, classname, sizeof(classname));
if( StrContains(classname, "weapon_bayonet") == 0 || StrContains(classname, "weapon_knife") == 0 ) {
ITEM_CANCEL(client, item_id);
return Plugin_Handled;
}
if( StrEqual(arg1, "fire") ) {
rp_SetWeaponBallType(wepid, ball_type_fire);
}
else if( StrEqual(arg1, "caoutchouc") ) {
rp_SetWeaponBallType(wepid, ball_type_caoutchouc);
}
else if( StrEqual(arg1, "paintball") ) {
rp_SetWeaponBallType(wepid, ball_type_paintball);
}
else if( StrEqual(arg1, "poison") ) {
rp_SetWeaponBallType(wepid, ball_type_poison);
}
else if( StrEqual(arg1, "vampire") ) {
rp_SetWeaponBallType(wepid, ball_type_vampire);
}
else if( StrEqual(arg1, "reflex") ) {
rp_SetWeaponBallType(wepid, ball_type_reflexive);
}
else if( StrEqual(arg1, "explode") ) {
rp_SetWeaponBallType(wepid, ball_type_explode);
}
return Plugin_Handled;
}
public void OnClientPostAdminCheck(int client) {
rp_HookEvent(client, RP_PostTakeDamageWeapon, fwdWeapon);
}
public void OnClientDisconnect(int client) {
rp_UnhookEvent(client, RP_PostTakeDamageWeapon, fwdWeapon);
}
public Action fwdWeapon(int victim, int attacker, float &damage, int wepID) {
bool changed = true;
switch( rp_GetWeaponBallType(wepID) ) {
case ball_type_fire: {
rp_ClientIgnite(victim, 10.0, attacker);
changed = false;
}
case ball_type_caoutchouc: {
damage *= 0.0;
if( rp_IsInPVP(victim) ) {
TeleportEntity(victim, NULL_VECTOR, NULL_VECTOR, vecNull);
damage *= 0.5;
}
rp_SetClientFloat(victim, fl_FrozenTime, GetGameTime() + 1.5);
ServerCommand("sm_effect_flash %d 1.5 180", victim);
}
case ball_type_poison: {
damage *= 0.66;
rp_ClientPoison(victim, 30.0, attacker);
}
case ball_type_vampire: {
damage *= 0.75;
int current = GetClientHealth(attacker);
if( current < 500 ) {
current += RoundToFloor(damage*0.2);
if( current > 500 )
current = 500;
SetEntityHealth(attacker, current);
float vecOrigin[3], vecOrigin2[3];
GetClientEyePosition(attacker, vecOrigin);
GetClientEyePosition(victim, vecOrigin2);
vecOrigin[2] -= 20.0; vecOrigin2[2] -= 20.0;
TE_SetupBeamPoints(vecOrigin, vecOrigin2, g_cBeam, 0, 0, 0, 0.1, 10.0, 10.0, 0, 10.0, {250, 50, 50, 250}, 10);
TE_SendToAll();
}
}
case ball_type_paintball: {
damage *= 1.0;
}
case ball_type_reflexive: {
damage = 0.9;
}
case ball_type_explode: {
damage *= 0.8;
}
default: {
changed = false;
}
}
if( changed )
return Plugin_Changed;
return Plugin_Continue;
}
// ----------------------------------------------------------------------------