Raised This Month: $ Target: $400
 0% 

new something[] = "something"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 09-22-2011 , 07:39   new something[] = "something"
Reply With Quote #1

As the title says i want to make something like this
Example:
Code:
new a[] = "v"
new g[] = "c"
new something[] = "somehting1"
..................................
that code is working, i mean that style, but what if i have more items, like 10 of them...
Is there any faster way in doing this?
maybe enums?
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 09-22-2011 , 07:49   Re: new something[] = "something"
Reply With Quote #2

PHP Code:
new a[] =
{
    
"v",
    
"c"
    
and so on...

?
Erox902 is offline
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 09-22-2011 , 07:50   Re: new something[] = "something"
Reply With Quote #3

PHP Code:
new a[][] ={ "v""d""e" }

a[0] = a[1] = a[2]= 
__________________
Preparing to release my plugins..
r0ck is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 09-22-2011 , 08:00   Re: new something[] = "something"
Reply With Quote #4

Quote:
Originally Posted by Erox902 View Post
PHP Code:
new a[] =
{
    
"v",
    
"c"
    
and so on...

?

doesn't help
Quote:
Originally Posted by r0ck View Post
PHP Code:
new a[][] ={ "v""d""e" }

a[0] = a[1] = a[2]= 
hm two dimensional array, i thought about that, but is there something more efficient? I think that this is same like the code i provided..
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 09-22-2011 , 08:01   Re: new something[] = "something"
Reply With Quote #5

Both examples are legit; the first one cannot handle a string however. Only one character.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-22-2011 , 08:10   Re: new something[] = "something"
Reply With Quote #6

maybe like this:

PHP Code:
new a[] =
{
    
'v',
    
'c',
    ... ,
    
0

jimaway is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 09-22-2011 , 08:17   Re: new something[] = "something"
Reply With Quote #7

Quote:
Originally Posted by jimaway View Post
maybe like this:

PHP Code:
new a[] =
{
    
'v',
    
'c',
    ... ,
    
0

i'm missing something, or i don't know how to use this
Let's say i have 10 new things that are equal to some other things
simple example

Code:
#include <amxmodx>

new a[] = "v"

public plugin_init()
	register_clcmd("say /test", "TestingCode")
	
public TestingCode(id)
	client_print(id, print_chat, "Your letter is %s", a)
	
////Outcome => Your letter is v//////
how can i use your code in this case?
show me example with 3/4 things, i really don't understand :S
Thanks in advance.
Only r0ck code was kind-a helpfull

Last edited by OvidiuS; 09-22-2011 at 08:23.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-22-2011 , 08:23   Re: new something[] = "something"
Reply With Quote #8

Tells us what you are trying to do in words, not in code.
__________________
Bugsy is online now
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-22-2011 , 08:23   Re: new something[] = "something"
Reply With Quote #9

use 2 dimensional array when you want to compare 10 different strings
jimaway is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 09-22-2011 , 08:28   Re: new something[] = "something"
Reply With Quote #10

Quote:
Originally Posted by Bugsy View Post
Tells us what you are trying to do in words, not in code.
Ok, i'm trying to create kind of simple decryption/encryption for files, data.
After disassembling plugin, you can see pass etc..
i first wanted to use md5 but pawn doesn't have decryption include, so i thought
about this.
If i put %s%s...etc after disassembling you only see %s not the letters, so no one can steal data. I know it's kinda dumb, but it do the job.

Last edited by OvidiuS; 09-22-2011 at 08:33.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
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 19:39.


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