Menu

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.

Show posts Menu

Topics - PSL

#1
I want to print the font in green color, what should I do?
#2
I have a module here, in the single game can open cannons and can fire machine guns, you can only cannons in the server, can you help me to see what is the reason, this is xml。

<?xml version="1.0" encoding="ASCII"?>
<vehicle>
    <basic>
        <type>car</type>
        <name>NASCAR 48</name>
        <anims>null</anims>
        <comprules>20479</comprules>
        <extraflags>40</extraflags>
        <wheelmodel>249</wheelmodel>
        <wheelscale>0.870000</wheelscale>
        <immunity>255</immunity>
    </basic>

    <aidata>
        <class>ignore</class>
        <freq>10</freq>
        <level>7</level>
    </aidata>

    <colors>
        <carcol>7,53</carcol>
        <carcol>3,40</carcol>
        <carcol>35,53</carcol>
        <carcol>40,75</carcol>
        <carcol>42,2</carcol>
        <carcol>46,6</carcol>
    </colors>

    <audio>
        <enginefarsample>274</enginefarsample>
        <enginenearsample>10</enginenearsample>
        <hornsample>0</hornsample>
        <hornfreq>26513</hornfreq>
        <sirensample>0</sirensample>
        <sirenfreq>9600</sirenfreq>
        <doorsounds>1</doorsounds>
    </audio>

    <handling>
        <mass>1600000.000000</mass>
        <percentsubmerged>-1</percentsubmerged>
        <steeringlock>28.000000</steeringlock>
        <seatoffset>0.600000</seatoffset>
        <damagemultiplier>-0.300000</damagemultiplier>
        <value>90000</value>
        <flags>0000A181</flags>

        <dimensions>
            <x>2.000000</x>
            <y>4.500000</y>
            <z>1.500000</z>
        </dimensions>

        <centreofmass>
            <x>0.000000</x>
            <y>0.000000</y>
            <z>-1.00000</z>
        </centreofmass>

        <traction>
            <multiplier>1.500000</multiplier>
            <loss>0.700000</loss>
            <bias>0.500000</bias>
        </traction>

        <transmission>
            <numofgears>5</numofgears>
            <maxspeed>300.000000</maxspeed>
            <acceleration>50.000000</acceleration>
            <drivetype>4</drivetype>
            <enginetype>P</enginetype>
        </transmission>

        <brakes>
            <deceleration>30.000000</deceleration>
            <bias>0.480000</bias>
            <abs>0</abs>
        </brakes>

        <suspension>
            <forcelevel>1.000000</forcelevel>
            <dampening>0.100000</dampening>
            <upperlimit>0.250000</upperlimit>
            <lowerlimit>-0.100000</lowerlimit>
            <bias>0.500000</bias>
            <antidive>0.500000</antidive>
        </suspension>

        <lights>
            <front>1</front>
            <rear>1</rear>
        </lights>
    </handling>

    <weaponlist>
        <weapon>
            <type>machinegun</type>
            <model>none</model>
           
            <hotkeys>
                <dockkey>0,0,0</dockkey>
                <moveupkey>0,0,0</moveupkey>
                <movedownkey>0,0,0</movedownkey>
                <restorekey>0,0,0</restorekey>
                <shootkey>16,16,16</shootkey>
            </hotkeys>
           
            <fireoffset>
                <x>0.5</x>
                <y>0.0</y>
                <z>-0.9</z>
            </fireoffset>

            <armedinfo>
                <movespeed>0</movespeed>
                <middlepos>0.5</middlepos>
           
                <minpos>
                    <x>0.58</x>
                    <y>0.4</y>
                    <z>0.3</z>
                </minpos>
               
                <minrot>
                    <x>-1.57</x>
                    <y>0.0</y>
                    <z>1.57</z>
                </minrot>
            </armedinfo>
        </weapon>

        <weapon>
            <type>machinegun</type>
            <model>none</model>
           
            <hotkeys>
                <dockkey>0,0,0</dockkey>
                <moveupkey>0,0,0</moveupkey>
                <movedownkey>0,0,0</movedownkey>
                <restorekey>0,0,0</restorekey>
                <shootkey>16,16,16</shootkey>
            </hotkeys>
           
            <fireoffset>
                <x>0.5</x>
                <y>0.0</y>
                <z>0.2</z>
            </fireoffset>

            <armedinfo>
                <movespeed>0</movespeed>
                <middlepos>0.5</middlepos>
           
                <minpos>
                    <x>-1.28</x>
                    <y>0.4</y>
                    <z>0.3</z>
                </minpos>
               
                <minrot>
                    <x>-1.57</x>
                    <y>0.0</y>
                    <z>1.57</z>
                </minrot>
            </armedinfo>
        </weapon>

        <weapon>
            <type>machinegun</type>
            <model>none</model>
           
            <hotkeys>
                <dockkey>0,0,0</dockkey>
                <moveupkey>0,0,0</moveupkey>
                <movedownkey>0,0,0</movedownkey>
                <restorekey>0,0,0</restorekey>
                <shootkey>16,16,16</shootkey>
            </hotkeys>
           
            <fireoffset>
                <x>0.5</x>
                <y>0.0</y>
                <z>0.2</z>
            </fireoffset>

            <armedinfo>
                <movespeed>0</movespeed>
                <middlepos>0.5</middlepos>
           
                <minpos>
                    <x>-0.3</x>
                    <y>0</y>
                    <z>0.85</z>
                </minpos>
               
                <minrot>
                    <x>-1.57</x>
                    <y>0.0</y>
                    <z>1.57</z>
                </minrot>
            </armedinfo>
        </weapon>

        <weapon>
            <type>machinegun</type>
            <model>none</model>
           
            <hotkeys>
                <dockkey>0,0,0</dockkey>
                <moveupkey>0,0,0</moveupkey>
                <movedownkey>0,0,0</movedownkey>
                <restorekey>0,0,0</restorekey>
                <shootkey>16,16,16</shootkey>
            </hotkeys>
           
            <fireoffset>
                <x>0.5</x>
                <y>0.0</y>
                <z>0.2</z>
            </fireoffset>

            <armedinfo>
                <movespeed>0</movespeed>
                <middlepos>0.5</middlepos>
           
                <minpos>
                    <x>0.7</x>
                    <y>0</y>
                    <z>0.85</z>
                </minpos>
               
                <minrot>
                    <x>-1.57</x>
                    <y>0.0</y>
                    <z>1.57</z>
                </minrot>
            </armedinfo>
        </weapon>
    </weaponlist>
