Nepasideda....

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
User avatar
nuodas159
Flooderis arba specialistas
Posts: 522
Joined: 2010 Sep 03 15:30
Skype: nuodas159
Location: SunCity

Nepasideda....

Post by nuodas159 »

Sveiki. Kazko nesuprantu i faila iraso kordinates ,o mepe nera ju... +karma

Code: Select all

public spawn_pup(num){    num -= 50     ents[num] = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))    new Float:fGlowColors[3] = {150.0, 150.0, 150.0}      entity_set_origin( ents[num], origins[num] );            entity_set_string(ents[num], EV_SZ_classname, "item_medkit");     entity_set_model(ents[num], "models/umbrella/etc/w_medkit.mdl");     entity_set_int(ents[num], EV_INT_solid, 2)         entity_set_byte(ents[num], EV_BYTE_controller1, 125);     entity_set_byte(ents[num], EV_BYTE_controller2, 125);     entity_set_byte(ents[num], EV_BYTE_controller3, 125);     entity_set_byte(ents[num], EV_BYTE_controller4, 125);      entity_set_int(ents[num], EV_INT_renderfx, kRenderFxGlowShell)     entity_set_vector(ents[num], EV_VEC_rendercolor, fGlowColors)     entity_set_size(ents[num], Float:{-2.5, -2.5, -1.5}, Float:{2.5, 2.5, 1.5})     entity_set_float(ents[num], EV_FL_animtime, 2.0)     entity_set_float(ents[num], EV_FL_framerate, 1.0)     entity_set_int(ents[num], EV_INT_sequence, 0);             drop_to_floor(ents[num]) }  public logevent_round_end(id){    new iEnt = -1             while((iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "item_medkit")))         {             engfunc(EngFunc_RemoveEntity, iEnt)         }     g_medkit[id] = false;} public load_powerups(){    if(file_exists(configfile))    {        new Fsize = file_size(configfile, 1)        new input[64], trash        new data[64], p_origin[3][8]        for(new i = 0; i < Fsize; i++)        {            read_file(configfile, i, input, 63, trash)            if(input[0] != ';' && count < MAX_MK && strlen(input) > 10)            {                     parse(data, p_origin[0],7, p_origin[1],7, p_origin[2],7)                   origins[count][0] = str_to_float(p_origin[0]);                origins[count][1] = str_to_float(p_origin[1]);                origins[count][2] = str_to_float(p_origin[2]);                 /*strbreak(input, data, 20, input, 999);    origins[count][0] = str_to_float(data);                strbreak(input, data, 20, input, 999);  origins[count][1] = str_to_float(data);                strbreak(input, data, 20, input, 999);  origins[count][2] = str_to_float(data);*/                 line[count] = i                count++            }        }    }}  public cmd_medkit(id){    if(!(get_user_flags(id) & ADMIN_IMMUNITY))        return PLUGIN_HANDLED     new menu = menu_create("\rVaistineliu Valdymo Pultas", "medkit_handler")     menu_additem(menu, "\wPadeti Vaistinele \r(i savo stovima vieta)", "1")    menu_additem(menu, "\wIstrinti Vaistinele \r(savo stovimoje vietoje)", "2")     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);    menu_display(id, menu, 0);    return PLUGIN_HANDLED} public medkit_handler(id, menu, item){    if( item == MENU_EXIT )    {        menu_destroy(menu);        return PLUGIN_HANDLED       }     new data[6], iName[64];    new access, callback;    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);        new key = str_to_num(data);     switch(key)    {        case 1:        {            pev(id,pev_origin,origins[count])            new string[200]            format(string,199,"%f %f %f",origins[count][0],origins[count][1],origins[count][2])            write_file(configfile,string)            line[count] = file_size(configfile,1) - 2            print(id, "\g.::[MEDKIT]::. \tSekmingai sukurete vaistinele!")        }        case 2:        {                   new bool:removed = false            new Float:origin[3], classname[32]            pev(id, pev_origin, origin)             new ent = engfunc(EngFunc_FindEntityInSphere,get_maxplayers(),origin,100.0)             while(ent)            {                for(new i=0;i<NUM_MK;i++)                {                    if(equali(classname,"item_medkit"))                    {                        for(new j=0;j<count;j++)                        {                            if(ent==ents[j])                            {                                print(id, "\g.::[MEDKIT]::. \tSekmingai pasalinote vaistinele!")                                write_file(configfile,"",line[j])                                break;                            }                        }                        engfunc(EngFunc_RemoveEntity,ent)                        removed=true;                        break;                    }                }                ent = engfunc(EngFunc_FindEntityInSphere,ent,origin,100.0)            }            if(!removed)                print(id, "\g.::[MEDKIT]::. \tAplink nera nei vienos vaistineles!")        }    }    menu_destroy(menu)      return PLUGIN_HANDLED} 
Image

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

