Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - EnForcer
1
Snippet Showroom / In Game AddClass with /addclass with Database
« on September 18th, 2020, 04:46 PM »
In Game addclass via cmd with Database
Credits: EnForcer


Commands: /addclass <Team ID> <R> <G> <B> <Skin ID>


Extra Note: If you encounter any bug, inform me here or on discord my ID : iNForSir#7490

Paste it in onscriptload
Code: [Select]
db <- ConnectSQL( "Classes.db" );
QuerySQL(db, "CREATE TABLE IF NOT EXISTS Creation ( Team NUMERIC, Skin NUMERIC, X NUMERIC, Y NUMERIC, Z NUMERIC, R NUMERIC, G NUMERIC, B NUMERIC, Angle NUMERIC)" );
LoadClass();

Function to Loadclass
Code: [Select]
function LoadClass()
{
local q = QuerySQL( db, "SELECT * FROM Creation" ), i = 0;
while( GetSQLColumnData( q, 0 ) )
{
local
Team= GetSQLColumnData( q, 0 ),
Skin= GetSQLColumnData( q, 1 ),
X= GetSQLColumnData( q, 2 ),
Y= GetSQLColumnData( q, 3 ),
Z= GetSQLColumnData( q, 4 ),
R= GetSQLColumnData( q, 5 ),
G= GetSQLColumnData( q, 6 ),
B= GetSQLColumnData( q, 7 ),
Angle= GetSQLColumnData( q, 8 );
AddClass( Team, RGB( R,G,B ), Skin, Vector( X,Y,Z ), Angle, 21, 999 ,1, 1, 25, 255 );
GetSQLNextRow( q );
i++;
}
print("Class Count ("+i+")");
return 0;
}

Paste it in onplayercommand
Code: [Select]

else if (cmd=="addclass")
{
if ( !player.IsSpawned ) MessagePlayer( "[#ff0000][Error] - [#ffffff]You need be spawned to use this command.", player );
else if( !text ) MessagePlayer( "[#ff0000][Error] - [#ffffff]Use /"+cmd+" <Team ID> <R> <G> <B> <Skin ID>.", player);
else {
local TeamID = GetTok( text, " ", 1 );
local R = GetTok( text, " ", 2 );
local G = GetTok( text, " ", 3 );
local B = GetTok( text, " ", 4 );
local SkinID = GetTok( text, " ", 5 );
if (!IsNum(TeamID)) MessagePlayer( "[#ff0000][Error] - [#ffffff]Use /"+cmd+" <Team ID> <R> <G> <B> <Skin ID>.", player);
else if ( !IsNum(R)) MessagePlayer( "[#ff0000][Error] - [#ffffff]Use /"+cmd+" <Team ID> <R> <G> <B> <Skin ID>.", player);
else if ( !IsNum(G)) MessagePlayer( "[#ff0000][Error] - [#ffffff]Use /"+cmd+" <Team ID> <R> <G> <B> <Skin ID>.", player);
else if ( !IsNum(B)) MessagePlayer( "[#ff0000][Error] - [#ffffff]Use /"+cmd+" <Team ID> <R> <G> <B> <Skin ID>.", player);
else if ( !IsNum(SkinID)) MessagePlayer( "[#ff0000][Error] - [#ffffff]Use /"+cmd+" <Team ID> <R> <G> <B> <Skin ID>.", player);
else if ( ( !TeamID ) || ( !R ) || (!G ) || ( !B ) || ( !SkinID ) ) MessagePlayer( "[#ff0000][Error] - [#ffffff]Use /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>.", player);
else {
QuerySQL( db, "INSERT INTO Creation ( Team, Skin, R, G, B, X, Y, Z, Angle ) VALUES ( '"+TeamID+"', '"+SkinID+"', '"+R+"', '"+G+"', '"+B+"', '"+player.Pos.x+"', '"+player.Pos.y+"', '"+player.Pos.z+"', '"+player.Angle+"' )" );
AddClass( TeamID.tointeger(), RGB( R.tointeger(), G.tointeger(), B.tointeger() ) ,SkinID.tointeger(), player.Pos, player.Angle, 22, 999 ,17, 100, 21, 245 );
Message( "[#FFFFFF]Admin [#FF0000]"+player.Name+" [#FFFFFF]Has added a new Class." );
     }
     }
return 0;
}

else if ( cmd == "removeclass" )
    {
if ( !text ) MessagePlayer( "[#ff0000][Error] - [#ffffff]Use /"+cmd+" <Skin ID>.", player);
else if (!IsNum(text)) MessagePlayer( "[#ff0000][Error] - [#ffffff]Skin ID must be in numbers.", player);
else {   
local q = QuerySQL( db, "SELECT * FROM Creation WHERE Skin='"+text+"'" );
if ( !q ) MessagePlayer( "[#ff0000][Error] - [#ffffff]Skin ID "+text+" not found in class.", player );
else {
QuerySQL( db, "DELETE FROM Creation WHERE Skin='"+text+"'" );
Message( "[#FFFFFF]Admin [#FF0000]"+player.Name+" [#FFFFFF]Has removed Class." );
     }
     }
return 0;
}
2
Servers / [0.4] Arbiter's Official Server
« on August 24th, 2020, 06:27 PM »
>>>>>>>>>>>>>>>>>>>Server Information: <<<<<<<<<<<<<<<<<<<
Server Name: [0.4] Arbiter's Official Server
Server IP: 152.89.245.140:8194
Players Slots: 50
Gamemode: Dm / FreeRoam
Scripter & Developer: EnForcer.
Discord: Click here!
>>>>>>>>>>>>>>>>>>>>>Server Features: <<<<<<<<<<<<<<<<<<<<<
- Custom Vehicles
- Clan System
- Manual Eventing System
- Auto Event System
- /Parkour
- /carzone ( Freeroam )
- Team Deathmatch ( Red vs Blue)
- New Time Cycle
- Title System
- Ranking System
- RTV Minigame ( Under Construction )
3
Client Scripting / GUI Skin Selection Menu
« on July 6th, 2020, 08:02 PM »
                                                                                    Credits :-
                                                                                                 -> EnForcer

                                                                                    GUI Skin Selection Menu


                                                                                            Server Side
Code: [Select]
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 );

}


                                                                                           Client Side
Code: [Select]

    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 );
}



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#