Raised This Month: $ Target: $400
 0% 

how can i check does array field was already set


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
orglee
Member
Join Date: Dec 2005
Old 12-03-2007 , 22:36   how can i check does array field was already set
Reply With Quote #1

Hello.
I'm creating a menu which player can disable.
Player settings are being stored in multi-dimensional
Code:
enum E_PLAYER {   menu_on = 1 } new g_players[32][E_PLAYER]
But when player connects to the server this variable isn't set and I want it to be set on 1 or...
I want the plugin to recognize empty var as 1
Now I'm checking it using function below.
Code:
public menuStatusGet(id) {   new out   if(equal(g_players[id][menu_on], "") || g_players[id][menu_on] == 1) {     client_print(id, print_chat, "MENU: its on")     out = 1   } else {     client_print(id, print_chat, "MENU: its off")     out = 0   }   client_print(id, print_chat, "menu_on equals: %d", g_players[id][menu_on])   return out }
It is probably cause I'm using equal to check does its empty.
How should I check it so its will return correct value ?
Regards.
orglee 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 11:00.


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