Raised This Month: $ Target: $400
 0% 

How to return an integer from a function?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Minimum
Senior Member
Join Date: Jun 2006
Old 11-25-2006 , 14:32   How to return an integer from a function?
Reply With Quote #1

Nothing in the tutorial section covers this. So I thought I should post here. I need to know how to make a function return an integer. Heres what I have so far but it will not work. I am really flying blind without any proper documentation on this.

Code:
/*      Test Integer Function */  public _testsqlint(table[],index[],authid[],equals[16],output) {     if(dbc < SQL_OK) return 0     format(query,255,"SELECT %s FROM %s WHERE steamid = '%s'",index,table,authid)     result = dbi_query(dbc,query)     for(new i=0;i < 16;i++) {         if(equals[i] == result) output = 1     }     if(output == 0) {         dbi_free_result(result)         format(query,255,"SELECT * FROM admins WHERE steamid = '%s' AND full_access = 1",authid)         result = dbi_query(dbc,query)         if(dbi_nextrow(result) > 0) output = 1     }     dbi_free_result(result)     return output } public testinteger(id) {     new sc_output, authid[32], stuff[16]     stuff[0] = 1     stuff[1] = 4     stuff[2] = 5     get_user_authid(id,authid,31)     _testsqlint("races","raceid",authid,stuff,sc_output)     server_print("Stuff[0] = %i ^n Stuff[1] = %i ^n Stuff[2] = %i ^n sc_output[i] = %i ^n sc_output[s] = %s ^n authid = %s",stuff[0],stuff[1],stuff[2],sc_output,sc_output,authid) }

I had my friend try the command in the server and it printed this to the server console.

Code:
 Stuff[0] = 1
 Stuff[1] = 4
 Stuff[2] = 5
 sc_output[i] = 0
 sc_output[s] =
 authid = STEAM_0:0:1632207
Minimum is offline
Send a message via AIM to Minimum Send a message via MSN to Minimum
 



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 06:56.


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