How to remove mapicon -
GabiXx - 03.12.2016
I use this
PHP код:
if(dialogid == 6)
{
if(response)
{
if(listitem == 0)
{
CreateDynamicCP(377.8297,-2087.4912,7.8359, 5.0, -1, -1, -1, 50.0);
SetPlayerMapIcon(playerid, 1,377.8297,-2087.4912,7.8359, 0, COLOR_YELLOW, 0);
SendClientMessage(playerid, COLOR_YELLOW, "Mergi la checkpoint-ul afisat pe harta.");
}
}
}
return 1;
}
What code i need for when player enter cp, to remove the mapicon.
Re: How to remove mapicon -
Abagail - 03.12.2016
Use RemovePlayerMapIcon(playerid, 1) when the player enters the specific checkpoint(use OnPlayerEnterDynamicCP).
Re: How to remove mapicon -
GabiXx - 03.12.2016
And if i create more dynamicCP with other ids this will be able?
Re: How to remove mapicon -
Tass007 - 03.12.2016
Yes. Whenever you create a DynamicCP you should always give it a variable name. For example
PHP код:
CheckpointOne[playerid] = CreateDynamicCP(377.8297,-2087.4912,7.8359, 5.0, -1, -1, -1, 50.0);
CheckpointTwo[playerid] = CreateDynamicCP(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid, Float:distance = 100.0);
Then under OnPlayerEnterDynamicCP
PHP код:
if(checkpointid == CheckpointOne[playerid])
{
RemovePlayerMapIcon(playerid, 1);
}
if(checkpointid == CheckpointTwo[playerid])
{
//Other things here.
}
That's basically it. Have anymore questions?
Re: How to remove mapicon -
GabiXx - 03.12.2016
I use this:
PHP код:
CheckpointOne[playerid] = CreateDynamicCP(377.8297,-2087.4912,7.8359, 5.0, -1, -1, -1, 50.0);
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
DestroyDynamicCP(checkpointid);
SendClientMessage(playerid, COLOR_YELLOW, "Ai ajuns la destinatia dorita.");
if(checkpointid == CheckpointOne[playerid])
{
RemovePlayerMapIcon(playerid, 1);
}
return 1;
}
too many errors, first undefined symbol
Re: How to remove mapicon -
Tass007 - 03.12.2016
Up the top of your script you need to define the variable so
PHP код:
new CheckpointOne[MAX_PLAYERS];
Also CheckpointOne was just an example of naming a variable.
With OnPlayerEnterDynamicCP you shouldn't be doing anything in the callback without getting the checkpointid.
So.
PHP код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == CheckpointOne[playerid])
{
DestroyDynamicCP(checkpointid);
SendClientMessage(playerid, COLOR_YELLOW, "Ai ajuns la destinatia dorita.");
RemovePlayerMapIcon(playerid, 1);
}
return 1;
}
Also you should still be creating the checkpoint in the dialog of where you first created it in your first initial post.
PHP код:
if(dialogid == 6)
{
if(response)
{
if(listitem == 0)
{
CheckpointOne[playerid] = CreateDynamicCP(377.8297,-2087.4912,7.8359, 5.0, -1, -1, -1, 50.0);
SetPlayerMapIcon(playerid, 1,377.8297,-2087.4912,7.8359, 0, COLOR_YELLOW, 0);
SendClientMessage(playerid, COLOR_YELLOW, "Mergi la checkpoint-ul afisat pe harta.");
}
}
}
return 1;
}
If you have any more errors. Please post them.
Re: How to remove mapicon -
GabiXx - 04.12.2016
Thanks. It work.
Now if i want to set another CP i must use new checkpointtwo[MAX_PLAYERS];?
Re: How to remove mapicon -
Tass007 - 04.12.2016
Yes that is correct so thst when your using OnPlayerEnterDyniamicCP that you have a variable to use as a checkpointid. Again you shouldn't be naming checkpoint variables CheckpointOne and CheckpointTwo you should be naming the checkpoint what it is. Example TruckingCP, or FishingHQcp. Use relevant names so you can easily identify what the checkpoint is without having to look at more than one bit of code.