AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Blank String? (https://forums.alliedmods.net/showthread.php?t=94730)

Spunky 06-14-2009 18:15

Blank String?
 
I have no idea why, but this isn't working:

Code:
if (equali(g_szBundleName[i], ""))

out of this code:

Code:
public cmd_create(id) {     if (!is_user_alive(id))         return PLUGIN_HANDLED     new const iIndex = id - 1     g_mCreateMenu[iIndex] = menu_create("Create Menu", "fnCreateMenu")     for (new i; i < 32; i++)     {         if (equali(g_szBundleName[i], ""))             break         num_to_str(i + 1, g_szKeys[i], 5)         menu_additem(g_mCreateMenu[iIndex], g_szBundleName[i], g_szKeys[i])     }     menu_setprop(g_mCreateMenu[iIndex], MPROP_TITLE, "Create Menu:")     menu_setprop(g_mCreateMenu[iIndex], MPROP_PERPAGE, 7)     menu_setprop(g_mCreateMenu[iIndex], MPROP_EXIT, MEXIT_ALL)     menu_display(id, g_mCreateMenu[iIndex], 0)     return PLUGIN_HANDLED }

I'm not sure that's the problem though. Help? :(

Arkshine 06-14-2009 18:18

Re: Blank String?
 
you can use something directly : if ( !g_szBundleName[i][0] )

Spunky 06-14-2009 18:26

Re: Blank String?
 
I've tried that too. Same result. The menu never displays.

Exolent[jNr] 06-14-2009 18:34

Re: Blank String?
 
The menu won't display if there are no items added to it.
Try adding some debug messages of your g_szBundleName[i] to make sure they contain characters.

Spunky 06-14-2009 18:58

Re: Blank String?
 
Nevermind, I got it. Found a simple enough workaround.

fysiks 06-14-2009 19:17

Re: Blank String?
 
Quote:

Originally Posted by Exolent[jNr] (Post 849115)
The menu won't display if there are no items added to it.
Try adding some debug messages of your g_szBundleName[i] to make sure they contain characters.

Some days I think we need a tutorial about adding debug messages that would be required to be read before posting here lol :). Sorry for OT, just though I would share :).


All times are GMT -4. The time now is 13:53.

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