Thread: [Solved] About ThrowNativeError
View Single Post
Author Message
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 02-13-2022 , 11:55   About ThrowNativeError
Reply With Quote #1

Is it fine to ThrowNativeError in a function which is called by a native?
Like here

I want to create a client validation stock which will throw native errors so i can get rid of such lines in all of my natives
Code:
    if ( !IsClientIndex( iClient ) )
        return ThrowNativeError( SP_ERROR_NATIVE, "Invalid client index %i", iClient );

    if ( !IsClientInGame( iClient ) )
        return ThrowNativeError( SP_ERROR_NATIVE, "Client %i is not in game", iClient );
Also, is it necessary to return after throwing an error?
Code:
return ThrowNativeError();
(I assume that ThrowNativeError just returns 0)
I saw some natives do it, some not.
Just a little confused
__________________

Last edited by MAGNAT2645; 02-17-2022 at 11:59. Reason: Solved
MAGNAT2645 is offline