01.02.2012, 20:51
(
Последний раз редактировалось The King's Bastard; 01.02.2012 в 21:27.
)
OK, I don't quite get how the write works...
You write @[pointer][1] = 444.
But how can this (with your definition of @) write 444 g_Test and replace 456?
//EDiT:
OK, figured out what PointerByAddress does.
It just stores the value of the argument into g_aaiPointers, right?
And then this is used:
@[%1] (PointerByAddress (%1), g_aaiPointers[0][0])
But why the devil is the address stored in g_aaiPointers[0][0] assigned with the actual value when you use @[pointer] = value and not just g_aaiPointers[0][0]?
What kind of sorcery is this?
//EDiT 2: OK, maybe I don't understand at all what PointerByAddress does...
pawn Код:
new
g_Test[] = {123, 456, 789}
;
public OnGameModeInit() {
new pointer = GetVariableAddress(g_Test);
// Change the 2nd value
@[pointer][1] = 444;
// Print out the values
printf("%d, %d, %d", @[pointer][0], @[pointer][1], @[pointer][2]);
}
But how can this (with your definition of @) write 444 g_Test and replace 456?
//EDiT:
OK, figured out what PointerByAddress does.
It just stores the value of the argument into g_aaiPointers, right?
And then this is used:
@[%1] (PointerByAddress (%1), g_aaiPointers[0][0])
But why the devil is the address stored in g_aaiPointers[0][0] assigned with the actual value when you use @[pointer] = value and not just g_aaiPointers[0][0]?
What kind of sorcery is this?
//EDiT 2: OK, maybe I don't understand at all what PointerByAddress does...