Sie sind nicht angemeldet.

Newbie'

Profi

  • »Newbie'« ist der Autor dieses Themas

Beiträge: 580

Wohnort: Zuhause

Rootserver vorhanden: Nein

  • Nachricht senden

1

Donnerstag, 24. Oktober 2013, 14:52

!ghost kurze Hilfe

Hallo,

Ich nutze folgendes Plugin auf meinem Gameserver (klick) alles läuft soweit. Der client kann via !ghost zwei kleine Einstellungen festlegen dieses läuft soweit auch nur werden diese Einstellungen nach Mapchange und oder Server Neustart wieder auf default gestellt. Hab mir das zwar schon etwas angesehen, jedoch komm ich damit nicht zurecht. Hab in folgender sp das Menü etwas geändert könnte es daran liegen? Über Hilfe wäre ich sehr dankbar.

Würde euch bitten folgende sp zu nutzen da in dieser schon einige Dinge wurden geändert:

Spoiler Spoiler

Quellcode

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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <tf2_stocks>
#include <sdkhooks>
#include <clientprefs>
#include <morecolors>

#undef REQUIRE_PLUGIN
#tryinclude <ghostmode>

#define PLUGIN_NAME				"Ghost Mode"
#define PLUGIN_VERSION			"2.04"

new Handle:g_hCvarEnabled,		g_iCvarEnabled;
new Handle:g_hCvarTeleporting,	g_iCvarTeleporting;
new Handle:g_hCvarFlying,		bool:g_bCvarFlying;
new Handle:g_hCvarModel,		String:g_strCvarModel[255];
new Handle:g_hCvarWearables,	bool:g_bCvarWearables;
new Handle:g_hCookieGhost;
new Handle:g_hCookieThirdPerson;

new bool:g_bArena;
new bool:g_bRoundStarted;
new bool:g_bIsGhost				[MAXPLAYERS + 1];
new bool:g_bBecomingGhost		[MAXPLAYERS + 1];
new bool:g_bInformed			[MAXPLAYERS + 1];
new bool:g_bGhost				[MAXPLAYERS + 1];
new bool:g_bThirdPerson			[MAXPLAYERS + 1];
new Float:g_fLocVec				[MAXPLAYERS + 1][3];
new Float:g_fLocAng				[MAXPLAYERS + 1][3];
new Float:g_fLocVel				[MAXPLAYERS + 1][3];

public APLRes:AskPluginLoad2(Handle:hPlugin, bool:bLateLoad, String:strError[], iErrorSize)
{
	CreateNative("GhostMode_IsPlayerGhost", Native_IsPlayerGhost);
	RegPluginLibrary("ghostmode");
	return APLRes_Success;
}

public Plugin:myinfo =
{
	name = "Ghost Mode",
	author = "ReFlexPoison",
	description = "Fly around as a ghost after death",
	version = PLUGIN_VERSION,
	url = "http://www.sourcemod.net"
};

public Native_IsPlayerGhost(Handle:hPlugin, iParams)
{
	new iClient = GetNativeCell(1);
	if(IsValidClient(iClient) && g_bIsGhost[iClient])
		return true;
	return false;
}

public OnPluginStart()
{
	CreateConVar("sm_ghostymode_version", PLUGIN_VERSION, PLUGIN_NAME, FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_DONTRECORD | FCVAR_NOTIFY);

	g_hCvarEnabled = CreateConVar("sm_ghostmode_enabled", "1", "Enable Ghost Mode\n0 = Disabled\n1 = Enabled\n2 = Enabled (Arena Only)", _, true, 0.0, true, 2.0);
	g_iCvarEnabled = GetConVarInt(g_hCvarEnabled);
	HookConVarChange(g_hCvarEnabled, OnConVarChange);

	g_hCvarTeleporting = CreateConVar("sm_ghostmode_teleporting", "2", "Enable teleporting\n0 = Disabled\n1 = Random target\n2 = Random team target", _, true, 0.0, true, 2.0);
	g_iCvarTeleporting = GetConVarInt(g_hCvarTeleporting);
	HookConVarChange(g_hCvarTeleporting, OnConVarChange);

	g_hCvarFlying = CreateConVar("sm_ghostmode_flying", "1", "Enable flying\n0 = Disabled\n1 = Enabled", _, true, 0.0, true, 1.0);
	g_bCvarFlying = GetConVarBool(g_hCvarFlying);
	HookConVarChange(g_hCvarFlying, OnConVarChange);

	g_hCvarModel = CreateConVar("sm_ghostmode_model", "models/props_halloween/ghost.mdl", "Model to use for ghosts");
	GetConVarString(g_hCvarModel, g_strCvarModel, sizeof(g_strCvarModel));
	HookConVarChange(g_hCvarModel, OnConVarChange);

	g_hCvarWearables = CreateConVar("sm_ghostmode_wearables", "0", "Enable wearables on ghosts\n0 = Disabled\n1 = Enabled", _, true, 0.0, true, 1.0);
	g_bCvarWearables = GetConVarBool(g_hCvarWearables);
	HookConVarChange(g_hCvarWearables, OnConVarChange);

	AutoExecConfig(true, "plugin.ghostmode");

	RegAdminCmd("sm_ghost", GhostModeCmd, 0, "Ghost Mode");

	AddCommandListener(TauntCmd, "+use_action_slot_item_server");
	AddCommandListener(TauntCmd, "use_action_slot_item_server");
	AddCommandListener(TauntCmd, "+taunt");
	AddCommandListener(TauntCmd, "taunt");
	AddCommandListener(JointeamCmd, "jointeam");
	AddCommandListener(JoinclassCmd, "joinclass");
	AddCommandListener(JoinclassCmd, "join_class");

	HookEvent("teamplay_round_win", OnRoundEnd);
	HookEvent("teamplay_round_start", OnRoundStart);
	HookEvent("arena_round_start", OnArenaStart);
	HookEvent("player_death", OnPlayerDeath);
	HookEvent("player_spawn", OnPlayerSpawn);
	HookEvent("player_changeclass", OnPlayerChangeClass);

	g_hCookieGhost = RegClientCookie("ghostmode_set", "Is ghostmode on?", CookieAccess_Private);
	g_hCookieThirdPerson = RegClientCookie("thirdperson", "Is thirdperson on?", CookieAccess_Private);

	AddNormalSoundHook(SoundHook);

	LoadTranslations("core.phrases");
	LoadTranslations("ghostmode.phrases");

	for(new i = 1; i <= MaxClients; i++) if(IsValidClient(i))
		OnClientPutInServer(i);
}

public OnConVarChange(Handle:hConvar, const String:strOldValue[], const String:strNewValue[])
{
	if(hConvar == g_hCvarEnabled)
		g_iCvarEnabled = GetConVarInt(g_hCvarEnabled);
	else if(hConvar == g_hCvarTeleporting)
		g_iCvarTeleporting = GetConVarInt(g_hCvarTeleporting);
	else if(hConvar == g_hCvarFlying)
		g_bCvarFlying = GetConVarBool(g_hCvarFlying);
	else if(hConvar == g_hCvarModel)
	{
		GetConVarString(g_hCvarModel, g_strCvarModel, sizeof(g_strCvarModel));

		if(FileExists(g_strCvarModel, true))
		{
			PrecacheModel(g_strCvarModel, true);
			return;
		}

		LogError("Model (%s) does not exist!", g_strCvarModel);
		strcopy(g_strCvarModel, sizeof(g_strCvarModel), "models/props_halloween/ghost.mdl");
		SetConVarString(g_hCvarModel, g_strCvarModel);
	}
	else if(hConvar == g_hCvarWearables)
		g_bCvarWearables = GetConVarBool(g_hCvarWearables);
}

