SA-MP Forums Archive
Checkpoint dissappears - 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: Checkpoint dissappears (/showthread.php?tid=622951)



Checkpoint dissappears [solved] - Gusteakas - 28.11.2016

Hello.

How I can do that the checkpoint would not dissappear when I do something in else statement? I want to print the message to remind player something and get back later but the checkpoint dissappears.

Код:
hook OnPlayerEnterDynamicCP(playerid, checkpointid)
{
	if(checkpointid == pizzaCheckpoint[playerid])
	{
        if(IsPlayerAttachedObjectSlotUsed(playerid, PIZZA_INDEX))
        {
            new string[126], earning = 5 + random(5);
            pizzaEarnings[playerid] += earning;
            		
            if(pizzaDeliveryTimeLeft[playerid] > 0)
            {
                pizzaDeliveryTimeLeft[playerid] = 0;
                KillTimer(pizzaDeliveryTimer[playerid]);
                
                new tips = 1 + random(MAX_TIP);
                pizzaTips[playerid] += tips;
    			
    		PlayerTextDrawHide(playerid, pizzaTextDraw5[playerid]);
            	PlayerTextDrawHide(playerid, pizzaTextDraw7[playerid]);
            	PlayerPlaySound(playerid, 1139, 0.0, 0.0, 0.0);
	    }
			
	    ClearAnimations(playerid);
	    DestroyDynamicCP(pizzaCheckpoint[playerid]);
        }
        else
        {
	// else statement
	}
        }
	return 1;
}



Re: Checkpoint dissappears - Micko123 - 28.11.2016

I don't understand very well what you wan't to do can you explain better?


Re: Checkpoint dissappears - Gusteakas - 28.11.2016

Quote:
Originally Posted by Micko123
Посмотреть сообщение
I don't understand very well what you wan't to do can you explain better?
I don't want my checkpoint to dissappear after I enter it. It's okay if it dissappears in the if statement, but I don't want it to dissappear when the else is called so I could write a message for a player while stile having the checkpoint at it's place.


Re: Checkpoint dissappears - Gusteakas - 28.11.2016

Anyone knows?


Re: Checkpoint dissappears - Micko123 - 29.11.2016

PHP код:
hook OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    if(
checkpointid == pizzaCheckpoint[playerid])
    {
        if(
IsPlayerAttachedObjectSlotUsed(playeridPIZZA_INDEX))
        {
            new 
string[126], earning random(5);
            
pizzaEarnings[playerid] += earning;
                    
            if(
pizzaDeliveryTimeLeft[playerid] > 0)
            {
                
pizzaDeliveryTimeLeft[playerid] = 0;
                
KillTimer(pizzaDeliveryTimer[playerid]);
                new 
tips random(MAX_TIP);
                
pizzaTips[playerid] += tips;
                
PlayerTextDrawHide(playeridpizzaTextDraw5[playerid]);
                
PlayerTextDrawHide(playeridpizzaTextDraw7[playerid]);
                
PlayerPlaySound(playerid11390.00.00.0);
           }    
           
ClearAnimations(playerid);
           
DestroyDynamicCP(pizzaCheckpoint[playerid]);
        }
        else
        {
           
SendClientMessage(playerid, -1"Here goes your message");
           return 
1;
        }
    }
    return 
1;




Re: Checkpoint dissappears - Gusteakas - 29.11.2016

Quote:
Originally Posted by Micko123
Посмотреть сообщение
PHP код:
hook OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    if(
checkpointid == pizzaCheckpoint[playerid])
    {
        if(
IsPlayerAttachedObjectSlotUsed(playeridPIZZA_INDEX))
        {
            new 
string[126], earning random(5);
            
pizzaEarnings[playerid] += earning;
                    
            if(
pizzaDeliveryTimeLeft[playerid] > 0)
            {
                
pizzaDeliveryTimeLeft[playerid] = 0;
                
KillTimer(pizzaDeliveryTimer[playerid]);
                new 
tips random(MAX_TIP);
                
pizzaTips[playerid] += tips;
                
PlayerTextDrawHide(playeridpizzaTextDraw5[playerid]);
                
PlayerTextDrawHide(playeridpizzaTextDraw7[playerid]);
                
PlayerPlaySound(playerid11390.00.00.0);
           }    
           
ClearAnimations(playerid);
           
DestroyDynamicCP(pizzaCheckpoint[playerid]);
        }
        else
        {
           
SendClientMessage(playerid, -1"Here goes your message");
           return 
1;
        }
    }
    return 
1;

The checkpoint still dissappears when I enter it and the text is showed.