Page 1 of 1

žaidėjo id

Posted: 2011 May 03 07:22
by aurimasko
Kai sužinoti žaidėjo ID kuris paleido raketą? ir kaip sužinoti ar tas žaidėjas į kurį pataikė raketa jau negyvas?

Code: Select all

 public rocket_touch(id, world){    new Float:location[3]    new players[32]    new playercount    entity_get_vector(id,EV_VEC_origin,location)    emit_sound(id, CHAN_WEAPON, _RpgSounds[2], 0.0, 0.0, SND_STOP, PITCH_NORM)      explode(location, SpriteExplosion, 30, 10, 0)     get_players(players,playercount,"a")     for (new i=0; i<playercount; i++)    {        new Float:playerlocation[3]        new Float:resultdistance            pev(players[i], pev_origin, playerlocation)                resultdistance = get_distance_f(playerlocation,location)            if(resultdistance < 450.0)        {            fakedamage(players[i],"RPG",(1000.0 - (2.0*resultdistance)),DMG_BLAST)        }    }    emit_sound(id, CHAN_AUTO, _RpgSounds[1], 1.0, ATTN_NORM, 0, PITCH_NORM)    remove_entity(id)        return PLUGIN_CONTINUE  }  

Re: žaidėjo id

Posted: 2011 May 03 08:04
by newb
Po fakedamage tikrink ar players gyvas. O kas paleido, is cia tikriausei nesuzinosi.

Re: žaidėjo id

Posted: 2011 May 03 13:01
by aurimasko
o iš šito kodo?

