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

Messages - PSL

#106
I changed the shotgun data, changing the firing action to standing fire! SetWeaponDataValue(19,24,0);
#107
The problem has been solved. Thank you all for your help.
#108
Script Showroom / Re: Server Builder
Apr 29, 2023, 03:06 AM
Here's the link to the update: https://pixeldrain.com/u/7kSYsbLk
This script mainly creates maps and hope you can have a good time.
#109
I've tried. I've never been the same as lw,Thanks for your advice
#110
The password for this key is 256,288. My return false does not disable these keys
#111
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.
#112
https://i.postimg.cc/g0RchsLh/1.png
Ha ha, I forgot, this is the rendering
#113
Your code is very useful.  I can control buildings more easily and directly.All in all, well done
#114
Snippet Showroom / Re: Open IMG files
Mar 18, 2023, 02:02 PM
This feature is very powerful, thank you very much for sharing, but I know the ID of the buildings in the game, but how to get their names so I can shoot the buildings directly and export the model.
#115
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;
}
#116
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

#117
Let me show you a piece of code and hope this helps you.
//The server sends hello to the client
local stream=Stream();
stream.StartWrite();
stream.WriteString("hello");
stream.SendStream(player);

//The client accepts it and prints it
function Server::ServerData( stream )
{
     local string=stream.ReadString();
     Console.Print(string);
}
#118
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。
#119
function onPickupPickedUp( player, pickup )
{
  if( pickup.Model == 366 ) 
{
if(player.Cash < 500) MessagePlayer("[#00cc00] Need enough money!",player);
else if(player.GetWeaponAtSlot(4)==10) MessagePlayer("[#00cc00] It's a weapon you already have!",player);
else{
 player.SetWeapon( 10, 999 );
MessagePlayer(" You got a Pump-Shotgun",player);
}
}

This link may help you: http://wiki.adtec.ovh/wiki/Scripting/Squirrel/Functions/Player.GetWeaponAtSlot
#120
This function should help you:
Put the GiveCash(player.ID); in onPlayerJoin.
function GiveCash(ID)
{
    local player=FindPlayer(ID);
    if(player)
    {
        player.Cash+=500;
        NewTimer("GiveCash",900000,1,player.ID);
    }
}