Raised This Month: $51 Target: $400
 12% 

Rendering


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
weplausss
Member
Join Date: Mar 2010
Old 08-14-2011 , 11:53   Rendering
Reply With Quote #1

I try to make blockmaker render menu. everything is ok but i can't save renders colors.
i hope anyone help me this is my code.
i don't know how save and load renders

PHP Code:
new g_red[33],g_green[33],g_blue[33],g_alpha[33]; // My colors RGB 
PHP Code:
public Render(id){  //Renders Menu
    
static msg[2500];
    new 
len formatex(msgsizeof(msg) - 1,    "\r[Renders]^n^n");    
    
    
len += format(msg[len], sizeof(msg) - len 1,    "\w1.\rMake render^n");
    
len += format(msg[len], sizeof(msg) - len 1,    "\w2.\rRed:\y%d^n",g_red[id]);
    
len += format(msg[len], sizeof(msg) - len 1,    "\w3.\rGreen:\y%d^n",g_green[id]);
    
len += format(msg[len], sizeof(msg) - len 1,    "\w4.\rBlue:\y%d^n",g_blue[id]);
    
len += format(msg[len], sizeof(msg) - len 1,    "\w5.\rIntensity:\y%d^n^n",g_alpha[id]);
    
len += format(msg[len], sizeof(msg) - len 1,    "\w6.\rReset value^n");
    
    
len += format(msg[len], sizeof(msg) - len 1,    "^n^n\w0.\w Wyjscie");
    
    
show_menu(id,RENDER_KEYSmsg, -1,"Render");
    
    return 
PLUGIN_HANDLED;

Keys function
PHP Code:
public KeyRendery(idkey) {
    switch(
key) {
        
        case 
0:{
            new 
body,ent;
            
get_user_aiming(identbody);
    
            if (
IsBlock(ent))
            {
            
set_rendering(entkRenderFxGlowShellg_red[id], g_green[id], g_blue[id], g_alpha[id]);
            
Render(id);
        }
        }
        case 
1:{
        if(
g_red[id] >= 255) {
                    
BCM_Print(id"^x03 Maximum^x04 255"); 
                    
Render(id);
                }
                else 
                {
                
g_red[id] += 5;
                
Render(id);
            }
        }
        case 
2:{
            if(
g_green[id] >= 255) {
                    
BCM_Print(id"^x03 Maximum^x04 255");  
                    
Render(id);
                }
                else 
                {
            
g_green[id] += 5;
            
Render(id);
        }
        }
        case 
3:{
            if(
g_blue[id] >= 255) {
                    
BCM_Print(id"^x03 Maximum^x04 255"); 
                    
Render(id);
                }
                else 
                {
            
g_blue[id] += 5;
            
Render(id);
        }
        }
        case 
4:{
            if(
g_alpha[id] >= 255) {
                    
BCM_Print(id"^x03 Maximum^x04 255"); 
                    
Render(id);
                }
                else 
                {
            
g_alpha[id] += 5;
            
Render(id);
        }
    }
        case 
5:{
            
g_alpha[id] = 0;
            
g_blue[id] = 0;
            
g_green[id] = 0;
            
g_red[id] = 0;
            
Render(id);
        }
            
    }

Save Blocks
PHP Code:
SaveBlocks(id)
{
    if ( !
g_admin[id] )
    {
        
console_print(id"You need acces here");
        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(entg_block_classname) ) )
    {
        
block_type entity_get_int(entEV_INT_body);
        
entity_get_vector(entEV_VEC_originorigin);
        
entity_get_vector(entEV_VEC_anglesangles);
        
entity_get_vector(entEV_VEC_maxssize_max);
        
        
peventpev_rendercolorflRenderColor );
        
        
GetProperty(ent1property1);
        
GetProperty(ent2property2);
        
GetProperty(ent3property3);
        
GetProperty(ent4property4);
        
        if ( !
property1[0] ) copy(property1charsmax(property1), "/");
        if ( !
property2[0] ) copy(property2charsmax(property2), "/");
        if ( !
property3[0] ) copy(property3charsmax(property3), "/");
        if ( !
property4[0] ) copy(property4charsmax(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(datacharsmax(data), "%c %f %f %f %f %f %f %d %s %s %s %s %d %d %d^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(filedata);
        
        ++
block_count;
    }
    
    
ent = -1;
    while ( ( 
ent find_ent_by_class(entg_destination_classname) ) )
    {
        
tele entity_get_int(entEV_INT_iuser1);
        if ( 
tele )
        {
            
entity_get_vector(teleEV_VEC_origintele_start);
            
entity_get_vector(entEV_VEC_origintele_end);
            
            
formatex(datacharsmax(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(filedata);
            
            ++
tele_count;
        }
    }
    
    
ent = -1;
    while ( ( 
ent find_ent_by_class(entg_light_classname) ) )
    {
        
entity_get_vector(entEV_VEC_originorigin);
        
        
GetProperty(ent1property1);
        
GetProperty(ent2property2);
        
GetProperty(ent3property3);
        
GetProperty(ent4property4);
        
        
formatex(datacharsmax(data), "! %f %f %f / / / / %s %s %s %s^n",\
            
origin[0],\
            
origin[1],\
            
origin[2],\
            
property1,\
            
property2,\
            
property3,\
            
property4
            
);
        
fputs(filedata);
        
        ++
light_count;
    }
    
    static 
name[32];
    
get_user_name(idnamecharsmax(name));
    
    for ( new 
1<= g_max_players; ++)
    {
        if ( 
g_connected[i]
        && ( 
g_admin[i] || g_gived_access[i] ) )
        {
            
BCM_Print(i"^1%s^3Saved^1 %d block^3,^1 %d teleports ^3 i^1 %dlightl^3! Byt on map:^1 %d"nameblock_counttele_countlight_countentity_count());
        }
    }
    
    
fclose(file);
    return 
PLUGIN_HANDLED;

And load blocks
PHP Code:

LoadBlocks
(id)
{
    if ( 
id != && !g_admin[id] )
    {
        
console_print(id"Nie masz dostepu do tej komendy");
        return 
PLUGIN_HANDLED;
    }
    else if ( !
file_exists(g_file)
    && 
<= id <= g_max_players )
    {
        
BCM_Print(id"Nie mozna znalezc pliku:^1 %s"g_file);
        return 
PLUGIN_HANDLED;
    }
    
    if ( 
<= id <= g_max_players )
    {
        
DeleteAll(idfalse);
    }
    
    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(filedatacharsmax(data));
        
parse(data,\
            
typecharsmax(type),\
            
origin_xcharsmax(origin_x),\
            
origin_ycharsmax(origin_y),\
            
origin_zcharsmax(origin_z),\
            
angel_xcharsmax(angel_x),\
            
angel_ycharsmax(angel_y),\
            
angel_zcharsmax(angel_z),\
            
block_sizecharsmax(block_size),\
            
property1charsmax(property1),\
            
property2charsmax(property2),\
            
property3charsmax(property3),\
            
property4charsmax(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) > )
        {
            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 
'3'block_type BHOP2;
                case 
'4'block_type BHLOD;
                

                case 
'*':
                {
                    
CreateTeleport(0TELEPORT_STARTorigin);
                    
CreateTeleport(0TELEPORT_DESTINATIONangles);
                    
                    ++
tele_count;
                }
                case 
'!':
                {
                    
CreateLight(originproperty1property2property3property4);
                    
                    ++
light_count;
                }
            }
            
            if ( 
type[0] != '*' && type[0] != '!' )
            {
                
CreateBlock(0block_typeoriginaxissizeproperty1property2property3property4);
                
                ++
block_count;
            }
        }
    }
    
fclose(file);
    
    if ( 
<= id <= g_max_players )
    {
        static 
name[32];
        
get_user_name(idnamecharsmax(name));
        
        for ( new 
1<= g_max_players; ++)
        {
            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"nameblock_countblock_count == g_blank "s"tele_counttele_count == g_blank "s"light_countlight_count == g_blank "s"entity_count());
        }
    }
    
    return 
PLUGIN_HANDLED;

weplausss is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode