remove_entity

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
alfre
Gana aktyvus vartotojas
Posts: 259
Joined: 2011 May 13 14:01
Skype: alfredasxl996
Contact:

remove_entity

Post by alfre »

Noriu paklausti, ar įmanoma remove_entity padaryti funkcijoje ir poto atkuri tą ištrintą entity kai prasideda raundas?
jei taip,tai kaip?

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: remove_entity

Post by aaarnas »

Teoriškai įmanoma, bet priklauso nuo entity. Ta prasme tu turėsi nustatyti begalę parametrų lygiai taip pat kaip buvo prieš tai.

Geriau ne trinti, o padaryti nematomu, neefektyviu, jei jį tau reikės po to atkurti.
Palikau CS pasaulį ;/ . Nebepasiekiamas.

alfre
Gana aktyvus vartotojas
Posts: 259
Joined: 2011 May 13 14:01
Skype: alfredasxl996
Contact:

Re: remove_entity

Post by alfre »

man reikia būtinai ištrinti ir atkurti.mačiau allied modders http://forums.alliedmods.net/showthread.php?p=657047 yra pluginas kuris trina ir atkuria,bet čia rankiniu būdu :(
galite bent jau kokį remove_entity kodą parašyti,nes mano labai jau užbugina.

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: remove_entity

Post by aaarnas »

Tau koki ent reik panaikint ir kodėl?
Palikau CS pasaulį ;/ . Nebepasiekiamas.

alfre
Gana aktyvus vartotojas
Posts: 259
Joined: 2011 May 13 14:01
Skype: alfredasxl996
Contact:

Re: remove_entity

Post by alfre »

man reikia panaikinti soccerjam_goalnet,ant krepšinio modo,kad būtų kiauras kamuolys.

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: remove_entity

Post by aaarnas »

Tai jei tai specialus entity, tai jis turi turėti visas reikiamas kūrimo funckijas, nes nėra default pasaulio objektų.
Palikau CS pasaulį ;/ . Nebepasiekiamas.

alfre
Gana aktyvus vartotojas
Posts: 259
Joined: 2011 May 13 14:01
Skype: alfredasxl996
Contact:

Re: remove_entity

Post by alfre »

