[Include] Easy Textur - Online View
#1

Hello,
first sorry for my bad english
Iґm from Germany and a big San Andreas Multiplayer fan.
I have made a Site for Textures and a Include so
the Functions:

PHP код:
SetTextur(ObjektID,Index,ID); 
You can find the IDґs here: http://textur.apl-rl.de/
The site is in German, but there only some mini Functions for that you
need Germany Language, the Include can be used without German speek.


Include:
PHP код:
#include <a_samp>
#include <sscanf2>
#include <a_http>
new oIndex;
stock SetTextur(Objekt,Index,ID) {
new 
string[64];
format(string,64,"textur.apl-rl.de/include.php?id=%d",ID);
HTTP(ObjektHTTP_GETstring"""LoadTextur");
oIndex Index;
return 
1;
}
forward LoadTextur(indexresponse_codedata[]);
public 
LoadTextur(indexresponse_codedata[]) {
if(
response_code == 200) {
new 
ObjektColor;
new 
TXD[20], Textur[20];
sscanf(data,"p<,>is[20]s[20]i",Objekt,TXD,Textur,Color);
SetObjectMaterial(index,oIndex,Objekt,TXD,Textur,Color);
printf("%d %d %d %s %s %d",index,oIndex,Objekt,TXD,Textur,Color);
}
else {
print(
"** Arendium Textur Addon: Error please send a Private Message to Arendium for help!);    
}
return 1;

So that it was by questions ask here, again sorry for my bad english
i had write it without translate/mediation programms.
Reply
#2

oh nice but i never knew there are that few material [ never tied that function though ]
Reply
#3

Thanks
Reply
#4

Example:

new Test = CreateObject(18754, -3119.44824, 498.26251, -0.06920, 0.00000, 0.00000, 0.00000);
SetTextur(Test,0,49);

This code will give the 0 Index from Objekt 'Test'
The Texture ID 49 from my Site(http://textur.apl-rl.de/
Reply
#5

Oh nice one, I like this release though I won't use it.
Reply
#6

thanks, for the answers.
Reply
#7

There aren't so less materials though, aren't there? Nice job compiling them!
Reply
#8

Right, there arenґt all materials because some peoples(I too) must add
Them and this is a hard work i wanna add 5+ every day
Reply
#9

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:
Код:
request #1: SetTextur -> writes oIndex = 1
request #2: SetTextur -> writes oIndex = 2
answer #1: LoadTextur -> reads oIndex = 2
answer #2: LoadTextur -> reads oIndex = 2
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):
Код:
((objectId & 0xFFFF) << 16) | (material_index & 0xFF)
P.S. You forgot a " at the end of the latest string.

--

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;
}
Reply
#10

Why not just make a texture include? This just seems completely pointless.
Reply
#11

As you can see everyone can add a texture, so it's not so pointless as you think. ( or maybe it is for you )


Suggestion : Translate in english so everyone can understand...
Reply
#12

It is pointless for me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)