AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved check a string from enum (https://forums.alliedmods.net/showthread.php?t=332306)

lexzor 05-04-2021 18:28

check a string from enum
 
hello
PHP Code:


enum _
:DATA
{
NAME[35]
}

new 
g_szSomething[33][DATA]

public function()
{
if(
g_szSomething[NAME] != EOS_
//do stuff



Bugsy 05-04-2021 18:50

Re: check a string from enum
 
NAME within the enum is an array, and you are sizing DATA already as part of a 2-dimension array, making it a 3-dimension array for the NAME variable.

PHP Code:

if ( g_szSomethingindex ][ NAME ][ ] == EOS )

    
//eat cabbage



lexzor 05-04-2021 19:41

Re: check a string from enum
 
Thanks.

LondoN 05-05-2021 04:30

Re: check a string from enum
 
you can use strlen too.

Bugsy 05-05-2021 09:36

Re: check a string from enum
 
While the difference is negligible, it's more efficient to not call a native and just check that the first char is null/EOS.


All times are GMT -4. The time now is 02:30.

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