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

How to use const


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SlientArmy
Junior Member
Join Date: Aug 2019
Old 07-17-2020 , 08:13   How to use const
Reply With Quote #1

hello everybody, I have a const but when I use %s a const and write screen;

client_print(id,print_chat,"%s",pNames[0][0][0],pTag)

My Consts;
HTML Code:
new const pTag[] = "NumberOne Gaming"

new const pNames[][][] = {
   {"\r[\w%s\r]","Theme1"},
   {"\d[\y%s\d]","Theme2"},
}
how do this;
client_print(id,print_chat,"\r[\wNumberOne Gaming\r]")
SlientArmy is offline
SlientArmy
Junior Member
Join Date: Aug 2019
Old 07-18-2020 , 03:18   Re: How to use const
Reply With Quote #2

Up
SlientArmy is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 07-18-2020 , 04:21   Re: How to use const
Reply With Quote #3

You only need to print the pTag
Code:
client_print(id,print_chat,"%s", pTag)
As for the second question I'm not sure about that
Code:
client_print(id,print_chat,"...", pNames[ 0 ], pNames[ 1 ]);
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
SlientArmy
Junior Member
Join Date: Aug 2019
Old 07-18-2020 , 08:11   Re: How to use const
Reply With Quote #4

I think you misunderstood me, I wanted to print ptag instead of% s in that pnames
SlientArmy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-18-2020 , 08:25   Re: How to use const
Reply With Quote #5

PHP Code:

new const pTag[] = "NumberOne Gaming"

new pNames[][][] = {
   {
"\r[\w%s\r]","Theme1"},
   {
"\d[\y%s\d]","Theme2"},
}

public 
plugin_init()
{
   
format(pNames[0][0], charsmax(pNames[][0]), pNames[0][0], pTag);
   
format(pNames[1][0], charsmax(pNames[][0]), pNames[1][0], pTag);
}

client_print(idprint_chat,"%s hello !"pNames[0][0]) 
try this
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-18-2020 at 08:27.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-18-2020 , 15:02   Re: How to use const
Reply With Quote #6

Quote:
Originally Posted by SlientArmy View Post
I think you misunderstood me, I wanted to print ptag instead of% s in that pnames
So, what is the point of "Theme1" and "Theme2" in pNames? It makes your request very confusing since you don't even mention that part.

If for example, you want to do dynamic formatting, you can do something like the following (which chooses one of the defined formats randomly):

PHP Code:
szFormats[][] = {"Format 1: %s""Format 2: %s"}

szMyString[28]
iFormat random(sizeof szFormats)

formatex(szMyStringcharsmax(szMyString), szFormats[iFormat], "MyString")
client_print(0print_chatszMyString)

// or to do it directly in client_print()

client_print(0print_chatszFormats[iFormat], "MyString"
@Natsheh, that doesn't make sense.
__________________

Last edited by fysiks; 07-18-2020 at 15:09.
fysiks is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-18-2020 , 15:40   Re: How to use const
Reply With Quote #7

What doesn't make sense?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
SlientArmy
Junior Member
Join Date: Aug 2019
Old 07-19-2020 , 04:20   Re: How to use const
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
So, what is the point of "Theme1" and "Theme2" in pNames? It makes your request very confusing since you don't even mention that part.

If for example, you want to do dynamic formatting, you can do something like the following (which chooses one of the defined formats randomly):

PHP Code:
szFormats[][] = {"Format 1: %s""Format 2: %s"}

szMyString[28]
iFormat random(sizeof szFormats)

formatex(szMyStringcharsmax(szMyString), szFormats[iFormat], "MyString")
client_print(0print_chatszMyString)

// or to do it directly in client_print()

client_print(0print_chatszFormats[iFormat], "MyString"
@Natsheh, that doesn't make sense.
I will make it easy to change menu designs. I will try and come back
SlientArmy 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 03:25.


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