Raised This Month: $ Target: $400
 0% 

[ SOLVED ] FormatEX?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-13-2015 , 13:06   [ SOLVED ] FormatEX?
Reply With Quote #1

How to add new parameter settings in formatex?
Code:
formatex(menu, charsmax(menu), "\d%s [%L]", g_playername[player], id, g_zombie[player] ? g_nemesis[player] ? "CLASS_NEMESIS" : "CLASS_ZOMBIE" : g_survivor[player] ? "CLASS_SURVIVOR" : "CLASS_HUMAN")

Example:
Code:
formatex(menu, charsmax(menu), "\d%s [%L]", g_playername[player], id, g_zombie[player] ? g_nemesis[player] ? "CLASS_NEMESIS" : "CLASS_ZOMBIE" : g_survivor[player] ? "CLASS_SURVIVOR" : g_sniper[player] ? "CLASS_SNIPER" : "CLASS_HUMAN")
__________________









Last edited by CrazY.; 11-14-2015 at 13:08.
CrazY. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-13-2015 , 19:30   Re: [ HELP ] FormatEX?
Reply With Quote #2

What? formatex() is the same as format() with the exception that you can't use the destination as one of the arguments.

Have you tested your code?
__________________
fysiks is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-14-2015 , 09:58   Re: [ HELP ] FormatEX?
Reply With Quote #3

No, idk the meaning of : and ? in the code.
__________________








CrazY. is offline
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 11-14-2015 , 10:24   Re: [ HELP ] FormatEX?
Reply With Quote #4

its a short form of if and else perhaps
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-14-2015 , 12:05   Re: [ HELP ] FormatEX?
Reply With Quote #5

But which is the if, else, else if?
__________________








CrazY. is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-14-2015 , 12:21   Re: [ HELP ] FormatEX?
Reply With Quote #6

PHP Code:
new var;
if(
== 1337)
    var = 
42;
else
    var = 
69
is equal to:
PHP Code:
new var = (== 1337 42 69); 
klippy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-14-2015 , 12:42   Re: [ HELP ] FormatEX?
Reply With Quote #7

This is called a conditional operator, inline if (iif), or ternary if. See here: https://en.wikipedia.org/wiki/%3F:.
__________________
fysiks is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-14-2015 , 13:00   Re: [ HELP ] FormatEX?
Reply With Quote #8

And for else if? : ? or ?: or dont need?
__________________









Last edited by CrazY.; 11-14-2015 at 13:00.
CrazY. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-14-2015 , 13:04   Re: [ HELP ] FormatEX?
Reply With Quote #9

Quote:
Originally Posted by CrazY. View Post
And for else if? : ? or ?: or dont need?
else if isn't a special construct . . . i.e. you can create it with the standard if then else:

Code:
if( condition1 )
    // then
else
    if( condition2 )
        //then
    end
end
Given the code example code you posted, I would recommend that you do NOT use the ternary if since it's more difficult to understand. Use switches to determine what multilingual key that you want to use.
__________________

Last edited by fysiks; 11-14-2015 at 13:07.
fysiks is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-14-2015 , 13:08   Re: [ HELP ] FormatEX?
Reply With Quote #10

Hmm, Thank you for your help
__________________








CrazY. is offline
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 17:55.


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