06.05.2013, 17:56
(
Последний раз редактировалось Dan..; 06.05.2013 в 18:38.
)
Sending a request whilst the request queue is not empty might cause unexpected errors. (oIndex should be passed as a parameter to the callback)
Here's an example to understand better what I want to say:
You can't pass two integer parameters to the callback, but you can implement an additional data structure (a enum and you pass an address, an index offset or something) or maybe use some clever bit-wise operations (which I highly recommend):
P.S. You forgot a " at the end of the latest string.
--
Edit:
This is what I had in mind:
Here's an example to understand better what I want to say:
Код:
request #1: SetTextur -> writes oIndex = 1 request #2: SetTextur -> writes oIndex = 2 answer #1: LoadTextur -> reads oIndex = 2 answer #2: LoadTextur -> reads oIndex = 2
Код:
((objectId & 0xFFFF) << 16) | (material_index & 0xFF)
--
Edit:
This is what I had in mind:
pawn Код:
stock SetTextur(objectid, index, id) {
new url[64];
format(url, sizeof(url), "textur.apl-rl.de/include.php?id=%d", id);
HTTP(((objectId & 0xFFFF) << 16) | (index & 0xFF), HTTP_GET, url, "", #LoadTextur);
return 1;
}
forward LoadTextur(index, response_code, data[]);
public LoadTextur(index, response_code, data[]) {
if (response_code == 200) {
new objectId = (index >> 16) & 0xFF, oIndex = index & 0xFF, modelid, TXD[20], textur[20], color;
sscanf(data, "p<,>is[20]s[20]i", modelid, TXD, textur, color);
SetObjectMaterial(objectId, oIndex, modelid, TXD, textur, color);
printf("[debug] Arendium Textur Addon: %d %d %d %s %s %d", objectId, oIndex, modelid, TXD, textur, color);
} else {
print("[error] Arendium Textur Addon: Error please send a Private Message to Arendium for help!");
}
return 1;
}