This is kinda complicated, but I'll explain it as best as I can.
Is it possible to set a string in a function using a seperate stock? Somewhat like format. What I'm trying to do is supply an ID to a stock and have it set strings to some data retrieved from MySQL.
Something like this:
Code:
stock get_info(id,string1[],len1,string2[],len2) {
new authid[32];
get_user_authid(id,authid,31);
result = dbi_query(sql,"SELECT * FROM data WHERE authid='%s'",authid);
// The checks for result failed & no result have been left out for simplicity's sake. Let's assume it IS there and result WAS successful.
dbi_nextrow(result);
dbi_result(result,"string1",string1,len1);
dbi_result(result,"string2",string2,len2);
dbi_free_result(result);
return true;
}
public show_data(id) {
new data1[64],data2[64];
get_info(id,data1,63,data2,63);
client_print(id,print_chat,"[Data] String 1 is %s; String 2 is %s",data1,data2);
return PLUGIN_HANDLED;
}
I'm not sure if that explains it well... if more explanation is needed, tell me and I'll try and come up with another example or a better explanation.
Edit: Basically what I want this to do is like format... it sets a variable in the function from which it is called.