dar beje :
public pfn_keyvalue(entid) {

new classname[32], key[32], value[32]
copy_keyvalue(classname, 31, key, 31, value, 31)
if(equal(key, "classname") && equal(value, "soccerjam_goalnet"))
DispatchKeyValue("classname", "func_wall")

kai šituos ištrini,eina kiaurai mesti kašę,bet tada neveikia soccerjam_goalnet.
visi įmanomi kašės kodai :

Code: Select all

 register_touch("PwnBall", "soccerjam_goalnet",  "touchNet")public touchNet(ball, player ,goalpost){    remove_task(55555)    new team = get_user_team(ballowner)        static mapname[64]    get_mapname(mapname, charsmax(mapname))     new goalent = GoalEnt[team]    if (goalpost != goalent && ballowner > 0) {        new aname[64]        new Float:netOrig[3]        new netOrig2[3]        entity_get_vector(ball, EV_VEC_origin,netOrig)        new l        for(l=0;l<3;l++)            netOrig2[l] = floatround(netOrig[l])        get_user_name(ballowner,aname,63)        new frags = get_user_frags(ballowner)        entity_set_float(ballowner, EV_FL_frags, float(frags + 10))        play_wav(0, SCORED_GOAL)        remove_task(66666)        remove_task(132515);          /////////////////////ASSIST CODE HERE///////////         new assisters[4] = { 0, 0, 0, 0 }        new iassisters = 0        new ilastplayer = iassist[ team ]        new assistname[MAX_ASSISTERS][32]         // We just need the last player to kick the ball        // 0 means it has passed 15 at least once        if ( ilastplayer == 0 )            ilastplayer = 15        else            ilastplayer--        if ( assist[ ilastplayer ] != 0 ) {            new i, x, bool:canadd, playerid            for(i=0; i<16; i++) {                // Stop if we've already found 4 assisters                if ( iassisters == MAX_ASSISTERS )                    break                playerid = assist[ i ]                // Skip if player is invalid                if ( playerid == 0 )                    continue                // Skip if kicker is counted as an assister                if ( playerid == assist[ ilastplayer ] )                    continue                 canadd = true                // Loop through each assister value                for(x=0; x<3; x++)                    // make sure we can add them                    if ( playerid == assisters[ x ] ) {                        canadd = false                        break                    }                 // Skip if they've already been added                if ( canadd == false )                    continue                // They didn't kick the ball last, and they haven't been added, add them                assisters[ iassisters++ ] = playerid            }            // This gives each person an assist, xp, and prints that out to them            new c, pass            for(c=0; c<iassisters; c++) {                pass = assisters[ c ]                Event_Record(pass, ASSIST, -1)                Event_Record(pass, MVP, -1)                get_user_name(pass, assistname[c], 31)                client_print( pass, print_chat, "%L",pass,"EXP_FOR_ASSIST",EXP_ASSIST)                }        }        iassist[ 0 ] = 0        /////////////////////ASSIST CODE HERE///////////         for(l=0; l<3; l++)            distorig[1][l] = floatround(netOrig[l])        new distshot = (get_distance(distorig[0],distorig[1])/12)        new gainedxp = distshot + EXP_GOAL         format(temp1,63,"%L",LANG_PLAYER,"SCORED_GOAL",TeamNames[team],aname,distshot)        client_print(0,print_console,"%s",temp1)          if(distshot > MadeRecord[ballowner][DISTANCE])            Event_Record(ballowner, DISTANCE, 0)// record distance, and make that distance exp        //zero xp for goal cause distance is what gives it.         client_print(ballowner,print_chat,"%L",ballowner,"EXP_FOR_GOAL",gainedxp,distshot)        new oteam = (team == 1 ? 2 : 1)        increaseTeamXP(team, 75)        increaseTeamXP(oteam, 50)        new x, kills, deaths;                    for(x=1; x<=maxplayers; x++) {                        if(is_user_connected(x))                        {                               kills = get_user_frags(x)                            deaths = cs_get_user_deaths(x)                                                        if( deaths > 0)                                PlayerDeaths[x] = deaths                            if( kills > 0)                                PlayerKills[x] = kills                        }                }                if(score[team] < get_pcvar_num(CVAR_SCORE)) {            new r = random_num(0,MAX_SOUNDS-1)            play_wav(0, SCORED_SOUNDS[r]);         }        else {            winner = team            format(scoreboard,1024,"%L",LANG_PLAYER,"TEAM_WINS",TeamNames[team])            set_task(1.0,"showhud_winner",0,"",0,"a",3)        }         server_cmd("sv_restart 4")     }    else if (goalpost == goalent) {        moveBall(0, team)        client_print(ballowner,print_chat,"%L",ballowner,"CANNOT_KICK_GOAL")    }    return PLUGIN_HANDLED} public pfn_keyvalue(entid) {     new classname[32], key[32], value[32]    copy_keyvalue(classname, 31, key, 31, value, 31)    if(equal(key, "classname") && equal(value, "soccerjam_goalnet"))        DispatchKeyValue("classname", "func_wall")     new temp_origins[3][10], x, team    new temp_angles[3][10]       if(equal(classname, "func_wall"))    {        if(equal(key, "team"))        {            team = str_to_num(value)            if(team == 1 || team == 2) {                GoalEnt[team] = entid                set_task(1.0, "FinalizeGoalNet", team)            }        }    }CreateGoalNets() {     new endzone, x    new Float:orig[3]    new Float:MinBox[3], Float:MaxBox[3]     for(x=1;x<3;x++) {        endzone = create_entity("info_target")        if (endzone) {             entity_set_string(endzone,EV_SZ_classname,"soccerjam_goalnet")            entity_set_model(endzone, "models/chick.mdl")            entity_set_int(endzone, EV_INT_solid, SOLID_BBOX)            entity_set_int(endzone, EV_INT_movetype, MOVETYPE_NONE)             MinBox[0] = -25.0;  MinBox[1] = -145.0; MinBox[2] = -36.0            MaxBox[0] =  25.0;  MaxBox[1] =  145.0; MaxBox[2] =  70.0             entity_set_vector(endzone, EV_VEC_mins, MinBox)            entity_set_vector(endzone, EV_VEC_maxs, MaxBox)             switch(x) {                case 1: {                    orig[0] = 2110.0                    orig[1] = 0.0                    orig[2] = 1604.0                }                case 2: {                    orig[0] = -2550.0                    orig[1] = 0.0                    orig[2] = 1604.0                }            }             entity_set_origin(endzone,orig)             entity_set_int(endzone, EV_INT_team, x)            set_entity_visibility(endzone, 0)            GoalEnt[x] = endzone        }    } }    create_wall() {    new wall = create_entity("func_wall")    if(wall)    {     }}public FinalizeGoalNet(team){    new goalnet = GoalEnt[team]    entity_set_string(goalnet,EV_SZ_classname,"soccerjam_goalnet")    entity_set_int(goalnet, EV_INT_team, team)    set_entity_visibility(goalnet,0)}
ir ištrinti bandžiau,beveik viską išbandžiau,vistiek neišeina..

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: remove_entity

Post by aaarnas »

Tai kažkur GoalEnt masyve sukuriamas tas entity. Dabar tikrai nenagrinėsiu viso soccejam kodo, kur kas padaroma.
Palikau CS pasaulį ;/ . Nebepasiekiamas.

alfre
Gana aktyvus vartotojas
Posts: 259
Joined: 2011 May 13 14:01
Skype: alfredasxl996
Contact:

Re: remove_entity

Post by alfre »

GoalEnt[x] = endzone daugiau niekur man atrodo

-- 2012 Spa 28 15:20 --

problema yra ant soccerjam_goalnet,dėl to ir atsitrenkia... koduose viskas gerai.. kaip padaryti kad soccerjam_goalnet būtų tik nematomas?per amxx

-- 2012 Spa 28 20:34 --

susitvarkiau,bet dar vienas klausimas,kaip ištrintą entity atgražinti?(undo padaryt)

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: remove_entity

Post by aaarnas »

Kai sudegini degtuką, jo vėl neuždegsi. Tad ištrynęs entity turi jį kurti naujai su tokiais parametrais, koks ir buvo. Apie tai jau buvo kalbėta.
Palikau CS pasaulį ;/ . Nebepasiekiamas.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest