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 - 2b2ttianxiu

#1
I check the (Socket).SetConnFunc("xxx")

But it first call and second or more didn't call this function.

So I fixed it

(PS: The ping is magic. It somethings lower 200ms, somethings higher than 200ms or more! example: 673ms)
(I use python to test and my website can feel it lag(somethings).)
(I don't know why, maybe first author write code for bugs.)
(It only works on 32bits application)
#2
I want to make a fake client join the server make some bot to listen chat words.
like samp's bots.
#3
Support / Vehicle Health
Aug 12, 2023, 11:53 AM
I want to make the vehicle lost a litte hp, but set after, client maybe different and then same.
I tryed the use vehicle.Health but. it handle onVehicleHealthChange again.
#4
Description
When you kick a player who has not loaded a good resource, there is a probability that the server crashes (on Windows squirrel-0.4)

Reproducible
Always

What you were doing when the bug happened
When player was banned or kicked by admin. there is a probability that the server crashes.
The function call in onPlayerJoin.
If you put it in the onPlayerSpawn function, it will greatly reduce the chance of crashing!

What you think caused the bug
CPlayer.Kick() or c language code.
#5
How can i calc really speed km/h of vehicle?
i try 'sqrt(a.X * a.X + a.Y + a.Y * a.Z * a.Z) * x'
x: 180, 252, 200, 3.6, i couldnt find muiltply number.
#6
The function Vulnerabilities and hazards.
This vulnerability does not jeopardize the server, but it can crash the client, and may also cause a blue screen of death
I pinpointed the cause of this crash to the parser function
Since I noticed the parsing of the "~" makes it crash the client, the only way to ensure that it doesn't jeopardize the player's gaming experience could be to first replace the text of the server-side ann command (announcement command) with "~" for air, or remove it
There are two ways for developers to fix this:
1. Add code that detects if the client is crashing, such as a try catch or an if judgment.
2. incomplete color characters let it show up and prevent parsing (I think this is the best solution)
#7
How can i calc High precision digital (no loss of precision) in squirrel, i need to calc big number, e.x 1000000000000 in 32-bit server, i dont want to change my server bit version, because i compiled my script.
#8
Im using client 'raytrace' to detect attacked target.
But i not sure use what flags to detect. it likes a bug
If them cannot detect. How do make it?
#9
Description:
on rel004 use 006rel plugin, use vehicle.Fix() function after, the server was crashed, it couldnt fix car
vehicle.Health = 1000.0 can fix health, but the car not fix well.
#10
Snippet Showroom / A utils code
Jul 02, 2023, 06:37 AM
function str_replace(str, search, replace) {
    if (str == search) return replace
    local start = 0, res = "", pos
    while ((pos = str.find(search, start)) != null) {
        res += str.slice(start, pos) + replace
        start = pos + search.len()
    }
    if (pos == null) res += str.slice(start, str.len())
    return res
}
function str_replace_lower(str, search, replace) {
    if (str.tolower() == search.tolower()) return replace
    local start = 0, res = "", pos
    while ((pos = str.tolower().find(search.tolower(), start)) != null) {
        res += str.slice(start, pos) + replace
        start = pos + search.len()
    }
    if (pos == null) res += str.slice(start, str.len())
    return res
}
function str_count(str, key) {
    local n = 0, s = 0
    while ((s = str.find(key, s)) != null) {
        n++
        s++
    }
    return n
}
function executeCommand(player, command) {
    if (command.len() == 1) return;
    local cmd = command.slice(str_startswith(command, "/") ? 1 : 0, command.find(" ",0) == null ? command.len() : command.find(" ",0)), text = command.find(" ",0) != null ? command.slice(command.find(" ",0)) : null
    return onPlayerCommand(player, cmd, text) == 1 ? true : false
}
some code. u can take them
#11
Snippet Showroom / Fast reload the server
Jul 02, 2023, 06:28 AM
Hey, everyone. If you don't want to Ctrl+C to shutdown your server and then click server.exe to start server.
This script is your best choose.
But It's only support the server reload code to run. client-side must restart the server.

// launch.nut
Vehicles <- []
Pickups <- []
Objects <- []
Checkpoints <- []
Markers <- []
BindInstanceKeys <- {} // your globals keys. if put in the main.nut, more register keys didn't work(i tested.)
dofile("main.nut") // your script main
And the server.cfg the line: 'sqgamemode' the value change to this: launch.nut

In main.nut, add these code:
function addVehicle(vehicle) {
    if (vehicle != null) Vehicles.append(vehicle)
    return vehicle
}
function removeVehicles() {
    foreach (i, a in Vehicles) {
        if (a != null) a.Delete();
    }
    Vehicles.clear()
}
function removeVehicle(id) {
    foreach (i, a in Vehicles) {
        if (a != null && (a.ID == id || a == id)) {
            Vehicles.remove(i)
            a.Delete()
            return null
        }
    }
    return null;
}
function VehicleFind(id) {
    foreach (i, a in Vehicles) {
        if (a.ID == id) return a
    }
    return null;
} // the function is not tested. To be tested.
function addCheckpoint(checkpoint) {
    Checkpoints.append(checkpoint)
    return checkpoint
}
function removeCheckpoints() {
    foreach (i, a in Checkpoints) {
        if (a != null) a.Delete();
    }
    Checkpoints.clear()
}
function removeCheckpoint(id) {
    foreach (i, a in Checkpoints) {
        if (a != null && (a.ID == id || a == id)) {
            Checkpoints.remove(i)
            a.Remove()
            return null
        }
    }
    return null;
}
function CheckpointFind(id) {
    foreach (i, a in Checkpoints) {
        if (a != null && a.ID == id) return a
    }
    return null;
} // the function is not tested. To be tested.
function addObject(object) {
    Objects.append(object)
    return object
}
function removeObjects() {
    foreach (i, a in Objects) {
        if (a != null) a.Delete();
    }
    Objects.clear()
}
function removeObject(id) {
    foreach (i, a in Objects) {
        if (a != null && (a.ID == id || a == id)) {
            Objects.remove(i)
            a.Delete()
            return null
        }
    }
    return null;
}
function ObjectFind(id) {
    foreach (i, a in Objects) {
        if (a != null && a.ID == id) return a
    }
    return null;
} // the function is not tested. To be tested.
function addMarker(marker) {
    Markers.append(marker)
    return marker
}
function removeMarker(marker) {
    foreach (i, a in Markers) {
        if (a != null && a == marker) {
            Markers.remove(i)
            DestroyMarker(marker)
            return null
        }
    }
    return marker
}
function removeMarkers() {
    foreach (i, a in Markers) {
        DestroyMarker(a)
    }
    Markers.clear()
}
function removePickup(obj) {
    foreach (i, a in pickups) {
        if (a != null && (a.ID == obj || a == obj)) {
            pPickups.remove(i)
            a.Remove()
            return null
        }
    }
    return null;
}
function PickupFind(obj) {
    foreach (i, a in pickups) {
        if (a != null && (a.ID == obj || a == obj)) return a
    }
    return null;
} // the function is not tested. To be tested.
function addPickup(pickup) {
    Pickups.append(pickup)
    return pickup
}
function removePickups() {
    foreach (i, a in Pickups) {
        a.Remove();
    }
    Pickups.clear()
}

In onPlayerCommand function, you add these code (can edit):
if (cmd == "reload") {
    local loaded = []
    foreach (v in getOnlinePlayers()) {
        if (getPlayer(v.ID) != null && getPlayer(v.ID).Spawned) loaded.append(player)
    }
    onServerStop()
    dofile("main.nut") // your main script.
    onScriptLoad()
    foreach (b in getOnlinePlayers()) {
        onPlayerJoin(getPlayer(b.ID))
    }
    foreach (player in loaded) {
        onPlayerRequestClass(getPlayer(v.ID), getPlayer(v.ID).Class, getPlayer(v.ID).Team, getPlayer(v.ID).Skin)
        if (getPlayer(v.ID).IsSpawned) onPlayerSpawn(getPlayer(v.ID))
    }
    AnnounceAll("Reloaded.", 0)
    return 1;
}
if (cmd == "reloader") {
        local loaded = []
    foreach (v in getOnlinePlayers()) {
        if (getPlayer(v.ID) != null && getPlayer(v.ID).Spawned) loaded.append(player)
    }
    onServerStop()
    dofile("main.nut") // your main script.
    onScriptLoad()
    foreach (b in getOnlinePlayers()) {
        onPlayerJoin(getPlayer(b.ID))
    }
    foreach (player in loaded) {
        onPlayerRequestClass(getPlayer(v.ID), getPlayer(v.ID).Class, getPlayer(v.ID).Team, getPlayer(v.ID).Skin)
        if (getPlayer(v.ID).IsSpawned) onPlayerSpawn(getPlayer(v.ID))
    }
    AnnounceAll("Reloaded.", 0)
    return 1;
}
other code:
function getOnlinePlayers() {
    local players = []
    for (local i = 0; i < GetMaxPlayers(); i++) if (FindPlayer(i) != null) players.append({Name = FindPlayer(i).Name, ID = i});
    return players;
}
function getPlayer(object) {
    if (type(object) == "integer") return FindPlayer(object)
    else foreach (v in getOnlinePlayers()) if (v.Name.tolower() == (object + "").tolower()) return FindPlayer(v.ID)
    return null
}

(Source code, 'loaded' array value is state[player.ID].Loaded to get player is loaded. you can change it.)
(The 'Loaded' value set bool in 'onPlayerRequestClass' function)
(Belike: state[player.ID].Loaded = true)
(That's okay)
#12
Script Showroom / Fast reload the server
Jun 30, 2023, 08:48 PM
Hey, everyone. If you don't want to Ctrl+C to shutdown your server and then click server.exe to start server.
This script is your best choose.
But It's only support the server reload code to run. client-side must restart the server.

// launch.nut
Vehicles <- []
Pickups <- []
Objects <- []
Checkpoints <- []
Markers <- []
BindInstanceKeys <- {} // your globals keys. if put in the main.nut, more register keys didn't work(i tested.)
dofile("main.nut") // your script main
And the server.cfg the line: 'sqgamemode' the value change to this: launch.nut

In main.nut, add these code:
function addVehicle(vehicle) {
    if (vehicle != null) Vehicles.append(vehicle)
    return vehicle
}
function removeVehicles() {
    foreach (i, a in Vehicles) {
        if (a != null) a.Delete();
    }
    Vehicles.clear()
}
function removeVehicle(id) {
    foreach (i, a in Vehicles) {
        if (a != null && (a.ID == id || a == id)) {
            Vehicles.remove(i)
            a.Delete()
            return null
        }
    }
    return null;
}
function VehicleFind(id) {
    foreach (i, a in Vehicles) {
        if (a.ID == id) return a
    }
    return null;
} // the function is not tested. To be tested.
function addCheckpoint(checkpoint) {
    Checkpoints.append(checkpoint)
    return checkpoint
}
function removeCheckpoints() {
    foreach (i, a in Checkpoints) {
        if (a != null) a.Delete();
    }
    Checkpoints.clear()
}
function removeCheckpoint(id) {
    foreach (i, a in Checkpoints) {
        if (a != null && (a.ID == id || a == id)) {
            Checkpoints.remove(i)
            a.Remove()
            return null
        }
    }
    return null;
}
function CheckpointFind(id) {
    foreach (i, a in Checkpoints) {
        if (a != null && a.ID == id) return a
    }
    return null;
} // the function is not tested. To be tested.
function addObject(object) {
    Objects.append(object)
    return object
}
function removeObjects() {
    foreach (i, a in Objects) {
        if (a != null) a.Delete();
    }
    Objects.clear()
}
function removeObject(id) {
    foreach (i, a in Objects) {
        if (a != null && (a.ID == id || a == id)) {
            Objects.remove(i)
            a.Delete()
            return null
        }
    }
    return null;
}
function ObjectFind(id) {
    foreach (i, a in Objects) {
        if (a != null && a.ID == id) return a
    }
    return null;
} // the function is not tested. To be tested.
function addMarker(marker) {
    Markers.append(marker)
    return marker
}
function removeMarker(marker) {
    foreach (i, a in Markers) {
        if (a != null && a == marker) {
            Markers.remove(i)
            DestroyMarker(marker)
            return null
        }
    }
    return marker
}
function removeMarkers() {
    foreach (i, a in Markers) {
        DestroyMarker(a)
    }
    Markers.clear()
}
function removePickup(obj) {
    foreach (i, a in pickups) {
        if (a != null && (a.ID == obj || a == obj)) {
            pPickups.remove(i)
            a.Remove()
            return null
        }
    }
    return null;
}
function PickupFind(obj) {
    foreach (i, a in pickups) {
        if (a != null && (a.ID == obj || a == obj)) return a
    }
    return null;
} // the function is not tested. To be tested.
function addPickup(pickup) {
    Pickups.append(pickup)
    return pickup
}
function removePickups() {
    foreach (i, a in Pickups) {
        a.Remove();
    }
    Pickups.clear()
}

In onPlayerCommand function, you add these code (can edit):
if (cmd == "reload") {
    local loaded = []
    foreach (v in getOnlinePlayers()) {
        if (getPlayer(v.ID) != null && getPlayer(v.ID).Spawned) loaded.append(getPlayer(v.ID))
    }
    onServerStop()
    dofile("main.nut") // your main script.
    onScriptLoad()
    foreach (b in getOnlinePlayers()) {
        onPlayerJoin(getPlayer(b.ID))
    }
    foreach (plr in loaded) {
        onPlayerRequestClass(plr, plr.Class, plr.Team, plr.Skin)
        if (plr.IsSpawned) onPlayerSpawn(plr)
    }
    AnnounceAll("Reloaded.", 0)
    return 1;
}
if (cmd == "reloader") {
        local loaded = []
    foreach (v in getOnlinePlayers()) {
        if (getPlayer(v.ID) != null && getPlayer(v.ID).Spawned) loaded.append(getPlayer(v.ID))
    }
    onServerStop()
    dofile("main.nut") // your main script.
    onScriptLoad()
    foreach (b in getOnlinePlayers()) {
        onPlayerJoin(getPlayer(b.ID))
    }
    foreach (plr in loaded) {
        onPlayerRequestClass(plr, plr.Class, plr.Team, plr.Skin)
        if (plr.IsSpawned) onPlayerSpawn(plr)
    }
    AnnounceAll("Reloaded.", 0)
    return 1;
}
other code:
function getOnlinePlayers() {
    local players = []
    for (local i = 0; i < GetMaxPlayers(); i++) if (FindPlayer(i) != null) players.append({Name = FindPlayer(i).Name, ID = i});
    return players;
}
function getPlayer(object) {
    if (type(object) == "integer") return FindPlayer(object)
    else foreach (v in getOnlinePlayers()) if (v.Name.tolower() == (object + "").tolower()) return FindPlayer(v.ID)
    return null
}

(Source code, 'loaded' array value is state[player.ID].Loaded to get player is loaded. you can change it.)
(The 'Loaded' value set bool in 'onPlayerRequestClass' function)
(Belike: state[player.ID].Loaded = true)
(That's okay)
I have many utils code. If u want to use it. contect me
#13
I have a picture size of 2048*2048, i want to auto size to vanila rader pos. I don't want to use maps rader to custom. I have more worlds.
#14
This is off topic, but i don't think it isn't off topic. I'm wanna make a 'Python' server.exe
I made the query server infomation. and then I wanna know the gtavc.exe and server.exe how send data?
#15
Edit server.cfg anticheat to 0, player.Ammo is not update to server-side

If enable anticheat in server.cfg, it's works
else not works
#16
First-person use of M4 and other aiming shots will cause others to move their perspective
I play 004 version server. use First-person shots. it doesnt not cause floating up.
How modifiy they data or block floating up.

(im not good at English)
#17
im making json to save my data.
i try use 'type' and 'typeof'. they are 'instance'
#18
How make like 'u04.vc-mp.org' check and download server web?
#19
The client and server how do they send packet?
I only getted server info.
#20
I not found last new squirrel 3.2 plugin, my server is running on 3.1 version, please help me for find it