Re: Nepasideda....

Post by aaarnas »

Taip supratau išsaugai koordinates faile ir po to jas užkrauni į pluginą, ir jos būna ne tos pačios, kurias išsaugojai?

Viena iš problemų gali būti, kad koordinates išsaugai faile float tipo. Klausimas ar jas tvarkingai nuskaito. Reiktų su log_amx patikrinti kas dedasi kintamuosiuose.
Palikau CS pasaulį ;/ . Nebepasiekiamas.

User avatar
nuodas159
Flooderis arba specialistas
Posts: 522
Joined: 2010 Sep 03 15:30
Skype: nuodas159
Location: SunCity

Re: Nepasideda....

Post by nuodas159 »

Seip buna ,kad toj pacioje vietoje isisaugoja. de_dust2.ini kordinates:

Code: Select all

356.987640 2276.163818 -91.968750414.486053 2142.250976 -91.968750 
Image

User avatar
psychical
Viršininkas
Posts: 2094
Joined: 2011 Mar 12 22:19
Skype: tautvydas11
Location: Linksmakalnis
Contact:

Re: Nepasideda....

Post by psychical »

Code: Select all

public new_round(){     spawn_pup();}  public spawn_pup(){    if(file_exists(configfile))    {        new ent_T;        new Data[128], len, line = 0        new p_origin[3][15];        new Float:fGlowColors[3] = {255.0, 20.0, 10.0}        new Float:origin[3];                while((line = read_file(configfile , line , Data , 127 , len) ) != 0 )         {            parse(Data, p_origin[0],7, p_origin[1],7, p_origin[2],7);                    origin[0] = str_to_float(p_origin[0]);             origin[1] = str_to_float(p_origin[1]);             origin[2] = str_to_float(p_origin[2]);                    ent_T = create_entity("info_target")             entity_set_origin( ent_T, origin );             entity_set_string(ent_T,EV_SZ_classname,"item_medkit");             entity_set_model(ent_T,"models/umbrella/etc/w_medkit.mdl");             entity_set_int(ent_T,EV_INT_solid, 2)              entity_set_byte(ent_T,EV_BYTE_controller1,125);             entity_set_byte(ent_T,EV_BYTE_controller2,125);             entity_set_byte(ent_T,EV_BYTE_controller3,125);             entity_set_byte(ent_T,EV_BYTE_controller4,125);              entity_set_int(ent_T, EV_INT_renderfx, kRenderFxGlowShell)             entity_set_vector(ent_T, EV_VEC_rendercolor, fGlowColors)             entity_set_size(ent_T, Float:{-1.5, -1.5, -1.0}, Float:{1.5, 1.5, 1.0})             entity_set_float(ent_T,EV_FL_animtime,2.0)             entity_set_float(ent_T,EV_FL_framerate,1.0)             entity_set_int(ent_T,EV_INT_sequence,0);              drop_to_floor(ent_T)        }    }} public logevent_round_end(id){    new iEnt = -1        while((iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "item_medkit")))     {         engfunc(EngFunc_RemoveEntity, iEnt)     }     g_medkit[id] = false;}
viso sito istaisymas, viskas veiks puikaii ir be jokiu erro ;)

User avatar
nuodas159
Flooderis arba specialistas
Posts: 522
Joined: 2010 Sep 03 15:30
Skype: nuodas159
Location: SunCity

Re: Nepasideda....

Post by nuodas159 »

dq
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests