View Issue Details

IDProjectCategoryView StatusLast Update
0001629Multi Theft Auto : San AndreasScriptingpublic2006-10-27 10:16
Reportererorr404Assigned ToJax 
PrioritynormalSeveritycrashReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Versionblue_sa.r2.a12 
Target VersionFixed in Versionmtasadm_v1.0-dp1 
Summary0001629: Event handler related server crash
Description

These two functions got called at the same time (when I hit a marker), and it crashed the server. They're not supposed to be called at the same time, it was a logical mistake in the script, but I'm reporting it anyway since nothing should cause the server to crash.

I guess the problem could be that the first event destroyed the marker, which was referenced by the second event handler's 'marker' argument. It tried to destroy event handlers of a marker that didn't exist.

Additional Information

function onFlagHit ( player, matching_dimension )
if ( isPlayerDead ( player ) == false and getElementData ( player, "pickup" ) == true ) then
if ( isPlayerInVehicle ( player ) == false or getElementData ( source, "state" ) == 2 ) then
if ( droptimer ) then
killTimer ( droptimer )
droptimer = false
end
removeEventHandler ( "onMarkerHit", source, "onFlagHit" )
destroyBlipAttachedTo ( source )
destroyElement ( source )
destroyBlipAttachedTo ( player )
addEventHandler ( "onPlayerMarkerHit", player, "onTargetDestinationHit" )
addEventHandler ( "onPlayerWasted", player, "onTargetWasted" )
addEventHandler ( "onPlayerEnterVehicle", player, "onTargetEnterVehicle" )
addEventHandler ( "onPlayerExitVehicle", player, "onTargetExitVehicle" )
addEventHandler ( "onPlayerQuit", player, "onTargetQuit" )
local vehicle = getPlayerOccupiedVehicle ( player )
if ( vehicle ) then
addEventHandler ( "onVehicleDamage", vehicle, "onTargetVehicleDamage" )
end
createBlipAttachedTo ( player, 0, 2, 255, 255, 0, 255 )
setElementData ( player, "points", tostring ( getElementData ( player, "points" ) + 25 ) )
setElementData ( player, "pickup", false )
if ( tonumber ( getElementData ( player, "points" ) ) >= 1000 ) then
setText ( "Point limit reached, " .. getClientName ( player ) .. " wins!", 5000 )
setTimer ( "killPlayersAndShowScores", 5000, 1 )
setTimer ( "endMap", 10000, 1 )
else
setText ( getClientName ( player ) .. " has the flag!", 5000 )
end
end
end
end

function onTargetDestinationHit ( marker, matching_dimension )
if ( isPlayerInVehicle ( source ) == false ) then
removeEventHandler ( "onPlayerMarkerHit", source, "onTargetDestinationHit" )
destroyBlipAttachedTo ( marker )
destroyElement ( marker )
destroyBlipAttachedTo ( source )
removeEventHandler ( "onPlayerMarkerHit", source, "onTargetDestinationHit" )
removeEventHandler ( "onPlayerWasted", source, "onTargetWasted" )
removeEventHandler ( "onPlayerEnterVehicle", source, "onTargetEnterVehicle" )
removeEventHandler ( "onPlayerExitVehicle", source, "onTargetExitVehicle" )
removeEventHandler ( "onPlayerQuit", source, "onTargetQuit" )
createBlipAttachedTo ( source, 0, 2, 0, 0, 255, 255 )
setElementData ( source, "points", tostring ( getElementData ( source, "points" ) + 100 ) )
setElementData ( source, "pickup", true )
if ( tonumber ( getElementData ( source, "points" ) ) >= 1000 ) then
setText ( "Point limit reached, " .. getClientName ( source ) .. " wins!", 5000 )
setTimer ( "killPlayersAndShowScores", 5000, 1 )
setTimer ( "endMap", 10000, 1 )
else
setText ( getClientName ( source ) .. " captured the flag!", 5000 )
setTimer ( "setFlagMarker", 5000, 1, 0 )
setTimer ( "setDestinationMarker", 5000, 1 )
end
end
end

TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change