open.mp icon indicating copy to clipboard operation
open.mp copied to clipboard

Vehicle respawn immediately after the explosion with SAMP Addon

Open ghost opened this issue 1 year ago • 4 comments

Client: SAMP0.3DL + SAMP Addon 2.7 R12 Server: open.mp v1.2.0.2670

When entering the game with the SAMP Addon and testing the following code, the vehicle will respawn immediately after the explosion,when without SAMP Addon, it seems to work fine, the vehicle respawns after 16 seconds

but this doesn't happen with samp server, the code works as expected with or without the SAMP Addon

#include <open.mp>

new testVehicleID;
new testVehicleTimer = -1;

public OnGameModeInit()
{
    testVehicleID = CreateVehicle(411, 2025.7511,-1420.9379,16.9922, 0.0, -1, -1, 300);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, 2028.7511,-1422.9379,16.9922);

    if(testVehicleTimer != -1)
        KillTimer(testVehicleTimer);

    testVehicleTimer = SetTimer("KillVehicle", 2000, false);
    return 1;
}

forward KillVehicle();
public KillVehicle()
{
    SetVehicleHealth(testVehicleID, 249.0);
    SendClientMessageToAll(-1, "SetVehicleHealth | vehicleid %d | health 249.0", testVehicleID);

    if(testVehicleTimer != -1)
        KillTimer(testVehicleTimer);
    testVehicleTimer = SetTimer("RespawnVehicle", 16*1000, false);
    return 1;
}

forward RespawnVehicle();
public RespawnVehicle()
{
    if(testVehicleTimer != -1) {
        KillTimer(testVehicleTimer);
        testVehicleTimer = -1;
    }
    SetVehicleToRespawn(testVehicleID);
    SendClientMessageToAll(-1, "SetVehicleToRespawn | vehicleid %d", testVehicleID);
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    if(testVehicleTimer != -1) {
        SendClientMessageToAll(-1, "OnVehicleSpawn | KillTimer %d", testVehicleTimer);

        KillTimer(testVehicleTimer);
        testVehicleTimer = -1;
    }
    SendClientMessageToAll(-1, "OnVehicleSpawn | vehicleid %d", vehicleid);
    return 1;
}

ghost avatar Aug 13 '24 06:08 ghost

Can you record a video with the same script and samp addon?

AmyrAhmady avatar Aug 13 '24 14:08 AmyrAhmady

Can you record a video with the same script and samp addon?

https://discord.com/channels/1272941658010550274/1272941660086735020/1272942237566763008

ghost avatar Aug 13 '24 15:08 ghost

This is a link to a message and it's unknown to anyone who is mot in that server just upload the video here, you can drag and drop the file

AmyrAhmady avatar Aug 13 '24 17:08 AmyrAhmady

This is a link to a message and it's unknown to anyone who is mot in that server just upload the video here, you can drag and drop the file

https://youtu.be/fmBA5JNfiPE

I can't upload files larger than 10m

ghost avatar Aug 14 '24 01:08 ghost