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
 

Zdjęcie

Brak wyświetlania rekordzisty


Najlepsza odpowiedź Rivit, 07.07.2018 10:24

Zamien:

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;	
}

na:

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] > fMapRecord)
		SetNewRecord(fPlayerActualSpeed[id], szPlayerName[id])

	if (fPlayerActualSpeed[id] > fPlayerMaxSpeed[id])
		fPlayerMaxSpeed[id] = fPlayerActualSpeed[id]

	
	return FMRES_IGNORED;	
}

skompiluj I sprawdz. Na przyszłość dawaj kod jako załącznik, wtedy mógłbym sobie to sprawdzic czy kompiluje sie, a tak to nie chce mi sie kopiowac tego

Przejdź do postu


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
11 odpowiedzi w tym temacie

#1 Automatyk

    Profesjonalista

  • Użytkownik

Reputacja: 21
Życzliwy

  • Postów:195
  • Steam:steam
  • Lokalizacja:Kraków
Offline

Napisano 07.07.2018 08:41

Witam. Czy ktoś może powiedzieć co tu nie gra gdyż Rekord Mapy oraz Rekordzista nie są w ogóle "naliczani"? Rekord Mapy stale wynosi 0.0 oraz brak rekordzisty oczywiście. Ktoś wie co tu może być źle? Wyodrębniłem tylko poszczególne napisy do osobnych HUD a mimo to właśnie jest problem który napisałem wyżej. Kod wygląda następująco:

public PlayerInfo(id)
{
	if(!is_user_alive(id))
	{
		new target = pev(id, pev_iuser2);
		new hp = get_user_health(target);

		
		if(!target)
			return 1;

		new Time[9]

		get_time("%H:%M:%S",Time,8)

		set_hudmessage(255, 255, 51, 0.01, 0.18, 0, 0.0, 0.3, 0.0, 0.0, 2);
		ShowSyncHudMsg(id, SyncHud, "[Klasa : %s]^n[Poziom : %i | 501]^n[EXP : %.1f %%]^n[HP : %d]", NazwyKlas[gClass[target]], gLvl[target], gfPercent[target], hp);
                set_hudmessage(255, 128, 0, -1.00, 0.76, 0, 0.0, 0.3, 0.0, 0.0, -1);
		ShowSyncHudMsg(id, SyncHud2, "~ Predkosc : %.2f^n ~ vMax : %.2f", fPlayerActualSpeed[target],fPlayerMaxSpeed[target]);
                set_hudmessage(0, 153, 0, -0.10, 0.18, 0, 0.0, 0.3, 0.0, 0.0, -1);
		ShowSyncHudMsg(id, SyncHud3, "[Rekord Mapy : %.2f]^n[Rekordzista : %s]", fMapRecord,szChampionName);
                
		return 1;
	}

	new Time[9]

	get_time("%H:%M:%S",Time,8)

	new hp = get_user_health(id); 

	set_hudmessage(255, 255, 51, 0.01, 0.18, 0, 0.0, 0.3, 0.0, 0.0, 2);
	ShowSyncHudMsg(id, SyncHud, "[Klasa : %s]^n[Poziom : %i | 501]^n[EXP : %.1f %%]^n[HP : %d]", NazwyKlas[gClass[id]], gLvl[id], gfPercent[id], hp);
        set_hudmessage(255, 128, 0, -1.00, 0.76, 0, 0.0, 0.3, 0.0, 0.0, -1);
	ShowSyncHudMsg(id, SyncHud2, "~ Predkosc : %.2f^n ~ vMax : %.2f", fPlayerActualSpeed[id],fPlayerMaxSpeed[id]);
        set_hudmessage(0, 153, 0, -0.10, 0.18, 0, 0.0, 0.3, 0.0, 0.0, -1);
	ShowSyncHudMsg(id, SyncHud3, "Rekord Mapy : %.2f^nRekordzista : %s",fMapRecord,szChampionName);
	
	return 1;
}


  • +
  • -
  • 0

#2 Rivit

    Godlike

  • Support Team

Reputacja: 1 319
Godlike

  • Postów:4 380
Offline

Napisano 07.07.2018 09:48

Misiu kolorowy, to co podałeś tutaj to jest tylko wyświetlanie informacji... które de facto są dobrze zrobione.

 

Musisz dać więcej kodu, który korzysta ze zmiennych fMapRecord i szChampionName


  • +
  • -
  • 1

#3 Automatyk

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 21
Życzliwy

  • Postów:195
  • Steam:steam
  • Lokalizacja:Kraków
Offline

Napisano 07.07.2018 09:54

Wiem , lecz mówię że wyżej nic nie zostało zmienione :) dlatego to jest bardzo dziwne.... To proszę cały :

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <nvault>
#include <fun>
#include <ColorChat>

#define MAX 32

#define NINJACLASS_FLAG ADMIN_LEVEL_A
#define GHOSTCLASS_FLAG ADMIN_LEVEL_B
#define SMIERCCLASS_FLAG ADMIN_LEVEL_C
#define RAMBOCLASS_FLAG ADMIN_LEVEL_D
#define MENTOSCLASS_FLAG ADMIN_LEVEL_E
#define EXPVIP_FLAG ADMIN_LEVEL_H

