Raised This Month: $32 Target: $400
 8% 

error in client print


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 01-09-2020 , 11:16   error in client print
Reply With Quote #1

first one causing error whats wrong?

PHP Code:
if(is_xp_loaded)
client_print_color(id0"Your Rank: %i %s"getrank(id), is_xp_loaded "XP: %i"getxp(id) : "")
else
client_print_color(id0"Your Rank: %i"getrank(id)) 
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-09-2020 , 13:28   Re: error in client print
Reply With Quote #2

If you get an error, you post the error here...

You can't pass multiple arguments in a ternary check.

PHP Code:
is_xp_loaded "XP: %i"getxp(id) : "" 
Simply use an if-else check.
__________________

Last edited by OciXCrom; 01-09-2020 at 13:29.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
JocAnis
Veteran Member
Join Date: Jun 2010
Old 01-09-2020 , 14:31   Re: error in client print
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
You can't pass multiple arguments in a ternary check.

PHP Code:
is_xp_loaded "XP: %i"getxp(id) : "" 
is there any possibility this can be implemented in new amxx version? 1.10 or which ever is next prepared

because its really faster that way to use it, alteast from my experience
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-09-2020 , 15:01   Re: error in client print
Reply With Quote #4

You can use "fmt" in 1.10.

PHP Code:
is_xp_loaded fmt("XP: %i"getxp(id)) : "" 
__________________

Last edited by OciXCrom; 01-09-2020 at 15:02.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 01-09-2020 , 16:06   Re: error in client print
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
You can use "fmt" in 1.10.

PHP Code:
is_xp_loaded fmt("XP: %i"getxp(id)) : "" 
And in 1.8.2?
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-09-2020 , 20:51   Re: error in client print
Reply With Quote #6

if and else ._.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-09-2020 , 22:04   Re: error in client print
Reply With Quote #7

Just always format the "XP: %i" and then conditionally use the string with the ternary operator. Simple.
__________________
fysiks is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 01-10-2020 , 02:48   Re: error in client print
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
Just always format the "XP: %i" and then conditionally use the string with the ternary operator. Simple.
PHP Code:
new playerxp[64]
formatex(playerxpcharmax(playerxp) , "XP : %i"getxp(I'd))

is_xp_loaded ? playerxp : "" 
Ignore syntax mistake used phone to write code 😂
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-10-2020 , 07:25   Re: error in client print
Reply With Quote #9

Yes, that will work.

PS: you probably don't need to store 64 characters in there.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 01-11-2020 , 10:51   Re: error in client print
Reply With Quote #10

Quote:
Originally Posted by Sanjay Singh View Post
PHP Code:
if([B]is_xp_loaded[/B])
client_print_color(id0"Your Rank: %i %s"getrank(id), [B]is_xp_loaded[/B] ? "XP: %i"getxp(id) : ""
Why are you checking it twice tho?
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Reply


Thread Tools
Display Modes

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 19:39.


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