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

Nowy Mod


  • Zamknięty Temat jest zamknięty
Brak odpowiedzi do tego tematu

#1 Tomi

    Wszechwidzący

  • Zbanowany

Reputacja: 8
Nowy

  • Postów:271
Offline

Napisano 26.08.2010 22:32

Witam Otóż znalazłem Silnik XP MOD
/*--------------------- /
/ Silnik XP Mod /
/----------------------*/

#include <amxmodx>
#include <cstrike>
#include <fun>
#include <amxmisc>
#include <nvault>
#include <ColorChat>
#include <fakemeta>

#define MAXLEVEL 10
#define prefix "XP"


/*--------===== HEAD SPLASH DEFINES =====-------*/

#define MINIMUM_FALL_SPEED 300
#define MAXIMUM_DAMAGE_FROM_JUMP 70.0
#define DAMAGE 5.0
#define DELAY 0.03


new const LEVELS[10] = {
// Level
500, // 1
3000, // 2
8000, // 3
15000, // 4
19000, // 5
25000, // 6
31000, // 7
38000, // 8
41000, // 9
50000 // 10
};

new const RANGI[10][] = {
"Ranga 1",
"Ranga 2",
"Ranga 3",
"Ranga 4",
"Ranga 5",
"Ranga 6",
"Ranga 7",
"Ranga 8",
"Ranga 9",
"Ranga 10"
};

/*--------===== ZMIENNE GLOBALNE =====-------*/
new g_Vault,xp_kill,xp_hs,xp_headsplash,SkillPoints[33],PlayerXP[33],PlayerLevel[33];

new Float:falling_speed[33];
new Float:damage_after[33][33];
new amx_headsplash;
new sprite_blood;
new sprite_bloodspray;

public plugin_init()
{
/*--------===== REJERSTRACJA PLUGINU =====-------*/

register_plugin("SILNIK XP MOD", "1.0", "xmS")



/*--------===== CVARY =====-------*/

register_cvar("xp_kill", "25")
register_cvar("xp_hs","10")
register_cvar("xp_headsplash","35")


amx_headsplash = register_cvar("amx_headsplash", "1");

/*--------===== ZMIENNE GLOBALNE =====-------*/

xp_kill = get_cvar_num("xp_kill")
xp_hs = get_cvar_num("xp_hs")
xp_headsplash = get_cvar_num("xp_headsplash")
g_Vault = nvault_open("xms_xp_mod");

/*--------===== FORWARDS =====-------*/

register_forward(FM_PlayerPreThink, "hud_prethink");
register_forward(FM_Touch, "forward_touch");


/*--------===== EVENTS =====-------*/

register_event("DeathMsg", "eDeath", "a");
}

public eDeath() {
new attacker = read_data( 1 );
new ofiara = read_data( 2 );
new headshot = read_data( 3 );

if(ofiara != attacker && attacker != 0)
{
if(get_user_team(attacker) != get_user_team(ofiara))
{
PlayerXP[attacker] += xp_kill;

if(headshot)
{
PlayerXP[attacker] += xp_hs;
ColorChat(attacker,GREEN,"[%s]^x01: Dostales ^x04%d^x01 xp za zabicie wroga oraz bonus^x04 %d^x01 xp za headshot'a !",prefix,xp_kill,xp_hs);
}
else
{
ColorChat(attacker,GREEN,"[%s]^x01: Dostales ^x04%d^x01 xp za zabicie wroga",prefix,xp_kill);
}
}
}
while(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])
{
PlayerLevel[attacker] += 1;
SkillPoints[attacker] += 1;
ColorChat(attacker,GREEN,"[%s]^x01: Gratuluje, wbiles poziom ! Twoj Poziom to :^x03 %d^x01, posiadasz :^x03 %d^x01 punktow skilli.",prefix,PlayerLevel[attacker],SkillPoints[attacker]);
}
}

public hud_prethink(id)
{
if(PlayerLevel[id]>=MAXLEVEL)
{
new text[512]
format(text,511,"Level: %d Exp: %d Ranga: %s",PlayerLevel[id],PlayerXP[id],RANGI[PlayerLevel[id]])
message_begin(MSG_ONE,get_user_msgid("StatusText"),{0,0,0}, id)
write_byte(0)
write_string(text)
message_end()
}
else
{
new text[512]
format(text,511,"Level: %d Exp: %d/%d (+%d) Ranga: %s", PlayerLevel[id], PlayerXP[id], LEVELS[PlayerLevel[id]],LEVELS[PlayerLevel[id]]-PlayerXP[id],RANGI[PlayerLevel[id]])
message_begin(MSG_ONE,get_user_msgid("StatusText"),{0,0,0}, id)
write_byte(0)
write_string(text)
message_end()
}
}

public client_connect(id)
LoadXp(id);

public client_disconnect(id)
SaveXp(id);

public SaveXp(id) {
new AuthID[35];
get_user_authid(id, AuthID, 34);

new vaultkey[64], vaultdata[256];
format(vaultkey, 63, "%s-Mod", AuthID);
format(vaultdata, 255, "%i#%i#%i#", PlayerXP[id], PlayerLevel[id],SkillPoints[id]);
nvault_set(g_Vault, vaultkey, vaultdata);
return PLUGIN_CONTINUE;
}

public LoadXp(id) {
new AuthID[35];
get_user_authid(id,AuthID,34);

new vaultkey[64], vaultdata[256];
format(vaultkey, 63, "%s-Mod", AuthID);
format(vaultdata, 255, "%i#%i#%i#", PlayerXP[id], PlayerLevel[id],SkillPoints[id]);
nvault_get(g_Vault, vaultkey, vaultdata,255);

replace_all(vaultdata, 255, "#", " ");

new playerxp[32], playerlevel[32], skillpoints[32];

parse(vaultdata, playerxp, 31, playerlevel, 31, skillpoints, 31);

PlayerXP[id] = str_to_num(playerxp);
PlayerLevel[id] = str_to_num(playerlevel);
SkillPoints[id] = str_to_num(skillpoints);
return PLUGIN_CONTINUE;
}

public forward_touch(toucher, touched)
{

if(!is_user_alive(toucher) || !is_user_alive(touched))
return;

if(!get_pcvar_num(amx_headsplash))
return;

if(falling_speed[touched])
return;

if(get_user_team(toucher) == get_user_team(touched) && !get_cvar_num("mp_friendlyfire"))
return;

new touched_origin[3], toucher_origin[3];
get_user_origin(touched, touched_origin);
get_user_origin(toucher, toucher_origin);

new Float:toucher_minsize[3], Float:touched_minsize[3];
pev(toucher,pev_mins,toucher_minsize);
pev(touched,pev_mins,touched_minsize);

if(touched_minsize[2] != -18.0)
{
if(!(toucher_origin[2] == touched_origin[2]+72 && toucher_minsize[2] != -18.0) && !(toucher_origin[2] == touched_origin[2]+54 && toucher_minsize[2] == -18.0))
{
return;
}
}
else
{
if(!(toucher_origin[2] == touched_origin[2]+68 && toucher_minsize[2] != -18.0) && !(toucher_origin[2] == touched_origin[2]+50 && toucher_minsize[2] == -18.0))
{
return;
}
}

if(falling_speed[toucher] >= MINIMUM_FALL_SPEED)
{
new Float:damage = ((falling_speed[toucher] - MINIMUM_FALL_SPEED + 30) * (falling_speed[toucher] - MINIMUM_FALL_SPEED + 30)) / 1300;
if(damage > MAXIMUM_DAMAGE_FROM_JUMP)
damage = MAXIMUM_DAMAGE_FROM_JUMP;
damage_player(touched, toucher, damage);
damage_after[toucher][touched] = 0.0;
}
if(is_user_alive(touched) && damage_after[toucher][touched] <= get_gametime())
{
damage_after[toucher][touched] = get_gametime() + DELAY;
damage_player(touched, toucher, DAMAGE);
}
}

public damage_player(pwned, pwnzor, Float:damage)
{
new health = get_user_health(pwned);
if(get_user_team(pwned) == get_user_team(pwnzor))
damage /= 1.4;
new CsArmorType:armortype;
cs_get_user_armor(pwned, armortype);
if(armortype == CS_ARMOR_VESTHELM)
damage *= 0.7;
if(health > damage)
{
new pwned_origin[3];
get_user_origin(pwned, pwned_origin);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_BLOODSPRITE);
write_coord(pwned_origin[0]+8);
write_coord(pwned_origin[1]);
write_coord(pwned_origin[2]+26);
write_short(sprite_bloodspray);
write_short(sprite_blood);
write_byte(248);
write_byte(4);
message_end();

new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "trigger_hurt"));
if(!ent)
return;
new value[16];
float_to_str(damage * 2, value, sizeof value - 1);
set_kvd(0, KV_ClassName, "trigger_hurt");
set_kvd(0, KV_KeyName, "dmg");
set_kvd(0, KV_Value, value);
set_kvd(0, KV_fHandled, 0);
dllfunc(DLLFunc_KeyValue, ent, 0);
num_to_str(DMG_GENERIC, value, sizeof value - 1);
set_kvd(0, KV_ClassName, "trigger_hurt");
set_kvd(0, KV_KeyName, "damagetype");
set_kvd(0, KV_Value, value);
set_kvd(0, KV_fHandled, 0);
dllfunc(DLLFunc_KeyValue, ent, 0);
set_kvd(0, KV_ClassName, "trigger_hurt");
set_kvd(0, KV_KeyName, "origin");
set_kvd(0, KV_Value, "8192 8192 8192");
set_kvd(0, KV_fHandled, 0);
dllfunc(DLLFunc_KeyValue, ent, 0);
dllfunc(DLLFunc_Spawn, ent);
set_pev(ent, pev_classname, "head_splash");
dllfunc(DLLFunc_Touch, ent, pwned);
engfunc(EngFunc_RemoveEntity, ent);
}
else
{
new pwned_origin[3];
get_user_origin(pwned, pwned_origin);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_BLOODSPRITE);
write_coord(pwned_origin[0]+8);
write_coord(pwned_origin[1]);
write_coord(pwned_origin[2]+26);
write_short(sprite_bloodspray);
write_short(sprite_blood);
write_byte(248);
write_byte(12);
message_end();

set_pev(pwned, pev_frags, float(get_user_frags(pwned) + 1));
user_silentkill(pwned);
make_deathmsg(pwnzor, pwned, 1, "his/her feet :)");
if(get_user_team(pwnzor) != get_user_team(pwned))
{
set_pev(pwnzor, pev_frags, float(get_user_frags(pwnzor) + 1));
cs_set_user_money(pwnzor, cs_get_user_money(pwnzor) + 300);
PlayerXP[pwnzor]+=xp_headsplash;
ColorChat(pwnzor,GREEN,"[%s]^x01: Zabiles headsplashem , dostales %d xp.",prefix,xp_headsplash);

while(PlayerXP[pwnzor] >= LEVELS[PlayerLevel[pwnzor]])
{
client_cmd(pwnzor,"stopsound;wait;mp3 play sound/misc/xmsexpmod/lvlup.mp3")
PlayerLevel[pwnzor] += 1;
SkillPoints[pwnzor] += 1;
ColorChat(pwnzor,GREEN,"[%s]^x01: Level UP ! Twoj Poziom =^x03 %d^x01 Skill Points =^x03 %d",prefix,PlayerLevel[pwnzor],SkillPoints[pwnzor]);
}


}
else
{
set_pev(pwnzor, pev_frags, float(get_user_frags(pwnzor) - 1));
cs_set_user_money(pwnzor, cs_get_user_money(pwnzor) - 300);
}

message_begin(MSG_ALL, get_user_msgid("ScoreInfo"));
write_byte(pwnzor);
write_short(get_user_frags(pwnzor));
write_short(cs_get_user_deaths(pwnzor));
write_short(0);
write_short(get_user_team(pwnzor));
message_end();

message_begin(MSG_ALL, get_user_msgid("ScoreInfo"));
write_byte(pwned);
write_short(get_user_frags(pwned));
write_short(cs_get_user_deaths(pwned));
write_short(0);
write_short(get_user_team(pwned));
message_end();
set_pev(pwned, pev_frags, float(get_user_frags(pwned) - 1));
}
}

otóż chciałbym do tego dodać że SkillPoints można wymieniać na np Dodatkowe Hp :). coś jak w diablo :)




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

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