←  Pytania

AMXX.pl: Support AMX Mod X i SourceMod

»

VIP pugin pytanko

Zablokowany

Karnerrr - zdjęcie Karnerrr 17.03.2011

WITAM. Napisałem sobie ostatnio plugin (bo mi nikt nie chcial pomoc), nazwalem go Vip_zzz (od mojego nicku w cs) ale niewazne... Chce sie was zapytac (poniewaz jest to moj pierwszy plugin ktory pisalem praktycznie od podstaw) czy ten plugin pujdxie... czyli czy bedzie dzialal tak:
Gracz z flaga "t" dostanie: na start deagle, all granaty oraz kamizelke +1000kasy... i czy (z tym sie najbardziej meczylem) za zabicie gracza dostanie normalnie (bez hs) +15hp a za zabicie z hs +30hp... ostawiłem sobie tez CVERY na zabicia oraz na max hp podczas doladowaniu hp za zabicia...
Z gory dzięki, a jezeli zobaczyliscie cos xle lub poprostu bezsensu w tym pliku to poprawcie, ja dam +'ika... Moze go opublikuje...
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fun>

new health_add
new health_hs_add
new health_max

new gmsgScreenFade, g_maxplayers

public plugin_init() {
register_plugin("Vip", "1.0", "ZzZ");
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);

health_add = register_cvar("amx_vip_hp", "15")
health_hs_add = register_cvar("amx_vip_hp_hs", "30")
health_max = register_cvar("amx_vip_max_hp", "100")

register_event("DeathMsg", "eDeathMsg", "a")

gmsgScreenFade = get_user_msgid("ScreenFade")
g_maxplayers = get_maxplayers()
}

public eDeathMsg(id) {

if (get_user_flags(id) & ADMIN_LEVEL_H) {

new KillerId = read_data(1)
new VictimId = read_data(2)
if(!KillerId || KillerId > g_maxplayers)
return

if(KillerId == VictimId || get_user_team(KillerId) == get_user_team(VictimId))
return

new KillerHealth = get_user_health(KillerId)
new NewKillerHealth = min( ( read_data(3) ?
get_pcvar_num(health_hs_add) :
get_pcvar_num(health_add) ) +
KillerHealth ,

get_pcvar_num(health_max) )

set_user_health(KillerId, NewKillerHealth)


set_hudmessage(0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1)
show_hudmessage(KillerId, "Healed +%d hp", NewKillerHealth - KillerHealth)


message_begin(MSG_ONE, gmsgScreenFade, _, KillerId)
write_short(1<<10)
write_short(1<<10)
write_short(0x0000)
write_byte(0)
write_byte(0)
write_byte(200)
write_byte(75)
message_end()
}

}
public fwHamPlayerSpawnPost(id){

if (get_user_flags(id) & ADMIN_LEVEL_H) {

give_item(id, "weapon_hegrenade");
give_item(id, "weapon_smokegrenade");
give_item(id, "weapon_flashbang");
give_item(id, "item_assaultsuit");
give_item(id, "weapon_deagle");
cs_set_user_bpammo(id, CSW_DEAGLE, 35);

new kasa = cs_get_user_money(id);
cs_set_user_money(id, kasa + 1000);
}
}
Odpowiedz

  • +
  • -
Lunatic - zdjęcie Lunatic 17.03.2011

A czemu nie przetestujesz na serwerze?
Użytkownik Lunatic edytował ten post 18.03.2011 16:58
Odpowiedz

Karnerrr - zdjęcie Karnerrr 17.03.2011

na razie malo osob i nie ma kogo deadac ;) // hmm...
Użytkownik Karnerrr edytował ten post 17.03.2011 19:30
Odpowiedz

  • +
  • -
Lunatic - zdjęcie Lunatic 18.03.2011

Ale moim zdaniem powinno być dobrze oprócz zabicia chyba.
Moim zdaniem powinno być tak.

public eDeathMsg() {
        
        new KillerId = read_data(1)
        new VictimId = read_data(2)
        if (!get_user_flags(KillerId) & ADMIN_LEVEL_H)   //nie wiem czy tu dobrze negacje zrobiłem
                return;

        if(!KillerId || KillerId > g_maxplayers)
                return

        if(KillerId == VictimId || get_user_team(KillerId) == get_user_team(VictimId))
                return

        new KillerHealth = get_user_health(KillerId)
        new NewKillerHealth = min(   ( read_data(3) ? 
                                        get_pcvar_num(health_hs_add) : 
                                        get_pcvar_num(health_add) ) + 
                                        KillerHealth ,

                                        get_pcvar_num(health_max)   )

        set_user_health(KillerId, NewKillerHealth)


        set_hudmessage(0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1)
        show_hudmessage(KillerId, "Healed +%d hp", NewKillerHealth - KillerHealth)


        message_begin(MSG_ONE, gmsgScreenFade, _, KillerId)
        write_short(1<<10)
        write_short(1<<10)
        write_short(0x0000)
        write_byte(0)
        write_byte(0)
        write_byte(200)
        write_byte(75)
        message_end()
}

Odpowiedz
Zablokowany