Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Wklejka pcnawjxp12ba dodana przez palarie, 19.11.2013 21:50
Typ:



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.
/* Plugin generated by AMXX-Studio */
 
#include <amxmodx>
#include <fakemeta>
#include <nvault>
#include <hamsandwich>
#include <amxmisc>
#include <csx>
 
#define PLUGIN "SpeedMeter"
#define VERSION "2.1"
#define AUTHOR "Vertricus"
 
 
#define ACCESS_RESET	 ADMIN_IMMUNITY
#define MAX_PLAYERS	 32
 
 
//Zmienne
new Float:fPlayerMaxSpeed[MAX_PLAYERS+1], Float: fPlayerActualSpeed[MAX_PLAYERS+1], szPlayerName[MAX_PLAYERS+1][32]
new szKeySpeed[32], szKeyName[34]
new bool:NewRecord = false, szMapName[32];
new szChampionName[32], Float:fMapRecord
new nVault
new HudObj
new pcvarEnabled, pcvarUpadte, pcvarTerro
new HudBot
new szData[10];
 
 
 
public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	//Cvars
	pcvarEnabled = register_cvar("sm_enabled", "1")
	pcvarUpadte = register_cvar("sm_upadte", "0.1")
	pcvarTerro = register_cvar("sm_terro", "1")
	//FM Part
	register_forward(FM_PlayerPreThink, "Fw_PlayerPreThink")
	register_forward(FM_ClientUserInfoChanged, "Fw_ClientUserInfoChanged", 1)
	//Others
	get_mapname(szMapName, charsmax(szMapName))
	HudObj = CreateHudSyncObj()
	register_clcmd("sm_reset", "CmdSpeedReset", ACCESS_RESET)
	//nVaultPart
	formatex(szKeySpeed,63,"%s-Speed",szMapName)
	formatex(szKeyName,63,"%s-Name",szMapName)
 
 
}
public plugin_cfg()
{
	nVault = nvault_open("SpeedRecord")
	if (nVault == INVALID_HANDLE)
		set_fail_state( "Error opening nVault");
 
	fMapRecord = float(nvault_get(nVault,szKeySpeed))
	nvault_get(nVault, szKeyName, szChampionName, 31)
 
	CreateHudBot()
}
public plugin_end() 
{
	if (!NewRecord)
		return
 
	new szNewRecord[32]
	float_to_str(fMapRecord, szNewRecord, 31)
 
	nvault_set(nVault,szKeySpeed, szNewRecord)
	nvault_set(nVault,szKeyName,szChampionName)
	nvault_close(nVault)
}
public client_authorized(id)
{
	if (!get_pcvar_num(pcvarEnabled))
		return
 
	get_user_name(id, szPlayerName[id], 31)
	fPlayerMaxSpeed[id] = 0.0
}
public Fw_ClientUserInfoChanged(id)
{
	get_user_name(id, szPlayerName[id], 31)
}
public Fw_PlayerPreThink(id)
{
	if (!is_user_alive(id)|| !get_pcvar_num(pcvarEnabled))
		return FMRES_IGNORED;
 
	if (get_pcvar_num(pcvarTerro) == 0 && get_user_team(id) == 1) 
		return FMRES_IGNORED;
 
	fPlayerActualSpeed[id] = Player_Speed(id)
 
	if (fPlayerActualSpeed[id] > fPlayerMaxSpeed[id])
		fPlayerMaxSpeed[id] = fPlayerActualSpeed[id]		
 
	return FMRES_IGNORED;	
}
public CreateHudBot()
{
	HudBot = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"));
 
	if(!pev_valid(HudBot))
		return;
 
	set_pev(HudBot, pev_classname, "HudBot");
	set_pev(HudBot, pev_nextthink, get_gametime()+ get_pcvar_float(pcvarUpadte))
 
	RegisterHamFromEntity(Ham_Think, HudBot, "Think_HudBot")
}
public Think_HudBot(Bot)
{
	if (!pev_valid(Bot) || Bot != HudBot)
		return HAM_IGNORED;
 
	if (get_pcvar_num(pcvarEnabled))
	{
		new iPlayers[32], iNum, id
		get_players(iPlayers, iNum)
 
		get_time( "%X", szData, 9 );
		new czas_mapy = get_timeleft()
 
		for(new i= 0; i<iNum; i++)
		{
			id = iPlayers[i];
			if (!is_user_alive(id))
				continue
 
			set_hudmessage(255, 170, 42, 0.7, 0.2, 1, 0.01, get_pcvar_float(pcvarUpadte), 0.01, 0.01, 3)
 
			if (get_pcvar_num(pcvarTerro) == 0 && get_user_team(id) == 1) 
				ShowSyncHudMsg(id, HudObj, "Rekord Mapy: %.2f^nRekordzista: %s", fMapRecord,szChampionName)
			else
				ShowSyncHudMsg(id, HudObj, "Forum: Fragiernia.Xaa.PL^nGG H@: 34458463^nTimeLeft: %i^nAktualna godzina:%s^n^nTwoja predkosc: %.2f^nTwoj vMax: %.2f^nRekord Mapy: %.2f^nRekordzista: %s", (czas_mapy/60), szData, fPlayerActualSpeed[id], fPlayerMaxSpeed[id], fMapRecord,szChampionName)
 
			if (fPlayerMaxSpeed[id] > fMapRecord)
				SetNewRecord(fPlayerMaxSpeed[id], szPlayerName[id])
		}
	}
 
	set_pev(Bot, pev_nextthink, get_gametime()+get_pcvar_float(pcvarUpadte))
 
	return HAM_IGNORED;
}
stock SetNewRecord(Float:Speed, Name[32])
{
	fMapRecord = Speed
	szChampionName = Name
	NewRecord = true
}
stock Float:Player_Speed(id)
{
	new Float:fVect[3]
	pev(id, pev_velocity,fVect)
	return floatsqroot(fVect[0]*fVect[0]+fVect[1]*fVect[1])
}
public CmdSpeedReset(id, level, cid) 
{ 
	if(!cmd_access(id,level, cid, 1)) 
		return PLUGIN_HANDLED; 
 
	new iPlayers[32], iNum
	get_players(iPlayers, iNum)
	for(new i=0; i<iNum; i++)
		fPlayerMaxSpeed[iPlayers[i]] = 0.0
 
	SetNewRecord(0.0, "Brak")
	client_print(id, print_console, "Rekord szybkosci na mapie zostal zresetowany")
	return PLUGIN_HANDLED 
}
 

Dodanych wklejek: 4031
Powered By (Pav32) Pastebin © 2011