</vehicle>
#3
Snippet Showroom / Player Vertical Angle
May 29, 2023, 11:18 AM
This client function returns the player's horizontal and vertical angles.
It is used as GetAngle("x"); , returns the same value as player.Angle, and a GetAngle("y"); ", returns the player's vertical Angle. One drawback is that when the player is facing in a positive east-west direction, it is impossible to calculate.

function GetAngle(m)
{
    local angle;
    local a=GUI.ScreenPosToWorld(Vector(GUI.GetScreenSize().X/2,GUI.GetScreenSize().Y/2,1));
    local b=GUI.ScreenPosToWorld(Vector(GUI.GetScreenSize().X/2,GUI.GetScreenSize().Y/2,-1));

    if(m=="x") angle=-atan2(a.X-b.X,a.Y-b.Y);
    if(m=="y") angle=-atan2(b.Y-a.Y,a.Z-b.Z);

    angle=(angle*100).tointeger();
    angle=angle.tofloat()*0.01;
    return angle;
}
#4
How do I disable crouching, I've tried a lot of things like actions, skins, weapon Settings, and it doesn't work very well, my current solution is to modify the firing motion of the weapon, but I want to do it better, like the crouching button doesn't exist.
#5
Client Scripting / Progress bar speedometer
Mar 18, 2023, 08:36 AM
I'm going to bring you a simple, segmented speedometer.You can set the maximum value to adjust the speed limit.It has fade in, fade out, and shake effects.The code has been tested on a blank server and works perfectly.

// ====Server side====
enum StreamType
{
    EnterVehicle=0x01
    ExitVehicle=0x02
}

function onPlayerEnterVehicle(player,vehicle,door)
{
    SendDataToClient(player,StreamType.EnterVehicle,vehicle.ID);
}

function onPlayerExitVehicle(player,vehicle)
{
    SendDataToClient(player,StreamType.ExitVehicle);
}

