How to remove mapicon
#1

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.
Reply
#2

Use RemovePlayerMapIcon(playerid, 1) when the player enters the specific checkpoint(use OnPlayerEnterDynamicCP).
Reply
#3

And if i create more dynamicCP with other ids this will be able?
Reply
#4

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?
Reply
#5

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
Reply
#6

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.
Reply
#7

Thanks. It work.
Now if i want to set another CP i must use new checkpointtwo[MAX_PLAYERS];?
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)