Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vehicle respawn immediately after the explosion with SAMP Addon #964

Open
ghost opened this issue Aug 13, 2024 · 4 comments
Open

Vehicle respawn immediately after the explosion with SAMP Addon #964

ghost opened this issue Aug 13, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Aug 13, 2024

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 ghost added the bug Something isn't working label Aug 13, 2024
@AmyrAhmady
Copy link
Member

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

@ghost
Copy link
Author

ghost commented Aug 13, 2024

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

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

@AmyrAhmady
Copy link
Member

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

@ghost
Copy link
Author

ghost commented Aug 14, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant