Pycckue-Bnepeg / samp-cef

Client and server plugins for SA:MP to embed CEF.
GNU General Public License v3.0
100 stars 46 forks source link

Emit in timer #9

Open Rams25 opened 2 years ago

Rams25 commented 2 years ago

Hi, multiple emits in timer (350ms) crash the cef, is for speedometer, any idea please ?

Thanks.

Pycckue-Bnepeg commented 2 years ago

some code?

Rams25 commented 2 years ago

{
    new vehicleid = GetPlayerVehicleID(playerid);
    if (vehicleid)
    {
        /*if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            for(new i; i != MAX_SPIKE; i++)
            {
                if (SpikeInfo[i][sCreated] == 0 || !IsPlayerInRangeOfPoint(playerid, 3.5, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))
                    continue;

                new panels, doorsd, lightsf, tires;
                GetVehicleDamageStatus(vehicleid, panels, doorsd, lightsf, tires);
                UpdateVehicleDamageStatus(vehicleid, panels, doorsd, lightsf, 15);
                break;
            }
        }*/

        if (IsABicycle(vehicleid)) return 1;

        new string[128], 
            kmh = GetVehicleSpeed(vehicleid),
            vfuel = floatround(VehicleInfo[vehicleid][carFuel]/GetVehicleFuelCapacity(GetVehicleModel(vehicleid)) * 100),
            Float:VehHeal;
        GetVehicleHealth(vehicleid, VehHeal);
        if (!IsPlayerAFK(playerid) && VehicleInfo[vehicleid][carEngineOn] && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            cef_emit_event(playerid, "vehspeedo", CEFINT(kmh)/*, CEFFLOAT(VehHeal), CEFINT(VehicleInfo[vehicleid][carMilliage]), CEFINT(vfuel)*/);
    }
    return 1;
}`

this:: = public & forward
Function call : 

SetTimerEx("VehicleSpeedo", 150, true, "i", playerid);
Pycckue-Bnepeg commented 2 years ago

ok. what about client code (the browser one)?

Rams25 commented 2 years ago
cef.on("vehspeedo_name", (name) =>
{
    $("#placeName").html(name);
});

cef.on("vehspeedo", (kmh/*, heal, kms, fuel*/) =>
{
    $("#numSpeed").html(kmh);
    /*$("#yeetHealth").css('width', heal+'%');
    $("#gearNum").html(kms);
    $("#yeetFuel").css('width', fuel+'%');*/
});

thanks for answers

Rams25 commented 2 years ago

ok. what about client code (the browser one)?

Any idea please ?

Rams25 commented 2 years ago

UP please ?

Pycckue-Bnepeg commented 2 years ago

I will rework the network part of this plugin. There is some kind of connection lost.

Rams25 commented 2 years ago

I will rework the network part of this plugin. There is some kind of connection lost.

Thanks :) I see u have make auto-reconnect, I'll try it ! thanks you very much for your work !!!

Rams25 commented 2 years ago

Ah, more info, new logs when it crash :

05:06:44 [TRACE] (7) client::browser::client: [client\src\browser\client.rs:331] was waiting for ... 182.2616ms 05:07:05 [TRACE] (7) client::browser::client: [client\src\browser\client.rs:331] was waiting for ... 1.1832792s 05:07:06 [TRACE] (7) client::browser::client: [client\src\browser\client.rs:331] was waiting for ... 1.1888965s 05:07:52 [TRACE] (7) client::browser::client: [client\src\browser\client.rs:331] was waiting for ... 150.1096ms 05:08:50 [TRACE] (7) client::browser::client: [client\src\browser\client.rs:331] was waiting for ... 2.13422s 05:09:34 [TRACE] (7) client::browser::client: [client\src\browser\client.rs:331] was waiting for ... 39.1049691s

Pycckue-Bnepeg commented 2 years ago

@Rams25 try this: https://github.com/ZOTTCE/samp-cef/releases/tag/v1.3

Rams25 commented 2 years ago

@ZOTTCE no more crash, thanks you very much ! Do u know how I can fix special char please ? I'm french and I use "é è à", where's file to encode browser please ?