Raised This Month: $ Target: $400
 0% 

Help with Callfunc_begin!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rixorster
Senior Member
Join Date: Jul 2005
Old 06-02-2006 , 06:41   Help with Callfunc_begin!
Reply With Quote #1

Like, what i need to know, is basically how to like use it to (example) run function "getFire" from "plugin.core.amxx"?
Code:
public getFire() {     // There's debug shit here which i wont show     new szUsername[32]     get_user_name(get_param(1), szUsername, 31)     return get_pdata_int(get_param(1), 460) }
So how can i make it do this to the player who uses the command thing in other plugin? o.o
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 06-02-2006 , 07:26  
Reply With Quote #2

i think it would be done somewhat like this..
Code:
public func(id) {     new call = callfunc_begin("getFire", "plugin.core.amxx")     if(call > 0) {         callfunc_push_int(id)         new ret = callfunc_end()        //ret should now hold the return value :o     } }
Code:
public getFire(id) {     // There's debug shit here which i wont show     new szUsername[32]     get_user_name(id, szUsername, 31)     return get_pdata_int(id, 460) }
__________________
plop
p3tsin is offline
Rixorster
Senior Member
Join Date: Jul 2005
Old 06-02-2006 , 09:01  
Reply With Quote #3

What about if i want it to use Arguments also?
Code:
public plugin_init() {     register_concmd("TestCall","func") } public func(id) {     new arg1[32]     read_argv( 1, arg1, 31 )     // what now? o.o }
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 06-02-2006 , 09:19  
Reply With Quote #4

u need to push them in like i did with the id
Code:
/* Push a parameter (integer, string, float) */
native callfunc_push_int(value);
native callfunc_push_str(const VALUE[]);
native callfunc_push_float(Float: value);
native callfunc_push_intrf(&value);
native callfunc_push_floatrf(& Float: value);
__________________
plop
p3tsin is offline
Rixorster
Senior Member
Join Date: Jul 2005
Old 06-02-2006 , 09:26  
Reply With Quote #5

Thanks again ^^
(Btw, answer meh pm k? )

Also, what might be wrong with this meany? >: (
Code:
public HmmDie(id) {     new arg1[32]     read_argv( 1, arg1, 31 )     if ( is_valid_ent(arg1) ) {         remove_entity(arg1)     } }
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 06-02-2006 , 09:29  
Reply With Quote #6

ents are edicts, not strings
Code:
public HmmDie(id) {     new arg1[32]     read_argv( 1, arg1, 31 )     new ent = str_to_num(arg1)     if ( is_valid_ent(ent) ) {         remove_entity(ent)     } }
__________________
plop
p3tsin is offline
Rixorster
Senior Member
Join Date: Jul 2005
Old 06-02-2006 , 09:30  
Reply With Quote #7

I did earlier like that, but it still didn't remove the ent, but ill try now, thanks ^^
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster 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 18:40.


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