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

GasNades + maska gazowa - problem z kompilacją


  • Zamknięty Temat jest zamknięty
29 odpowiedzi w tym temacie

#1 PEREF

    Profesjonalista

  • Zbanowany

Reputacja: 27
Życzliwy

  • Postów:201
  • GG:
Offline

Napisano 14.08.2008 15:05

Salomon, kiedyś edytował mi ten plugin, aby była opcja z maską gazową, niestety nie mogę skompilować, wyskakuję taki błąd:

/home/groups/amxmodx/tmp3/phpgRTrbP.sma(118) : error 017: undefined symbol "amx_gas_mascost"
/home/groups/amxmodx/tmp3/phpgRTrbP.sma(359) : warning 217: loose indentation

1 Error.
Could not locate output file /home/groups/amxmodx/public_html/websc3/phpgRTrbP.amx (compile failed).


*sma - http://www.ampaste.net/m5bf19247

Pozdrawiam.

#2 Miczu

    Godlike

  • Przyjaciel

Reputacja: 646
Wszechmogący

  • Postów:2862
Offline

Napisano 14.08.2008 15:17

dodaj "new amx_gas_maskcost" gdzies pod #include i a warningiem sie nie przejmuj bo tylko za duzo spacji tam jest.
  • +
  • -
  • 0

#3 PEREF

    Profesjonalista

  • Autor tematu
  • Zbanowany

Reputacja: 27
Życzliwy

  • Postów:201
  • GG:
Offline

Napisano 14.08.2008 18:29

Ok, była w jednym miejscu literówka...

Ale jest jeszcze jeden BUG. Plugin jest tak zrobiony, gdy gracz wejdzie smoke i straci HP to potem gdy z niego wyjdzie z powrotem mu się życie odnawia. Kiedy kupię maskę gazową działa to podobnie (ale nie powinno), wejdę w smoke nie tracę HP, ale gdy z niego wyjdę HP mi się zwiększa przez kilka sekund co 2 HP i mam czasem 130 HP ;/. Da radę to naprawić?

#4 Miczu

    Godlike

  • Przyjaciel

Reputacja: 646
Wszechmogący

  • Postów:2862
Offline

Napisano 14.08.2008 18:49

zmien:
if(get_pcvar_num(amx_gas_restore))
        {
            damage_took[id] += damage
        }
na:
if(get_pcvar_num(amx_gas_restore)&&!has_mask[id])
        {
            damage_took[id] += damage
        }

Tak kolo 300 liniki. Mozna by to ladniej zrobic, ale bym w tedy musial ci wyslac caly kod ;-)
  • +
  • -
  • 0

#5 PEREF

    Profesjonalista

  • Autor tematu
  • Zbanowany

Reputacja: 27
Życzliwy

  • Postów:201
  • GG:
Offline

Napisano 14.08.2008 19:24

Działa, dzięki ;)

#6 JaCo

    Zaawansowany

  • Użytkownik

Reputacja: 4
Nowy

  • Postów:79
  • GG:
  • Lokalizacja:195.114.0.71:27088
Offline

Napisano 14.08.2008 23:58

A ja mam taki kod

/* AMX Mod X Plugin
*
* (c) Copyright 2007, ConnorMcLeod
* This file is provided as is (no warranties).
*
*/
 
/* http://forums.alliedmods.net/showthread.php?t=60947
*
* Changelog
* v1.6
* now when a player dies, nade's owner gets a frag
* don't make death msgs if another plugin block those messages
* v1.5b
* -little optimization ( get_gametime was used more than 1 time in few functions )
* -error fix in entity think forward, now check first if entity is valid
* -added a public cvar
* -little changes/cleanup
* v1.5a
* -amx_gas_restore now works according to cvars amx_gascheck and amx_gasdmg
* v1.5
* -added cvar amx_gas_restore that allow to restore players HP
* v1.4b
* -fixed plugin didn't work correctly with mp_friendlyfire
* -little optimization
* v1.4
* -Almost completly rewrote the plugin
*/

#include <amxmodx>
#include <cstrike>
#include <fakemeta>

#define VERSION    "1.6"

#if AMXX_VERSION_NUM < 180
    #define charsmax(%1)    sizeof(%1) - 1
#endif

#define OFFSET_CSDEATHS        444
#define OFFSET_TEAM            114

#define GASP_SOUND1         "player/gasp1.wav"
#define GASP_SOUND2         "player/gasp2.wav"

#define SMOKEGRENADE_SOUND     "weapons/sg_explode.wav"
#define GAS_CLASSNAME         "gasgrenade"
#define GASNADE_LIFE         25.0

new amx_gas_maskcost

new amx_gasnades, amx_gasdmg, amx_gascheck, amx_gasradius, amx_smokegasp, amx_gasobeyFF, amx_gas_restore, amx_gas_maskcost, amx_gas_maskon
new mp_friendlyfire

new gmsgDamage, gmsgDeathMsg, gmsgScoreInfo

new Float:player_affected_time[33]
new Float:player_restored_time[33]
new Float:damage_took[33]
new bool:has_mask[33]

public plugin_precache()
{
    engfunc(EngFunc_PrecacheSound, GASP_SOUND1)
    engfunc(EngFunc_PrecacheSound, GASP_SOUND2)
}

public plugin_init()
{
    register_plugin("Gas Grenades", VERSION, "ConnorMcLeod") //  RichoDemus/AssKicR/T(+)rget for previous versions

    register_event("HLTV", "eNewRound", "a", "1=0", "2=0")

    register_forward(FM_EmitSound, "fwdEmitSound")
    register_forward(FM_Touch, "fwdTouch")
    register_forward(FM_Think, "fwdThink")
    register_forward(FM_PlayerPreThink, "fwdPlayerPreThink")
    register_event("DeathMsg", "player_death", "a")
    register_clcmd("say /maska", "mask")

    register_cvar("gasnade", VERSION, FCVAR_SERVER)

    amx_gasnades = register_cvar("amx_gasnades",       "1")         // 0/1 Disable/Enable the whole plugin

    amx_gasdmg =      register_cvar("amx_gasdmg",      "2")         // How much damage the player takes every check cycle, 0 to disable damage (see amx_gascheck)
    amx_gascheck =    register_cvar("amx_gascheck",    "2")         // Check period in seconds
    amx_gasradius =   register_cvar("amx_gasradius",   "180")         // Smoke Radius (best is 170 - 230)
    amx_smokegasp =   register_cvar("amx_smokegasp",   "1")         // 0/1 Makes players gasp/cough in smoke
    amx_gasobeyFF =   register_cvar("amx_gasobeyFF",   "0")         // 0/1 Makes plugin act or not as cvar mp_friendlyfire
    amx_gas_restore = register_cvar("amx_gas_restore", "1")         // 0/1 Restore or not HP (if amx_gasdmg > 0)
    amx_gas_maskon = register_cvar("amx_gas_maskon", "1")
    amx_gas_maskcost = register_cvar("amx_gas_maskcost", "500")
}

public plugin_cfg()
{
    mp_friendlyfire = get_cvar_pointer("mp_friendlyfire")

    gmsgDamage = get_user_msgid("Damage")
    gmsgDeathMsg = get_user_msgid("DeathMsg")
    gmsgScoreInfo = get_user_msgid("ScoreInfo")
}

public mask(id)
{
 if(!is_user_alive(id) && get_pcvar_num(amx_gas_maskon))
  {
   client_print(id, print_chat, "nie zyjesz")
  }
 if(has_mask[id])
  {
   client_print(id, print_chat, "masz maske")
  }
 if(cs_get_user_money(id) < get_pcvar_num(amx_gas_maskcost) && get_pcvar_num(amx_gas_maskon) && !has_mask[id])
  {
   client_print(id, print_chat, "nie masz kasy")
  }
 if(is_user_alive(id) && get_pcvar_num(amx_gas_maskon) && cs_get_user_money(id) >= get_pcvar_num(amx_gas_maskcost) && !has_mask[id])
  {
   cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(amx_gas_maskcost))
   client_print(id, print_chat, "kupiles maske")
   has_mask[id] = true
  }
}

public player_death()
{
 new id = read_data(2)

 has_mask[id] = false
}

public client_connect(id) {
    new Float:global_Time
    global_get(glb_time, global_Time)
    player_affected_time[id] = global_Time
    player_restored_time[id] = global_Time
    damage_took[id] = 0.0
}

public eNewRound() {
    new ent = -1
    while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", GAS_CLASSNAME)) > 0) {
        engfunc(EngFunc_RemoveEntity, ent)
    }
    new Float:global_Time
    global_get(glb_time, global_Time)
    new players[32], inum, player
    get_players(players, inum)
    for(new i; i<inum; i++) {
        player = players[i]
        player_affected_time[player] = global_Time
        player_restored_time[player] = global_Time
        damage_took[player] = 0.0
    }
}