function SendDataToClient(player,...)
{
    if(vargv[0])
    {
        local byte=vargv[0],len=vargv.len();
        if(1>len) devprint("ToClent <"+byte+"> No params specified.");
        else
        {
            Stream.StartWrite();
            Stream.WriteByte(byte);

            for(local i=1;i<len;i++)
            {
                switch(typeof(vargv[i]))
                {
                    case "integer": Stream.WriteInt(vargv[i]); break;
                    case "string": Stream.WriteString(vargv[i]); break;
                    case "float": Stream.WriteFloat(vargv[i]); break;
                }
            }
           
            if(player==null) Stream.SendStream(null);
            else if(typeof(player)=="instance") Stream.SendStream(player);
            else devprint("ToClient <"+byte+"> Player is not online.");
        }
    }
    else devprint("ToClient: Even the byte wasn't specified...");
}

// ====Client side====
local speedbar1=null;
local speedbar2=null;
local speedtext=null;
local speedveh=null;
local speedalpha=0;

function Script::ScriptLoad()
{
    speedbar1=GUIProgressBar();
    speedbar1.Pos=VectorScreen(GetProportion(1635,"x"),GetProportion(290,"y"));
    speedbar1.Size=VectorScreen(GetProportion(175,"x"),GetProportion(25,"y"));
    speedbar1.StartColour=Colour(255,0,0,255);
    speedbar1.EndColour=Colour(0,255,0,255);
    speedbar1.MaxValue=750;
    speedbar1.Value=750;
    speedbar1.Thickness=GetProportion(2,"y");
    speedbar1.BackgroundShade=0.75;
    speedbar1.Alpha=0;
    speedbar1.RemoveFlags(GUI_FLAG_VISIBLE|GUI_FLAG_BACKGROUND);

    speedbar2=GUIProgressBar();
    speedbar2.Pos=VectorScreen(GetProportion(1635,"x"),GetProportion(325,"y"));
    speedbar2.Size=VectorScreen(GetProportion(175,"x"),GetProportion(25,"y"));
    speedbar2.StartColour=Colour(0,128,255,255);
    speedbar2.EndColour=Colour(255,0,255,255);
    speedbar2.MaxValue=200;
    speedbar2.Value=1;
    speedbar2.Thickness=GetProportion(2,"y");
    speedbar1.BackgroundShade=0.75;
    speedbar2.Alpha=0;
    speedbar2.RemoveFlags(GUI_FLAG_VISIBLE|GUI_FLAG_BACKGROUND);

    speedtext=GUILabel();
    speedtext.Text="xxxxxxxx";
    speedtext.TextColour=Colour(255,255,255,255);
    speedtext.FontName="Helvetica";
    speedtext.FontSize=GetProportion(20,"y");
    speedtext.Pos=VectorScreen(0,GetProportion(25,"y"));
    speedtext.TextAlignment=GUI_ALIGN_LEFT|GUI_ALIGN_TOP;
    speedtext.FontFlags=GUI_FFLAG_BOLD;
    speedtext.Text=""+(speedbar2.Value-1)+" Km/h";
    speedtext.Alpha=0;
    speedtext.RemoveFlags(GUI_FLAG_VISIBLE);

    speedbar2.AddChild(speedtext);
}

