AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   new something[] = "something" (https://forums.alliedmods.net/showthread.php?t=167944)

OvidiuS 09-22-2011 07:39

new something[] = "something"
 
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?

Erox902 09-22-2011 07:49

Re: new something[] = "something"
 
PHP Code:

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


?

r0ck 09-22-2011 07:50

Re: new something[] = "something"
 
PHP Code:

new a[][] ={ "v""d""e" }

a[0] = a[1] = a[2]= 


OvidiuS 09-22-2011 08:00

Re: new something[] = "something"
 
Quote:

Originally Posted by Erox902 (Post 1560693)
PHP Code:

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


?


doesn't help
Quote:

Originally Posted by r0ck (Post 1560694)
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..

Xellath 09-22-2011 08:01

Re: new something[] = "something"
 
Both examples are legit; the first one cannot handle a string however. Only one character.

jimaway 09-22-2011 08:10

Re: new something[] = "something"
 
maybe like this:

PHP Code:

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



OvidiuS 09-22-2011 08:17

Re: new something[] = "something"
 
Quote:

Originally Posted by jimaway (Post 1560702)
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

Bugsy 09-22-2011 08:23

Re: new something[] = "something"
 
Tells us what you are trying to do in words, not in code.

jimaway 09-22-2011 08:23

Re: new something[] = "something"
 
use 2 dimensional array when you want to compare 10 different strings

OvidiuS 09-22-2011 08:28

Re: new something[] = "something"
 
Quote:

Originally Posted by Bugsy (Post 1560711)
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.


All times are GMT -4. The time now is 19:39.

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