SA-MP Forums Archive
How to remove mapicon - 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: How to remove mapicon (/showthread.php?tid=623675)



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.83595.0, -1, -1, -150.0);
                
SetPlayerMapIcon(playerid1,377.8297,-2087.4912,7.83590COLOR_YELLOW0);
                
SendClientMessage(playeridCOLOR_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.83595.0, -1, -1, -150.0); 
CheckpointTwo[playerid] = CreateDynamicCP(Float:xFloat:yFloat:zFloat:sizeworldid = -1interiorid = -1playeridFloat:distance 100.0); 
Then under OnPlayerEnterDynamicCP
PHP код:
if(checkpointid == CheckpointOne[playerid])
{
    
RemovePlayerMapIcon(playerid1);
}
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.83595.0, -1, -1, -150.0);
public 
OnPlayerEnterDynamicCP(playeridcheckpointid)
{
   
DestroyDynamicCP(checkpointid);
   
SendClientMessage(playeridCOLOR_YELLOW"Ai ajuns la destinatia dorita.");
   if(
checkpointid == CheckpointOne[playerid])
   {
       
RemovePlayerMapIcon(playerid1);
   }
   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(playeridcheckpointid)
{
    if(
checkpointid == CheckpointOne[playerid]) 
    { 
        
DestroyDynamicCP(checkpointid); 
        
SendClientMessage(playeridCOLOR_YELLOW"Ai ajuns la destinatia dorita."); 
        
RemovePlayerMapIcon(playerid1);
    } 
    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.83595.0, -1, -1, -150.0);  
                
SetPlayerMapIcon(playerid1,377.8297,-2087.4912,7.83590COLOR_YELLOW0); 
                
SendClientMessage(playeridCOLOR_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.