You can only do callfunc_end() when there is an successfull function called.
You didn't put { and } to define the code of ( if ( ) ) check, so the compiler will only consider the client_print function as the only function of the if check. Therefore, when the check fails, callfunc_end will throw an error as the function call failed.
So you could do (Also you could check for errors for debugging ...)
Code:
switch(callfunc_begin("amx_spectate", "invisible_spectator.amxx"))
{
case 1:
{
client_print(id, print_chat, "You are now invisible spectator!")
callfunc_end()
}
case 0:
{
log_error(AMX_ERR_GENERAL, "Runtime error")
}
case -1:
{
log_error(AMX_ERR_GENERAL, "Plugin not found")
}
case -2:
{
log_error(AMX_ERR_GENERAL, "Function not found")
}
}
__________________