#define TASKTIME 0.1

#define ACCESS_RESET	 ADMIN_IMMUNITY
#define MAX_PLAYERS	 32

native get_user_diamenty(id);
enum 
{
	Brak,
	Operator,
	Jumper,
	Odrzutowiec,
	Nozownik,
	Farciarz,
	Exper,
	Predator,
	Mentos,
	Ninja,
	Smierc,
	Rambo,
	Ghost,
	
	Klasy
}

new const NazwyKlas[Klasy][] =
{
	"Brak",
	"Operator",
	"Jumper",
	"Odrzutowiec",
	"Nozownik",
	"Farciarz",
	"Exper",
	"Predator",
	"Mentos (Premium)",
	"Ninja (Premium)",
	"Smierc (Premium)",
	"Rambo (Premium)",
	"Ghost (Premium)"
}

new const OpisyKlas[Klasy][] =
{
	"Brak opisu",
	"Cicho chodzi",
	"Posiada podwojny skok",
	"LongJump co 5s",
	"1/2 szans na zabicie",
	"40% na zrespienie sie po smierci",
	"Za zabojstwo dostajesz wiecej doswiadczenia",
	"Widzisz niewidzialnych oraz dostajesz mniejsza grawitacje",
	"Dostajesz mniejsza widocznosc, mniejsza grawitacje, podwojny skok oraz na start 150HP",
	"Grawitacja: -10%, podwojny skok, 50% na zabicie z noza (PPM)",
	"Posiada 1/1 z noza, dostaje tylko 150HP oraz mniejsza grawitacje",
	"Dostajesz potrojny skok, 1/4 na zabicie z noza oraz 40% na odrodzenie",
	"Jest niewidzialny, posiadasz 10DMG oraz dostajesz potrojny skok"
}
new const OpisyUmiejetnosci[Klasy][] =
{
	"Brak opisu",
	"Zmniejszona Grawitacja oraz dodatkowe +25 HP",
	"Zmniejszona Grawitacja",
	"Dodatkowe +20HP",
	"Dodatkowe +50HP",
	"Wieksza kondycja", //itd robic juz z sprezycowanymi klasami
	"Za zabojstwo dostajesz wiecej doswiadczenia",
	"Widzisz niewidzialnych oraz dostajesz mniejsza grawitacje",
	"Dostajesz mniejsza widocznosc, mniejsza grawitacje, podwojny skok oraz na start 150HP",
	"Grawitacja: -10%, podwojny skok, 50% na zabicie z noza (PPM)",
	"Posiada 1/1 z noza, dostaje tylko 150HP oraz mniejsza grawitacje",
	"Dostajesz potrojny skok, 1/4 na zabicie z noza oraz 40% na odrodzenie",
	"Jest niewidzialny, posiadasz 10DMG oraz dostajesz potrojny skok"
}

new const ExpTable[502] = {
	0,
	26, 52, 80, 102, 124, 174, 203, 237, 278, 290, 
	308, 371, 412, 413, 434, 444, 487, 526, 590, 626, 
	668, 687, 705, 709, 780, 826, 853, 861, 921, 958, 
	985, 990, 1035, 1086, 1086, 1125, 1161, 1178, 1214, 1280, 
	1291, 1333, 1334, 1361, 1396, 1404, 1467, 1481, 1505, 1541, 
	1629, 1657, 1679, 1725, 1728, 1773, 1787, 1856, 1862, 1873, 
	1923, 1925, 2011, 2048, 2074, 2092, 2105, 2161, 2193, 2207, 
	2256, 2294, 2305, 2349, 2358, 2430, 2442, 2492, 2521, 2535, 
	2573, 2621, 2632, 2641, 2651, 2737, 2744, 2764, 2826, 2860, 
	2895, 2941, 2948, 2967, 3036, 3038, 3050, 3091, 3098, 3142, 
	3192, 3208, 3269, 3320, 3356, 3380, 3402, 3405, 3465, 3494, 
	3513, 3545, 3602, 3636, 3647, 3688, 3734, 3744, 3744, 3817, 
	3847, 3902, 3921, 3933, 3989, 4015, 4046, 4093, 4116, 4150, 
	4162, 4187, 4202, 4272, 4279, 4302, 4339, 4343, 4383, 4400, 
	4493, 4530, 4530, 4546, 4607, 4665, 4680, 4689, 4740, 4760, 
	4792, 4843, 4882, 4924, 4960, 4963, 4994, 5030, 5046, 5070, 
	5134, 5168, 5175, 5178, 5228, 5275, 5318, 5370, 5385, 5397, 
	5428, 5446, 5499, 5517, 5543, 5602, 5612, 5647, 5700, 5750, 
	5765, 5797, 5833, 5849, 5919, 5946, 5950, 5951, 5975, 5978, 
	6028, 6138, 6157, 6172, 6225, 6260, 6273, 6333, 6348, 6383, 
	6401, 6441, 6467, 6467, 6515, 6551, 6557, 6566, 6622, 6648, 
	6751, 6779, 6810, 6835, 6860, 6879, 6925, 6930, 6971, 6978, 
	7034, 7085, 7134, 7142, 7157, 7188, 7199, 7252, 7256, 7326, 
	7366, 7369, 7397, 7412, 7488, 7540, 7557, 7557, 7597, 7660, 
	7674, 7674, 7757, 7759, 7807, 7848, 7881, 7936, 7965, 7997, 
	8002, 8063, 8083, 8092, 8123, 8126, 8134, 8149, 8202, 8317, 
	8350, 8381, 8407, 8410, 8433, 8456, 8523, 8574, 8605, 8640, 
	8650, 8664, 8682, 8718, 8787, 8812, 8826, 8892, 8902, 8955, 
	8982, 9002, 9051, 9058, 9114, 9130, 9132, 9197, 9220, 9248, 
	9248, 9270, 9374, 9381, 9390, 9410, 9470, 9508, 9526, 9557, 
	9606, 9608, 9637, 9699, 9707, 9742, 9816, 9846, 9884, 9905, 
	9932, 9963, 9980, 10031, 10041, 10074, 10104, 10150, 10191, 10195, 
	10262, 10278, 10328, 10334, 10352, 10412, 10459, 10460, 10502, 10509, 
	10586, 10623, 10630, 10678, 10720, 10722, 10772, 10802, 10811, 10858, 
	10858, 10882, 10898, 10970, 10998, 11007, 11018, 11057, 11123, 11188, 
	11228, 11232, 11266, 11306, 11308, 11348, 11392, 11440, 11475, 11499, 
	11519, 11561, 11603, 11647, 11679, 11680, 11689, 11741, 11784, 11814, 
	11851, 11872, 11889, 11906, 11996, 12017, 12059, 12094, 12116, 12143, 
	12168, 12223, 12233, 12233, 12299, 12302, 12314, 12360, 12442, 12465, 
	12484, 12494, 12532, 12564, 12629, 12643, 12686, 12699, 12758, 12796, 
	12815, 12863, 12891, 12897, 12934, 12940, 12987, 13038, 13059, 13062, 
	13134, 13156, 13167, 13212, 13221, 13306, 13323, 13326, 13335, 13342, 
	13458, 13479, 13516, 13556, 13583, 13604, 13627, 13680, 13683, 13725, 
	13748, 13758, 13769, 13791, 13896, 13916, 13947, 13996, 14036, 14066, 
	14076, 14138, 14156, 14207, 14230, 14245, 14245, 14248, 14254, 14363, 
	14430, 14440, 14467, 14471, 14502, 14577, 14588, 14634, 14649, 14717, 
	14721, 14721, 14811, 14846, 14871, 14896, 14899, 14946, 15004, 15005, 
	15023, 15037, 15087, 15090, 15146, 15181, 15210, 15261, 15297, 15303, 
	15354, 15412, 15450, 15487, 15489, 15544, 15567, 15602, 15634, 15647, 
	15672, 15701, 15754, 15783, 15828, 15869, 15880, 15906, 15920, 15991, 
	15995
}

enum
{
	Zycie,
	Grawitacja,
	Obrazenia,
	Kondycja,
	
	Staty
}


new gStats[MAX+1][Staty];
new iZycie[MAX+1], Float:iGrawitacja[MAX+1], iKondycja[MAX+1], Float:iObrazenia[MAX+1];
new gClass[MAX+1], gNewClass[MAX+1];
new gExp[MAX+1], gLvl[MAX+1], gPoints[MAX+1];
new gName[MAX+1][32];
new Float:gfPercent[MAX+1];
new bool:isVip[MAX+1];
new bool:g_loaded[MAX+1];

new gSkoki[MAX+1], Float:gfLastModulUse[MAX+1];

new SyncHud;
new SyncHud2;
new SyncHud3;


new g_vault;

new xp_kill, xp_higher, xp_vip;

//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 pcvarEnabled, pcvarTerro

public plugin_init()
{
	register_plugin("Deathrun EXP Mod", "v5.1", "Mentos");
	
	register_event("DeathMsg", "Death", "a");
	register_logevent("EventRoundEnd", 2, "1=Round_End");
	register_forward(FM_CmdStart, "CmdStart");
	register_forward(FM_AddToFullPack, "FwdAddToFullPack", 1)
	
	RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
	RegisterHam(Ham_Spawn, "player", "SpawnPlayer", 1);
	
	register_concmd("reset_player", "CmdReset", ADMIN_IMMUNITY, "<nick, #userid, authid>");
	register_concmd("give_exp", "CmdGiveLvl", ADMIN_IMMUNITY, "<nick, #userid, authid>");
	register_clcmd("say /klasa", "WybierzKlase");
	register_clcmd("say /klasy", "MenuOpisKlas");
	register_clcmd("say /staty", "PrzydzielPunkty");
	register_clcmd("say /statystyki", "PrzydzielPunkty");
	register_clcmd("say /reset", "Resetuj");
	
	xp_kill = register_cvar("xp_kill", "15");
	xp_higher = register_cvar("xp_higher", "5");
	xp_vip = register_cvar("xp_vip", "5");
	
	SyncHud = CreateHudSyncObj();
        SyncHud2 = CreateHudSyncObj();
        SyncHud3 = CreateHudSyncObj();
	g_vault = nvault_open("DeathrunXP");
	
	pcvarEnabled = register_cvar("sm_enabled", "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))
	register_clcmd("sm_reset", "CmdSpeedReset", ACCESS_RESET)
	//nVaultPart
	formatex(szKeySpeed,63,"%s-Speed",szMapName)
	formatex(szKeyName,63,"%s-Name",szMapName)

	set_task(1.0, "plugin_cfg");
}

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)
}

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 plugin_precache()
{	
	precache_sound("deathrunmod/select.wav");
	precache_sound("deathrunmod/levelup.wav");
}

public CmdReset(client, level, cid)
{
	if( !cmd_access(client, level, cid, 2) ) return PLUGIN_HANDLED;
	
	static arg[35];
	read_argv(1, arg, sizeof(arg) - 1);
	
	new target = cmd_target(client, arg, CMDTARGET_OBEY_IMMUNITY|CMDTARGET_NO_BOTS);
	if( !target ) return PLUGIN_HANDLED;
	
	Resetuj(target);
	
	ColorChat(target, GREEN, "[DR:ODTv3]^x03 Admin wymusil zresetowanie Twoich statystyk.");
	
	return PLUGIN_HANDLED;
}
public CmdGiveLvl(client, level, cid)
{
	if( !cmd_access(client, level, cid, 3) ) return PLUGIN_HANDLED;
	
	static arg[35];
	read_argv(1, arg, sizeof(arg) - 1);
	
	new target = cmd_target(client, arg, CMDTARGET_NO_BOTS);
	if( !target ) return PLUGIN_HANDLED;
	
	read_argv(2, arg, sizeof(arg) - 1);
	new lvl = str_to_num(arg);
	
	if(gLvl[target] > lvl)
	{
		console_print(client, "Gracz ma wiekszy poziom, niz chcesz mu dac!");
		return PLUGIN_HANDLED;
	}

	gLvl[target] = lvl;
	gExp[target] = 0;
	gPoints[target] = 2*lvl
	for(new i=0; i<=Odrodzenie; i++)
		gPoints[target] -= gStats[target][i]
	
	ColorChat(target, GREEN, "[DR:ODTv3]^x01 Dostales^x03 %s^x01 poziom od^x03 Admina", arg);
	
	return PLUGIN_HANDLED;
}

public client_putinserver(id)
{
	isVip[id] = bool:(get_user_flags(id) & EXPVIP_FLAG);
	get_user_name(id, gName[id], 31);
	
	g_loaded[id] = false;
	
	set_task(TASKTIME, "PlayerInfo", id, _, _, "b");
	ResetPlayer(id);
	return 1;
}


public ResetPlayer(id)
{
	gLvl[id] = 0;
	gExp[id] = 0;
	gClass[id] = 0;
	gPoints[id] = 0;
	gNewClass[id] = 0;
	for(new i=0; i<=3; i++)
		gStats[id][i] = 0;
	
	iZycie[id] = 0;
	iKondycja[id] = 0;
	iGrawitacja[id] = 0.0;
	iObrazenia[id] = 0.0;
	gfPercent[id] = 0.0;
	
	return 1;
}

public client_disconnect(id)
{
	SaveData(id);
	remove_task(id);
	
	return 1;
}

public SpawnPlayer(id)
{
	if(!is_user_alive(id))
		return 1;
	
	if(!gClass[id])
	{
		WybierzKlase(id);
		return 1;
	}
	
	if(gNewClass[id])
	{
		ResetPlayer(id);
		WybierzKlase(id);
	}
	if(gPoints[id]) PrzydzielPunkty(id);
	
	GetStats(id)

	switch(gClass[id])
	{
		case Ninja: iGrawitacja[id] -= 0.10;
		case Ghost: set_user_visibility(id, 5);
		case Operator: iZycie[id] += 25, iGrawitacja[id] -= 0.25;
		case Jumper: iGrawitacja[id] -= 0.25;
		case Nozownik: iZycie[id] -= 50;
		case Farciarz: iKondycja[id] += 50;
		case Smierc: iZycie[id] += 50, iGrawitacja[id] -= 0.50;
		case Predator: iGrawitacja[id] -= 0.50;
		case Mentos: set_user_visibility(id, 100), iGrawitacja[id] -= 0.50, iZycie[id] += 50;
	}

	if(gClass[id] == Operator)
		set_user_footsteps(id, 1);
	else
		set_user_footsteps(id, 0);
	
	set_task(0.1, "Bonusy", id)
	
	return 1;
}

public Bonusy(id)
{
	fm_set_user_health(id, 100+iZycie[id]);
	fm_set_user_gravity(id, iGrawitacja[id]);
}

