Raised This Month: $32 Target: $400
 8% 

SourceMod 1.7.1 Released


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
psychonic

BAFFLED
Join Date: May 2008
Old 04-20-2015 , 06:52   Re: SourceMod 1.7.1 Released
#10

Quote:
Originally Posted by Electr000999 View Post
i am put line "#pragma newdecls required" after include's and after experiments get error..
  • why we cannot create custom native with type not a int type, may be beacuse by this in .inc files
    Code:
    native CreateNative(const String:name[], NativeCall:func); 
    typedef NativeCall = function int (Handle plugin, int numParams)
    for example how get error
    Code:
    error 100: function prototypes do not match
    example code:
    Code:
    #include <sourcemod>
    
    #pragma    semicolon 1
    #pragma newdecls required
    
    public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
    {
         CreateNative("TestNative", _TestNative);
         return APLRes_Success;
    }
    
    public bool _TestNative(Handle plugin, int numParams)
    {
        return GetSpawnAccess();  
    }
    
    bool GetSpawnAccess()
    {
       return true;
    }
For now, you must just retag the return value. return view_as<int>(true);

Note that this is nothing new, other than the transitional syntax for retagging. Before, it would have been return _:true; (which is still valid now).

Quote:
Originally Posted by Electr000999 View Post
  • line public void OnEntityCreated(int entity, const char[] classname) get error:
    Code:
    error 180: function return type differs from prototype. expected 'int', but got 'void'
    example code:
    Code:
    #include <sourcemod>
    #include <sdkhooks>
    
    #pragma    semicolon 1
    #pragma newdecls required
    
    public void OnEntityCreated(int entity, const char[] classname)
    {
        if (IsServerProcessing())
        {                
            
        }
    }
    in sdkhooks.inc
    Code:
    /**
     * @brief When an entity is created
     *
     * @param        entity        Entity index
     * @param        classname    Class name
     */
    forward void OnEntityCreated(int entity, const char[] classname);
I think that you are compiling against old include files.

Last edited by psychonic; 04-20-2015 at 07:30.
psychonic 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 22:06.


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