Raised This Month: $51 Target: $400
 12% 

Solved [ H3LP ] Fix Code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 07-20-2017 , 04:03   [ H3LP ] Fix Code
Reply With Quote #1

Hello. I noticed that if I want to show a hud, for example, that contains more lines and I put ^n after the %% the "%" wll not be displayed in the hud. Any way to fix that? If I don't use ^n then it works fine, but ti will show everything on the same line. Thanks !

Last edited by DarthMan; 07-21-2017 at 06:21. Reason: Solved
DarthMan is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 07-20-2017 , 04:37   Re: [ H3LP ] Use %% if ^n
Reply With Quote #2

Give an example please, because it works good for me.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
DarthMan
Veteran Member
Join Date: Aug 2011
Old 07-20-2017 , 04:41   Re: [ H3LP ] Use %% if ^n
Reply With Quote #3

Quote:
Originally Posted by PRoSToTeM@ View Post
Give an example please, because it works good for me.
For example if I use formatex : formatex(sBuffer, charsmax(sBuffer), "%%^n"), it will not display the %.

Last edited by DarthMan; 07-20-2017 at 04:46.
DarthMan is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 07-20-2017 , 05:11   Re: [ H3LP ] Use %% if ^n
Reply With Quote #4

Fixed by using %% twice. (%%%%)

Last edited by DarthMan; 07-20-2017 at 05:11.
DarthMan is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-20-2017 , 05:13   Re: [ H3LP ] Use %% if ^n
Reply With Quote #5

I almost feel like you are double formatting (which can be a security hole too!). Better show your code.
klippy is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 07-20-2017 , 05:23   Re: [ H3LP ] Use %% if ^n
Reply With Quote #6

Quote:
Originally Posted by KliPPy View Post
I almost feel like you are double formatting (which can be a security hole too!). Better show your code.
That's what I did.

Code:
formatex(sBuffer, charsmax(sBuffer), "%s. %s - %d%%%%^n", map_position[i], szTemp, iHealth) add( buff, charsmax( buff ), sBuffer )

It adds each on a new line.

Last edited by DarthMan; 07-20-2017 at 05:24.
DarthMan is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 07-20-2017 , 06:58   Re: [ H3LP ] Use %% if ^n
Reply With Quote #7

Show the part of code with show_hudmessage.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
DarthMan
Veteran Member
Join Date: Aug 2011
Old 07-20-2017 , 07:02   Re: [ H3LP ] Use %% if ^n
Reply With Quote #8

Quote:
Originally Posted by PRoSToTeM@ View Post
Show the part of code with show_hudmessage.
Code:
public mapvote_hud(taskid) {     if(!PLAYERS_CONNECTED)         return;         new i_Ent = -1, x_Ent = -1, iArray[MAXSHOW];     new Float:fCurrHealth, iHealth, iCount;     new buff[1024], szList[1024];         for(new i = 0, j; i < EXISTED_PANELS; i++)     {         if(iCount >= MAXSHOW)         {             break;         }                 i_Ent = PANELS[i];                 if(!pev_valid(i_Ent))             continue;                 iHealth = pev(i_Ent, pev_health, fCurrHealth);                 if(fCurrHealth >= MAX_PANEL_HEALTH)             continue;                 iArray[iCount] = i_Ent;                 for(j = i+1; j < EXISTED_PANELS; j++)         {             x_Ent = PANELS[j];                         if(pev(i_Ent, pev_health) > pev(x_Ent, pev_health))             {                 iArray[iCount] = x_Ent;             }         }                 iCount ++;     }         if(!iCount)         return;         new sBuffer[500], szTemp[32];         for(new i; i < iCount; i++)     {         x_Ent = iArray[i]                 pev(x_Ent, pev_targetname, szTemp, charsmax(szTemp))         pev(x_Ent, pev_health, fCurrHealth)                 iHealth = floatround((fCurrHealth / MAX_PANEL_HEALTH) * 100)         formatex(sBuffer, charsmax(sBuffer), "%s. %s - %d%%^n", map_position[i], szTemp, iHealth)         add( buff, charsmax( buff ), sBuffer )     }         formatex(szList, charsmax(szList), "Vote Results:^n%s", buff)         set_hudmessage(255, 255, 255, 0.80, 0.05, 0, 0.0, 0.2, 0.0, 0.0, 4)     show_hudmessage(0"%s", szList) }

Maybe you can fix the sorting

Last edited by DarthMan; 07-20-2017 at 08:04.
DarthMan is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 07-20-2017 , 07:09   Re: [ H3LP ] Use %% if ^n
Reply With Quote #9

Code:
show_hudmessage(0, szList)
->
Code:
show_hudmessage(0, "%s", szList)
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
DarthMan
Veteran Member
Join Date: Aug 2011
Old 07-20-2017 , 07:13   Re: [ H3LP ] Use %% if ^n
Reply With Quote #10

Quote:
Originally Posted by PRoSToTeM@ View Post
Code:
show_hudmessage(0, szList)
->
Code:
show_hudmessage(0, "%s", szList)
Now it works with %%, but cold u fix the sorting?

Last edited by DarthMan; 07-20-2017 at 08:02.
DarthMan 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 05:00.


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