Raised This Month: $ Target: $400
 0% 

Question about .inc files


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 03-02-2010 , 20:48   Re: Question about .inc files
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
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(idszPrimWeapon[], szSecWeapon[], iHealthiArmorFloat:flSpeedFloat:flGravity)
{
    
give_item(idszPrimWeapon);
    
give_item(idszSecWeapon);
    
cs_set_user_bpammoid get_weaponidszPrimWeapon ) , 200 );
    
cs_set_user_bpammoid get_weaponidszSecWeapon ) , 200 );  
    
set_user_health(idiHealth);
    
set_user_armor(idiArmor);
    
set_user_maxspeed(idflSpeed);
    
set_user_gravity(idflGravity);

With that in the inc file it allows any of the plugins that include that inc to call something like.

PHP Code:
SetSkills(idweapon_akweapon_usp1501503200.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)

Last edited by Doc-Holiday; 03-02-2010 at 20:54.
Doc-Holiday is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:39.


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