GetStats(id)
{
	iZycie[id] = gStats[id][Zycie] * 1;
	new Float:Bonus = gStats[id][Grawitacja] * 0.005;
	iGrawitacja[id] = 1.0 - Bonus;
	iKondycja[id] = floatround(gStats[id][Odrodzenie] * 0.4);
	iObrazenia[id] = gStats[id][Obrazenia] * 0.5;
}

public Death(id)
{
	new iKid = read_data(1);
	new iVid = read_data(2);
	
	if(iOdrodzenie[iVid] >= 1 || gClass[iVid] == Rambo)
	{
		new iPoints = iOdrodzenie[iVid];
		if(gClass[iVid] == Rambo)
			iPoints += 40;
		
		if(random_num(1, 100) <= iPoints)
			set_task(0.1, "Respawn", iVid);
	}
	
	if(!is_user_connected(iKid) || !is_user_connected(iVid) || SameTeam(iVid, iKid))
		return 1;

	new exp_add = get_pcvar_num(xp_kill);
	
	if(isVip[iKid])
		exp_add += get_pcvar_num(xp_vip);
		
	if(gLvl[iVid] > gLvl[iKid])
		exp_add += get_pcvar_num(xp_higher);
	
	new bonus_doswiadczenie = 20
	if(gClass[iVid] == Exper)
		exp_add += bonus_doswiadczenie
	
	gExp[iKid] += exp_add;
	Check(iKid);

	return 1;
}

public Respawn(id)
{
	if(is_user_connected(id))
	{
		ExecuteHamB(Ham_CS_RoundRespawn, id);
		ColorChat(id, GREEN, "[DR:ODTv3]^x01 Nie mozliwe !^x03 Odrodzilem sie !");
	}
}

public Check(id)
{
	if(gExp[id] >= ExpTable[gLvl[id]+1] && gLvl[id] < 500)
	{
		gExp[id] -= ExpTable[gLvl[id]+1];
		gLvl[id] ++;
		gPoints[id] += 2;
		ColorChat(id, GREEN, "[DR:ODTv3]^x01 Awansowales do^x03 %i^x01 poziom.", gLvl[id]);
		client_cmd(id, "spk deathrunmod/levelup");
	}
	
	gfPercent[id] = get_percent(id);
	
	SaveData(id);
}

Float:get_percent(id)
{
	new Float:iExp = float(gExp[id]);
	new Float:iNeed = float(ExpTable[gLvl[id]+1]);
	return (iExp*100.0/iNeed);
}

public PlayerInfo(id)
{
	if(!is_user_alive(id))
	{
		new target = pev(id, pev_iuser2);
		new hp = get_user_health(target);
                new monety = get_user_diamenty(target)
		
		if(!target)
			return 1;

		new Time[9]

		get_time("%H:%M:%S",Time,8)

		set_hudmessage(255, 255, 51, 0.01, 0.18, 0, 0.0, 0.3, 0.0, 0.0, 2);
		ShowSyncHudMsg(id, SyncHud, "[Klasa : %s]^n[Poziom : %i | 501]^n[EXP : %.1f %%]^n[Monety : %i]^n[HP : %d]", NazwyKlas[gClass[target]], gLvl[target], gfPercent[target],monety, hp);
                set_hudmessage(255, 128, 0, -1.00, 0.76, 0, 0.0, 0.3, 0.0, 0.0, -1);
		ShowSyncHudMsg(id, SyncHud2, "~ Predkosc : %.2f^n ~ vMax : %.2f", fPlayerActualSpeed[target],fPlayerMaxSpeed[target]);
                set_hudmessage(255, 255, 51, -0.10, 0.18, 0, 0.0, 0.3, 0.0, 0.0, -1);
		ShowSyncHudMsg(id, SyncHud3, "[Rekord Mapy : %.2f]^n[Rekordzista : %s]", fMapRecord,szChampionName);
                
		return 1;
	}

	new Time[9]

	get_time("%H:%M:%S",Time,8)

	new hp = get_user_health(id); 

	set_hudmessage(255, 255, 51, 0.01, 0.18, 0, 0.0, 0.3, 0.0, 0.0, 2);
	ShowSyncHudMsg(id, SyncHud, "[Klasa : %s]^n[Poziom : %i | 501]^n[EXP : %.1f %%]^n[Monety : %i]^n[HP : %d]", NazwyKlas[gClass[id]], gLvl[id], gfPercent[id],get_user_diamenty(id), hp);
        set_hudmessage(255, 128, 0, -1.00, 0.76, 0, 0.0, 0.3, 0.0, 0.0, -1);
	ShowSyncHudMsg(id, SyncHud2, "~ Predkosc : %.2f^n ~ vMax : %.2f", fPlayerActualSpeed[id],fPlayerMaxSpeed[id]);
        set_hudmessage(255, 255, 51, -0.10, 0.18, 0, 0.0, 0.3, 0.0, 0.0, -1);
	ShowSyncHudMsg(id, SyncHud3, "[Rekord Mapy : %.2f]^n[Rekordzista : %s]",fMapRecord,szChampionName);
	
	return 1;
}

public CmdStart(id, uc_handle)
{
	if(!is_user_alive(id))
		return FMRES_IGNORED;
	
	new button = get_uc(uc_handle, UC_Buttons);
	new oldbutton = get_user_oldbutton(id);
	new flags = get_entity_flags(id);
	
	if(gClass[id] == Ninja || gClass[id] == Jumper || gClass[id] == Mentos)
	{
		if((button & IN_JUMP) && !(flags & FL_ONGROUND) && !(oldbutton & IN_JUMP) && gSkoki[id] > 0)
		{
			gSkoki[id]--;
			new Float:velocity[3];
			entity_get_vector(id,EV_VEC_velocity,velocity);
			velocity[2] = random_float(265.0,285.0);
			entity_set_vector(id,EV_VEC_velocity,velocity);
		}
		else if(flags & FL_ONGROUND)
			gSkoki[id] = 1;
	}

	if(gClass[id] == Rambo || gClass[id] == Ghost)
	{
		if((button & IN_JUMP) && !(flags & FL_ONGROUND) && !(oldbutton & IN_JUMP) && gSkoki[id] > 0)
		{
			gSkoki[id]--;
			new Float:velocity[3];
			entity_get_vector(id,EV_VEC_velocity,velocity);
			velocity[2] = random_float(265.0,285.0);
			entity_set_vector(id,EV_VEC_velocity,velocity);
		}
		else if(flags & FL_ONGROUND)
			gSkoki[id] = 2;
	}
	
	if(gClass[id] == Odrzutowiec)
	{
		if(button & IN_DUCK && flags & FL_ONGROUND && button & IN_JUMP)
		{			
			if( get_gametime() > gfLastModulUse[id] + 5.0)
			{
				gfLastModulUse[id] = get_gametime();
				new Float:velocity[3];
				VelocityByAim(id, 500, velocity);
				velocity[2] = 230.0
				entity_set_vector(id, EV_VEC_velocity, velocity);
			}
		}
	}
	return FMRES_IGNORED;
}

public TakeDamage(vid, infl, idinflictor, kid, Float:damage, damagebits)
{
	if(!kid || !is_user_alive(vid) || !is_user_alive(kid) || SameTeam(vid, kid))
		return HAM_IGNORED;
	
	new health = get_user_health(vid)
	
	if(iObrazenia[kid] > 0.0)
		damage += iObrazenia[kid];
	
	if(get_user_weapon(kid) == CSW_KNIFE && damage > 20.0)
	{	
		if((gClass[kid] == Ninja) && random_num(1, 2) == 1 || (gClass[kid] == Rambo) && random_num(1, 4) == 1 || (gClass[kid] == Nozownik) && random_num(1, 2) == 1 || (gClass[kid] == Smierc))
			damage = float(health);
	}

	if((gClass[kid] == Ghost))
		damage+=10;
	
	SetHamParamFloat(4, damage);
	
	return HAM_IGNORED;
}

public FwdAddToFullPack(es_state, e, ent, host, hostflags, player, set)
{
	if(!is_user_connected(host) || !is_user_connected(ent))
		return FMRES_IGNORED;

	if(gClass[host] == Predator) 
		return FMRES_IGNORED;

	if(pev(ent, pev_rendermode) == kRenderTransAlpha)
		{
		set_es(ent, ES_RenderAmt, 255);
		}
	return FMRES_IGNORED;
}

public WybierzKlase(id)
{
	static title[29];
	formatex(title, sizeof(title) - 1, "\yWybierz klase");
	new menu = menu_create(title, "Handler_WybierzKlase");
	new callback =	menu_makecallback("CallbackKlasy");
	
	new item[32], iNum[3];
	for(new i=1; i <= charsmax(NazwyKlas); i++)
	{
		LoadData(id, i);
		formatex(item, 31, "%s \r[Poziom %i]", NazwyKlas[i], gLvl[id]);
		num_to_str(i, iNum, 2);
		menu_additem(menu, item, iNum, _, callback);
	}
	
	LoadData(id, gClass[id]);
	client_cmd(id, "spk deathrunmod/select");
	
	menu_display(id, menu);
}

public Handler_WybierzKlase(id, menu, item)
{

	client_cmd(id, "spk deathrunmod/select");

	if( item == MENU_EXIT )
	{
		menu_destroy(menu);
		return;
	}
	
	item ++;
	
	if(gClass[id])
	{
		gNewClass[id] = item;
		ColorChat(id, GREEN, "[DR:ODTv3]^x03 Wybierz Klase na nastepnej rundzie.");
		return;
	}
	
	set_user_visibility(id, 255);
	
	gClass[id] = item;
	
	LoadData(id, gClass[id]);
	SpawnPlayer(id);
	
	menu_destroy(menu);
}

public CallbackKlasy(id, menu, item)
{
	item++;
	
	if(item == Ninja && !(get_user_flags(id) & NINJACLASS_FLAG))
		return ITEM_DISABLED;

	if(item == Ghost && !(get_user_flags(id) & GHOSTCLASS_FLAG))
		return ITEM_DISABLED;

	if(item == Smierc && !(get_user_flags(id) & SMIERCCLASS_FLAG))
		return ITEM_DISABLED;
	
	if(item == Rambo && !(get_user_flags(id) & RAMBOCLASS_FLAG))
		return ITEM_DISABLED;
		
	if(item == Mentos && !(get_user_flags(id) & MENTOSCLASS_FLAG))
		return ITEM_DISABLED;
	
	return ITEM_ENABLED;
}


public MenuOpisKlas(id)
{
	static title[29];
	formatex(title, sizeof(title) - 1, "\rOpisy klas");
	new menu = menu_create(title, "MenuOpis");
	
	new item[32];
	for(new i=1; i<=charsmax(NazwyKlas); i++)
	{
		formatex(item, 31, "%s", NazwyKlas[i]);
		menu_additem(menu, item);
	}
	
	menu_display(id, menu);
	client_cmd(id, "spk deathrunmod/select");
}

public MenuOpis(id, menu, item)
{
	client_cmd(id, "spk deathrunmod/select");

	if( item == MENU_EXIT )
	{
		menu_destroy(menu);
		return;
	}
	item++;

	new opis[416+256];
	format(opis, charsmax(opis), "\r~~ Klasa: \y%s^n \r~~ Opis: \y%s \r^n \r~~ Statystyki: \y%s \r", NazwyKlas[item], OpisyKlas[item],OpisyUmiejetnosci[item]);
	show_menu(id, 1023, opis);
	
	menu_destroy(menu);
}

public PrzydzielPunkty(id)
{
	client_cmd(id, "spk deathrunmod/select");

	static title[36];
	formatex(title, sizeof(title) - 1, "\yPrzydziel punkty : \r[%i]", gPoints[id]);
	new menu =		menu_create(title, "MenuPunkty");
	new callback =	menu_makecallback("CallbackPunkty");
	
	new item[60];
	formatex(item, 60, "Zdrowie \r[%i]", gStats[id][Zycie]*1);
	menu_additem(menu, item, "0", _, callback);
	
	formatex(item, 60, "Grawitacja \r[-%.1f %%]", float(gStats[id][Grawitacja])*0.5);
	menu_additem(menu, item, "1", _, callback);
	
	formatex(item, 60, "Obrazenia \r[+%.1f]", gStats[id][Obrazenia]*0.5);
	menu_additem(menu, item, "2", _, callback);
	
	formatex(item, 60, "Szansa na Odrodzenie \r[%i %%]", floatround(gStats[id][Odrodzenie]*0.4));
	menu_additem(menu, item, "3", _, callback);
	
	menu_display(id, menu);
}

public MenuPunkty(id, menu, item)
{
	if( item == MENU_EXIT )
	{
		menu_destroy(menu);
		return;
	}
	if(gPoints[id] <= 0)
		return;
	
	gStats[id][item]++;
	gPoints[id]--;
	SaveData(id);
	
	if(gPoints[id]) PrzydzielPunkty(id);
	
	menu_destroy(menu);
}

public CallbackPunkty(id, menu, item)
{
	if(gStats[id][item] >= 50)
		return ITEM_DISABLED;
	
	return ITEM_ENABLED;
}

public SaveData(id)
{
	if(!g_loaded[id])
		return 1;
	
	new vaultkey[64], vaultdata[256];
	
	format(vaultkey,63,"%s-%i", gName[id], gClass[id]);
	format(vaultdata,255,"%i %i %i %i %i %i", gExp[id], gLvl[id], gStats[id][0], gStats[id][1], gStats[id][2], gStats[id][3]);
	nvault_set(g_vault, vaultkey, vaultdata);
	
	return 1;
}


public LoadData(id, klasa)
{
	new vaultkey[64],vaultdata[256];
	format(vaultkey,63,"%s-%i", gName[id], klasa);
	format(vaultdata,255,"%i %i %i %i %i %i", gExp[id], gLvl[id], gStats[id][0], gStats[id][1], gStats[id][2], gStats[id][3]);
	nvault_get(g_vault, vaultkey, vaultdata, 255);
	
	new szExp[5], szLvl[5], szStats[4][5];
	parse(vaultdata, szExp, 4, szLvl, 4, szStats[0], 4, szStats[1], 4, szStats[2], 4, szStats[3], 4);
	
	gExp[id] = str_to_num(szExp);
	gLvl[id] = str_to_num(szLvl);
	gStats[id][0] = str_to_num(szStats[0]);
	gStats[id][1] = str_to_num(szStats[1]);
	gStats[id][2] = str_to_num(szStats[2]);
	gStats[id][3] = str_to_num(szStats[3]);
	
	gfPercent[id] = get_percent(id)
	
	g_loaded[id] = true;
	gPoints[id] = 2*gLvl[id] - gStats[id][0] - gStats[id][1] - gStats[id][2] - gStats[id][3];
	
	return 1;
}

