28.03.2016, 08:20
Quote:
Yes, but not in the situation, in a following:
PHP код:
But I can possible using the macro. PHP код:
PS: Sorry if not get express better. My english is not fluent |
Yes, but not in the situation, in a following:
PHP код:
But I can possible using the macro. PHP код:
PS: Sorry if not get express better. My english is not fluent |
stock MyFunc(
{Float, _, unused}:var1 = unused:0,
{Float, _, unused}:var2 = unused:0,
{Float, _, unused}:var3 = unused:0,
{Float, _, unused}:var4 = unused:0,
tag1 = tagof(var1),
tag1 = tagof(var2),
tag1 = tagof(var3),
tag1 = tagof(var4)
) {
if (tagof(var1) == tagof(unused:)) {
num_vars = 0;
} else if (tagof(var2) == tagof(unused:)) {
num_vars = 1;
} else if (tagof(var3) == tagof(unused:)) {
num_vars = 2;
} else if (tagof(var4) == tagof(unused:)) {
num_vars = 3;
} else {
num_vars = 4;
}
var values[4], tags[4];
values[0] = _:var1;
values[1] = _:var2;
values[2] = _:var3;
values[3] = _:var4;
tags[0] = tag1;
tags[1] = tag2;
tags[2] = tag3;
tags[3] = tag4;
// you now have values and tags in an array
// if you want to allow many arguments, you must manually add more
}
new pointer[][] = {{1},{1,2}}; //1 and 1,2 are placeholders //the compiler will allocate space for the array as if it was pointer[2][] //but it does not store the maximum size for the second dimension in the compiler's compile-time symbol table //therefore, the compiler does not know the size of the second dimension //this will allow you to use any index for the 2nd dimension //pointer[0][1000] the compiler won't complain about the index being 1000 getaddress(pointer, array); //fix the indirection table pointer[0][5000]; //no warning, no error
new pData[][] = {{}};
Init() {
new data;
#emit lctrl 1
#emit stor.s.pri data
setPointer(pData, 0, -data); // set pData[0] to -data
data = getData(pData[0][4]); // just for show
new // load offsets
publics = getData(pData[0][8]) - data,
natives = getData(pData[0][9]) - data,
libraries = getData(pData[0][10]) - data,
pubvars = getData(pData[0][11]) - data;
printf("%d %d %d %d %d", data, publics, natives, libraries, pubvars);
}
stock setPointer(pointer[][], index, address) {
#emit load.s.alt pointer
#emit load.s.pri index
#emit idxaddr
#emit move.alt
#emit load.s.pri address
#emit sub
#emit stor.i
}
stock setData(&address, value) address = value; // sref
stock getData(&address) return address; // lref
BUD::SetStringEntry(
PlayerData[playerid][uID], g_AccountData[i][e_Name],
@ptr[address, playerid]
);
printf("SAVING: %s|%s", g_AccountData[i][e_Name], @ptr[address, playerid]);
AADATE `users` SET `deaths`=0 WHERE `uid`=1