GUI Skin Selection Menu

Started by EnForcer, Jul 06, 2020, 07:02 PM

Previous topic - Next topic

EnForcer

                                                                                    Credits :-
                                                                                                 -> EnForcer

                                                                                    GUI Skin Selection Menu


                                                                                            Server Side
[noae][noae]function onClientScriptData(player)
{
local string = Stream.ReadString(), int = Stream.ReadInt();
switch( int )
{


case 1:
player.Skin = 7;
break;

case 2:
player.Skin = 1;
break;

case 3:
player.Skin = 2;
break;

case 4:
player.Skin = 0;
break;

case 5:
player.Skin = 30;
break;

case 6:
player.Skin = 29;
break;

case 7:
player.Skin = 115;
break;

case 8:
player.Skin = 28;
break;
}
}
//////////test cmd which i used in video to get menu/////////////

else if(cmd == "test")
{
local data = Stream();
data.StartWrite( );
data.WriteInt(1);
data.SendStream( player );

}
[/noae][/noae]

                                                                                           Client Side
[noae][noae]
    skin <-
{
Skins = null
Skin1 = null
Skin2 = null
Skin3 = null
    Skin4 = null
    Skin5 = null
    Skin6 = null
    Skin7 = null
    Skin8 = null       
}

function skinnull()
{
    skin.Skins = null;
skin.Skin1 = null;
skin.Skin2 = null;
skin.Skin3 = null;
    skin.Skin4 = null;
    skin.Skin5 = null;
    skin.Skin6 = null;
    skin.Skin7 = null;
    skin.Skin8 = null;
    GUI.SetMouseEnabled( false );
}

function Server::ServerData(stream)
{
    local strint = stream.ReadInt();
    switch (strint.tointeger())
    {
        case 1: skinsgui(); break;
        case 2: skinnull(); break;
        }

}


function GUI::ElementClick( element, mouseX, mouseY )
{
        if (element == skin.Skin1)
    {
    local Datos = Stream();
    Datos.WriteString("skin1");
Datos.WriteInt(1);
    Server.SendData(Datos);
            skinnull();
}
else if (element == skin.Skin2)
    {
    local Datos = Stream();
    Datos.WriteString("skin2");
Datos.WriteInt(2);
    Server.SendData(Datos);
            skinnull();
    }

else if (element == skin.Skin3)
    {
    local Datos = Stream();
    Datos.WriteString("skin3");
Datos.WriteInt(3);
    Server.SendData(Datos);
            skinnull();
}
else if (element == skin.Skin4)
    {
    local Datos = Stream();
    Datos.WriteString("skin4");
Datos.WriteInt(4);
    Server.SendData(Datos);
    skinnull();
        }
else if (element == skin.Skin5)
    {
    local Datos = Stream();
    Datos.WriteString("skin5");
Datos.WriteInt(5);
    Server.SendData(Datos);
    skinnull();
        }
else if (element == skin.Skin6)
    {
    local Datos = Stream();
    Datos.WriteString("skin6");
Datos.WriteInt(6);
    Server.SendData(Datos);
    skinnull();
        }
else if (element == skin.Skin7)
    {
    local Datos = Stream();
    Datos.WriteString("skin7");
Datos.WriteInt(7);
    Server.SendData(Datos);
            skinnull();
}

        else if (element == skin.Skin8)
    {
    local Datos = Stream();
    Datos.WriteString("skin8");
Datos.WriteInt(8);
    Server.SendData(Datos);
            skinnull();
}
}


function GUI::ElementHoverOver(element)
{
switch( element )
{
case skin.Skin1:
skin.Skin1.Size.X-=5;
skin.Skin1.Size.Y-=5;
break;

case skin.Skin2:
skin.Skin2.Size.X-=5;
skin.Skin2.Size.Y-=5;
break;

case skin.Skin3:
skin.Skin3.Size.X-=5;
skin.Skin3.Size.Y-=5;
break;

case skin.Skin4:
skin.Skin4.Size.X-=5;
skin.Skin4.Size.Y-=5;
break;

case skin.Skin5:
skin.Skin5.Size.X-=5;
skin.Skin5.Size.Y-=5;
break;

case skin.Skin6:
skin.Skin6.Size.X-=5;
skin.Skin6.Size.Y-=5;
break;

case skin.Skin7:
skin.Skin7.Size.X-=5;
skin.Skin7.Size.Y-=5;
break;

case skin.Skin8:
skin.Skin8.Size.X-=5;
skin.Skin8.Size.Y-=5;
break;
}
}

    function GUI::ElementHoverOut(element)
{
switch( element )
{
case skin.Skin1:
skin.Skin1.Size.X+=5;
skin.Skin1.Size.Y+=5;
break;

case skin.Skin2:
skin.Skin2.Size.X+=5;
skin.Skin2.Size.Y+=5;
break;

case skin.Skin3:
skin.Skin3.Size.X+=5;
skin.Skin3.Size.Y+=5;
break;

case skin.Skin4:
skin.Skin4.Size.X+=5;
skin.Skin4.Size.Y+=5;
break;

case skin.Skin5:
skin.Skin5.Size.X+=5;
skin.Skin5.Size.Y+=5;
break;

case skin.Skin6:
skin.Skin6.Size.X+=5;
skin.Skin6.Size.Y+=5;
break;

case skin.Skin7:
skin.Skin7.Size.X+=5;
skin.Skin7.Size.Y+=5;
break;

case skin.Skin8:
skin.Skin8.Size.X+=5;
skin.Skin8.Size.Y+=5;
break;
}
}