public EventRoundEnd(id, kid)
{		
	for(new id=1; id<=MAX; id++)
	{
		if(is_user_alive(id) && !is_user_bot(id))
		{
			new XP = 0;
			
			switch(get_user_team(id))
			{
				case 1: XP = 80;
				case 2: XP = 20;
				default: continue;
			}
			
			gExp[id] += XP;
			Check(id);
			ColorChat(id, GREEN, "[DR:ODTv3]^x01 Dostales^x03 %d^x01 doswiadczenia za przezycie rundy!", XP);
		}
	}
   	return PLUGIN_CONTINUE;
}

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 
}

public Resetuj(id)
{
	for(new i=0; i<4; i++)
		gStats[id][i] = 0;
	
	gPoints[id] = 2*gLvl[id];
	ColorChat(id, GREEN, "[DR:ODTv3]^x03 Zresetowales Punkty !");
}

stock SameTeam(id, id2)
	return (get_user_team(id) == get_user_team(id2))

stock set_user_visibility(entity, amount)
{
	new Float:RenderColor[3];
	RenderColor[0] = 0.0, RenderColor[1] = 0.0, RenderColor[2] = 0.0;
	
	if(amount == 255) {
		set_pev(entity, pev_renderfx, kRenderFxNone);
		set_pev(entity, pev_rendercolor, RenderColor);
		set_pev(entity, pev_rendermode, kRenderNormal);
		set_pev(entity, pev_renderamt, 255.0);
	}
	else {
		set_pev(entity, pev_renderfx, kRenderFxGlowShell);
		set_pev(entity, pev_rendercolor, RenderColor);
		set_pev(entity, pev_rendermode, kRenderTransColor);
		set_pev(entity, pev_renderamt, float(amount));
	}
	
	return 1;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/


Użytkownik misiakool12 edytował ten post 07.07.2018 09:55

  • +
  • -
  • 0

#4 Rivit

    Godlike

  • Support Team

Reputacja: 1 319
Godlike

  • Postów:4 380
Offline

Napisano 07.07.2018 10:24   Najlepsza odpowiedź

Zamien:

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;	
}

na:

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] > fMapRecord)
		SetNewRecord(fPlayerActualSpeed[id], szPlayerName[id])

	if (fPlayerActualSpeed[id] > fPlayerMaxSpeed[id])
		fPlayerMaxSpeed[id] = fPlayerActualSpeed[id]

	
	return FMRES_IGNORED;	
}

skompiluj I sprawdz. Na przyszłość dawaj kod jako załącznik, wtedy mógłbym sobie to sprawdzic czy kompiluje sie, a tak to nie chce mi sie kopiowac tego


  • +
  • -
  • 0

#5 Automatyk

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 21
Życzliwy

  • Postów:195
  • Steam:steam
  • Lokalizacja:Kraków
Offline

Napisano 07.07.2018 10:51

Dziękóweczka - działa :)


  • +
  • -
  • 0

#6 Automatyk

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 21
Życzliwy

  • Postów:195
  • Steam:steam
  • Lokalizacja:Kraków
Offline

Napisano 07.07.2018 10:53

Jedyny problem to to iż te rekordy się nie zapisują :)


Użytkownik misiakool12 edytował ten post 07.07.2018 10:58

  • +
  • -
  • 0

#7 Rivit

    Godlike

  • Support Team

Reputacja: 1 319
Godlike

  • Postów:4 380
Offline

Napisano 07.07.2018 11:02

Nom, system zapisu pozostawia trochę do życzenia. Daj w załączniku to moze gdzie poprawie wieczorem jak będę miec czas


  • +
  • -
  • 0

#8 Automatyk

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 21
Życzliwy

  • Postów:195
  • Steam:steam
  • Lokalizacja:Kraków
Offline

Napisano 07.07.2018 11:16

Dobrze, załączam. Z góry dziękuje :)

Załączone pliki


Użytkownik misiakool12 edytował ten post 07.07.2018 11:17

  • +
  • -
  • 0

#9 Rivit

    Godlike

  • Support Team

Reputacja: 1 319
Godlike

  • Postów:4 380
Offline

Napisano 07.07.2018 16:39

dałeś mi .sma bez tych zmian co ci powiedziałem w tym temacie

 

zrobiłem, nie wiem czy bedzie smigac nie testowalem musisz sprawdzic sam

Załączone pliki


  • +
  • -
  • 0

#10 Automatyk

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 21
Życzliwy

  • Postów:195
  • Steam:steam
  • Lokalizacja:Kraków
Offline

Napisano 07.07.2018 17:36

Niestety nadal nie zapisują się :(


  • +
  • -
  • 0

#11 Rivit

    Godlike

  • Support Team

Reputacja: 1 319
Godlike

  • Postów:4 380
Offline

Napisano 08.07.2018 00:02

Info info!

 

Zobacz czy plik .vault sie tworzy i jakie dane zawiera. Więcej szczegółów trzeba


  • +
  • -
  • 0

#12 Automatyk

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 21
Życzliwy

  • Postów:195
  • Steam:steam
  • Lokalizacja:Kraków
Offline

Napisano 08.07.2018 07:55

Doszłem już do ładu i składu, dzięki za zainteresowanie ;)
  • +
  • -
  • 0




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych