AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved arrays (https://forums.alliedmods.net/showthread.php?t=336007)

kww 01-21-2022 01:56

arrays
 
I can't understand how this code will behave:
PHP Code:

formatex(szDatacharsmax(szData), "a%i"id

If id == 5 then I will have szData equal to "a5", but if id >= 10 then szData should be, like, "a10".
But it will be:
Code:

szData[0]=="a"
 szData[1]=="1"
 szData[2]=="0"

or:
Code:

szData[0]=="a"
 szData[1]=="10"

Which of them? Thanks in advance

Natsheh 01-21-2022 01:59

Re: arrays
 
Code:

szData[0]=='a'
 szData[1]=='1'
 szData[2]=='0'

Formatex is used to reformat an array of string and its faster than format

kww 01-21-2022 02:08

Re: arrays
 
Quote:

Originally Posted by Natsheh (Post 2768954)
Code:

szData[0]=='a'
 szData[1]=='1'
 szData[2]=='0'

Formatex is used to reformat a array of string and its faster than format

Thank you for responce

fysiks 01-21-2022 22:04

Re: arrays
 
I think you need to read up on how strings work in Pawn so that you actually understand why it is what it is (this will help you in the future). For example, take a look at Part 2 here.


All times are GMT -4. The time now is 11:44.

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