Raised This Month: $ Target: $400
 0% 

rotating by cvar


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
mammapappa
Member
Join Date: Nov 2008
Old 03-20-2011 , 15:33   rotating by cvar
Reply With Quote #1

Hi can someone fix this code for me? i have tried but it doesnt rotate anything it's suposed to rotate by cvar with angles so i can rotate a block 360 degrees but it doesnt rotate when i write for example bm_rotate "0 0 -30" i hope you understand what i mean its like the regular rotate in bm that rotates 90 degrees but with this cvar it could be rotated like 35 degrees or 91 etc sry for bad english

PHP Code:
new pcv_rotate
PHP Code:
pcv_rotate register_cvar("bm_rotate","0 0 0"); 
PHP Code:
bool:rotateBlock(ent)
{
    
//if entity is valid
    
if (is_valid_ent(ent))
    {
        
//get block type
        
new blockType entity_get_int(entEV_INT_body);
        
        
//if block is a type that can be rotated (a block without a sprite, makes it easier!)
        
if (isBlockTypeRotatable(blockType))
        {
            new 
Float:rgb[3];
            new 
Float:vAngles[3];
            new 
Float:vSizeMin[3];
            new 
Float:vSizeMax[3];
            static 
rotate[12];
            
            
//get block information 
            
entity_get_vector(entEV_VEC_anglesvAngles);
            
            
//create new block using current block information with new angles and sizes
            
if (vAngles[0] == 0.0 && vAngles[2] == 0.0)
            {
                
vAngles[0] = 90.0;
                
vSizeMin gfBlockSizeMinForX;
                
vSizeMax gfBlockSizeMaxForX;
            }
            else if (
vAngles[0] == 90.0 && vAngles[2] == 0.0)
            {
                
vAngles[0] = 90.0;
                
vAngles[2] = 90.0;
                
vSizeMin gfBlockSizeMinForY;
                
vSizeMax gfBlockSizeMaxForY;
            }
            else
            { 
                
vAngles gfDefaultBlockAngles;
                
vSizeMin gfBlockSizeMinForZ;
                
vSizeMax gfBlockSizeMaxForZ;
            }
            
            if (
get_pcvar_string(pcv_rotate,rotate,11))
            {
                
parse(rotate,vAngles[0],3,vAngles[1],3,vAngles[2],3);
                
rgb[0] = floatstr(vAngles[0]);
                
rgb[1] = floatstr(vAngles[1]);
                
rgb[2] = floatstr(vAngles[2]);
            }
            
            
entity_set_vector(entEV_VEC_anglesvAngles);
            
entity_set_size(entvSizeMinvSizeMax);
            
            return 
true;
        }
    }
    
    return 
false;


Last edited by mammapappa; 03-20-2011 at 16:18. Reason: bad info
mammapappa is offline
 



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 14:36.


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