AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with Callfunc_begin! (https://forums.alliedmods.net/showthread.php?t=29263)

Rixorster 06-02-2006 06:41

Help with Callfunc_begin!
 
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

p3tsin 06-02-2006 07:26

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) }

Rixorster 06-02-2006 09:01

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 }

p3tsin 06-02-2006 09:19

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);


Rixorster 06-02-2006 09:26

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)     } }

p3tsin 06-02-2006 09:29

ents are edicts, not strings :P
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)     } }

Rixorster 06-02-2006 09:30

I did earlier like that, but it still didn't remove the ent, but ill try now, thanks ^^


All times are GMT -4. The time now is 16:28.

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