public fwdPlayerPreThink(id) {
    if(!get_pcvar_num(amx_gasnades))
        return FMRES_IGNORED

    static Float:gasdmg
    gasdmg = get_pcvar_float(amx_gasdmg)
    if( !gasdmg && !get_pcvar_num(amx_gas_restore) )
        return FMRES_IGNORED
   
    if( !is_user_alive(id) || !is_user_connected(id))
        return FMRES_IGNORED
   
    // check if player has HPs to be set back
    static Float:damage_to_restore
    damage_to_restore = damage_took[id]
    if( damage_to_restore < 1.0 )
        return FMRES_IGNORED

    static Float:global_Time
    global_get(glb_time, global_Time)

    static Float:cycle
    cycle = get_pcvar_float(amx_gascheck)

    // should tell if player is still in smoke
    if( global_Time - player_affected_time[id] < cycle + 0.1 )
        return FMRES_IGNORED
   
    if( global_Time - player_restored_time[id] < cycle )
        return FMRES_IGNORED
   
    static Float:userHealth
    pev(id, pev_health, userHealth)
   
    if( damage_to_restore >= gasdmg) {
        set_pev(id, pev_health, userHealth + gasdmg)
        damage_took[id] -= gasdmg
       
    }
    else if( damage_to_restore > 0.0 ) { //shouldn't happen unless an admin change some cvars during a round
        set_pev(id, pev_health, userHealth + damage_to_restore)
        damage_took[id] -= damage_to_restore
    }
   
    player_restored_time[id] = global_Time

    return FMRES_HANDLED
}

public fwdEmitSound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch)
{
    if(!get_pcvar_num(amx_gasnades))
        return FMRES_IGNORED

    if(!equali(sample, SMOKEGRENADE_SOUND))
        return FMRES_IGNORED
   
    static owner
    owner = pev(entity, pev_owner)
   
    static Float:origin[3]
    pev(entity, pev_origin, origin)
   
    static ent
    ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
    set_pev(ent, pev_classname, GAS_CLASSNAME)
    set_pev(ent,pev_solid,SOLID_TRIGGER)

    static Float:radius, Float:min_rad[3], Float:max_rad[3]
    radius = get_pcvar_float(amx_gasradius)
    min_rad[0] = -radius
    min_rad[1] = -radius
    min_rad[2] = -radius
    max_rad[0] = radius
    max_rad[1] = radius
    max_rad[2] = radius

    engfunc(EngFunc_SetSize, ent, min_rad, max_rad)

    set_pev(ent, pev_owner, owner) // cvar amx_gasobeyFF
    engfunc(EngFunc_SetOrigin,ent,origin)

    new Float:global_Time
    global_get(glb_time, global_Time)
    set_pev(ent, pev_nextthink, global_Time + GASNADE_LIFE)

    return FMRES_HANDLED
}

public fwdThink(ent) {
    if(!pev_valid(ent))
        return FMRES_IGNORED

    static classname[33]
    pev(ent, pev_classname, classname, charsmax(classname))

    if(!equal(classname,GAS_CLASSNAME))
        return FMRES_IGNORED

    engfunc(EngFunc_RemoveEntity, ent)
    return FMRES_HANDLED
}

