SA-MP Forums Archive
[Include] Easy Textur - Online View - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Easy Textur - Online View (/showthread.php?tid=435041)



Easy Textur - Online View - Arendium - 05.05.2013

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.


Re: Easy Textur - Online View - Niko_boy - 05.05.2013

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


AW: Easy Textur - Online View - Arendium - 05.05.2013

Thanks


AW: Easy Textur - Online View - Arendium - 05.05.2013

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/


Re: Easy Textur - Online View - Jochemd - 06.05.2013

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


AW: Easy Textur - Online View - Arendium - 06.05.2013

thanks, for the answers.


Re: Easy Textur - Online View - RajatPawar - 06.05.2013

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


AW: Easy Textur - Online View - Arendium - 06.05.2013

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


Re: Easy Textur - Online View - Dan.. - 06.05.2013

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;
}



Re: Easy Textur - Online View - Pottus - 07.05.2013

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


Re: Easy Textur - Online View - jdey - 07.05.2013

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...


Re: Easy Textur - Online View - Pottus - 07.05.2013

It is pointless for me