This site is a testing version, but all data is shared with the live forum.


Raised This Month: $12 Target: $400
 3% 

Solved About ThrowNativeError


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 02-17-2022 , 08:03   Re: About ThrowNativeError
Reply With Quote #4

I thought so. But anyway thanks for the answers.
But i'm still not sure about using ThrowNativeError inside non-native functions which are called by natives.
Like this:
Code:
stock void ThrowNativeErrorIfBadClient(int client, bool inGame = true) {
    if ( client < 1 || client > MaxClients )
        ThrowNativeError( SP_ERROR_NATIVE, "Invalid client index %i", client );

    if ( inGame && !IsClientInGame( client ) )
        ThrowNativeError( SP_ERROR_NATIVE, "Client %i is not in game", client );
}

int NTV_DoSomething(Handle plugin, int numParams) {
    int iClient = GetNativeCell( 1 );
    ThrowNativeErrorIfBadClient( iClient );

    // ...
}
__________________

Last edited by MAGNAT2645; 02-17-2022 at 08:09.
MAGNAT2645 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode