OnPlayerWeaponShot problem !
#1

When I hit the object function isn't working (sound isn't playing and object isn't getting destroyed) what's the problem ?

Код:
	if(hittype == 3)
	{
	    if(hitid == slotb1[playerid])
		{
		    switch(IsTraining[playerid])
		    {
		    	case 1:
				{
				    slotb2[playerid] = CreatePlayerObject(playerid, 1486, 809.6979,1645.6659,4.4826, 0.0, 0.0, 0.0, 100.00);
		            DestroyPlayerObject(playerid, slotb1[playerid]);
				}
				case 2:
				{
				    slotb2[playerid] = CreatePlayerObject(playerid, 1486, 807.9756,1645.3145,4.4826, 0.0, 0.0, 0.0, 100.00);
		            DestroyPlayerObject(playerid, slotb1[playerid]);
				}
				case 3:
				{
				    slotb2[playerid] = CreatePlayerObject(playerid, 1486, 806.5139,1645.0021,4.4826, 0.0, 0.0, 0.0, 100.00);
		            DestroyPlayerObject(playerid, slotb1[playerid]);
				}
				case 4:
				{
				    slotb2[playerid] = CreatePlayerObject(playerid, 1486, 805.0288,1645.0342,4.4826, 0.0, 0.0, 0.0, 100.00);
		            DestroyPlayerObject(playerid, slotb1[playerid]);
				}
				case 5:
				{
				    slotb2[playerid] = CreatePlayerObject(playerid, 1486, 803.3965,1645.0092,4.4826, 0.0, 0.0, 0.0, 100.00);
		            DestroyPlayerObject(playerid, slotb1[playerid]);
				}
				case 6:
				{
				    slotb2[playerid] = CreatePlayerObject(playerid, 1486, 801.6772,1644.6831,4.4826, 0.0, 0.0, 0.0, 100.00);
	            	DestroyPlayerObject(playerid, slotb1[playerid]);
				}
				case 7:
				{
				    slotb2[playerid] = CreatePlayerObject(playerid, 1486, 800.4271,1644.5623,4.4826, 0.0, 0.0, 0.0, 100.00);
	            	DestroyPlayerObject(playerid, slotb1[playerid]);
				}
				case 8:
				{
				    slotb2[playerid] = CreatePlayerObject(playerid, 1486, 798.6858,1644.7762,4.4826, 0.0, 0.0, 0.0, 100.00);
	            	DestroyPlayerObject(playerid, slotb1[playerid]);
				}
				case 9:
				{
				    slotb2[playerid] = CreatePlayerObject(playerid, 1486, 797.1193,1644.7615,4.4826, 0.0, 0.0, 0.0, 100.00);
	            	DestroyPlayerObject(playerid, slotb1[playerid]);
				}
				case 10:
				{
				    slotb2[playerid] = CreatePlayerObject(playerid, 1486, 795.4224,1644.7452,4.4826, 0.0, 0.0, 0.0, 100.00);
	            	DestroyPlayerObject(playerid, slotb1[playerid]);
				}
				case 11:
				{
				    slotb2[playerid] = CreatePlayerObject(playerid, 1486, 793.9834,1644.4231,4.4826, 0.0, 0.0, 0.0, 100.00);
	            	DestroyPlayerObject(playerid, slotb1[playerid]);
				}
			}
			PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
		}
	    if(hitid == slotb2[playerid])
		{
		    switch(IsTraining[playerid])
		    {
		        case 1:
		        {
		            slotb3[playerid] = CreatePlayerObject(playerid, 1486, 810.3208,1618.1469,4.4813, 0.0, 0.0, 0.0, 100.00);
		            DestroyPlayerObject(playerid, slotb2[playerid]);
		        }
		        case 2:
		        {
		            slotb3[playerid] = CreatePlayerObject(playerid, 1486, 809.3016,1618.1086,4.4813, 0.0, 0.0, 0.0, 100.00);
		            DestroyPlayerObject(playerid, slotb2[playerid]);
		        }
		        case 3:
		        {
		            slotb3[playerid] = CreatePlayerObject(playerid, 1486, 808.1950,1618.0488,4.4813, 0.0, 0.0, 0.0, 100.00);
		            DestroyPlayerObject(playerid, slotb2[playerid]);
		        }
		        case 4:
		        {
		            slotb3[playerid] = CreatePlayerObject(playerid, 1486, 806.1711,1617.9402,4.4813, 0.0, 0.0, 0.0, 100.00);
		            DestroyPlayerObject(playerid, slotb2[playerid]);
		        }
		        case 5:
		        {
		            slotb3[playerid] = CreatePlayerObject(playerid, 1486, 805.2635,1617.8916,4.4813, 0.0, 0.0, 0.0, 100.00);
		            DestroyPlayerObject(playerid, slotb2[playerid]);
		        }
		        case 6:
		        {
		            slotb3[playerid] = CreatePlayerObject(playerid, 1486, 804.1240,1617.8302,4.4813, 0.0, 0.0, 0.0, 100.00);
	            	DestroyPlayerObject(playerid, slotb2[playerid]);
		        }
		        case 7:
		        {
		            slotb3[playerid] = CreatePlayerObject(playerid, 1486, 802.3339,1617.7347,4.4813, 0.0, 0.0, 0.0, 100.00);
	            	DestroyPlayerObject(playerid, slotb2[playerid]);
		        }
		        case 8:
		        {
		            slotb3[playerid] = CreatePlayerObject(playerid, 1486, 800.9711,1617.6616,4.4813, 0.0, 0.0, 0.0, 100.00);
	            	DestroyPlayerObject(playerid, slotb2[playerid]);
		        }
		        case 9:
		        {
		            slotb3[playerid] = CreatePlayerObject(playerid, 1486, 798.8643,1617.5491,4.4813, 0.0, 0.0, 0.0, 100.00);
	            	DestroyPlayerObject(playerid, slotb2[playerid]);
		        }
		        case 10:
		        {
		            slotb3[playerid] = CreatePlayerObject(playerid, 1486,  796.9112,1617.4443,4.4813, 0.0, 0.0, 0.0, 100.00);
	            	DestroyPlayerObject(playerid, slotb2[playerid]);
		        }
		        case 11:
		        {
		            slotb3[playerid] = CreatePlayerObject(playerid, 1486,  793.8408,1617.3242,4.4813, 0.0, 0.0, 0.0, 100.00);
	            	DestroyPlayerObject(playerid, slotb2[playerid]);
		        }
			}
			PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
		}
		if(hitid == slotb3[playerid])
		{
			PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
		    DestroyPlayerObject(playerid, slotb3[playerid]);
		    DestroyPlayerObject(playerid, slotb2[playerid]);
		    DestroyPlayerObject(playerid, slotb1[playerid]);
		    slotb1[playerid] = 0;
		    slotb2[playerid] = 0;
		    slotb3[playerid] = 0;
		    TerminateTimer[playerid] = SetTimerEx("TerminateTraining", 3000, 0, "d", playerid);
	        GameTextForPlayer(playerid, "~b~Training Session ~g~Finished!", 3000, 6);
		}
	}
Reply
#2

https://sampwiki.blast.hk/wiki/BulletHitTypes
Reply
#3

You are using `BULLET_HIT_TYPE_OBJECT` (3) instead of `BULLET_HIT_TYPE_PLAYER_OBJECT` (4).

Change:
if(hittype == 3)
To:
if(hittype == BULLET_HIT_TYPE_PLAYER_OBJECT)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)