Raised This Month: $ Target: $400
 0% 

Getting empty string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nikol4u
Member
Join Date: Jan 2007
Location: Burgas
Old 12-30-2008 , 11:26   Getting empty string
Reply With Quote #1

How can I get/understand if "player1" is empty (it doesn't have anything in it)?

I would use empty(player1) @ php, but dno what should I use here :s
__________________
www.cosy-climbing.net - The official Kreedz community for non-official Kreedz maps

Cosy-Climbing's server IP: 108.61.254.236:27015
Nikol4u is offline
Send a message via ICQ to Nikol4u Send a message via Skype™ to Nikol4u
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-30-2008 , 11:59   Re: Getting empty string
Reply With Quote #2

try this
PHP Code:
if( player1[0] == "" ) {
    
// stuff

__________________
xPaw is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-30-2008 , 12:28   Re: Getting empty string
Reply With Quote #3

PHP Code:
if (equal(player1,""))
    
// stuff 
PHP Code:
if (player1[0] == "\0")
    
// stuff 
The first method should work fine. The second one depends on what your escape character is. I think it can also equal 0, but I am not sure.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-30-2008 , 14:45   Re: Getting empty string
Reply With Quote #4

Quote:
Originally Posted by YamiKaitou View Post
PHP Code:
if (equal(player1,""))
    
// stuff 
PHP Code:
if (player1[0] == "\0")
    
// stuff 
The first method should work fine. The second one depends on what your escape character is. I think it can also equal 0, but I am not sure.
The second won't compile. You would have to use:

Code:
if(player1[0] == '\0')

or

Code:
if(!player1[0])

I prefer the latter because the escape character can be changed using compiler options, but the null character is still 0.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 12-30-2008 , 16:08   Re: Getting empty string
Reply With Quote #5

Quote:
Originally Posted by Hawk552 View Post
The second won't compile. You would have to use:

Code:
if(player1[0] == '\0')


or

Code:
if(!player1[0])


I prefer the latter because the escape character can be changed using compiler options, but the null character is still 0.
You guys forgot that the default escape char in AMXX is '^'.
__________________

Community / No support through PM
danielkza is offline
Zefir
Member
Join Date: Oct 2007
Location: Kiev, Ukraine
Old 07-07-2009 , 09:52   Re: Getting empty string
Reply With Quote #6

PHP Code:
if(player1[0] != EOS
From pawn manual
Quote:
EOS: predefined constant standing for End Of String; it has the value ’\0’
__________________
Zefir is offline
Send a message via ICQ to Zefir
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 09:15.


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