|
Member
|

08-03-2011
, 17:32
Blockmaker + Movetype
|
#1
|
Hi
I have a problem I try to do jumping death Block.
everything is ok, but after loading maps,block does not move
I hope that you will help
Sorry for English: D
This is my code
//Create Blocks
PHP Code:
CreateBlock(const id, const block_type, Float:origin[3], const axis, const size, const property1[], const property2[], const property3[], const property4[]) { new ent = create_entity("info_target"); if ( !is_valid_ent(ent) ) return 0; entity_set_string(ent, EV_SZ_classname, g_block_classname); entity_set_int(ent, EV_INT_solid, SOLID_BBOX); entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);
new Float:flProperty1; pev( ent, pev_fuser1, flProperty1); if( flProperty1 == 0.0 ) Death[id][2] = 500.0; else Death[id][2] = flProperty1; Death[id][1] = 0.0; Death[id][0] = 0.0; if( block_type == DEATH) { entity_set_int(ent, EV_INT_movetype, MOVETYPE_BOUNCE); set_pev(ent, pev_velocity, Death[id][0], Death[id][1], Death[id][2]);
}
new block_model[256]; new Float:size_min[3]; new Float:size_max[3]; new Float:angles[3]; new Float:scale; switch ( axis ) { case X: { size_min[0] = -4.0; size_min[1] = -32.0; size_min[2] = -32.0; size_max[0] = 4.0; size_max[1] = 32.0; size_max[2] = 32.0; if(size == POLE) { size_min[0] = -32.0; size_min[1] = -4.0; size_min[2] = -4.0; size_max[0] = 32.0; size_max[1] = 4.0; size_max[2] = 4.0; } angles[0] = 90.0; } case Y: { size_min[0] = -32.0; size_min[1] = -4.0; size_min[2] = -32.0; size_max[0] = 32.0; size_max[1] = 4.0; size_max[2] = 32.0; if(size == POLE) { size_min[0] = -4.0; size_min[1] = -32.0; size_min[2] = -4.0; size_max[0] = 4.0; size_max[1] = 32.0; size_max[2] = 4.0; } angles[0] = 90.0; angles[2] = 90.0; } case Z: { size_min[0] = -32.0; size_min[1] = -32.0; size_min[2] = -4.0; size_max[0] = 32.0; size_max[1] = 32.0; size_max[2] = 4.0; if(size == POLE) { size_min[0] = -4.0; size_min[1] = -4.0; size_min[2] = -32.0; size_max[0] = 4.0; size_max[1] = 4.0; size_max[2] = 32.0; } angles[0] = 0.0; angles[1] = 0.0; angles[2] = 0.0; } } switch ( size ) { case TINY: { SetBlockModelName(block_model, g_block_models[block_type], "Small"); scale = 0.25; } case NORMAL: { block_model = g_block_models[block_type]; scale = 1.0; } case LARGE: { SetBlockModelName(block_model, g_block_models[block_type], "Large"); scale = 2.0; } case POLE: { SetBlockModelName(block_model, g_block_models[block_type], "Pole"); scale = 1.0; } } for ( new i = 0; i < 3; ++i ) { if ( size_min[i] != 4.0 && size_min[i] != -4.0 ) { size_min[i] *= scale; } if ( size_max[i] != 4.0 && size_max[i] != -4.0 ) { size_max[i] *= scale; } } entity_set_model(ent, block_model); SetBlockRendering(ent, g_render[block_type], g_red[block_type], g_green[block_type], g_blue[block_type], g_alpha[block_type]); entity_set_vector(ent, EV_VEC_angles, angles); entity_set_size(ent, size_min, size_max); entity_set_int(ent, EV_INT_body, block_type); if ( 1 <= id <= g_max_players ) { DoSnapping(id, ent, origin); } entity_set_origin(ent, origin); SetProperty(ent, 1, property1); SetProperty(ent, 2, property2); SetProperty(ent, 3, property3); SetProperty(ent, 4, property4); return ent; }
//Save Blocks
PHP Code:
SaveBlocks(id) { if ( !g_admin[id] ) { console_print(id, "Nie masz dostepu do tej komendy"); return PLUGIN_HANDLED; } new ent; new file; new data[128]; new block_count; new tele_count; new light_count; new block_type; new size; new property1[5], property2[5], property3[5], property4[5]; new tele; new Float:origin[3]; new Float:angles[3]; new Float:tele_start[3]; new Float:tele_end[3]; new Float:max_size; new Float:size_max[3]; file = fopen(g_file, "wt"); block_count = 0; tele_count = 0; ent = -1; while ( ( ent = find_ent_by_class(ent, g_block_classname) ) ) { block_type = entity_get_int(ent, EV_INT_body); entity_get_vector(ent, EV_VEC_origin, origin); entity_get_vector(ent, EV_VEC_angles, angles); entity_get_vector(ent, EV_VEC_maxs, size_max); GetProperty(ent, 1, property1); GetProperty(ent, 2, property2); GetProperty(ent, 3, property3); GetProperty(ent, 4, property4); if ( !property1[0] ) copy(property1, charsmax(property1), "/"); if ( !property2[0] ) copy(property2, charsmax(property2), "/"); if ( !property3[0] ) copy(property3, charsmax(property3), "/"); if ( !property4[0] ) copy(property4, charsmax(property4), "/"); max_size = size_max[0] + size_max[1] + size_max[2]; if ( max_size > 128.0 ) size = LARGE; else if ( max_size > 64.0 ) size = NORMAL; else if ( max_size > 32.0 ) size = POLE; else size = TINY; formatex(data, charsmax(data), "%c %f %f %f %f %f %f %d %s %s %s %s^n",\ g_block_save_ids[block_type],\ origin[0],\ origin[1],\ origin[2],\ angles[0],\ angles[1],\ angles[2],\ size,\ property1,\ property2,\ property3,\ property4 ); fputs(file, data); ++block_count; } ent = -1; while ( ( ent = find_ent_by_class(ent, g_destination_classname) ) ) { tele = entity_get_int(ent, EV_INT_iuser1); if ( tele ) { entity_get_vector(tele, EV_VEC_origin, tele_start); entity_get_vector(ent, EV_VEC_origin, tele_end); formatex(data, charsmax(data), "* %f %f %f %f %f %f^n",\ tele_start[0],\ tele_start[1],\ tele_start[2],\ tele_end[0],\ tele_end[1],\ tele_end[2] ); fputs(file, data); ++tele_count; } } ent = -1; while ( ( ent = find_ent_by_class(ent, g_light_classname) ) ) { entity_get_vector(ent, EV_VEC_origin, origin); GetProperty(ent, 1, property1); GetProperty(ent, 2, property2); GetProperty(ent, 3, property3); GetProperty(ent, 4, property4); formatex(data, charsmax(data), "! %f %f %f / / / / %s %s %s %s^n",\ origin[0],\ origin[1],\ origin[2],\ property1,\ property2,\ property3,\ property4 ); fputs(file, data); ++light_count; } static name[32]; get_user_name(id, name, charsmax(name)); for ( new i = 1; i <= g_max_players; ++i ) { if ( g_connected[i] && ( g_admin[i] || g_gived_access[i] ) ) { BCM_Print(i, "^1%s^3 zapisal^1 %d blokow^3,^1 %d teleportow ^3 i^1 %d swiatel^3! Bytow na mapie:^1 %d", name, block_count, tele_count, light_count, entity_count()); } } fclose(file); return PLUGIN_HANDLED; }
//Load blocks
PHP Code:
LoadBlocks(id) { if ( id != 0 && !g_admin[id] ) { console_print(id, "Nie masz dostepu do tej komendy"); return PLUGIN_HANDLED; } else if ( !file_exists(g_file) && 1 <= id <= g_max_players ) { BCM_Print(id, "Nie mozna znalezc pliku:^1 %s", g_file); return PLUGIN_HANDLED; } if ( 1 <= id <= g_max_players ) { DeleteAll(id, false); } new file; new data[128]; new block_count; new tele_count; new light_count; new type[2]; new block_size[17]; new origin_x[17]; new origin_y[17]; new origin_z[17]; new angel_x[17]; new angel_y[17]; new angel_z[17]; new block_type; new axis; new size; new property1[5], property2[5], property3[5], property4[5]; new Float:origin[3]; new Float:angles[3]; file = fopen(g_file, "rt"); block_count = 0; tele_count = 0; while ( !feof(file) ) { type = g_blank; fgets(file, data, charsmax(data)); parse(data,\ type, charsmax(type),\ origin_x, charsmax(origin_x),\ origin_y, charsmax(origin_y),\ origin_z, charsmax(origin_z),\ angel_x, charsmax(angel_x),\ angel_y, charsmax(angel_y),\ angel_z, charsmax(angel_z),\ block_size, charsmax(block_size),\ property1, charsmax(property1),\ property2, charsmax(property2),\ property3, charsmax(property3),\ property4, charsmax(property4) ); origin[0] = str_to_float(origin_x); origin[1] = str_to_float(origin_y); origin[2] = str_to_float(origin_z); angles[0] = str_to_float(angel_x); angles[1] = str_to_float(angel_y); angles[2] = str_to_float(angel_z); size = str_to_num(block_size); if ( strlen(type) > 0 ) { if ( type[0] != '*' ) { if ( angles[0] == 90.0 && angles[1] == 0.0 && angles[2] == 0.0 ) { axis = X; } else if ( angles[0] == 90.0 && angles[1] == 0.0 && angles[2] == 90.0 ) { axis = Y; } else { axis = Z; } } switch ( type[0] ) { case 'A': block_type = BUNNYHOP; case 'B': block_type = NO_SLOW_DOWN_BUNNYHOP; case 'C': block_type = DELAYED_BUNNYHOP; case 'D': block_type = DAMAGE; case 'E': block_type = HEALER; case 'F': block_type = NO_FALL_DAMAGE; case 'G': block_type = ICE; case 'H': block_type = TRAMPOLINE; case 'I': block_type = SPEED_BOOST; case 'J': block_type = DEATH; case 'K': block_type = LOW_GRAVITY; case 'L': block_type = HONEY; case 'M': block_type = CT_BARRIER; case 'N': block_type = T_BARRIER; case 'O': block_type = GLASS; case 'P': block_type = PLATFORM; case 'Q': block_type = TRAWA; case 'R': block_type = DREWNO; case 'S': block_type = INVINCIBILITY; case 'T': block_type = STEALTH; case 'U': block_type = BOOTS_OF_SPEED; case 'V': block_type = MONEYBLOCK; case 'W': block_type = KAMUFLAZ; case 'X': block_type = MELANZ; case 'Y': block_type = SG; case 'Z': block_type = HE; case '@': block_type = GRANATY; case '#': block_type = BRON; case '$': block_type = VIP; case '%': block_type = DUCK; case '1': block_type = KOKS; case '2': block_type = SKY;
case '*': { CreateTeleport(0, TELEPORT_START, origin); CreateTeleport(0, TELEPORT_DESTINATION, angles); ++tele_count; } case '!': { CreateLight(origin, property1, property2, property3, property4); ++light_count; } } if ( type[0] != '*' && type[0] != '!' ) { CreateBlock(0, block_type, origin, axis, size, property1, property2, property3, property4); ++block_count; } } } fclose(file); if ( 1 <= id <= g_max_players ) { static name[32]; get_user_name(id, name, charsmax(name)); for ( new i = 1; i <= g_max_players; ++i ) { if ( !g_connected[i] || !g_admin[i] && !g_gived_access[i] ) continue; BCM_Print(i, "^1%s^3 loaded^1 %d block%s^3,^1 %d teleport%s^3 and^1 %d light%s^3! Total entites in map:^1 %d", name, block_count, block_count == 1 ? g_blank : "s", tele_count, tele_count == 1 ? g_blank : "s", light_count, light_count == 1 ? g_blank : "s", entity_count()); } } return PLUGIN_HANDLED; }
|
|