SA-MP Forums Archive
Minimap Mapicons - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Minimap Mapicons (/showthread.php?tid=481903)



Minimap Mapicons - LMagnifico - 18.12.2013

need help.. i have a little problem with my icons and i dont know how to edit it.. on my minimap when im far away the icon is not showing up when im very near it only shows up:

1st image


2nd image


Код HTML:
CMD:mused(playerid, params[])
{
	new string[128];
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
//    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
	SendClientMessage(playerid, COLOR_ORANGE, "[Used MapIcons]:");
	for(new idx=0; idx<MAX_MAPICONS; idx++)
	{
	    if(MapIconInfo[idx][mpType])
	    {
			format(string, sizeof(string), "ID: %d | Pickup: %d", idx, MapIconInfo[idx][mpType]);
			SendClientMessage(playerid, COLOR_ORANGE, string);
	    }
	}
	return 1;
}

CMD:medit(playerid, params[])
{
	new string[128], idx;
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
//    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
 	if(sscanf(params, "s[128]", params))
	{
		SendClientMessage(playerid, COLOR_WHITE, "USAGE: /medit [option] [mapiconid]");
		SendClientMessage(playerid, COLOR_GREY, "OPTIONS: Position | Icon");
		return 1;
	}
	if(!strcmp(params, "position", true, 8))
	{
	    if(sscanf(params, "s[128]i", params, idx)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /medit position [mapiconid]");
        if(MapIconInfo[idx][mpType] == 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid mapicon id.");
        GetPlayerPos(playerid, MapIconInfo[idx][mpX], MapIconInfo[idx][mpY], MapIconInfo[idx][mpZ]);
        DestroyDynamicMapIcon(MapIconInfo[idx][mpID]);
		MapIconInfo[idx][mpID] = CreateDynamicMapIcon(MapIconInfo[idx][mpX], MapIconInfo[idx][mpY], MapIconInfo[idx][mpZ], MapIconInfo[idx][mpType], 0 ,0);
	    format(string, sizeof(string), " You have set mapicon ID %d's position to your coordinates.", idx);
	    SendClientMessage(playerid, COLOR_WHITE, string);
	}
	if(!strcmp(params, "icon", true, 4))
	{
	    new pickup;
	    if(sscanf(params, "s[128]ii", params, idx, pickup)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /medit icon [mapiconid] [iconid]");
        if(pickup == 0 || pickup == 1) return SendClientMessage(playerid, COLOR_GREY, "Invalid mapicon type.");
        if(MapIconInfo[idx][mpType] == 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid mapicon id.");
        MapIconInfo[idx][mpType] = pickup;
        DestroyDynamicMapIcon(MapIconInfo[idx][mpID]);
		MapIconInfo[idx][mpID] = CreateDynamicMapIcon(MapIconInfo[idx][mpX], MapIconInfo[idx][mpY], MapIconInfo[idx][mpZ], MapIconInfo[idx][mpType], 0 ,0);
	    format(string, sizeof(string), " You have set mapicon ID %d's icon to %d.", idx, pickup);
	    SendClientMessage(playerid, COLOR_WHITE, string);
	}
	return 1;
}

CMD:gotomapicon(playerid, params[])
{
    new idx, string[128];
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
//    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
	if(sscanf(params, "i", idx)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gotomapicon [mapiconid]");
	if(!MapIconInfo[idx][mpType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid mapicon id.");
	SetPlayerInterior(playerid, 0);
	SetPlayerVirtualWorld(playerid, 0);
	SetPlayerPos(playerid, MapIconInfo[idx][mpX], MapIconInfo[idx][mpY], MapIconInfo[idx][mpZ]);
	format(string, sizeof(string), " You have teleported to mapicon ID %d.", idx);
	SendClientMessage(playerid, COLOR_WHITE, string);
	return 1;
}

CMD:deletemapicon(playerid, params[])
{
	new idx, string[128];
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
//    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
	if(sscanf(params, "i", idx)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deletemapicon [mapiconid]");
	if(!MapIconInfo[idx][mpType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid mapicon id.");
    MapIconInfo[idx][mpType] = 0;
    MapIconInfo[idx][mpX] = 0;
	MapIconInfo[idx][mpY] = 0;
	MapIconInfo[idx][mpZ] = 0;
	DestroyDynamicMapIcon(MapIconInfo[idx][mpID]);
    format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has deleted mapicon ID %d.", RPN(playerid), idx);
    SendAdminMessage(COLOR_DARKRED, 1, string);
	Log("logs/mapicons.log", string);
	return 1;
}

CMD:createmapicon(playerid, params[])
{
	new string[128], type;
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
//    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
	if(sscanf(params, "i", type)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createmapicon [icon]");
	if(type == 0 || type == 1) return SendClientMessage(playerid, COLOR_GREY, "Invalid mapicon type.");
	for(new idx=0; idx<MAX_MAPICONS; idx++)
	{
	    if(!MapIconInfo[idx][mpType])
	    {
		    MapIconInfo[idx][mpType] = type;
		    GetPlayerPos(playerid, MapIconInfo[idx][mpX], MapIconInfo[idx][mpY], MapIconInfo[idx][mpZ]);
		    MapIconInfo[idx][mpID] = CreateDynamicMapIcon(MapIconInfo[idx][mpX], MapIconInfo[idx][mpY], MapIconInfo[idx][mpZ], MapIconInfo[idx][mpType], 0 ,0);
			format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has created mapicon ID %d.", RPN(playerid), idx);
		    SendAdminMessage(COLOR_DARKRED, 1, string);
			Log("logs/mapicons.log", string);
			idx = MAX_DOORS;
		}
	}
	return 1;
}



Re: Minimap Mapicons - WhiteAngels - 18.12.2013

Try this :

Quote:

CMD:createmapicon(playerid, params[])
{
new string[128], type;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
// if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
if(sscanf(params, "i", type)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createmapicon [icon]");
if(type == 0 || type == 1) return SendClientMessage(playerid, COLOR_GREY, "Invalid mapicon type.");
for(new idx=0; idx<MAX_MAPICONS; idx++)
{
if(!MapIconInfo[idx][mpType])
{
MapIconInfo[idx][mpType] = type;
GetPlayerPos(playerid, MapIconInfo[idx][mpX], MapIconInfo[idx][mpY], MapIconInfo[idx][mpZ]);
MapIconInfo[idx][mpID] = CreateDynamicMapIcon(MapIconInfo[idx][mpX], MapIconInfo[idx][mpY], MapIconInfo[idx][mpZ], MapIconInfo[idx][mpType], 100);
format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has created mapicon ID %d.", RPN(playerid), idx);
SendAdminMessage(COLOR_DARKRED, 1, string);
Log("logs/mapicons.log", string);
idx = MAX_DOORS;
}
}
return 1;
}




Re: Minimap Mapicons - WhiteAngels - 18.12.2013

if you want to create some MapIcons, Just type /save In The Game and open the savepositions.txt and Copy the [x] [y] [z] Position and Create this in the FillterscriptInit/GamemodeInit : CreateDynamicMapIcon([x],[y],[z],[Icons ID],[Radius]);

To see All Icons ID , you can see At >>Click This<<


Re : Minimap Mapicons - [HRD]Mar1 - 18.12.2013

It's from the map icon draw distance


Re: Minimap Mapicons - LMagnifico - 18.12.2013

Quote:
Originally Posted by WhiteAngels
Посмотреть сообщение
if you want to create some MapIcons, Just type /save In The Game and open the savepositions.txt and Copy the [x] [y] [z] Position and Create this in the FillterscriptInit/GamemodeInit : CreateDynamicMapIcon([x],[y],[z],[Icons ID],[Radius]);

To see All Icons ID , you can see At >>Click This<<
yah im trying that but problem encountered

i tried what you say i add this CreateDynamicMapIcon(294,1461.7731,-1010.2757,26.8438,1.5667,0,0,0,0,0,0); // to gamemodeinit

: warning 213: tag mismatch
: warning 213: tag mismatch
: warning 202: number of arguments does not match definition
: warning 202: number of arguments does not match definition


Re : Minimap Mapicons - [HRD]Mar1 - 18.12.2013

Код:
CreateDynamicMapIcon(MapIconInfo[idx][mpX], MapIconInfo[idx][mpY], MapIconInfo[idx][mpZ], MapIconInfo[idx][mpType], -1,0, 0, -1, 100.0);



Re: Minimap Mapicons - LMagnifico - 19.12.2013

still tag mismatch.. what should i do? help!!!


Re: Minimap Mapicons - WhiteAngels - 20.12.2013

Quote:
Originally Posted by LMagnifico
Посмотреть сообщение
yah im trying that but problem encountered

i tried what you say i add this CreateDynamicMapIcon(294,1461.7731,-1010.2757,26.8438,1.5667,0,0,0,0,0,0); // to gamemodeinit

: warning 213: tag mismatch
: warning 213: tag mismatch
: warning 202: number of arguments does not match definition
: warning 202: number of arguments does not match definition
FALSE
That's for AddPlayerClass
Okay i'll Explain this...
______________________________________
AddPlayerClass(294,1461.7731,-1010.2757,26.8438,1.5667,0,0,0,0,0,0);
294 is Skin ID
1461.77731 = [X] Position
-1010.2757 = [Y] Position
26.8438 = [Z] Postion
1.5667 = your skin Rotation when you type /save
and then ,0,0,0,0,0,0 = Weapon1,Ammo,Weapon2,Ammo,Weapon3,Ammo...

So , You just Copy from 1461.77731 to 26.8438 = from X position to Z position... and Paste in CreateDynamicMapIcon([x],[y],[z],100.0);
_____________________________________
Try This :

CreateDynamicMapIcon(1461.7731,-1010.2757,26.8438,[Changethis to MapIconsID],100,0.); // to gamemodeinit

*SorryForMyLittleEnglish


Re: Minimap Mapicons - LMagnifico - 20.12.2013

yah it worked thanks.. but nothing change the problem remains..

any problem with the code?

Код:
enum mapiconInfo
{
	mpID,
	mpType,
	Float:mpX,
	Float:mpY,
	Float:mpZ
}
new MapIconInfo[MAX_MAPICONS][mapiconInfo];

stock SaveMapIcons()
{
	new idx = 0, File:file;
	new string[256];
	while(idx < MAX_MAPICONS)
	{
	    format(string, sizeof(string), "%d|%f|%f|%f\r\n",
		MapIconInfo[idx][mpType],
		MapIconInfo[idx][mpX],
		MapIconInfo[idx][mpY],
		MapIconInfo[idx][mpZ]);
	    if(idx == 0)
	    {
	        file = fopen("mapicons.cfg", io_write);
	    }
	    else
	    {
	    	file = fopen("mapicons.cfg", io_append);
	    }
		fwrite(file, string);
		fclose(file);
		idx++;
	}
	print("Mapicons saved successfully.");
}

stock LoadMapIcons()
{
	new dinfo[4][128];
	new string[256];
	new File:file = fopen("mapicons.cfg", io_read);
	if(file)
	{
	    new idx = 0;
		while(idx < MAX_MAPICONS)
		{
		    fread(file, string);
		    split(string, dinfo, '|');
		    MapIconInfo[idx][mpType] = strval(dinfo[0]);
			MapIconInfo[idx][mpX] = floatstr(dinfo[1]);
			MapIconInfo[idx][mpY] = floatstr(dinfo[2]);
			MapIconInfo[idx][mpZ] = floatstr(dinfo[3]);
			if(MapIconInfo[idx][mpType]) // If mapicon exists
			{
			    CreateDynamicMapIcon(MapIconInfo[idx][mpX], MapIconInfo[idx][mpY], MapIconInfo[idx][mpZ], MapIconInfo[idx][mpType], -1,0, 0, -1, 100.0);
			}
			idx++;
	    }
	}
	print("Mapicons loaded successfully.");
	return 1;
}
gl_mapicon
Код:
//-------------------------------------------------
//
// These are the default map icons from San Andreas
// Cluckin Bell, Ammu, Burgershot etc
//
// Kye 2010
//
//-------------------------------------------------

#pragma tabsize 0

#include <a_samp>
#include <core>
#include <float>

public OnPlayerConnect(playerid)
{
	SetPlayerMapIcon(playerid,49,822.6,-1590.3,13.5,7,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,50,-2570.1,245.4,10.3,7,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,51,2726.6,-2026.4,17.5,7,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,52,2080.3,2119.0,10.8,7,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,53,675.7,-496.6,16.8,7,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,54,-1805.7,943.2,24.8,29,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,55,2750.9,2470.9,11.0,29,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,56,2351.8,2529.0,10.8,29,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,57,2635.5,1847.4,11.0,29,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,58,2083.4,2221.0,11.0,29,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,59,-1719.1,1359.4,8.6,29,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,60,2330.2,75.2,31.0,29,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,61,203.2,-200.4,6.5,29,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,62,812.9,-1616.1,13.6,10,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,63,1199.1,-924.0,43.3,10,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,64,2362.2,2069.9,10.8,10,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,65,2469.5,2033.8,10.8,10,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,66,2172.9,2795.7,10.8,10,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,67,1875.3,2072.0,10.8,10,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,68,1161.5,2072.0,10.8,10,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,69,-2356.0,1009.0,49.0,10,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,70,-1913.3,826.2,36.9,10,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,71,-2335.6,-165.6,39.5,10,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,72,2397.8,-1895.6,13.7,14,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,73,2421.6,-1509.6,24.1,14,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,74,-2671.6,257.4,4.6,14,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,75,2392.4,2046.5,10.8,14,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,76,2844.5,2401.1,11.0,14,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,77,2635.5,1674.3,11.0,14,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,78,2105.7,2228.7,11.0,14,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,79,-2154.0,-2461.2,30.8,14,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,80,-1816.2,620.8,37.5,14,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,81,-1216.0,1831.4,45.3,14,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,82,172.73,1176.76,13.7,14,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,83,932.0,-1353.0,14.0,14,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,84,1971.7,-2036.6,13.5,39,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,85,2071.6,-1779.9,13.5,39,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,86,2094.6,2119.0,10.8,39,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,87,-2490.5,-40.1,39.3,39,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,88,1372.9,-1278.8,12.5,6,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,89,2400.5,-1978.4,13.5,6,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,90,-2626.6,209.4,4.9,6,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,91,2535.9,2083.5,10.8,6,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,92,2156.5,943.2,10.8,6,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,93,779.7,1874.3,4.9,6,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,94,-2092.7,-2463.8,30.6,6,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,95,240.0,-178.2,2.0,6,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,96,-1509.4,2611.8,58.5,6,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,97,-315.67,829.87,13.43,6,0,MAPICON_LOCAL);
	SetPlayerMapIcon(playerid,98,2332.9,63.6,31.0,6,0,MAPICON_LOCAL);
	
	return 1;
}