public OnConfigsExecuted()
{
	g_bRoundStarted = false;

	g_bArena = false;
	if(FindEntityByClassname(-1, "tf_logic_arena") != -1)
		g_bArena = true;

	PrecacheModel("models/props_halloween/ghost.mdl", true);
	if(FileExists(g_strCvarModel, true))
	{
		PrecacheModel(g_strCvarModel, true);
		return;
	}

	LogError("Model (%s) does not exist!", g_strCvarModel);
	strcopy(g_strCvarModel, sizeof(g_strCvarModel), "models/props_halloween/ghost.mdl");
	SetConVarString(g_hCvarModel, g_strCvarModel);
}

public OnClientPutInServer(iClient)
{
	g_bIsGhost[iClient] = false;
	g_bBecomingGhost[iClient] = false;
	g_bGhost[iClient] = true;
	g_bThirdPerson[iClient] = true;

	SDKHook(iClient, SDKHook_SetTransmit, SetTransmit);
	SDKHook(iClient, SDKHook_PreThink, PreThink);
}

public OnClientCookiesCached(iClient)
{
	decl String:strCookieGhost[16];
	GetClientCookie(iClient, g_hCookieGhost, strCookieGhost, sizeof(strCookieGhost));

	if(StrEqual(strCookieGhost, "0"))
		g_bGhost[iClient] = false;

	decl String:strCookieThirdPerson[16];
	GetClientCookie(iClient, g_hCookieThirdPerson, strCookieThirdPerson, sizeof(strCookieThirdPerson));

	if(StrEqual(strCookieThirdPerson, "0"))
		g_bThirdPerson[iClient] = false;
}


public Action:OnRoundStart(Handle:hEvent, String:strName[], bool:bDontBroadcast)
{
	if(g_bArena)
	{
		g_bRoundStarted = false;
		return;
	}

	g_bRoundStarted = true;

	for(new i = 1; i <= MaxClients; i++) if(IsValidClient(i))
	{
		if(IsPlayerAlive(i))
		{
			g_bIsGhost[i] = false;
			g_bBecomingGhost[i] = false;
		}
	}
}

public Action:OnArenaStart(Handle:hEvent, String:strName[], bool:bDontBroadcast)
{
	g_bRoundStarted = true;

	for(new i = 1; i <= MaxClients; i++) if(IsValidClient(i))
	{
		if(IsPlayerAlive(i))
		{
			g_bIsGhost[i] = false;
			g_bBecomingGhost[i] = false;
		}
	}
}

public Action:OnRoundEnd(Handle:hEvent, String:strName[], bool:bDontBroadcast)
{
	g_bRoundStarted = false;

	for(new i = 1; i <= MaxClients; i++) if(IsValidClient(i))
	{
		if(IsPlayerAlive(i))
		{
			g_bIsGhost[i] = false;
			g_bBecomingGhost[i] = false;
		}

		if(g_bIsGhost[i])
		{
			SetEntityRenderMode(i, RENDER_TRANSALPHA);
			SetEntityRenderColor(i, 255, 255, 255, 75);
		}
	}
}

public Action:OnPlayerSpawn(Handle:hEvent, String:strName[], bool:bDontBroadcast)
{
	new iUserId = GetEventInt(hEvent, "userid");
	new iClient = GetClientOfUserId(iUserId);
	if(!IsValidClient(iClient))
		return;

	static iCollisionGroup[MAXPLAYERS + 1];
	iCollisionGroup[iClient] = GetEntProp(iClient, Prop_Send, "m_CollisionGroup");

	static iSolidFlags[MAXPLAYERS + 1];
	iSolidFlags[iClient] = GetEntProp(iClient, Prop_Send, "m_usSolidFlags");

	static iHideHUD[MAXPLAYERS + 1];
	iHideHUD[iClient] = GetEntProp(iClient, Prop_Send, "m_iHideHUD");


	if(g_bRoundStarted && g_bGhost[iClient] && g_bBecomingGhost[iClient] &&  GetClientTeam(iClient) > 1 && IsPlayerAlive(iClient) && CheckCommandAccess(iClient, "sm_ghost", 0, true))
	{
		g_bIsGhost[iClient] = true;
		g_bBecomingGhost[iClient] = false;

		SetEntityGravity(iClient, 0.5);
		SetEntProp(iClient, Prop_Send, "m_CollisionGroup", 1);
		SetEntProp(iClient, Prop_Send, "m_usSolidFlags", iSolidFlags[iClient] | ((1 << 1) | (1 << 2)));
		SetEntProp(iClient, Prop_Send, "m_iHideHUD", iHideHUD[iClient] | (1 << 3));
		SetEntProp(iClient, Prop_Send, "m_bGlowEnabled", 0);
		SetEntProp(iClient, Prop_Send, "m_lifeState", 2);
		SetEntProp(iClient, Prop_Send, "m_bUseClassAnimations", 0);

		SetVariantInt(1);
		AcceptEntityInput(iClient, "SetCustomModelRotates");

		SetVariantString(g_strCvarModel);
		AcceptEntityInput(iClient, "SetCustomModel");

		SetEntityRenderMode(iClient, RENDER_TRANSALPHA);
		SetEntityRenderColor(iClient, 255, 255, 255, 75);

		TeleportEntity(iClient, g_fLocVec[iClient], g_fLocAng[iClient], g_fLocVel[iClient]);

		CreateTimer(0.1, Timer_ReApplyModel, iUserId, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
		CreateTimer(0.2, Timer_ThirdPerson, iUserId, TIMER_FLAG_NO_MAPCHANGE);
		CreateTimer(1.0, Timer_RemoveParticles, iUserId, TIMER_FLAG_NO_MAPCHANGE);

		for(new i = 0; i <= 5 ; i++)
		{
			new iWeapon = GetPlayerWeaponSlot(iClient, i);
			if(iWeapon != -1)
			{
				if(i != TFWeaponSlot_Melee)
					TF2_RemoveWeaponSlot(iClient, i);
				else
				{
					SetEntityRenderMode(iWeapon, RENDER_TRANSALPHA);
					SetEntityRenderColor(iWeapon, _, _, _, 0);
					SetEntPropFloat(iWeapon, Prop_Data, "m_flNextPrimaryAttack", GetGameTime() + 7200.0);
					SetEntPropFloat(iWeapon, Prop_Data, "m_flNextSecondaryAttack", GetGameTime() + 7200.0);
				}
			}
		}

		new iEntity = -1;
		while((iEntity = FindEntityByClassname(iEntity, "tf_powerup_bottle")) != -1)
		{
			if(GetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity") == iClient)
				AcceptEntityInput(iEntity, "kill");
		}

		if(!g_bCvarWearables)
		{
			iEntity = -1;
			while((iEntity = FindEntityByClassname(iEntity, "tf_wear*")) != -1)
			{
				if(GetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity") == iClient)
					AcceptEntityInput(iEntity, "kill");
			}
		}

		if(!g_bInformed[iClient])
		{
			CPrintToChat(iClient, "%t", "ghostinfo");
			g_bInformed[iClient] = true;
		}
	}
	else
	{
		g_bIsGhost[iClient] = false;
		g_bBecomingGhost[iClient] = false;

		if(IsPlayerAlive(iClient))
		{
			SetEntProp(iClient, Prop_Send, "m_CollisionGroup", 5);
			SetEntProp(iClient, Prop_Send, "m_usSolidFlags",16);
			SetEntProp(iClient, Prop_Send, "m_iHideHUD",0);
		}

		decl String:strModel[PLATFORM_MAX_PATH];
		GetClientModel(iClient, strModel, sizeof(strModel));

		if(StrEqual(strModel, g_strCvarModel) || StrEqual(strModel, "models/props_halloween/ghost.mdl"))
		{
			SetVariantString("");
			AcceptEntityInput(iClient, "SetCustomModel");
		}

		SetEntityGravity(iClient, 1.0);
		SetEntityRenderMode(iClient, RENDER_NORMAL);

		CreateTimer(1.0, Timer_RemoveParticles, iUserId, TIMER_FLAG_NO_MAPCHANGE);

		new iWeapon = GetPlayerWeaponSlot(iClient, TFWeaponSlot_Melee);
		if(iWeapon != -1)
		{
			SetEntityRenderMode(iWeapon, RENDER_TRANSALPHA);
			SetEntityRenderColor(iWeapon, _, _, _, 255);
			SetEntPropFloat(iWeapon, Prop_Data, "m_flNextPrimaryAttack", GetGameTime() + 1.0);
			SetEntPropFloat(iWeapon, Prop_Data, "m_flNextSecondaryAttack", GetGameTime() + 1.0);
		}
	}
}

public Action:OnPlayerDeath(Handle:hEvent, String:strName[], bool:bDontBroadcast)
{
	if((g_iCvarEnabled != 1 && (g_iCvarEnabled != 2 || !g_bArena)) || !g_bRoundStarted)
		return;

	new iFlags = GetEventInt(hEvent, "death_flags");
	if(iFlags & TF_DEATHFLAG_DEADRINGER)
		return;

	new iClient = GetClientOfUserId(GetEventInt(hEvent, "userid"));
	if(!IsValidClient(iClient) || IsFakeClient(iClient) || !CheckCommandAccess(iClient, "sm_ghost", 0, true) || TF2_GetPlayerDesiredClass(iClient) == TFClass_Unknown)
		return;

	if(g_bGhost[iClient])
	{
		g_bBecomingGhost[iClient] = true;

		for(new i = 0; i <= 5 ; i++)
		{
			new iWeapon = GetPlayerWeaponSlot(iClient, i);
			if(iWeapon != -1)
			{
				SetEntityRenderMode(iWeapon, RENDER_TRANSALPHA);
				SetEntityRenderColor(iWeapon, _, _, _, 0);
			}
		}

		new iEntity = -1;
		while((iEntity = FindEntityByClassname(iEntity, "tf_powerup_bottle")) != -1)
		{
			if(GetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity") == iClient)
				AcceptEntityInput(iEntity, "kill");
		}

		iEntity = -1;
		while((iEntity = FindEntityByClassname(iEntity, "tf_wear*")) != -1)
		{
			if(GetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity") == iClient)
				AcceptEntityInput(iEntity, "kill");
		}

		GetClientAbsOrigin(iClient, g_fLocVec[iClient]);
		GetClientAbsAngles(iClient, g_fLocAng[iClient]);
		GetEntPropVector(iClient, Prop_Data, "m_vecVelocity", g_fLocVel[iClient]);

		CreateTimer(0.1, Timer_Respawn, GetClientUserId(iClient), TIMER_FLAG_NO_MAPCHANGE);
	}
}

public Action:OnPlayerChangeClass(Handle:hEvent, String:strName[], bool:bDontBroadcast)
{
	new iClient = GetClientOfUserId(GetEventInt(hEvent, "userid"));
	if(!IsValidClient(iClient) || !IsPlayerAlive(iClient))
		return;

	g_bIsGhost[iClient] = false;
	g_bBecomingGhost[iClient] = false;
}

public Action:OnPlayerRunCmd(iClient, &iButtons, &iImpulse, Float:fVelocity[3], Float:fAngles[3], &iWeapon)
{
	if(!IsValidClient(iClient))
		return;

	if(GetClientTeam(iClient) == 1 && GetEntityMoveType(iClient) != MOVETYPE_OBSERVER)
		TF2_RespawnPlayer(iClient);

	if(IsPlayerAlive(iClient) || !g_bIsGhost[iClient])
		return;

	if(g_iCvarTeleporting > 0 && iButtons & IN_ATTACK)
	{
		static iLastTeleport[MAXPLAYERS + 1];
		new iTime = GetTime();

		if(iTime - iLastTeleport[iClient] >= 4)
		{
			TeleportToRandomPlayer(iClient);
			iLastTeleport[iClient] = iTime;
		}
	}

	if(g_bCvarFlying && iButtons & IN_ATTACK2 || (iButtons & IN_JUMP && !(GetEntityFlags(iClient) & FL_ONGROUND)))
	{
		if(GetEntityMoveType(iClient) != MOVETYPE_FLY)
			SetEntityMoveType(iClient, MOVETYPE_FLY);
	}
	else if(GetEntityMoveType(iClient) != MOVETYPE_WALK)
		SetEntityMoveType(iClient, MOVETYPE_WALK);
}

public Action:SetTransmit(iEntity, iClient)
{
	if(!g_bRoundStarted)
		return Plugin_Continue;

	if(g_bIsGhost[iEntity] && IsPlayerAlive(iClient))
	{
		if(GetClientTeam(iClient) > 1)
			return Plugin_Handled;
	}

	return Plugin_Continue;
}

public Action:PreThink(iEntity, iClient)
{
	if(!g_bIsGhost[iEntity])
		return;

	SetEntPropFloat(iEntity, Prop_Send, "m_flMaxspeed", 300.0);
	if(GetEntityMoveType(iEntity) == MOVETYPE_FLY && GetClientTeam(iEntity) > 1)
	{
		decl Float:fVelocity[3];
		GetEntPropVector(iEntity, Prop_Data, "m_vecVelocity", fVelocity);

		fVelocity[0] *= 0.98;
		fVelocity[1] *= 0.98;
		fVelocity[2] *= 0.98;

		TeleportEntity(iEntity, NULL_VECTOR, NULL_VECTOR, fVelocity);
	}
}

public Action:SoundHook(iClients[64], &iNumClients, String:strSample[PLATFORM_MAX_PATH], &iEntity, &iChannel, &Float:flVolume, &iLevel, &iPitch, &iFlags)
{
	if(IsValidClient(iEntity) && g_bIsGhost[iEntity])
	{
		if(StrContains(strSample, "footsteps", false) != -1 || StrContains(strSample, "weapons", false) != -1 || StrContains(strSample, "pain", false) != -1)
			return Plugin_Stop;
	}
	return Plugin_Continue;
}

// ====[ COMMANDS ]============================================================

public Action:GhostModeCmd(iClient, iArgs)
{
	if(!IsValidClient(iClient))
		return Plugin_Continue;

	GhostModeMenu(iClient);
	return Plugin_Handled;
}

public Action:JoinclassCmd(iClient, const String:strCmd[], iArgs)
{
	if(iArgs < 1 || !g_bIsGhost[iClient])
		return Plugin_Continue;

	decl String:strCommand[32];
	GetCmdArg(1, strCommand, sizeof(strCommand));

	new TFClassType:iClass = TF2_GetClass(strCommand);
	if(iClass != TFClass_Unknown)
		SetEntProp(iClient, Prop_Send, "m_iDesiredPlayerClass", iClass);

	return Plugin_Stop;
}

public Action:JointeamCmd(iClient, const String:strCmd[], iArgs)
{
	if(g_bIsGhost[iClient])
		return Plugin_Handled;
	return Plugin_Continue;
}

public Action:TauntCmd(iClient, const String:strCmd[], iArgs)
{
	if(g_bIsGhost[iClient])
		return Plugin_Handled;
	return Plugin_Continue;
}

// ====[ MENUS ]===============================================================

public GhostModeMenu(iClient)
{
	if(!IsValidClient(iClient) || IsVoteInProgress())
		return;

	new Handle:hPanel = CreatePanel();
	SetPanelTitle(hPanel, "Ghostmode Preferences");
	DrawPanelText(hPanel, " ");

	SetGlobalTransTarget(iClient);
	decl String:strInfo[128];
	if(g_bGhost[iClient])
	{
		Format(strInfo, sizeof(strInfo), "%t", "ghoston");
		DrawPanelText(hPanel, strInfo);
		Format(strInfo, sizeof(strInfo), "%t", "ghostdisable");
		DrawPanelItem(hPanel, strInfo);
	}
	else
	{
		Format(strInfo, sizeof(strInfo), "%t", "ghostoff");
		DrawPanelText(hPanel, strInfo);
		Format(strInfo, sizeof(strInfo), "%t", "ghostenable");
		DrawPanelItem(hPanel, strInfo);
	}
	DrawPanelText(hPanel, "");
	if(g_bThirdPerson[iClient])
	{
		Format(strInfo, sizeof(strInfo), "%t", "thirdpersonon");
		DrawPanelText(hPanel, strInfo);
		Format(strInfo, sizeof(strInfo), "%t", "thirdpersondisable");
		DrawPanelItem(hPanel, strInfo);
	}
	else
	{
		Format(strInfo, sizeof(strInfo), "%t", "thirdpersonoff");
		DrawPanelText(hPanel, strInfo);
		Format(strInfo, sizeof(strInfo), "%t", "thirdpersonenable");
		DrawPanelItem(hPanel, strInfo);
	}
	DrawPanelText(hPanel, " ");
	Format(strInfo, sizeof(strInfo), "%t", "Exit");
	DrawPanelItem(hPanel, strInfo);

	SendPanelToClient(hPanel, iClient, GhostModeMenu_Handler, 30);
	CloseHandle(hPanel);
}

public GhostModeMenu_Handler(Handle:hPanel, MenuAction:iAction, iParam1, iParam2)
{
	if(iAction != MenuAction_Select)
		return;

	if(iParam2 == 1)
	{
		if(g_bGhost[iParam1])
		{
			g_bGhost[iParam1] = false;
			SetClientCookie(iParam1, g_hCookieGhost, "0");
		}
		else
		{
			g_bGhost[iParam1] = true;
			SetClientCookie(iParam1, g_hCookieGhost, "1");
		}
		GhostModeMenu(iParam1);
	}

	if(iParam2 == 2)
	{
		if(g_bThirdPerson[iParam1])
		{
			g_bThirdPerson[iParam1] = false;
			SetClientCookie(iParam1, g_hCookieThirdPerson, "0");

			if(g_bIsGhost[iParam1])
			{
				SetVariantInt(0);
				AcceptEntityInput(iParam1, "SetForcedTauntCam");
			}
		}
		else
		{
			g_bThirdPerson[iParam1] = true;
			SetClientCookie(iParam1, g_hCookieThirdPerson, "1");

			if(g_bIsGhost[iParam1])
			{
				SetVariantInt(2);
				AcceptEntityInput(iParam1, "SetForcedTauntCam");
			}
		}
		GhostModeMenu(iParam1);
	}
}

// ====[ TIMERS ]==============================================================

public Action:Timer_Respawn(Handle:hTimer, any:iClientId)
{
	new iClient = GetClientOfUserId(iClientId);
	if(!IsValidClient(iClient))
		return;

	if(!g_bRoundStarted)
	{
		g_bIsGhost[iClient] = false;
		g_bBecomingGhost[iClient] = false;
		return;
	}

	if(TF2_GetPlayerDesiredClass(iClient) != TFClass_Unknown)
		TF2_RespawnPlayer(iClient);
}

public Action:Timer_ReApplyModel(Handle:hTimer, any:iClientId)
{
	new iClient = GetClientOfUserId(iClientId);
	if(!IsValidClient(iClient) || !g_bIsGhost[iClient])
		return Plugin_Stop;

	decl String:strModel[PLATFORM_MAX_PATH];
	GetClientModel(iClient, strModel, sizeof(strModel));

	if(StrEqual(strModel, g_strCvarModel))
		return Plugin_Stop;

	SetVariantString(g_strCvarModel);
	AcceptEntityInput(iClient, "SetCustomModel");

	return Plugin_Continue;
}

public Action:Timer_ThirdPerson(Handle:hTimer, any:iClientId)
{
	new iClient = GetClientOfUserId(iClientId);
	if(!IsValidClient(iClient))
		return;

	if(g_bIsGhost[iClient] && g_bThirdPerson[iClient])
	{
		SetVariantInt(2);
		AcceptEntityInput(iClient, "SetForcedTauntCam");
	}
}

public Action:Timer_RemoveParticles(Handle:hTimer, any:iClientId)
{
	new iClient = GetClientOfUserId(iClientId);
	if(!IsValidClient(iClient))
		return;

	SetVariantString("ParticleEffectStop");
	AcceptEntityInput(iClient, "DispatchEffect");
}

// ====[ STOCKS ]==============================================================

stock bool:IsValidClient(iClient)
{
	if(iClient <= 0 || iClient > MaxClients || !IsClientInGame(iClient))
		return false;
	return true;
}

stock TFClassType:TF2_GetPlayerDesiredClass(iClient)
{
	return TFClassType:GetEntProp(iClient, Prop_Send, "m_iDesiredPlayerClass");
}

stock TeleportToRandomPlayer(iClient)
{
	new iCount;
	new iPlayers[MAXPLAYERS + 1];

	for(new i = 1; i <= MaxClients; i++) if(IsValidClient(i))
	{
		if(IsPlayerAlive(i) && i != iClient)
		{
			if(g_iCvarTeleporting == 2 && GetClientTeam(iClient) != GetClientTeam(i))
				continue;

			if(GetEntProp(i, Prop_Send, "m_bDucked") || GetEntProp(i, Prop_Send, "m_bDucking"))
				continue;

			iPlayers[iCount++] = i;
		}
	}

	if(iCount <= 0)
		return;

	new iTarget = iPlayers[GetRandomInt(0, iCount - 1)];
	if(IsValidClient(iTarget))
	{
		decl Float:fPosition[3];
		GetClientAbsOrigin(iTarget, fPosition);

		decl Float:fAngle[3];
		GetClientAbsAngles(iTarget, fAngle);

		TeleportEntity(iClient, fPosition, fAngle, NULL_VECTOR);
	}
}

Hoffe mir kann damit wer helfen. Danke.

MfG,
Newbie'

Newbie'

Profi

  • »Newbie'« ist der Autor dieses Themas

Beiträge: 580

Wohnort: Zuhause

Rootserver vorhanden: Nein

  • Nachricht senden

2

Freitag, 25. Oktober 2013, 12:07

Keiner Interesse einem Noob kurz und schnell zu helfen? Ich denke für jemanden der sich dami auskennt ist es eine Sache von 5 Minuten ... :lovu:

Alles geht soweit nur die "Ghostmode Preferences" werden nach jedem Mapchange und oder Server Restart zurückgesetzt. Also die Einstellungen vom Spieler werden nie gespeichert. ;(

Lacrimosa99

Fortgeschrittener

Beiträge: 275

Wohnort: Leipzig

Beruf: IT-Systemintegrator

Rootserver vorhanden: Ja

  • Nachricht senden

3

Freitag, 25. Oktober 2013, 18:18

Wenn die Player Settings nicht gespeichert werden.. dann ist erstmal die beste Anlaufstelle das "clientprefs.smx" Plugin (was dazu aktiv sein sollte) und die database.cfg die sqlite als Type beinhalten muss, um lokal die Datenbanktabellen zu füllen.

MfG




Newbie'

Profi

  • »Newbie'« ist der Autor dieses Themas

Beiträge: 580

Wohnort: Zuhause

Rootserver vorhanden: Nein

  • Nachricht senden

4

Freitag, 25. Oktober 2013, 19:47

Da ist alles korrekt, alle anderen Plugins laufen auch problemlos ...

Ähnliche Themen

Verwendete Tags

sourcemod, Team Fortress 2