PHP Code:
ConditionNames:
"TF_COND_AIMING"(0)
"TF_COND_ZOOMED"(4)
"TF_COND_DISGUISING"(8)
"TF_COND_DISGUISED"(0xC) //12
"TF_COND_STEALTHED"(0x10) //16
"TF_COND_INVULNERABLE"(0x14) //20
.
.
.
PHP Code:
GetTFConditionName(int condition){
if(condition > 129)return 0;
return DS:ConditionNames[condition*4];
}
PHP Code:
"GetTFConditionName"
{
"library" "server"
"windows" "\x55\x8B\xEC\x8B\x45\x08\x3D\x82\x00\x00\x00"
"linux" "@_Z18GetTFConditionName7ETFCond"
"mac" "@_Z18GetTFConditionName7ETFCond"
}
PHP Code:
Handle hTestHandle;
public void OnPluginStart(){
Handle Config = LoadGameConfigFile("TextFile");
StartPrepSDKCall(SDKCall_Static);
PrepSDKCall_SetFromConf(Config, SDKConf_Signature, "GetTFConditionName");
PrepSDKCall_SetReturnInfo(SDKType_String, SDKPass_Pointer);
/*
i tried SDKType_PlainOldData, SDKPass_Pointer,
SDKType_PlainOldData, SDKPass_ByRef,
even SDKType_PlainOldData, SDKPass_ByVal,
well it worked, but it prints DWORD size, like this "TF_C", "Y{'Q"
+ SDKType_String, SDKPass_ByRef, ByVal, Pointer = runtime error
*/
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
hTestHandle= EndPrepSDKCall();
//PrintToServer("%d", hTestHandle) -> 49..1, Valid Handle
CloseHandle(Config);
RegConsoleCmd("sm_string_test", stringtest);
}
public Action stringtest(int client, int args){
char test[30];
test = SDKCall(hTestHandle, 5); //compile error
PrintToConsole(client, "%s", test);
return Plugin_Handled;
}
Solved!!!!!!!!! YES!!!! Many Thank YOU!!!!
PHP Code:
//-------------Solved-------------
Handle hGetTFConditionName;
Handle hStrCopy;
public void OnPluginStart(){
Handle Config = LoadGameConfigFile("TextFile");
StartPrepSDKCall(SDKCall_Static);
PrepSDKCall_SetFromConf(Config, SDKConf_Signature, "GetTFConditionName");
PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain);
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
hGetTFConditionName = EndPrepSDKCall();
StartPrepSDKCall(SDKCall_Static);
PrepSDKCall_SetFromConf(Config, SDKConf_Signature, "V_strncpy");
PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer);
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
hStrCopy = EndPrepSDKCall();
CloseHandle(Config);
RegConsoleCmd("sm_string_test", stringtest);
}
public Action stringtest(int client, int args){
char test[30];
SDKCall(hStrCopy, test, SDKCall(hGetTFConditionName, 33), 30);
PrintToConsole(client, "%s", test); //worked!
return Plugin_Handled;
}
//-------------------------------