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

Feature Request Adding commands for change position of hats


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mickael002
Senior Member
Join Date: Jul 2010
Old 02-17-2013 , 12:44   Adding commands for change position of hats
Reply With Quote #1

Adding commands for getting position of hats
Simply commands for admin for change position of hat

Description :

The feature have 2 commands, one for the angle of hats (!store_ang) and one for the position of hats(!store_pos). When admin type the commands, he have a menu opened for change in live the position of hats. When he press a number of menu, i can see the new position in chat, now i can modified in "attrs" colunms the value of the position hats ang and angle in "phpmyadmin".


Screenshot :


( View Screenshot )


Scripting Code:
  • OnPluginStart

    PHP Code:
    RegAdminCmd("sm_storeang",    CmdAng,            ADMFLAG_ROOT,    "Brings up a menu allowing you to adjust the hat angles (affects all hats/players)." );
    RegAdminCmd("sm_storepos",    CmdPos,            ADMFLAG_ROOT,    "Brings up a menu allowing you to adjust the hat position (affects all hats/players)." ); 

  • The Core
    PHP Code:
    // ====================================================================================================
    //                    sm_hatang
    // ====================================================================================================
    public Action:CmdAng(clientargs)
    {
        
    ShowAngMenu(client);
        return 
    Plugin_Handled;
    }

    ShowAngMenu(client)
    {
        if( !
    IsValidClient(client) )
        {
            
    ReplyToCommand(client"%sYou do not have access to this command!"CHAT_TAG);
            return;
        }

        new 
    Handle:menu CreateMenu(AngMenuHandler);

        
    AddMenuItem(menu"""X + 10.0");
        
    AddMenuItem(menu"""Y + 10.0");
        
    AddMenuItem(menu"""Z + 10.0");
        
    AddMenuItem(menu"""");
        
    AddMenuItem(menu"""X - 10.0");
        
    AddMenuItem(menu"""Y - 10.0");
        
    AddMenuItem(menu"""Z - 10.0");

        
    SetMenuTitle(menu"Set hat angle.");
        
    SetMenuExitButton(menutrue);
        
    DisplayMenu(menuclientMENU_TIME_FOREVER);
    }

    public 
    AngMenuHandler(Handle:menuMenuAction:actionclientindex)
    {
        if( 
    action == MenuAction_End )
            
    CloseHandle(menu);
        if( 
    action == MenuAction_Cancel )
        {
            if( 
    index == MenuCancel_ExitBack )
                
    ShowAngMenu(client);
        }
        else if( 
    action == MenuAction_Select )
        {
            if( 
    IsValidClient(client) )
            {
                
    ShowAngMenu(client);

                new 
    Float:vAng[3], ent;
                for( new 
    1<= MaxClientsi++ )
                {
                    if( 
    IsValidClient(i) )
                    {
                        
    ent g_iHatIndex[i];
                        if( 
    ent && EntRefToEntIndex(ent) != INVALID_ENT_REFERENCE )
                        {
                            
    GetEntPropVector(entProp_Send"m_angRotation"vAng);
                            if( 
    index == vAng[0] += 10.0;
                            else if( 
    index == vAng[1] += 10.0;
                            else if( 
    index == vAng[2] += 10.0;
                            else if( 
    index == vAng[0] -= 10.0;
                            else if( 
    index == vAng[1] -= 10.0;
                            else if( 
    index == vAng[2] -= 10.0;
                            
    TeleportEntity(entNULL_VECTORvAngNULL_VECTOR);
                        }
                    }
                }
                
    PrintToChat(client"%sNew hat origin: %f %f %f"CHAT_TAGvAng[0], vAng[1], vAng[2]);
            }
        }
    }

    // ====================================================================================================
    //                    sm_hatpos
    // ====================================================================================================
    public Action:CmdPos(clientargs)
    {
        
    ShowPosMenu(client);
        return 
    Plugin_Handled;
    }

    ShowPosMenu(client)
    {
        if( !
    IsValidClient(client) )
        {
            
    ReplyToCommand(client"%sYou do not have access to this command!"CHAT_TAG);
            return;
        }

        new 
    Handle:menu CreateMenu(PosMenuHandler);

        
    AddMenuItem(menu"""X + 0.5");
        
    AddMenuItem(menu"""Y + 0.5");
        
    AddMenuItem(menu"""Z + 0.5");
        
    AddMenuItem(menu"""");
        
    AddMenuItem(menu"""X - 0.5");
        
    AddMenuItem(menu"""Y - 0.5");
        
    AddMenuItem(menu"""Z - 0.5");

        
    SetMenuTitle(menu"Set hat position.");
        
    SetMenuExitButton(menutrue);
        
    DisplayMenu(menuclientMENU_TIME_FOREVER);
    }

    public 
    PosMenuHandler(Handle:menuMenuAction:actionclientindex)
    {
        if( 
    action == MenuAction_End )
            
    CloseHandle(menu);
        if( 
    action == MenuAction_Cancel )
        {
            if( 
    index == MenuCancel_ExitBack )
                
    ShowPosMenu(client);
        }
        else if( 
    action == MenuAction_Select )
        {
            if( 
    IsValidClient(client) )
            {
                
    ShowPosMenu(client);

                new 
    Float:vPos[3], ent;
                for( new 
    1<= MaxClientsi++ )
                {
                    if( 
    IsValidClient(i) )
                    {
                        
    ent g_iHatIndex[i];
                        if( 
    ent && EntRefToEntIndex(ent) != INVALID_ENT_REFERENCE )
                        {
                            
    GetEntPropVector(entProp_Send"m_vecOrigin"vPos);
                            if( 
    index == vPos[0] += 0.5;
                            else if( 
    index == vPos[1] += 0.5;
                            else if( 
    index == vPos[2] += 0.5;
                            else if( 
    index == vPos[0] -= 0.5;
                            else if( 
    index == vPos[1] -= 0.5;
                            else if( 
    index == vPos[2] -= 0.5;
                            
    TeleportEntity(entvPosNULL_VECTORNULL_VECTOR);
                        }
                    }
                }
                
    PrintToChat(client"%sNew hat origin: %f %f %f"CHAT_TAGvPos[0], vPos[1], vPos[2]);
            }
        }

__________________

Last edited by mickael002; 02-17-2013 at 12:48.
mickael002 is offline
vodka00
Veteran Member
Join Date: Jun 2012
Location: Los Angeles
Old 02-17-2013 , 16:16   Re: Adding commands for change position of hats
Reply With Quote #2

Wow, awesome! This will be very useful.

edit: Would be much better if specific items could be moved, and much better if it's possible to do for specific models too.
__________________
cw main:

cw speedruns:

Last edited by vodka00; 02-17-2013 at 20:15.
vodka00 is offline
Mantux
Junior Member
Join Date: Jan 2013
Location: Allgäu Germany
Old 02-17-2013 , 22:47   Re: Adding commands for change position of hats
Reply With Quote #3

YOU SAVED MY DAY!!! +++KARMA i was banging with my head into a wall getting crazy with cs:go forward bone, you are my hero!

ahhh y, cant compile it allways get errors, can someone help about building this into right sp?

i have tried with includes from store and hats :/

//// hats_controll.sp
// hats_controll.sp(20) : error 017: undefined symbol "IsValidClient"
// hats_controll.sp(22) : error 017: undefined symbol "CHAT_TAG"
// hats_controll.sp(52) : error 017: undefined symbol "IsValidClient"
// hats_controll.sp(59) : error 017: undefined symbol "IsValidClient"
// hats_controll.sp(61) : error 017: undefined symbol "g_iHatIndex"
// hats_controll.sp(61) : warning 215: expression has no effect
// hats_controll.sp(61) : error 001: expected token: ";", but found "]"
// hats_controll.sp(61) : error 029: invalid expression, assumed zero
// hats_controll.sp(61) : fatal error 127: too many error messages on one line
Attached Files
File Type: sp Get Plugin or Get Source (hats_controll.sp - 206 views - 5.2 KB)

Last edited by Mantux; 02-18-2013 at 08:54. Reason: error code
Mantux is offline
mickael002
Senior Member
Join Date: Jul 2010
Old 02-18-2013 , 09:31   Re: Adding commands for change position of hats
Reply With Quote #4

Mantux its just a code for helping alongub not for compil alone.

The is part of the plugin from Silvers.

You can see the full code here.
__________________
mickael002 is offline
alongub
Veteran Member
Join Date: Aug 2009
Location: Israel
Old 02-20-2013 , 19:56   Re: Adding commands for change position of hats
Reply With Quote #5

I've started working on it here:
https://github.com/alongubkin/store-...ae3678ea76eede

Most of the functionality is ready (everything except angles editing), but it needs way more testing (still very buggy).

I have also added the Store_GetItemAttributes and Store_WriteItemAttributes APIs to store-backend because I needed them for the editor.
https://github.com/alongubkin/store/...4bd26370a439ba
__________________

Last edited by alongub; 02-20-2013 at 20:01.
alongub 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 06:18.


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