openmultiplayer / openmultiplayer/open.mp
Vehicle respawn immediately after the explosion with SAMP Addon
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 641
- Forks
- 208
- PR merge metrics
- No merged PRs in 30d
Description
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;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the provided Pawn test with and without SAMP Addon 2.7 R12, comparing vehicle explosion and respawn events. Trace the open.mp vehicle respawn handling implicated by the reproduction; done when the addon no longer causes an immediate respawn and the vehicle follows the expected 16-second delay.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100