Open oscar-broman opened 11 years ago
@Zeex do you think it would be possible to avoid when a runtime error happens?
For example: if you catch AMX_ERR_BOUNDS
in OnPlayerCommandText
, can you prevent SERVER: Unknown command
?
Should be possible now with this: https://github.com/Zeex/samp-plugin-crashdetect/commit/bbea212ce8c11e9b66d7c5b964040ec23c844adf
Now basically whatever you return in OnRuntimeError
is returned to the server like if you return from the public itself. You can make a table of "default" return values for all SA-MP callbacks and return them in case of an error.
Nice!
crashdetect can report runtime errors to a public function - hook this function and use it to throw exceptions.
One of the problems with doing this is the outer public function will return 0 before
OnRuntimeError
, which makes it impossible to gracefully handle runtime errors in callbacks such asOnPlayerUpdate
andOnPlayerCommandText
.Old code for this: