[PHP+DJSON] DMap 0.4 - Dynamic Website Player/Car/Obj/Shop Map(******Maps based)
#21

it's not good working.
then server has ~10 players, it's good.
then ~30 it's not working.


http://gta-mp.xz.lt/fr_map.php -Map
http://gta-mp.xz.lt/fr_on.php -Players
Reply
#22

Quote:
Originally Posted by Reamis
it's not good working.
then server has ~10 players, it's good.
then ~30 it's not working.


http://gta-mp.xz.lt/fr_map.php -Map
http://gta-mp.xz.lt/fr_on.php -Players
Hello Reamis,

thanks for this report. Your dmap_feed.json looks like only the first player is added+updated.

I am currently doing a rework for some general handling of dmap, I'll message you as soon as dmap 0.3 is ready.

- Draco
Reply
#23

ok, i will wait for it.
Reply
#24

Dmap 0.3 release

Changes:
- less cpu usage -> faster
- now pretty reliable, even with more players online

Important: Use the new djson 1.5.1, to have full speed features of dmap!

- Draco
Reply
#25

Quote:
Originally Posted by DracoBlue
Dmap 0.3 release

Changes:
- less cpu usage -> faster
- now pretty reliable, even with more players online

Important: Use the new djson 1.5.1, to have full speed features of dmap!

- Draco
gonna update this night.
thank you.
Reply
#26

ok,
it's working now with +30 players.

but how to show in map 'map icons'?
Reply
#27

Quote:
Originally Posted by Reamis
ok,
it's working now with +30 players.

but how to show in map 'map icons'?
Hm? What do you mean by map icons?

- Draco

PS: Can I add your site as demo page, too?
Reply
#28

Quote:
Originally Posted by DracoBlue
Quote:
Originally Posted by Reamis
ok,
it's working now with +30 players.

but how to show in map 'map icons'?
Hm? What do you mean by map icons?

- Draco

PS: Can I add your site as demo page, too?
this :
possible to show in web map?


and about demo, yes
Reply
#29

Quote:
Originally Posted by Reamis
ok,
it's working now with +30 players.

but how to show in map 'map icons'?
..

this :
possible to show in web map?
Of course!

Add this to your gamemode:
pawn Code:
new DMAP_last_icon = 0;
stock addDmapIcon(Float:x,Float:y,icon_id,name[],text[]) {
        new tmp[DJSON_MAX_STRING];
        DMAP_last_icon++;

        format(tmp,DJSON_MAX_STRING,"items/i%d/id",DMAP_last_icon);
        djSetInt("dmap_feed.json",tmp,DMAP_last_icon);
        format(tmp,DJSON_MAX_STRING,"items/i%d/name",DMAP_last_icon);
        djSet("dmap_feed.json",tmp,name);
        format(tmp,DJSON_MAX_STRING,"items/i%d/icon",DMAP_last_icon);
        djSetFloat("dmap_feed.json",tmp,icon_id);
        format(tmp,DJSON_MAX_STRING,"items/i%d/pos/x",DMAP_last_icon);
        djSetInt("dmap_feed.json",tmp,floatround(x));
        format(tmp,DJSON_MAX_STRING,"items/i%d/pos/y",DMAP_last_icon);
        djSetInt("dmap_feed.json",tmp,floatround(y));
}
Now add icons easily (after dmap_GameModeInit()):
pawn Code:
addDmapIcon(1200,-500,10,"Burger Shop","Description text for the icon (what comes when you click it)");
- Draco

[edit] Updated the code .. should be working now :)
Reply
#30

