SA-MP Forums Archive
i need help with /findcar marker - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: i need help with /findcar marker (/showthread.php?tid=187499)



i need help with /findcar marker - Deal-or-die - 03.11.2010

ok, i have this problem with my /findcar cmd, it places the marker(ID 41) (https://sampwiki.blast.hk/wiki/MapIcons) but when ever you mark somewhere else on the map it will hide your car again this can be quite annoying, id like to make this icon a red square on the mini-map and on the big map, and if possable make it so that when you walk into the marker it removes the marker rather than having to type /foundcar, thanks a heap
Код:
	if(strcmp(cmd, "/findcar", true) == 0) // By CuervO_NegrO
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pPcarkey] == 999)
            {
                SendClientMessage(playerid, COLOR_GREY, "You don't have a car");
                return 1;
            }
            new carid = PlayerInfo[playerid][pPcarkey];
			new Float:X, Float:Y, Float:Z;
			new zone[MAX_ZONE_NAME];
        	GetVehicle2DZone(carid, zone, MAX_ZONE_NAME);
			GetVehiclePos(carid, X,Y,Z);
            if(Searching[playerid] == 0)
            {
                Searching[playerid] = 1;
				SetPlayerMapIcon(playerid, 500 + playerid, X,Y,Z, 41, COLOR_RED);
				format(string, sizeof(string),"Your car is at %s, red marker has been set at the map. Type /foundit when you have found it.",zone);
				SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
			}
			else
			{
			    RemovePlayerMapIcon(playerid, carid+1);
                SetPlayerMapIcon(playerid, 500 + playerid, X,Y,Z, 41, COLOR_YELLOW);
				format(string, sizeof(string),"Your car is at %s, red marker has been set at the map. Type /foundit when you have found it.",zone);
				SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
			}
		}
		return 1;
	}



Re: i need help with /findcar marker - Grim_ - 03.11.2010

You cannot natively check if someone is near a marker on the radar. You would be much better off just setting a checkpoint at the position of the car, and when they enter the checkpoint, make it disappear.

Note: Checkpoints also show up on the radar as a red square (triangle if the target is above/below the current Z coordinate of the player), so it would work perfectly for what you want.


Re: i need help with /findcar marker - Deal-or-die - 03.11.2010

Quote:
Originally Posted by Grim_
Посмотреть сообщение
You cannot natively check if someone is near a marker on the radar. You would be much better off just setting a checkpoint at the position of the car, and when they enter the checkpoint, make it disappear.

Note: Checkpoints also show up on the radar as a red square (triangle if the target is above/below the current Z coordinate of the player), so it would work perfectly for what you want.
Exactly what i want! Now, How would i change that script i have to make it work like that? or mayby even start from scratch with that script, but then the rest of the script wouldn't work knowing my luck. :/


Re: i need help with /findcar marker - Grim_ - 03.11.2010

You have to have some sort of scripting knowledge to understand complete answers.

For setting the checkpoint: https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint

For disabling the checkpoint after entering: https://sampwiki.blast.hk/wiki/OnPlayerEnterCheckpoint & https://sampwiki.blast.hk/wiki/DisablePlayerCheckpoint


Re: i need help with /findcar marker - Deal-or-die - 03.11.2010

Quote:
Originally Posted by Grim_
Посмотреть сообщение
You have to have some sort of scripting knowledge to understand complete answers.

For setting the checkpoint: https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint

For disabling the checkpoint after entering: https://sampwiki.blast.hk/wiki/OnPlayerEnterCheckpoint & https://sampwiki.blast.hk/wiki/DisablePlayerCheckpoint
Yea, but this is setting a marker to a personal car. the wiki link you sent me was for setting a marker to a set location, in someway these are related but i just need it to set it to their car rather than a location, this is the original code from my script, to set a marker, which doesn't set any marker what so ever
pawn Код:
SetPlayerMapIcon(playerid, 500 + playerid, X,Y,Z, 41, COLOR_RED);
any help hugely appreciated also i understand.

"I am no longer releasing scripts here, since a lot of people have taken them and are claiming them as their own.
All of my currently released scripts are also in their latest versions, and will not be updated anymore."