Raised This Month: $51 Target: $400
 12% 

Improving and optimizing this thing


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-29-2022 , 22:50   Re: Improving and optimizing this thing
Reply With Quote #21

Looks ok at first glance, test it

To fix those tag mismatches:
PHP Code:
for(new Knives:DefaultKnifeKnivesi++) {

for(new 
P90s:DefaultP90P90si++) { 
__________________
Bugsy is offline
Krystek.
Member
Join Date: May 2022
Old 05-29-2022 , 23:17   Re: Improving and optimizing this thing
Reply With Quote #22

Quote:
Originally Posted by Bugsy View Post
Looks ok at first glance, test it

To fix those tag mismatches:
PHP Code:
for(new Knives:DefaultKnifeKnivesi++) {

for(new 
P90s:DefaultP90P90si++) { 
It's fine

Last edited by Krystek.; 05-29-2022 at 23:18.
Krystek. is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-30-2022 , 04:33   Re: Improving and optimizing this thing
Reply With Quote #23

Another way to get rid of the tag mismatch is to detag the enum, for example:
PHP Code:
enum _:Knives 
{
}

enum _:P90s
{

It is better to learn how to work with the tag instead of just stripping it completely, but I am showing this way too for completness.
__________________

Last edited by HamletEagle; 05-30-2022 at 04:34.
HamletEagle is offline
Krystek.
Member
Join Date: May 2022
Old 05-30-2022 , 07:27   Re: Improving and optimizing this thing
Reply With Quote #24

Quote:
Originally Posted by HamletEagle View Post
Another way to get rid of the tag mismatch is to detag the enum, for example:
PHP Code:
enum _:Knives 
{
}

enum _:P90s
{

It is better to learn how to work with the tag instead of just stripping it completely, but I am showing this way too for completness.
PHP Code:
But does it matter if tag_mismatch was when the function looked like this.

for(new 
Knives:0Knivesi++) {

and 
not like this

for(new Knives:DefaultKnifeKnivesi++) { 
Krystek. is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-30-2022 , 09:43   Re: Improving and optimizing this thing
Reply With Quote #25

Technically, no, because in both cases it's the same value: DefaultKnive is equal to 0. This is strictly a tag mismatch warning and the code will still run. As HamletEagle mentioned, you can suppress the tag checking logic entirely, but I'd try to avoid it if possible.

The tagging can help prevent mistakes in coding by ensuring that you're using the correct type of value based on the definition of the variable. For example, if you tried to assign a P90 enum value or a regular number value to a variable tagged with Knives, the compiler will throw a warning and you will discover the mistake you made.

Warnings:
for(new Knives:i = DefaultP90; i < Knives; i++) {
for(new Knives:i = 2; i < Knives; i++) {

The compiler wants this to not throw a warning:
for(new Knives:i = DefaultKnife; i < Knives; i++) {
for(new Knives:i = SomeKnife1; i < Knives; i++) {
for(new Knives:i = SomeKnife2; i < Knives; i++) {
or
for(new Knives:i = Knives:0; i < Knives; i++) {
for(new Knives:i = Knives:1; i < Knives; i++) {
for(new Knives:i = Knives:2; i < Knives; i++) {
__________________
Bugsy 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 16:45.


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