ok. in the dmap_feed.json it looks so:
Code:
{"items":{"i1":{"icon":31,"id":1,"name":"Haus frei","pos":{"x":2499,"y":-1646},"text":"Haus mit 543333334$ und<br>354 Score gehцrt niemandem!"},"p0":{"icon":"58","id":0,"name":"[HC]E4sTsId3 (0)","pos":{"x":2025,"y":-1135},"text":"Health: 100 Armour: 0 Score: 44<br><img src=\\"https://sampwiki.blast.hk/w/images/a/ab/Skin_105.png\\"> <img src=\\"https://sampwiki.blast.hk/w/images/f/fe/Vehicle_458.jpg\\">"}}}
the format-code is:
if i open the fetch_data.php in the browser there are these images with the src: "http://domain.ltd/map/%5C%5C%22http:....png%5C%5C%22"
Reply
#31

Quote:
Originally Posted by papagei9
ok. in the dmap_feed.json it looks so:
Code:
{"items":{"i1":{"icon":31,"id":1,"name":"Haus frei","pos":{"x":2499,"y":-1646},"text":"Haus mit 543333334$ und<br>354 Score gehцrt niemandem!"},"p0":{"icon":"58","id":0,"name":"[HC]E4sTsId3 (0)","pos":{"x":2025,"y":-1135},"text":"Health: 100 Armour: 0 Score: 44<br><img src=\\"https://sampwiki.blast.hk/w/images/a/ab/Skin_105.png\\"> <img src=\\"https://sampwiki.blast.hk/w/images/f/fe/Vehicle_458.jpg\\">"}}}
the format-code is:
if i open the fetch_data.php in the browser there are these images with the src: "http://domain.ltd/map/%5C%5C%22http:....png%5C%5C%22"
There is a little bug in djson when saving ". Just replace " with \", before saving.

- Draco
Reply
#32

Code:
format(skincar,255,"<img src=\\\"https://sampwiki.blast.hk/w/images/a/ab/Skin_105.png\\\"> <img src=\\\"https://sampwiki.blast.hk/w/images/f/fe/..._458.jpg\\\">");
Code:
Here i must set one \ before the " cause i use format()

and then if i set again a \ before the " the rest of the line gets green.
and the i set again a \ before the ". Then are 3 \ in front of the ".

But it still doesn't work...

--sry for my bad english.--
Reply
#33

Try this instead:
- Draco
Reply
#34

Ok thx!

Now another problem :

I add in OnGameModeInit 30 MapIcons to Dmap.

The Icons are visible on the map.
If i connect with the playerid 0 a new playericon appears.
But if another player connect with the playerid 1-200 (not 0) the player's icon is one of the map-Icons i've added.
Also a player have a mapicon on the online-map like a 'house'.

Can you fix that ? Or can u give me an advice to fix that ?

- Andi
Reply
#35

Quote:
Originally Posted by papagei9
Ok thx!

Now another problem :

I add in OnGameModeInit 30 MapIcons to Dmap.

The Icons are visible on the map.
If i connect with the playerid 0 a new playericon appears.
But if another player connect with the playerid 1-200 (not 0) the player's icon is one of the map-Icons i've added.
Also a player have a mapicon on the online-map like a 'house'.

Can you fix that ? Or can u give me an advice to fix that ?

- Andi
How do you add the own icons?

- Draco
Reply
#36

Under OnGameModeInit:
Code:
if(dini_Int(HouseFile(i), "Kaufbar") == 1)
				{
					//ChangeMapIconInfo(playerid,H_Icon[playerid][i], dini_Int(HouseFile(i), "x"),dini_Int(HouseFile(i),"y"),dini_Int(HouseFile(i), "z"), 31, 800);
					nIconDestroyForAll(H_Icon[i]);
					H_Icon[i] = nIconAddForAll(HausInfos[i][Hx],HausInfos[i][Hy],HausInfos[i][Hz],31);
					format(hinfo,255,"<font color=BLUE>%s</font> <font color=GREEN>steht zum Verkauf!</font><br><font color=BLUE>Preis:</font> <font color=RED>%d$</font> <font color=BLUE>Score:</font> <font color=RED>%d</font>",dini_Get(HouseFile(i), "Name"),dini_Int(HouseFile(i), "Preis"),dini_Int(HouseFile(i), "Score"));
					format(h2info,64,"%s ist frei",dini_Get(HouseFile(i), "Name"));
					addDmapIcon(HausInfos[i][Hx],HausInfos[i][Hy],31,h2info,hinfo);
				}
				else
				if(dini_Int(HouseFile(i), "Kaufbar") == 0)
				{
					//ChangeMapIconInfo(playerid,H_Icon[playerid][i], dini_Int(HouseFile(i), "x"),dini_Int(HouseFile(i),"y"),dini_Int(HouseFile(i), "z"), 32, 800);
					nIconDestroyForAll(H_Icon[i]);
					H_Icon[i] = nIconAddForAll(HausInfos[i][Hx],HausInfos[i][Hy],HausInfos[i][Hz],32);
					format(hinfo,255,"<font color=BLUE>%s</font> <font color=GREEN>geh&ouml;rt</font> <font color=RED>%s</font>",dini_Get(HouseFile(i), "Name"),dini_Get(HouseFile(i), "Besitzer"));
					format(h2info,64,"%s ist besetzt",dini_Get(HouseFile(i), "Name"));
					H_DIcon[i] = addDmapIcon(HausInfos[i][Hx],HausInfos[i][Hy],32,h2info,hinfo);
				}
addDmapIcon:
Code:
new DMAP_last_icon = 0;

stock addDmapIcon(Float:x,Float:y,icon_id,name[],text[])
{
		new tmp[DJSON_MAX_STRING];
		DMAP_last_icon++;

		format(tmp,DJSON_MAX_STRING,"items/i%d/id",DMAP_last_icon);
		djSetInt("dmap_feed.json",tmp,DMAP_last_icon);
		format(tmp,DJSON_MAX_STRING,"items/i%d/name",DMAP_last_icon);
		djSet("dmap_feed.json",tmp,name);
		format(tmp,DJSON_MAX_STRING,"items/i%d/text",DMAP_last_icon);
		djSet("dmap_feed.json",tmp,text);
		format(tmp,DJSON_MAX_STRING,"items/i%d/icon",DMAP_last_icon);
		djSetInt("dmap_feed.json",tmp,icon_id); //SetFloat
		format(tmp,DJSON_MAX_STRING,"items/i%d/pos/x",DMAP_last_icon);
		djSetInt("dmap_feed.json",tmp,floatround(x));
		format(tmp,DJSON_MAX_STRING,"items/i%d/pos/y",DMAP_last_icon);
		djSetInt("dmap_feed.json",tmp,floatround(y));
		return DMAP_last_icon;
}
Reply
#37

This code looks fine.

Could you send me a link to your map where this happens?

- Draco
Reply
#38

I have only a picture cause it's a testserver and there won't be people many times...

[img width=1024 height=654]http://sa-mp.bplaced.net/uploader/uploads/35085ecf4ac671e427e268203.jpg[/img]
Reply
#39

Excellent work !
Reply
#40

Quote:
Originally Posted by stansan
look at the link one post above yours.. there is my map running..

stansan
Wow, nice!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)