function skinsgui()
{
   
skin.Skins = GUIWindow( VectorScreen( sX * 0.0896094, sY * 0.114583 ), VectorScreen( sX * 0.720000, sY * 0.794271 ), Colour( 255, 255, 255 ), "Select Skins" );
skin.Skins.TextColour = Colour( 255, 255, 255 );
skin.Skins.FontSize = 11;

skin.Skin1 = GUISprite( );
skin.Skin1.SetTexture( "skin1.png" );
skin.Skin1.Size = VectorScreen( sX * 0.15111, sY * 0.311111 );
skin.Skin1.Pos = VectorScreen( sX * 0.020, sY * 0.009 );

skin.Skin2 = GUISprite( );
skin.Skin2.SetTexture( "Police.png" );
skin.Skin2.Size = VectorScreen( sX * 0.15111, sY * 0.311111 );
skin.Skin2.Pos = VectorScreen( sX * 0.200, sY * 0.009 );

skin.Skin3 = GUISprite( );
skin.Skin3.SetTexture( "Swat.png" );
skin.Skin3.Size = VectorScreen( sX * 0.15111, sY * 0.311111 );
skin.Skin3.Pos = VectorScreen( sX * 0.380, sY * 0.009 );

skin.Skin4 = GUISprite( );
skin.Skin4.SetTexture( "Tommy.png" );
skin.Skin4.Size = VectorScreen( sX * 0.15111, sY * 0.311111 );
skin.Skin4.Pos = VectorScreen( sX * 0.550, sY * 0.009 );

skin.Skin5 = GUISprite( );
skin.Skin5.SetTexture( "black.png" );
skin.Skin5.Size = VectorScreen( sX * 0.15111, sY * 0.311111 );
skin.Skin5.Pos = VectorScreen( sX * 0.020, sY * 0.4 );

skin.Skin6 = GUISprite( );
skin.Skin6.SetTexture( "blue.png" );
skin.Skin6.Size = VectorScreen( sX * 0.15111, sY * 0.311111 );
skin.Skin6.Pos = VectorScreen( sX * 0.200, sY * 0.4 );

skin.Skin7 = GUISprite( );
skin.Skin7.SetTexture( "lance.png" );
skin.Skin7.Size = VectorScreen( sX * 0.15111, sY * 0.311111 );
skin.Skin7.Pos = VectorScreen( sX * 0.380, sY * 0.4 );

skin.Skin8 = GUISprite( );
skin.Skin8.SetTexture( "taxi.png" );
skin.Skin8.Size = VectorScreen( sX * 0.15111, sY * 0.311111 );
skin.Skin8.Pos = VectorScreen( sX * 0.550, sY * 0.4 );


skin.Skin1.AddFlags( GUI_FLAG_MOUSECTRL );
skin.Skin2.AddFlags( GUI_FLAG_MOUSECTRL );
skin.Skin3.AddFlags( GUI_FLAG_MOUSECTRL );
skin.Skin4.AddFlags( GUI_FLAG_MOUSECTRL );
skin.Skin5.AddFlags( GUI_FLAG_MOUSECTRL );
skin.Skin6.AddFlags( GUI_FLAG_MOUSECTRL );
skin.Skin7.AddFlags( GUI_FLAG_MOUSECTRL );
skin.Skin8.AddFlags( GUI_FLAG_MOUSECTRL );

skin.Skins.AddChild( skin.Skin1 );
skin.Skins.AddChild( skin.Skin2 );
skin.Skins.AddChild( skin.Skin3 );
skin.Skins.AddChild( skin.Skin4 );
skin.Skins.AddChild( skin.Skin5 );
skin.Skins.AddChild( skin.Skin6 );
skin.Skins.AddChild( skin.Skin7 );
skin.Skins.AddChild( skin.Skin8 );

GUI.SetMouseEnabled( true );
}

[/noae][/noae]

Sprites : https://www.mediafire.com/file/7u58mwr9gciufcz/sprites.rar/file
Just unrar sprites and paste in your server/store/sprites

                                                                                           How it looks

https://youtu.be/HRW7_pNh6IQ#