Can I Add Value To An Array
#1

Hi everyone,

For example, i have an array like "new arr[] = {1, 3, 5, 7};". Can i add more values to this array dynamically?
Reply
#2

In running-time nope afaik.
Reply
#3

You certainly cannot if you declare your array like that. If you declare it like this instead then you can :
Quote:

new arr[50] = {1, 3, 5, 7};

It is mandatory in pawn to know array size before compilation therefore dynamic memory allocation is not possible through pawn directly.

You can use plugin if you really want dynamic memory allocation, here is one i found https://sampforum.blast.hk/showthread.php?tid=364285
Reply
#4

Thank you for your answers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)