AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to connect two plugins? Or Make subplugins. (https://forums.alliedmods.net/showthread.php?t=303272)

TheSpaniard 11-30-2017 10:33

How to connect two plugins? Or Make subplugins.
 
For example i have a ak47 skin menu plugin and another m4a1 skin menu plugin and i want to combine both without merging the code and making one big plugin.
I want to make a main plugin, which calls any plugin from those two when called.
Any help appreciated.
The Spaniard.

EFFx 11-30-2017 10:48

Re: How to connect two plugins? Or Make subplugins.
 
U can use native.

TheSpaniard 11-30-2017 10:50

Re: How to connect two plugins? Or Make subplugins.
 
Quote:

Originally Posted by EFFx (Post 2563722)
U can use native.

How to use native to link two plugins can you give a example?

DjSoftero 11-30-2017 11:09

Re: How to connect two plugins? Or Make subplugins.
 
read this: https://forums.alliedmods.net/showthread.php?t=41251 and then test countless amount of times

TheSpaniard 11-30-2017 11:12

Re: How to connect two plugins? Or Make subplugins.
 
Quote:

Originally Posted by DjSoftero (Post 2563729)
read this: https://forums.alliedmods.net/showthread.php?t=41251 and then test countless amount of times

lol that i have to do till my brain is throughly fucked still thanks for the tut.

TheSpaniard 11-30-2017 11:30

Re: How to connect two plugins? Or Make subplugins.
 
Quote:

Originally Posted by DjSoftero (Post 2563729)
read this: https://forums.alliedmods.net/showthread.php?t=41251 and then test countless amount of times

Now after reading it and not understanding 50% i think this isnt related.
i want it like this -

Main Plugin-
A menu to call the first and second plugin.

First plugin-
ak47 skins menu.

Second plugin-
m4a1 skins menu.

EDIT:- Now i get it. the whole plugin in an dynamic native and then calling it in the main plugin as a function. Brilliant.

EDIT2:- i think coding a whole big plugin in a native is a bad idea. too much work. working with a predefined function is ok. but this is insane almost 200 lines of simple code and making it into an native double it i think 400 line just to make one plugin another 400 lines to make another plugin and another 100 lines for the main plugin. its better to merge two of the plugin. Any alternative way?

Relaxing 11-30-2017 11:38

Re: How to connect two plugins? Or Make subplugins.
 
Create a clcmd for each menu and on the main one just call them.
Or create the hole menu in a header and call it whenever you want.(no data saves)[if the code is way to huge, don't follow this]

aron9forever 11-30-2017 14:21

Re: How to connect two plugins? Or Make subplugins.
 
in plugin for m4 you create a native player_equip_special_m4 or whatever
in plugin for ak47 you make player_equip_special_ak47
plugins only do what is needed for weapons like setting skin, sounds animations etc, maybe also remove on death or round end

in 3rd plugin, the actual menu, shop, or whatever plugin, you create your menus, all other logic (money price or XP or whatever) and when you need to give the player the weapon you just call the native

all info needed to do this is in the tutorial you were given above; but you can look at how natives work in a real example, just search for any AMXX API (like cs_set_player_team)

TheSpaniard 12-01-2017 00:14

Re: How to connect two plugins? Or Make subplugins.
 
Quote:

Originally Posted by Relaxing (Post 2563738)
Create a clcmd for each menu and on the main one just call them.
Or create the hole menu in a header and call it whenever you want.(no data saves)[if the code is way to huge, don't follow this]

I know the clcmd method. But the code is self repeating cant help that. So anyone reading the clcmd method would definitely unapprove the plugin. And i dont care about my plugins coming in the approved or unapproved, In the end it still remains on the forum. My main concern is readability, no would like to read self repeating code code two times (the function of the both plugins being same but only for different weapons). And the debugging becomes hell lot harder.

TheSpaniard 12-01-2017 00:19

Re: How to connect two plugins? Or Make subplugins.
 
Quote:

Originally Posted by aron9forever (Post 2563778)
in plugin for m4 you create a native player_equip_special_m4 or whatever
in plugin for ak47 you make player_equip_special_ak47
plugins only do what is needed for weapons like setting skin, sounds animations etc, maybe also remove on death or round end

in 3rd plugin, the actual menu, shop, or whatever plugin, you create your menus, all other logic (money price or XP or whatever) and when you need to give the player the weapon you just call the native

all info needed to do this is in the tutorial you were given above; but you can look at how natives work in a real example, just search for any AMXX API (like cs_set_player_team)

So basically you are telling me to make the menu in the main plugin and handler in secondary plugin and how do you propose to link them?

EDIT:- I am a dumbass I got it i have to link them by the dynamic native


All times are GMT -4. The time now is 18:56.

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