forked from tsx-eu/csgo-roleplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
roleplay_epicier.sp
268 lines (220 loc) · 7.46 KB
/
roleplay_epicier.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/*
* 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 <sdkhooks>
#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.0"
#pragma newdecls required
#include <roleplay.inc> // https://www.ts-x.eu
//#define DEBUG
public Plugin myinfo = {
name = "Jobs: EPICIER", author = "KoSSoLaX",
description = "RolePlay - Jobs: Epicier",
version = __LAST_REV__, url = "https://www.ts-x.eu"
};
Handle g_hCigarette[65];
int g_cBeam;
// ----------------------------------------------------------------------------
public void OnPluginStart() {
RegServerCmd("rp_item_cig", Cmd_ItemCigarette, "RP-ITEM", FCVAR_UNREGISTERED);
RegServerCmd("rp_item_sanandreas", Cmd_ItemSanAndreas, "RP-ITEM", FCVAR_UNREGISTERED);
RegServerCmd("rp_item_needforspeed",Cmd_ItemNeedForSpeed, "RP-ITEM", FCVAR_UNREGISTERED);
RegServerCmd("rp_item_lessive", Cmd_ItemLessive, "RP-ITEM", FCVAR_UNREGISTERED);
RegServerCmd("rp_item_cafe", Cmd_ItemCafe, "RP-ITEM", FCVAR_UNREGISTERED);
RegServerCmd("rp_item_crayons", Cmd_ItemCrayons, "RP-ITEM", FCVAR_UNREGISTERED);
RegServerCmd("rp_item_map", Cmd_ItemMaps, "RP-ITEM", FCVAR_UNREGISTERED);
RegServerCmd("rp_item_ruban", Cmd_ItemRuban, "RP-ITEM", FCVAR_UNREGISTERED);
}
public void OnMapStart() {
g_cBeam = PrecacheModel("materials/sprites/laserbeam.vmt");
}
// ----------------------------------------------------------------------------
public Action Cmd_ItemCigarette(int args) {
#if defined DEBUG
PrintToServer("Cmd_ItemCigarette");
#endif
char Arg1[32];
GetCmdArg(1, Arg1, 31);
int client = GetCmdArgInt(2);
if( StrEqual(Arg1, "deg") ) {
int item_id = GetCmdArgInt(args);
if( rp_GetZoneBit( rp_GetPlayerZone(client) ) & BITZONE_PEACEFULL ) {
ITEM_CANCEL(client, item_id);
CPrintToChat(client, "{lightblue}[TSX-RP]{default} Cet objet est interdit où vous êtes.");
return Plugin_Handled;
}
float origin[3];
GetClientAbsOrigin(client, origin);
origin[2] -= 1.0;
rp_Effect_Push(origin, 500.0, 1000.0, client);
}
else if( StrEqual(Arg1, "flame") ) {
UningiteEntity(client);
for(float i=0.1; i<=30.0; i+= 0.50) {
CreateTimer(i, Task_UningiteEntity, client);
}
}
else if( StrEqual(Arg1, "light") ) {
rp_HookEvent(client, RP_PrePlayerPhysic, fwdCigGravity, 30.0);
}
else if( StrEqual(Arg1, "choco") ) {
// Ne fait absolument rien.
}
else { // WHAT IS THAT KIND OF SORCELERY?
rp_HookEvent(client, RP_PrePlayerPhysic, fwdCigSpeed, 30.0);
}
rp_Effect_Smoke(client, 30.0);
if( g_hCigarette[client] )
delete g_hCigarette[client];
g_hCigarette[client] = CreateTimer( 30.0, ItemStopCig, client);
rp_SetClientBool(client, b_Smoking, true);
return Plugin_Handled;
}
public Action Task_UningiteEntity(Handle timer, any client) {
#if defined DEBUG
PrintToServer("Task_UningiteEntity");
#endif
UningiteEntity(client);
}
public Action ItemStopCig(Handle timer, any client) {
#if defined DEBUG
PrintToServer("ItemStopCig");
#endif
rp_SetClientBool(client, b_Smoking, false);
}
public Action fwdCigSpeed(int client, float& speed, float& gravity) {
#if defined DEBUG
PrintToServer("fwdCigSpeed");
#endif
speed += 0.15;
return Plugin_Changed;
}
public Action fwdCigGravity(int client, float& speed, float& gravity) {
#if defined DEBUG
PrintToServer("fwdCigGravity");
#endif
gravity -= 0.15;
return Plugin_Changed;
}
// ----------------------------------------------------------------------------
public Action Cmd_ItemRuban(int args) {
#if defined DEBUG
PrintToServer("Cmd_ItemRuban");
#endif
int color[4];
color[0] = GetCmdArgInt(1);
color[1] = GetCmdArgInt(2);
color[2] = GetCmdArgInt(3);
color[3] = 200;
int client = GetCmdArgInt(4);
int target = GetClientAimTarget(client, false);
int item_id = GetCmdArgInt(args);
if( target == 0 || !IsValidEdict(target) || !IsValidEntity(target) ) {
ITEM_CANCEL(client, item_id);
return Plugin_Handled;
}
char classname[64];
GetEdictClassname(target, classname, sizeof(classname));
if( StrContains("chicken|player|weapon|prop_physics|", classname) == -1 ) {
ITEM_CANCEL(client, item_id);
return Plugin_Handled;
}
if( !rp_IsEntitiesNear(client, target) ) {
ITEM_CANCEL(client, item_id);
return Plugin_Handled;
}
TE_SetupBeamFollow(target, g_cBeam, 0, 180.0, 4.0, 0.1, 5, color);
TE_SendToAll();
return Plugin_Handled;
}
// ----------------------------------------------------------------------------
public Action Cmd_ItemSanAndreas(int args) {
#if defined DEBUG
PrintToServer("Cmd_ItemSanAndreas");
#endif
int client = GetCmdArgInt(1);
int item_id = GetCmdArgInt(args);
int wepid = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
char classname[64];
if( !IsValidEntity(wepid) ) {
ITEM_CANCEL(client, item_id);
return Plugin_Handled;
}
GetEdictClassname(wepid, classname, sizeof(classname));
if( StrContains(classname, "weapon_bayonet") == 0 || StrContains(classname, "weapon_knife") == 0 ) {
ITEM_CANCEL(client, item_id);
return Plugin_Handled;
}
int ammo = Weapon_GetPrimaryClip(wepid);
ammo += 1000; if( ammo > 5000 ) ammo = 5000;
Weapon_SetPrimaryClip(wepid, ammo);
CPrintToChat(client, "{lightblue}[TSX-RP]{default} Votre arme à maintenant %i balles", ammo);
return Plugin_Handled;
}
public Action Cmd_ItemNeedForSpeed(int args) {
#if defined DEBUG
PrintToServer("Cmd_ItemNeedForSpeed");
#endif
int client = GetCmdArgInt(1);
rp_HookEvent(client, RP_PrePlayerPhysic, fwdCigSpeed, 60.0);
rp_HookEvent(client, RP_PrePlayerPhysic, fwdCigSpeed, 10.0);
}
public Action Cmd_ItemLessive(int args) {
#if defined DEBUG
PrintToServer("Cmd_ItemLessive");
#endif
int client = GetCmdArgInt(1);
int item_id = GetCmdArgInt(args);
if( rp_IsInPVP(client) ) {
ITEM_CANCEL(client, item_id);
CPrintToChat(client, "{lightblue}[TSX-RP]{default} Cet objet est interdit en PvP.");
return Plugin_Handled;
}
SDKHooks_TakeDamage(client, client, client, 5000.0);
ForcePlayerSuicide(client);
rp_ClientRespawn(client);
return Plugin_Handled;
}
public Action Cmd_ItemCafe(int args) {
#if defined DEBUG
PrintToServer("Cmd_ItemCafe");
#endif
int client = GetCmdArgInt(1);
rp_HookEvent(client, RP_PrePlayerPhysic, fwdCigSpeed, 10.0);
rp_HookEvent(client, RP_PrePlayerPhysic, fwdCigSpeed, 10.0);
rp_IncrementSuccess(client, success_list_cafeine);
}
public Action Cmd_ItemCrayons(int args) {
#if defined DEBUG
PrintToServer("Cmd_ItemCrayons");
#endif
int client = GetCmdArgInt(1);
bool crayon = rp_GetClientBool(client, b_Crayon);
if( !crayon ) {
rp_IncrementSuccess(client, success_list_rainbow);
}
rp_SetClientBool(client, b_Crayon, true);
}
public Action Cmd_ItemMaps(int args) {
#if defined DEBUG
PrintToServer("Cmd_ItemMaps");
#endif
int client = GetCmdArgInt(1);
rp_SetClientBool(client, b_Map, true);
}
// ----------------------------------------------------------------------------
void UningiteEntity(int entity) {
int ent = GetEntPropEnt(entity, Prop_Data, "m_hEffectEntity");
if( IsValidEdict(ent) )
SetEntPropFloat(ent, Prop_Data, "m_flLifetime", 0.0);
}