public fwdTouch(ent, id) {
    if(!is_user_alive(id) || !is_user_connected(id))
        return FMRES_IGNORED
    if(!pev_valid(ent)) {
        return FMRES_IGNORED
    }
    static classname[33]
    pev(ent, pev_classname, classname, charsmax(classname))
    if(!equal(classname, GAS_CLASSNAME))
        return FMRES_IGNORED

    new Float:global_Time
    global_get(glb_time, global_Time)

    if( global_Time - player_affected_time[id] < get_pcvar_float(amx_gascheck) )
        return FMRES_IGNORED

    static owner
    owner = pev(ent, pev_owner)
    if( !get_pcvar_num(mp_friendlyfire) && get_pcvar_num(amx_gasobeyFF) && get_pdata_int(id, OFFSET_TEAM) == get_pdata_int(owner, OFFSET_TEAM) )
        return FMRES_IGNORED

    player_affected_time[id] = global_Time
    msg_damage(id, ent)

    if(get_pcvar_num(amx_smokegasp) && !has_mask[id])
    {
        switch (random_num(1, 2))
        {
            case 1: emit_sound(id, CHAN_VOICE, GASP_SOUND1, 1.0, ATTN_NORM, 0, PITCH_NORM)
            case 2: emit_sound(id, CHAN_VOICE, GASP_SOUND2, 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
    }

    static Float:damage
    damage = get_pcvar_float(amx_gasdmg)
    if(damage > 0.0) {
        ExtraDamage(id, owner, damage, GAS_CLASSNAME)
        if(get_pcvar_num(amx_gas_restore)&&!has_mask[id])
        {
            damage_took[id] += damage
        }
    }

    return FMRES_HANDLED
}

ExtraDamage(id, attacker, Float:damage, weaponDescription[])
{
    if(is_user_alive(id))
    {
        static Float:userHealth
        pev(id, pev_health, userHealth)

        if(userHealth - damage < 1.0 && !has_mask[id])
        {
            if(!is_user_connected(attacker))
                attacker = 0

            add_frags(id, 1.0)

            new msgblock = get_msg_block(gmsgDeathMsg)
            if(msgblock != BLOCK_SET)
            {
                set_msg_block(gmsgDeathMsg, BLOCK_ONCE)
                make_deathmsg ( attacker, id, 0, weaponDescription )
                dllfunc(DLLFunc_ClientKill, id)
                set_msg_block(gmsgDeathMsg, msgblock)
            }
            else
                dllfunc(DLLFunc_ClientKill, id)

            if(attacker && attacker != id)
            {
                if( get_pdata_int(id, OFFSET_TEAM) != get_pdata_int(attacker, OFFSET_TEAM) )
                    add_frags(attacker, 1.0)
                else if( get_pcvar_num(mp_friendlyfire) )
                    add_frags(attacker, -1.0)
            }
        }
        else
        {
            if(!has_mask[id])
              set_pev(id, pev_health, userHealth - damage)
        }
    }
}

add_frags(id, Float:amount) {
    static Float:frags, Float:newfrags
    pev(id, pev_frags, frags)
    newfrags = amount + frags
    set_pev(id, pev_frags, newfrags)

    message_begin( MSG_ALL , gmsgScoreInfo )
    write_byte( id )
    write_short( floatround( newfrags ) )
    write_short( get_pdata_int(id, OFFSET_CSDEATHS) )
    write_short( 0 )
    write_short( get_pdata_int(id, OFFSET_TEAM) )
    message_end()
}

msg_damage(id, entity) {

   static Float:origin[3]
   pev(entity, pev_origin, origin)

   if(!has_mask[id])
   {
    message_begin(MSG_ONE, gmsgDamage, _, id)
    write_byte(30) // dmg_save
    write_byte(30) // dmg_take

    write_long(DMG_SLOWFREEZE) // visibleDamageBits  //DMG_ACID , //

    engfunc(EngFunc_WriteCoord, origin[0])  //arkshine
    engfunc(EngFunc_WriteCoord, origin[1])
    engfunc(EngFunc_WriteCoord, origin[2])

    message_end()
   }
}

i wywala podobny błąd

Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright © 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Symbol already defined: "amx_gas_maskcost" on line 52

1 Error.
Could not locate output file amx_gasnades.amx (compile failed).


  • +
  • -
  • 0

#7 GuTeK

    Zaawansowany

  • Użytkownik

Reputacja: 29
Życzliwy

  • Postów:76
  • GG:
  • Lokalizacja:Trzebnica
Offline

Napisano 15.08.2008 00:11

Error: Symbol already defined: "amx_gas_maskcost" on line 52

to znacza, ze zmiena o takiej nazwie jest juz zadeklarowana
patrz na to:

new amx_maskcost

new amx_gasnades, amx_gasdmg, amx_gascheck, amx_gasradius, amx_smokegasp, amx_gasobeyFF, amx_gas_restore, amx_gas_maskcost, amx_gas_maskon


Ten kod powinien dzialac

#include <amxmodx>
#include <cstrike>
#include <fakemeta>

#define VERSION    "1.6"

#if AMXX_VERSION_NUM < 180
    #define charsmax(%1)    sizeof(%1) - 1
#endif

#define OFFSET_CSDEATHS        444
#define OFFSET_TEAM            114

#define GASP_SOUND1         "player/gasp1.wav"
#define GASP_SOUND2         "player/gasp2.wav"

#define SMOKEGRENADE_SOUND     "weapons/sg_explode.wav"
#define GAS_CLASSNAME         "gasgrenade"
#define GASNADE_LIFE         25.0



new amx_gasnades, amx_gasdmg, amx_gascheck, amx_gasradius, amx_smokegasp, amx_gasobeyFF, amx_gas_restore, amx_gas_maskcost, amx_gas_maskon
new mp_friendlyfire

new gmsgDamage, gmsgDeathMsg, gmsgScoreInfo

new Float:player_affected_time[33]
new Float:player_restored_time[33]
new Float:damage_took[33]
new bool:has_mask[33]

public plugin_precache()
{
    engfunc(EngFunc_PrecacheSound, GASP_SOUND1)
    engfunc(EngFunc_PrecacheSound, GASP_SOUND2)
}

public plugin_init()
{
    register_plugin("Gas Grenades", VERSION, "ConnorMcLeod") //  RichoDemus/AssKicR/T(+)rget for previous versions

    register_event("HLTV", "eNewRound", "a", "1=0", "2=0")

    register_forward(FM_EmitSound, "fwdEmitSound")
    register_forward(FM_Touch, "fwdTouch")
    register_forward(FM_Think, "fwdThink")
    register_forward(FM_PlayerPreThink, "fwdPlayerPreThink")
    register_event("DeathMsg", "player_death", "a")
    register_clcmd("say /maska", "mask")

    register_cvar("gasnade", VERSION, FCVAR_SERVER)

    amx_gasnades = register_cvar("amx_gasnades",       "1")         // 0/1 Disable/Enable the whole plugin

    amx_gasdmg =      register_cvar("amx_gasdmg",      "2")         // How much damage the player takes every check cycle, 0 to disable damage (see amx_gascheck)
    amx_gascheck =    register_cvar("amx_gascheck",    "2")         // Check period in seconds
    amx_gasradius =   register_cvar("amx_gasradius",   "180")         // Smoke Radius (best is 170 - 230)
    amx_smokegasp =   register_cvar("amx_smokegasp",   "1")         // 0/1 Makes players gasp/cough in smoke
    amx_gasobeyFF =   register_cvar("amx_gasobeyFF",   "0")         // 0/1 Makes plugin act or not as cvar mp_friendlyfire
    amx_gas_restore = register_cvar("amx_gas_restore", "1")         // 0/1 Restore or not HP (if amx_gasdmg > 0)
    amx_gas_maskon = register_cvar("amx_gas_maskon", "1")
    amx_gas_maskcost = register_cvar("amx_gas_maskcost", "500")
}

public plugin_cfg()
{
    mp_friendlyfire = get_cvar_pointer("mp_friendlyfire")

    gmsgDamage = get_user_msgid("Damage")
    gmsgDeathMsg = get_user_msgid("DeathMsg")
    gmsgScoreInfo = get_user_msgid("ScoreInfo")
}

public mask(id)
{
 if(!is_user_alive(id) && get_pcvar_num(amx_gas_maskon))
  {
   client_print(id, print_chat, "nie zyjesz")
  }
 if(has_mask[id])
  {
   client_print(id, print_chat, "masz maske")
  }
 if(cs_get_user_money(id) < get_pcvar_num(amx_gas_maskcost) && get_pcvar_num(amx_gas_maskon) && !has_mask[id])
  {
   client_print(id, print_chat, "nie masz kasy")
  }
 if(is_user_alive(id) && get_pcvar_num(amx_gas_maskon) && cs_get_user_money(id) >= get_pcvar_num(amx_gas_maskcost) && !has_mask[id])
  {
   cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(amx_gas_maskcost))
   client_print(id, print_chat, "kupiles maske")
   has_mask[id] = true
  }
}

public player_death()
{
 new id = read_data(2)

 has_mask[id] = false
}

public client_connect(id) {
    new Float:global_Time
    global_get(glb_time, global_Time)
    player_affected_time[id] = global_Time
    player_restored_time[id] = global_Time
    damage_took[id] = 0.0
}

public eNewRound() {
    new ent = -1
    while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", GAS_CLASSNAME)) > 0) {
        engfunc(EngFunc_RemoveEntity, ent)
    }
    new Float:global_Time
    global_get(glb_time, global_Time)
    new players[32], inum, player
    get_players(players, inum)
    for(new i; i<inum; i++) {
        player = players[i]
        player_affected_time[player] = global_Time
        player_restored_time[player] = global_Time
        damage_took[player] = 0.0
    }
}

public fwdPlayerPreThink(id) {
    if(!get_pcvar_num(amx_gasnades))
        return FMRES_IGNORED

    static Float:gasdmg
    gasdmg = get_pcvar_float(amx_gasdmg)
    if( !gasdmg && !get_pcvar_num(amx_gas_restore) )
        return FMRES_IGNORED
   
    if( !is_user_alive(id) || !is_user_connected(id))
        return FMRES_IGNORED
   
    // check if player has HPs to be set back
    static Float:damage_to_restore
    damage_to_restore = damage_took[id]
    if( damage_to_restore < 1.0 )
        return FMRES_IGNORED

    static Float:global_Time
    global_get(glb_time, global_Time)

    static Float:cycle
    cycle = get_pcvar_float(amx_gascheck)

    // should tell if player is still in smoke
    if( global_Time - player_affected_time[id] < cycle + 0.1 )
        return FMRES_IGNORED
   
    if( global_Time - player_restored_time[id] < cycle )
        return FMRES_IGNORED
   
    static Float:userHealth
    pev(id, pev_health, userHealth)
   
    if( damage_to_restore >= gasdmg) {
        set_pev(id, pev_health, userHealth + gasdmg)
        damage_took[id] -= gasdmg
       
    }
    else if( damage_to_restore > 0.0 ) { //shouldn't happen unless an admin change some cvars during a round
        set_pev(id, pev_health, userHealth + damage_to_restore)
        damage_took[id] -= damage_to_restore
    }
   
    player_restored_time[id] = global_Time

    return FMRES_HANDLED
}

