AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Fake Natives Question [Solved] (https://forums.alliedmods.net/showthread.php?t=63341)

Wilson [29th ID] 11-18-2007 10:28

Fake Natives Question [Solved]
 
In Hawk's Tutorial on Dynamic/Fake Natives, he provides the below example of usage.

My question is how to use the function that serves as the code for the native within this base plugin.

Code:
#include <amxmodx> #include <fun> public plugin_init()     register_plugin("Dynamic Native Test - Handler","1.0","Hawk552")     public plugin_natives() {     register_library("dyn_test")         register_native("half_user_hp","_half_user_hp") } public _half_user_hp(iPlugin,iParams) {     if(iParams != 1)         return PLUGIN_CONTINUE             new id = get_param(1)     if(!id)         return PLUGIN_CONTINUE             set_user_health(id,get_user_health(id) / 2)         return PLUGIN_HANDLED }

How would I use _half_user_hp() within this plugin itself? The main question is how can I get the 'id' parameter to it from within this plugin?

For example, if I wanted to make every user cut his hp in half when he spawned,

Code:
public event_ResetHUD( id ) {    _half_user_hp(......); // What goes in the brackets? }

P34nut 11-18-2007 11:09

Re: Fake Natives Question
 
If you want to use the fake native in the base plugin you need to include the include and use it

Alka 11-18-2007 11:14

Re: Fake Natives Question
 
He wants to know what the params are ?! What param should be the player "index" ? If he want to half a user hp how can use that native "_half_user_hp( ??? ) "

??? - unknown params :s

Wilson [29th ID] 11-18-2007 11:43

Re: Fake Natives Question
 
Quote:

Originally Posted by P34nut (Post 554279)
If you want to use the fake native in the base plugin you need to include the include and use it

Are you shitting me? It's that simple?

So just #include <dyn_test> and then use half_user_hp(id) instead of _half_user_hp....wow.

Thanks P34nut


All times are GMT -4. The time now is 01:23.

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