Question about Natives
Is it possible to create a forward and a native with more params?
Will something like this work? PHP Code:
|
Re: Question about Natives
Not exactly sure what you need but you can add more or less as many parameters as you want/need.
|
Re: Question about Natives
The original native has two parameters, id and attacker
PHP Code:
PHP Code:
|
Re: Question about Natives
No, you misunderstand. To get the id and attacker parameter values inside a style 0 dynamic native you have to use
Code:
Code:
Declaring them might be a problem. You're supposed to use ... and the compiler will ignore how many arguments you use, but when I did this the values I got where completely off. I think I got the right values by using get_param_byref() but I can't tell for sure and I'm not suggesting it. I would instead use a default value which is obscure and checking if that is in use or if the user entered a value. Code:
Forwards are more complicated. But you can send whatever you want, it's up to the receiver to decide if they want that information. |
Re: Question about Natives
Is this right?
Condition is just an optional parameter, which i want to send only in case of a special event, so i can use exceptions for special events in other plugins with the forwards created PHP Code:
PHP Code:
PHP Code:
|
Re: Question about Natives
I really don't fully understand your code.
You have to check how many params were used in the native. That's what num_params is for. num_condition should not be there at all. There's also no way of determining how many cells were passed into the forward. So the receiver doesn't know. Perhaps making the condition into another native? If you would tell what the third parameter is I could give you a direct answer. I also want to point out that the middle forward is kind of useless. You either want to prevent it on pre or react on post. The middle forward is basically post. |
Re: Question about Natives
So we have the following
Spoiler
I want to add an optional, not mandatory third parameter to the forwards and the native, so i can use the third parameter in the infection bomb to tell in the rewards plugin that the infection was done with the bomb, and to not display the message Example Infection Grenade Plugin PHP Code:
PHP Code:
|
Re: Question about Natives
I am sorry blackrose, I misunderstood what num_params is for, i got how it works now thanks to you
I have found the answer to my question here https://forums.alliedmods.net/showthread.php?t=245176 I don't know how i found it, i did over 20 searches on google with different keywords checking 5 pages for each search until that popped out |
Re: Question about Natives
get_param_ byref should be used with "...".
|
Re: Question about Natives
Quote:
PHP Code:
|
| All times are GMT -4. The time now is 18:36. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.