function Script::ScriptProcess()
{
    if(speedveh!=null)
    {
        if(speedalpha<255)
        {
            speedalpha+=5;
            speedbar1.Alpha=speedalpha;
            speedbar2.Alpha=speedalpha;
            speedtext.Alpha=speedalpha;
        }

        local speed=((speedveh.Speed.X*speedveh.Speed.X)+(speedveh.Speed.Y*speedveh.Speed.Y)+(speedveh.Speed.Z*speedveh.Speed.Z))*100;
        local a=speed-speedbar2.Value.tointeger();
        if(speedbar2.Value!=speed)
        {   speedbar2.Value=speedbar2.Value+a*0.1;
            speedtext.Text=""+speedbar2.Value.tointeger()+" Km/h";
        }

        local hp=speedveh.Health.tointeger()-250;
        local a=speedbar1.Value.tointeger()-hp;
        if(speedbar1.Value!=speedveh.Health.tointeger()-250) speedbar1.Value=speedbar1.Value-a*0.1;

        if(speed>speedbar2.MaxValue) speedtext.TextColour=Colour(255,0,0,255);
        else speedtext.TextColour=Colour(255,255,255,255);

        if(speed>=25)
        {
            local a=random(-2,2);
            local b=random(-2,2);
            local c=5;
           
            if(speedbar1.Pos.X+a>=1635-c&&speedbar1.Pos.X+a<=1635+c) speedbar1.Pos.X+=a;
            if(speedbar1.Pos.Y+b>=290-c&&speedbar1.Pos.Y+b<=290+c) speedbar1.Pos.Y+=b;
            if(speedbar2.Pos.X+a>=1635-c&&speedbar2.Pos.X+a<=1635+c) speedbar2.Pos.X+=a;
            if(speedbar2.Pos.Y+b>=325-c&&speedbar2.Pos.Y+b<=325+c) speedbar2.Pos.Y+=b;
        }
    }
    else
    {
        if(speedalpha>0)
        {
            speedalpha-=5;
            speedbar1.Alpha=speedalpha;
            speedbar2.Alpha=speedalpha;
            speedtext.Alpha=speedalpha;
        }
        else
        {
            speedbar1.RemoveFlags(GUI_FLAG_VISIBLE);
            speedbar2.RemoveFlags(GUI_FLAG_VISIBLE);
            speedtext.RemoveFlags(GUI_FLAG_VISIBLE);
        }
    }
}

function Server::ServerData(stream)
{
    local type=stream.ReadByte();
    switch(type)
    {
        case 0x01:
        {
            local id=stream.ReadInt();
            speedveh=World.FindVehicle(id);
            speedbar1.AddFlags(GUI_FLAG_VISIBLE);
            speedbar2.AddFlags(GUI_FLAG_VISIBLE);
            speedtext.AddFlags(GUI_FLAG_VISIBLE);
        }
        break;

        case 0x02:
        {
            speedveh=null;
        }
        break;
    }
}

function GUI::GameResize(width,height)
{
    speedbar1.Pos=VectorScreen(GetProportion(1635,"x"),GetProportion(290,"y"));
    speedbar1.Size=VectorScreen(GetProportion(175,"x"),GetProportion(25,"y"));
    speedbar1.Thickness=GetProportion(2,"y");
    speedbar2.Pos=VectorScreen(GetProportion(1635,"x"),GetProportion(325,"y"));
    speedbar2.Size=VectorScreen(GetProportion(175,"x"),GetProportion(25,"y"));
    speedbar2.Thickness=GetProportion(2,"y");
    speedtext.FontSize=GetProportion(20,"y");
    speedtext.Pos=VectorScreen(0,GetProportion(25,"y"));
}

function GetProportion(a,b)
{
    local x=GUI.GetScreenSize().X,y=GUI.GetScreenSize().Y;
    if(b=="x")
    {
        a=(a.tofloat()*x.tofloat())/1920;
        local c=x.tofloat()*(a.tofloat()/x.tofloat());
        return c.tointeger();
    }

    if(b=="y")
    {
        a=(a.tofloat()*y.tofloat())/1080;
        local c=y.tofloat()*(a.tofloat()/y.tofloat());
        return c.tointeger();
    }
}

function random(start,finish)
{
    local r=((rand() % (finish-start))+start);
    return r;
}
#6
Script Showroom / Server Builder
Jan 12, 2023, 09:20 AM
I had a good idea, so I did it, in my continuous testing, no bug happened.
This script helps you create maps, vehicles, pickups, and checkpoints and you can export the code.
There is a manual in it, my English is not good, there may be some grammar problems.
Download address of the server: https://www107.zippyshare.com/v/f6yh7gqq/file.html

#7
General Discussion / Report pirated servers
Nov 06, 2022, 10:33 AM
My favorite server is pirated,I may not tolerate such a thing。See the main list with multiple pirate servers and more people playing。These are the IP addresses of the two pirate servers: 61.136.162.163:8100。By some means, they obtained the server's script file and started the service under their name。
This is the IP address of the genuine server: 182.61.50.31:8100, and the author of the server is KL。I'm a server writer myself, and I don't want someone stealing my scripts and publishing them。Instead of apologizing to KL, they repeatedly showed off the scripts they had obtained。So I had to ask the administrator to ban their server IP from the master list。