Code: Select all

 public rpg_pre(weapon){    if (!is_valid_ent(weapon)) return PLUGIN_CONTINUE    new id = entity_get_edict( weapon, EV_ENT_owner )     new  ent    new Float:where[3]    new gmsgShake = get_user_msgid("ScreenShake")     message_begin(MSG_ONE, gmsgShake, {0,0,0}, id)    write_short(255<< 14 ) //ammount     write_short(1 << 14) //lasts this long     write_short(255<< 14) //frequency       message_end()      ent = create_entity("info_target")    set_pev(ent, pev_classname, "rpg_missile")    set_pev(ent, pev_solid, SOLID_TRIGGER)    set_pev(ent, pev_movetype, MOVETYPE_BOUNCE)    entity_set_model(ent, "models/rpgrocket.mdl")    pev(id, pev_origin, where)    where[2] += 50.0;    where[0] += random_float(-20.0, 20.0)    where[1] += random_float(-20.0, 20.0)    entity_set_origin(ent, where)    entity_get_vector(id,EV_VEC_angles,where)    //where[1] = random_float(0.0, 180.0)    entity_set_vector(ent, EV_VEC_angles, where)    velocity_by_aim(id, 700, where)    //entity_set_edict(ent, EV_ENT_aiment, id );    //where[2] += 200.0;    entity_set_edict(ent,EV_ENT_owner,id)    entity_set_vector(ent,EV_VEC_velocity,where)    message_begin( MSG_BROADCAST, SVC_TEMPENTITY )    write_byte( TE_BEAMFOLLOW )    write_short(ent) // entity    write_short(m_iTrail)  // model    write_byte( 10 )       // lifeffffff        write_byte( 8 )        // width     write_byte( 130)      // r, g, b    write_byte( 130 )    // r, g, b    write_byte( 130 )      // r, g, b    write_byte( 196 )    // brightness    message_end()    emit_sound(id, CHAN_WEAPON, _RpgSounds[0], 1.0, ATTN_NORM, 0, PITCH_NORM)    emit_sound(ent, CHAN_WEAPON, _RpgSounds[2], 1.0, ATTN_NORM, 0, PITCH_NORM)     RegisterHamFromEntity(Ham_Think,ent,"fw_rocket_think")    set_pev(ent, pev_nextthink, get_gametime()+0.25);     set_pdata_float( weapon , 46 , 2.5, 4 );    set_user_weaponanim(id, 2)     //cs_set_weapon_ammo(gun, 2000)    return HAM_SUPERCEDE}public fw_rocket_think(ent){    entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.25)     new id = entity_get_edict( ent, EV_ENT_owner )    new Float:where[3]    entity_get_vector(id,EV_VEC_angles,where)    entity_set_vector(ent, EV_VEC_angles, where)    velocity_by_aim(id, 700, where)        entity_set_vector(ent,EV_VEC_velocity,where)     return PLUGIN_CONTINUE}

Re: žaidėjo id

Posted: 2011 May 03 13:09
by hleV
entity_get_edict(ent, EV_ENT_owner) grąžina paleidėjo ID. ent tavo atveju yra id rocket_touch() funkcijoje, bet galėtum pervadint į ent.

Re: žaidėjo id

Posted: 2011 May 03 15:12
by aurimasko
error:

Code: Select all

L 05/03/2011 - 16:05:48: [FUN] Player out of range (145)L 05/03/2011 - 16:05:48: [AMXX] Displaying debug trace (plugin "jailbreak_last_request.amxx")L 05/03/2011 - 16:05:48: [AMXX] Run time error 10: native error (native "set_user_frags")L 05/03/2011 - 16:05:48: [AMXX]    [0] jailbreak_last_request.sma::rocket_touch (line 261) 
eilutė:

Code: Select all

public rocket_touch(id, world){    new Float:location[3]    new players[32]    new playercount    entity_get_vector(id,EV_VEC_origin,location)    entity_get_edict(id, EV_ENT_owner)    new ent = id     emit_sound(id, CHAN_WEAPON, _RpgSounds[2], 0.0, 0.0, SND_STOP, PITCH_NORM)      explode(location, SpriteExplosion, 30, 10, 0)     get_players(players,playercount,"a")     for (new i=0; i<playercount; i++)    {        new Float:playerlocation[3]        new Float:resultdistance            pev(players[i], pev_origin, playerlocation)                resultdistance = get_distance_f(playerlocation,location)            if(resultdistance < 450.0)        {            fakedamage(players[i],"RPG",(1000.0 - (2.0*resultdistance)),DMG_BLAST)                        if(!is_user_alive(players[i]))            {                set_user_frags(ent, get_user_frags(ent) + 1 ) // čia meta                user_silentkill(players[i] )                    make_deathmsg( ent, players[i], 0, "grenade" )                 SetHamParamInteger(3, 2)            }        }    }    emit_sound(id, CHAN_AUTO, _RpgSounds[1], 1.0, ATTN_NORM, 0, PITCH_NORM)    remove_entity(id)        return PLUGIN_CONTINUE  } 

Re: žaidėjo id

Posted: 2011 May 03 16:33
by newb

Code: Select all

public rocket_touch(ent, world){    new Float:location[3]    new players[32]    new playercount    entity_get_vector(id,EV_VEC_origin,location)    new id = entity_get_edict(ent, EV_ENT_owner)     emit_sound(ent, CHAN_WEAPON, _RpgSounds[2], 0.0, 0.0, SND_STOP, PITCH_NORM)     explode(location, SpriteExplosion, 30, 10, 0)     get_players(players,playercount,"a")     for (new i=0; i<playercount; i++)    {        new Float:playerlocation[3]        new Float:resultdistance           pev(players[i], pev_origin, playerlocation)               resultdistance = get_distance_f(playerlocation,location)           if(resultdistance < 450.0)        {            fakedamage(players[i],"RPG",(1000.0 - (2.0*resultdistance)),DMG_BLAST)                       if(!is_user_alive(players[i]))            {                set_user_frags(id, get_user_frags(id) + 1)                user_silentkill(players[i])                make_deathmsg( id, players[i], 0, "grenade" )                SetHamParamInteger(3, 2)            }        }    }    emit_sound(ent, CHAN_AUTO, _RpgSounds[1], 1.0, ATTN_NORM, 0, PITCH_NORM)    remove_entity(ent)       return PLUGIN_CONTINUE }
Bet seip nesuprantu kam tu darai user_silentkill gi fakedamage turi zudyt ir apskaicuoja pagal atstuma dmg, o tu dabar zudai iskart nesvabu kiek hp nuima.

Re: žaidėjo id

Posted: 2011 May 03 17:56
by aurimasko
newb wrote:

Code: Select all

public rocket_touch(ent, world){    new Float:location[3]    new players[32]    new playercount    entity_get_vector(id,EV_VEC_origin,location)    new id = entity_get_edict(ent, EV_ENT_owner)     emit_sound(ent, CHAN_WEAPON, _RpgSounds[2], 0.0, 0.0, SND_STOP, PITCH_NORM)     explode(location, SpriteExplosion, 30, 10, 0)     get_players(players,playercount,"a")     for (new i=0; i<playercount; i++)    {        new Float:playerlocation[3]        new Float:resultdistance           pev(players[i], pev_origin, playerlocation)               resultdistance = get_distance_f(playerlocation,location)           if(resultdistance < 450.0)        {            fakedamage(players[i],"RPG",(1000.0 - (2.0*resultdistance)),DMG_BLAST)                       if(!is_user_alive(players[i]))            {                set_user_frags(id, get_user_frags(id) + 1)                user_silentkill(players[i])                make_deathmsg( id, players[i], 0, "grenade" )                SetHamParamInteger(3, 2)            }        }    }    emit_sound(ent, CHAN_AUTO, _RpgSounds[1], 1.0, ATTN_NORM, 0, PITCH_NORM)    remove_entity(ent)       return PLUGIN_CONTINUE }
Bet seip nesuprantu kam tu darai user_silentkill gi fakedamage turi zudyt ir apskaicuoja pagal atstuma dmg, o tu dabar zudai iskart nesvabu kiek hp nuima.
Tiksliai! :D