Raised This Month: $ Target: $400
 0% 

Transfer data from functions?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Drak
Veteran Member
Join Date: Jul 2005
Old 10-17-2006 , 20:42   Transfer data from functions?
Reply With Quote #1

How would i get the random data that was made in one function to another?
Code:
stock buying(id,pet[],cost) {     new ages = random_num(1,8)     new menu_body[256]     new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)     if(equali(pet,"dog"))     {         format(menu_body,256,"Pet is %s^n Age: %i",pet,ages)         show_menu(id,keys,menu_body)     } } public data_here(id) {             client_print(id,print_chat,"[TEST] %s",pet) }

So, how would i get the age/pet from 'buying' to a different function?
Drak is offline
Send a message via MSN to Drak
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 10-17-2006 , 21:14   Re: Transfer data from functions?
Reply With Quote #2

Make pet a global function
wonsae is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 10-17-2006 , 21:46   Re: Transfer data from functions?
Reply With Quote #3

Quote:
Originally Posted by wonsae View Post
Make ages a global variable
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-17-2006 , 22:43   Re: Transfer data from functions?
Reply With Quote #4

Umm no, just change your function decleration:

Code:
public data_here(id, const pet[]) {             client_print(id,print_chat,"[TEST] %s",pet) } public some_test_func(id, const pet[]) {     // Call it     data_here(id, pet); }
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 10-17-2006 , 23:30   Re: Transfer data from functions?
Reply With Quote #5

Eep, sorry, I was typing too fast :X
wonsae 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 04:50.


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