public fwdEmitSound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch)
{
    if(!get_pcvar_num(amx_gasnades))
        return FMRES_IGNORED

    if(!equali(sample, SMOKEGRENADE_SOUND))
        return FMRES_IGNORED
   
    static owner
    owner = pev(entity, pev_owner)
   
    static Float:origin[3]
    pev(entity, pev_origin, origin)
   
    static ent
    ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
    set_pev(ent, pev_classname, GAS_CLASSNAME)
    set_pev(ent,pev_solid,SOLID_TRIGGER)

    static Float:radius, Float:min_rad[3], Float:max_rad[3]
    radius = get_pcvar_float(amx_gasradius)
    min_rad[0] = -radius
    min_rad[1] = -radius
    min_rad[2] = -radius
    max_rad[0] = radius
    max_rad[1] = radius
    max_rad[2] = radius

    engfunc(EngFunc_SetSize, ent, min_rad, max_rad)

    set_pev(ent, pev_owner, owner) // cvar amx_gasobeyFF
    engfunc(EngFunc_SetOrigin,ent,origin)

    new Float:global_Time
    global_get(glb_time, global_Time)
    set_pev(ent, pev_nextthink, global_Time + GASNADE_LIFE)

    return FMRES_HANDLED
}

public fwdThink(ent) {
    if(!pev_valid(ent))
        return FMRES_IGNORED

    static classname[33]
    pev(ent, pev_classname, classname, charsmax(classname))

    if(!equal(classname,GAS_CLASSNAME))
        return FMRES_IGNORED

    engfunc(EngFunc_RemoveEntity, ent)
    return FMRES_HANDLED
}

