Raised This Month: $ Target: $400
 0% 

Easy question : most efficient way


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 01-01-2015 , 06:56   Easy question : most efficient way
Reply With Quote #1

Hi there, in order to improve my scrpting "skills", i want that all the codes i make use the most officient way to work. I have juste an easy question today, what is the more efficient way to set armor to player ? By efficient, i mean the method that "increases" performance of the server. Like that i can understand a lot of things on these questions :

PHP Code:
give_itemid"item_assaultsuit" ); 
or

PHP Code:
set_user_armorid100 ); 
or

PHP Code:
cs_set_user_armorid100CS_ARMOR_VESTHELM ); 
Is this only a question about includes used ? Or is there really "the best way" to do ?

Thanks in advance for any answer
Monster Truck is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-01-2015 , 07:09   Re: Easy question : most efficient way
Reply With Quote #2

I would go with give_item() or cs_set_user_armor(). That will also set some in-game variables ("user has helmet" etc), while the second one will only set the armor value and update it on HUD. But in this case, the efficiency is probably trivial and not noticeable, but always try to let the game do most of the work for you if possible.
klippy is offline
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 01-01-2015 , 07:24   Re: Easy question : most efficient way
Reply With Quote #3

Ah okay ... I understand, thanks for the answer, got the logic
Yeah, i Know, but when u have around 100 plugins in your server, u try to get your plugins the most efficient possible ^^ Thanks again.

Last edited by Monster Truck; 01-01-2015 at 07:27.
Monster Truck is offline
Reply



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 15:23.


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