Quote:
Originally Posted by fysiks
Don't create 'global' variables in includes. They will not be used as you are hoping.
|
They work fine to seperate the two plugins just fine...
The first one was just to keep the main plugin nice and simple to read..
How ever say i added another plugin that used that include if i dont use all those variables i get errors saying that all the variables werent used.
So if its just a really large plugin to make it more readable i sperated them.
The plugin was like 4k lines of code lol so makeing the inc and regular file it was so much easier.
Quote:
@ NbC_Sav:
so you make it like the start of a normal plugin, defining things and such.
Could you explain a little more about the stocks to?
And i create a float in my inc and 1 plugin changes the value of the float, will plugin 2 see the changed value or not?
|
Not exactly like that
When you create a Float in your inc. Plugin one can use it and make the value what it would like change it and do what ever how ever plugin two can use it but its a completely different variable
So technically it would be like creating a float in each of the 2 plugins. I believe that is correct.
Now for the stock
PHP Code:
Stock SetSkills(id, szPrimWeapon[], szSecWeapon[], iHealth, iArmor, Float:flSpeed, Float:flGravity)
{
give_item(id, szPrimWeapon);
give_item(id, szSecWeapon);
cs_set_user_bpammo( id , get_weaponid( szPrimWeapon ) , 200 );
cs_set_user_bpammo( id , get_weaponid( szSecWeapon ) , 200 );
set_user_health(id, iHealth);
set_user_armor(id, iArmor);
set_user_maxspeed(id, flSpeed);
set_user_gravity(id, flGravity);
}
With that in the inc file it allows any of the plugins that include that inc to call something like.
PHP Code:
SetSkills(id, weapon_ak, weapon_usp, 150, 150, 320, 0.5)
Which would send to the stock the players id and the values for those give items and set user health/armor/speed/gravity
It makes it simpler to use multiple functions calling the same function. (if that makes sense)