So I read the Tutorial on Forwards. I know how to return integer/float based forwards but I can't seem to figure out how to do it for functions.
1st Goal:
Return a string from a function. (This has been one of my other issues)
2nd Goal: Forward that string, and use that string in another plugin.
For This Example, let us pretend someone wrote /increment twice.
Code:
#include <amxmodx>
new location[33]
enum LOCATION
{
MYHOUSE = 0,
FRIEND1,
FRIEND2
}
new const locationNames[LOCATION][] =
{
"My House",
"First Friend House",
"Second Friend House"
}
public plugin_init()
{
register_plugin("Forward String Test", "1.0", "Lobopack23")
register_concmd("say /mylocation","checklocation");
register_concmd("say /increment","incrementlocation"); // just to make this more "realistic"
}
public incrementlocation(id)
{
location[id]++
}
public checklocation(id)
{
// TEST 1
new iLocation = location[id]
return locationNames[iLocation]
/*
// TEST 2, another way i tried to return it but failed..
new iLocation = location[id]
new temp[1024];
formatex(temp, charsmax(temp), "%s", locationNames[iLocation] );
return temp
*/
}
And this is how I was trying to forward the value to another plugin.
Code:
locationForward(id)
{
new temp_return, temp_forward = CreateMultiForward( "checklocation", ET_STOP, FP_STRING );
ExecuteForward( temp_forward, temp_return, id );
DestroyForward( temp_forward );
return temp_return;
}
Any help, suggestions or etc would be appreciated.
__________________