public fwdTouch(ent, id) {
    if(!is_user_alive(id) || !is_user_connected(id))
        return FMRES_IGNORED
    if(!pev_valid(ent)) {
        return FMRES_IGNORED
    }
    static classname[33]
    pev(ent, pev_classname, classname, charsmax(classname))
    if(!equal(classname, GAS_CLASSNAME))
        return FMRES_IGNORED

    new Float:global_Time
    global_get(glb_time, global_Time)

    if( global_Time - player_affected_time[id] < get_pcvar_float(amx_gascheck) )
        return FMRES_IGNORED

    static owner
    owner = pev(ent, pev_owner)
    if( !get_pcvar_num(mp_friendlyfire) && get_pcvar_num(amx_gasobeyFF) && get_pdata_int(id, OFFSET_TEAM) == get_pdata_int(owner, OFFSET_TEAM) )
        return FMRES_IGNORED

    player_affected_time[id] = global_Time
    msg_damage(id, ent)

    if(get_pcvar_num(amx_smokegasp) && !has_mask[id])
    {
        switch (random_num(1, 2))
        {
            case 1: emit_sound(id, CHAN_VOICE, GASP_SOUND1, 1.0, ATTN_NORM, 0, PITCH_NORM)
            case 2: emit_sound(id, CHAN_VOICE, GASP_SOUND2, 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
    }

    static Float:damage
    damage = get_pcvar_float(amx_gasdmg)
    if(damage > 0.0) {
        ExtraDamage(id, owner, damage, GAS_CLASSNAME)
        if(get_pcvar_num(amx_gas_restore)&&!has_mask[id])
        {
            damage_took[id] += damage
        }
    }

    return FMRES_HANDLED
}

ExtraDamage(id, attacker, Float:damage, weaponDescription[])
{
    if(is_user_alive(id))
    {
        static Float:userHealth
        pev(id, pev_health, userHealth)

        if(userHealth - damage < 1.0 && !has_mask[id])
        {
            if(!is_user_connected(attacker))
                attacker = 0

            add_frags(id, 1.0)

            new msgblock = get_msg_block(gmsgDeathMsg)
            if(msgblock != BLOCK_SET)
            {
                set_msg_block(gmsgDeathMsg, BLOCK_ONCE)
                make_deathmsg ( attacker, id, 0, weaponDescription )
                dllfunc(DLLFunc_ClientKill, id)
                set_msg_block(gmsgDeathMsg, msgblock)
            }
            else
                dllfunc(DLLFunc_ClientKill, id)

            if(attacker && attacker != id)
            {
                if( get_pdata_int(id, OFFSET_TEAM) != get_pdata_int(attacker, OFFSET_TEAM) )
                    add_frags(attacker, 1.0)
                else if( get_pcvar_num(mp_friendlyfire) )
                    add_frags(attacker, -1.0)
            }
        }
        else
        {
            if(!has_mask[id])
              set_pev(id, pev_health, userHealth - damage)
        }
    }
}

add_frags(id, Float:amount) {
    static Float:frags, Float:newfrags
    pev(id, pev_frags, frags)
    newfrags = amount + frags
    set_pev(id, pev_frags, newfrags)

    message_begin( MSG_ALL , gmsgScoreInfo )
    write_byte( id )
    write_short( floatround( newfrags ) )
    write_short( get_pdata_int(id, OFFSET_CSDEATHS) )
    write_short( 0 )
    write_short( get_pdata_int(id, OFFSET_TEAM) )
    message_end()
}

msg_damage(id, entity) {

   static Float:origin[3]
   pev(entity, pev_origin, origin)

   if(!has_mask[id])
   {
    message_begin(MSG_ONE, gmsgDamage, _, id)
    write_byte(30) // dmg_save
    write_byte(30) // dmg_take

    write_long(DMG_SLOWFREEZE) // visibleDamageBits  //DMG_ACID , //

    engfunc(EngFunc_WriteCoord, origin[0])  //arkshine
    engfunc(EngFunc_WriteCoord, origin[1])
    engfunc(EngFunc_WriteCoord, origin[2])

    message_end()
   }
}
[/code]
  • +
  • -
  • 0

#8 colt

    Życzliwy

  • Użytkownik

Reputacja: 1
Nowy

  • Postów:25
Offline

Napisano 11.02.2009 22:28

Niestety mimo poprawki Micza Hp dalej leci powyżej 100 HP :( gdzie indziej pies pogrzebany tylko gdzie ??
  • +
  • -
  • 0

#9 WHineye

    Zaawansowany

  • Użytkownik

Reputacja: 8
Nowy

  • Postów:83
  • GG:
  • Lokalizacja:w-wa
Offline

Napisano 12.02.2009 09:39

Dopisz sobie do pluginu:
na poczatku to:
#include <fun>
a na koncu to:
public pilnujmax100hp(id){
if (get_user_health(id)>100)
set_user_health(id, 100) 
}

Działenie:
jak masz powyzej 100 hp, zostaje ono sprowadzone do 100.(zerżnełam funkcje z diablomoda :cfaniak: )
  • +
  • -
  • 0

#10 colt

    Życzliwy

  • Użytkownik

Reputacja: 1
Nowy

  • Postów:25
Offline

Napisano 13.02.2009 12:30

Ok dział wersja micza to ja poknociłem sorka :P
Teraz mam inną prośbe a dało by zrobić takie cuś ze jak mam maske to słysze ja i inni jakis tam dzwiek ale jak zgine to nie ??
  • +
  • -
  • 0

#11 Miczu

    Godlike

  • Przyjaciel

Reputacja: 646
Wszechmogący

  • Postów:2862
Offline

Napisano 13.02.2009 14:58

Da sie przerobic w dosc 'prosty' sposob mojego 'do you hear?' (dzwiek bicia serca gdy ma sie malo hp) przerobi sie if'a na to czy ma sie maske oraz dzwiek bicia serca na dzwiek oddychania przez maske...

PS. Jak dasz znajdziesz dzwiek .wav (!) z tym dzwiekiem i link do mojego pluga na forum (me -> leń) to daj tutaj, ja to przerobie i oczywiscie zapodam.
  • +
  • -
  • 0

#12 colt

    Życzliwy

  • Użytkownik

Reputacja: 1
Nowy

  • Postów:25
Offline

Napisano 13.02.2009 15:03

Do you hear :
http://amxx.pl/viewtopic.php?t=800

oraz kod sma maski + dzwięk.wav Lokalizacja dzwieku jest sound/player

Załączone pliki

  • Załączony plik  maska.rar   27,06 KB  49 Ilość pobrań

  • +
  • -
  • 0

#13 Miczu

    Godlike

  • Przyjaciel

Reputacja: 646
Wszechmogący

  • Postów:2862
Offline

Napisano 13.02.2009 15:16

Hmm... moze lepiej skroc dzwiek, bo jak dzwiek trwa 7 sekund, to jak umrze w 3s. to nadal bedzie oddychac xD (najlepiej osobno wdech i wydech :F).
  • +
  • -
  • 0

#14 colt

    Życzliwy

  • Użytkownik

Reputacja: 1
Nowy

  • Postów:25
Offline

Napisano 13.02.2009 15:19

ok dzwięk jest umieszczam go jest krótki chyba 2 sek :

Załączone pliki


  • +
  • -
  • 0

#15 Miczu

    Godlike

  • Przyjaciel

Reputacja: 646
Wszechmogący

  • Postów:2862
Offline

Napisano 13.02.2009 20:18

amx_gas_maskon_sap - domyslnie 1 czyli dzwiek dyszenia, 0 wylancza.

Przetestuj i sprawdz czy all ok.

Załączone pliki


  • +
  • -
  • 0

#16 colt

    Życzliwy

  • Użytkownik

Reputacja: 1
Nowy

  • Postów:25
Offline

Napisano 14.02.2009 10:43

^D^ A działa. Dziękuje Ci dobry człowieku :blaga:

teraz tylko ostatnie i uciekam nie zawracam ci doopy :P zeby zakladanie i zdejmowanie maski było zamiast latarki czyli na F
  • +
  • -
  • 0

#17 Miczu

    Godlike

  • Przyjaciel

Reputacja: 646
Wszechmogący

  • Postów:2862
Offline

Napisano 14.02.2009 11:34

Zrobione pod latarke (gdy jest ON to masz maske ON).
Nie ma cvara na zmiane tego, za to masz gratisa:

Jak sie zalozy maske to zaciemnia ci obraz (gorsza widocznosc?).

amx_gas_maskon_fade - zaciemnianie on/off => 1/0 (domyslnie 1)
amx_gas_maskon_max_fade - poziom zaciemnianoa 0%/100% => 0/255 (domyslnie 30)

Załączone pliki


  • +
  • -
  • 0

#18 colt

    Życzliwy

  • Użytkownik

Reputacja: 1
Nowy

  • Postów:25
Offline

Napisano 14.02.2009 11:57

Ta wersja już niestety nie działa native error 10
a jak wyłacze fade to latarka nie działa znaczy maska na latarce
  • +
  • -
  • 0

#19 Miczu

    Godlike

  • Przyjaciel

Reputacja: 646
Wszechmogący

  • Postów:2862
Offline

Napisano 14.02.2009 12:16

Dobra fade chyba poprawilem... a ikonka latarki sie zmienia? Bo bez tego raczej nie przechwyce guzika... (flashlight to najbardziej klopotliwy guzik jaki mogles chyba dac xD - bo nie da sie wykryc guzika, tylko sie wykrywa ikonke latarki).

Załączone pliki


  • +
  • -
  • 0

#20 colt

    Życzliwy

  • Użytkownik

Reputacja: 1
Nowy

  • Postów:25
Offline

Napisano 14.02.2009 12:27

Hmmm a jakby zamiast latarki tylko zrobić ze guzik F poprostu zeby nie było latarki(mp_flashlight 0) np.

register_clcmd("F", "mask")

Tylko nie wiem jak to działa :P zeby poprostu nie wpisywac ciagle to /maska tylko F i jest on/off
  • +
  • -
  • 0




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

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