AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   rotating by cvar (https://forums.alliedmods.net/showthread.php?t=153247)

mammapappa 03-20-2011 15:33

rotating by cvar
 
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;




All times are GMT -4. The time now is 14:36.

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