AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with a code (https://forums.alliedmods.net/showthread.php?t=295195)

EFFx 03-19-2017 02:38

Problem with a code
 
Why this cannot be possible?

PHP Code:

enum EventStringsSettings
{
    
g_szPrepositionAn[4]
}

new 
EventIntergers[EventIntergersSettings

PHP Code:

new szValue[4]
num_to_str(PlayerData[id][arWhileFlashBanged], szValuecharsmax(szValue)) 

PHP Code:

new bool:bMoreThanOne bool:(PlayerData[id][arWhileFlashBanged] > 1

This >

PHP Code:

bMoreThanOne szValue EventStrings[g_szPrepositionAn

Code:

Error: Array must be indexed (variable "szValue")

klippy 03-19-2017 03:13

Re: Problem with a code
 
Post the full line on which error occurs.

edon1337 03-19-2017 05:36

Re: Problem with a code
 
Code:
str_to_num(bMoreThanOne) ? szValue : EventStrings[g_szPrepositionAn]

Arkshine 03-19-2017 07:12

Re: Problem with a code
 
edon1337, it's okay to help if you know something, but please avoid to answer randomly.

If you look at 'bMoreThanOne', you see it's a boolean. What you're doing doesn't make sense at all.

Issue is more because compiler is dumb. You must provide both either indexed or not indexed, i.e either "condition ? array1 : array2" or "condition ? array1[index1] : array2[index2].

It might work if you use "szValue[0]".

edon1337 03-19-2017 07:30

Re: Problem with a code
 
Quote:

Originally Posted by Arkshine (Post 2504776)
edon1337, it's okay to help if you know something, but please avoid to answer randomly.

I'm sorry, I just thought that would be the solution because it worked for me in some situations :)

EFFx 03-19-2017 13:22

Re: Problem with a code
 
Quote:

Originally Posted by Arkshine (Post 2504776)
edon1337, it's okay to help if you know something, but please avoid to answer randomly.

If you look at 'bMoreThanOne', you see it's a boolean. What you're doing doesn't make sense at all.

Issue is more because compiler is dumb. You must provide both either indexed or not indexed, i.e either "condition ? array1 : array2" or "condition ? array1[index1] : array2[index2].

It might work if you use "szValue[0]".

I noticed it when I created new aaa[4] and changed to bMoreThanOne ? szValue : aaa and it worked then what you said should work. I got it, thx


All times are GMT -4. The time now is 17:56.

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