Thread: [Solved] Can SDKCall Return String?
View Single Post
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 10-02-2020 , 22:25   Re: Can SDKCall Return String?
Reply With Quote #2

Yep. This is what I use in Info Editor plugin to return strings from an SDKCall:

PHP Code:
    StartPrepSDKCall(SDKCall_Raw);
    if( 
PrepSDKCall_SetFromConf(hGameDataSDKConf_Signature"KeyValues::GetString") == false )
        
SetFailState("Could not load the \"KeyValues::GetString\" gamedata signature.");
    
PrepSDKCall_AddParameter(SDKType_StringSDKPass_Pointer);
    
PrepSDKCall_AddParameter(SDKType_StringSDKPass_Pointer);
    
PrepSDKCall_SetReturnInfo(SDKType_StringSDKPass_Pointer);
    
SDK_KV_GetString EndPrepSDKCall();
    if( 
SDK_KV_GetString == null )
        
SetFailState("Could not prep the \"KeyValues::GetString\" function.");


        
char key[MAX_STRING_LENGTH];
        
char value[MAX_STRING_LENGTH];
        
SDKCall(SDK_KV_GetStringg_PointerMissionvaluesizeof(value), key"N/A"); 
The "key" var is what it's looking for, the "value" var is what it's returning and the "N/A" is the default returned if not found. I think SM wiki explains all this which is where I learnt to SDKCall and return strings.
__________________

Last edited by Silvers; 10-02-2020 at 22:25.
Silvers is offline