Raised This Month: $51 Target: $400
 12% 

Setting a string from a stock


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jordan44053
Junior Member
Join Date: Aug 2005
Old 02-04-2006 , 13:00   Setting a string from a stock
Reply With Quote #1

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.
Jordan44053 is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 02-05-2006 , 06:43  
Reply With Quote #2

This would work
Code:
// stock get_info(id,string1[64],string2[64]) {     // ... } public show_data(id) {     new data1[64],data2[64];     get_info(id,data1,data2);     // ... }
VEN is offline
Reply



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 02:42.


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