OnPlayerWeaponShot
#1

hey guys i have a mission system but i have just a problem with a next step

HTML Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(OwnerMisiune[playerid] == 1)
    {
		if(weaponid == 34)
		{
		    if(hittype == BULLET_HIT_TYPE_OBJECT)
			{
    			CreateMisiuneActor();
				DestroyObject(MisiuneSpeciala[0]);
				SendClientMessage(playerid, -1, "Ai distrus obiectul, du-te acum aici pentru a omori acea persoana cu tricou negru.");
			}
			else if(hittype == BULLET_HIT_TYPE_OBJECT)
			{
				MisiuneActiva = 0;
				DestroyActor(Actorr[0]);
				DestroyActor(Actorr[1]);
				OwnerMisiune[playerid] = 0;
				SendClientMessage(playerid, -1, "Ai omorit persoana in tricou negru.");
			}
		}
	}
	return 1;
}
first step from here is ok , but after i am doing first step i want to change it to the next one "else if etc..." how can i do it ? some ideas?
Reply
#2

Put debugs into every if and every line of code, so you will see where is code stucking.
Reply
#3

no bro is working but i don't know how to make the next step to activate after first step is ending
Reply
#4

use a simple variable

PHP Code:
new step=0;
public 
OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    if(
OwnerMisiune[playerid] == 1)
    {
        if(
weaponid == 34)
        {
            if(
hittype == BULLET_HIT_TYPE_OBJECT)
            {
                if(
step == 0)
                {
                    
CreateMisiuneActor();
                    
DestroyObject(MisiuneSpeciala[0]);
                    
SendClientMessage(playerid, -1"Ai distrus obiectul, du-te acum aici pentru a omori acea persoana cu tricou negru.");
                    
step 1;
                }
                if(
step == 1)
                {
                    
MisiuneActiva 0;
                    
DestroyActor(Actorr[0]);
                    
DestroyActor(Actorr[1]);
                    
OwnerMisiune[playerid] = 0;
                    
SendClientMessage(playerid, -1"Ai omorit persoana in tricou negru.");
                    
step 0;
                }
            }
        }
    }
    return 
1;

Reply
#5

is not working , now both are destroyed in the same time with step 1
Reply
#6

Change "if(step == 1)" to "else if(step == 1)".
Reply
#7

works , thx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)