Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

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

Problem z ilością expa.


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 SadistiC

    Pomocny

  • Zbanowany

Reputacja: 8
Nowy

  • Postów:57
  • GG:
  • Imię:Bartłomiej
  • Lokalizacja:Czersk
Offline

Napisano 13.11.2011 22:29

Witam, mam problem z ExpModem, którego jeszcze tworzę, ale już wkradł się jakiś błąd.
A mianowicie mam wpisane, że po zabiciu gracza ma dawać 10 expa a jednak daje 20 expa.
No i nie działa HeadSplash, może źle dodałem... Proszę o pomoc...
Kod SMA:
//Moduły:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <amxmisc>
#include <nvault>
#include <colorchat>
#include <fakemeta>
//HeadSplash:
#define MINIMUM_FALL_SPEED 10
#define MAXIMUM_DAMAGE_FROM_JUMP 70.0
#define DAMAGE 60.0
#define DELAY 0.02
//Informacje:
#define PLUGIN "ExpMod"
#define VERSION "1.0"
#define AUTHOR "Freeway."
#define MAXLEVEL 10
#define prefix "ExpMod"
//Tabela Expa:
new const Levels[10] = {
100, // Level 1
250, // Level 2
500, // Level 3
1000, // Level 4
2000, // Level 5
4000, // Level 6
8000, // Level 7
16000, // Level 8
32000, // Level 9
64000 // Level 10
};
//Zmienne Globalne:
new g_Vault, exp_kill, exp_hs, exp_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()
{
//Rejestracja Pluginu:
register_plugin("ExpMod", "1.0", "Freeway.")

//Cvary:
register_cvar("exp_kill","10")
register_cvar("exp_hs","5")
register_cvar("exp_headsplash","10")
register_cvar("amx_headsplash","1");

//Zmienne Globalne:
exp_kill = get_cvar_num("exp_kill")
exp_hs = get_cvar_num("exp_hs")
exp_headsplash = get_cvar_num("exp_headsplash")
g_Vault = nvault_open("exp_mod");

//Forwardy:
register_forward(FM_PlayerPreThink, "hud_prethink");
register_forward(FM_Touch, "forward_touch");

//Eventy:
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] += exp_kill;

if(headshot)
{
PlayerXP[attacker] += exp_hs;
ColorChat(attacker,GREEN,"[%s]^x01 Dostales ^x04%d^x01 expa za zabicie wroga oraz ^x04%d^x01 expa za headshota!", prefix, exp_kill, exp_hs);
}
else
{
ColorChat(attacker,GREEN,"[%s]^x01 Dostales ^x04%d^x01 expa za zabicie wroga!", prefix, exp_kill);
}
}
}
while(PlayerXP[attacker] >= Levels[PlayerLevel[attacker]])
{
PlayerLevel[attacker] += 1;
SkillPoints[attacker] += 1;
ColorChat(attacker,GREEN,"[%s]^x01 Gratulacje, wbiles^x03 %d^x01 poziom, posiadasz ^x03 %d^x01 punktow do rozdania!", prefix, PlayerLevel[attacker], SkillPoints[attacker]);
}
}
public hud_prethink(id)
{
if(PlayerLevel[id]>=MAXLEVEL)
{
new text[512]
format(text,511,"Poziom: %d Doswiadczenie: %d", PlayerLevel[id], PlayerXP[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,"Poziom: %d Doswiadczenie: %d/%d (+%d)", PlayerLevel[id], PlayerXP[id], Levels[PlayerLevel[id]], Levels[PlayerLevel[id]]-PlayerXP[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]+=exp_headsplash;
ColorChat(pwnzor,GREEN,"[%s]^x01 Dostales ^x04%d^x01 expa za zabicie wroga headsplashem! ",prefix, exp_headsplash);

while(PlayerXP[pwnzor] >= Levels[PlayerLevel[pwnzor]])
{
PlayerLevel[pwnzor] += 1;
SkillPoints[pwnzor] += 1;
ColorChat(pwnzor,GREEN,"[%s]^x01 Gratulacje, wbiles^x03 %d^x01 poziom, posiadasz ^x03%d^x01 punktow do rozdania!", 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));
}
}


Temat do zamknięcia!

Użytkownik SadistiC edytował ten post 13.11.2011 15:55





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

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