SA-MP Forums Archive
OnPlayerPickUpPickup Problem - 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: OnPlayerPickUpPickup Problem (/showthread.php?tid=655770)



OnPlayerPickUpPickup Problem - Istrator - 29.06.2018

Hi, I need help with this..

Код:
if(pickupid == meatDrops)
	{
	   	if(team[playerid] == TEAM_HUMAN)
	   	{
			if(pInfo[playerid][pHumanClass] == ENGINEER || pInfo[playerid][pHumanClass] == VIPENGINEER || pInfo[playerid][pHumanClass] == BUSINESSHUMAN || pInfo[playerid][pHumanClass] == SCAVENGER)
			{
				switch(pInfo[playerid][pHumanClass])
				{
			    	case SCAVENGER:
					{
						new ammo = GetPlayerAmmo(playerid);
						new Float:armor;
						GetPlayerArmour(playerid,armor);
						SetPlayerArmour(playerid, armor+5);
						SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), ammo+15);
				 		GameTextForPlayer(playerid, "~g~Found~w~: Armour and Ammo",4000,5);
				 		DestroyPickup(meatDrops);
					}
			    	case ENGINEER: pInfo[playerid][Boxes]++,GameTextForPlayer(playerid,"~g~Found~w~: 1 Box",4000,5),DestroyPickup(meatDrops);
					case VIPENGINEER: pInfo[playerid][pVipBoxes] += 3,GameTextForPlayer(playerid,"~g~Found~w~: 3 Boxes",4000,5),DestroyPickup(meatDrops);
					case BUSINESSHUMAN: pInfo[playerid][pXP] += 10*2,GameTextForPlayer(playerid,"~g~Found~w~ xp",4000,5),DestroyPickup(meatDrops);
				}
			}
			else
			{
				if(pInfo[playerid][IsPlayerInfected] == 0)
				{
					new slot, weap, ammo;
					for ( slot = 0; slot < 14; slot++ )
					{
						GetPlayerWeaponData(playerid,slot,weap,ammo);
						if(IsValidWeapon(weap))
						{
							new randomselect = random(2);
							switch(randomselect)
							{
								case 0:
								{
									new randomammo = random(50);
									ServerWeapon(playerid,weap,randomammo);
									format(string,sizeof(string),"~g~Found~w~: %d ammo",randomammo);
									GameTextForPlayer(playerid,string,4000,5);
									DestroyPickup(meatDrops);
								}
								case 1:
								{
									new randomxp = random(35);
									format(string,sizeof(string),"~g~Found~w~: %d XP",randomxp);
									GameTextForPlayer(playerid,string,4000,5);
									pInfo[playerid][pXP] += randomxp;
									DestroyPickup(meatDrops);
								}
							}
						}
					}
				}
			}
		}
	}
	else if(pickupid == fakeDrops)
	{
		if(team[playerid] == TEAM_HUMAN)
 		{
			InfectPlayerStandard(playerid);
			DestroyPickup(fakeDrops);
		}
	}
That "meatDrops" should only gives ammo, boxes, ladders, etc. That "fakeDrops" should only gives Infections.

But when I go ingame, once I pick fakeDrops, it gives me ammo, boxes, ladders, etc too. Even when I pick meatDrops, it also gives me ammo, boxes, ladders, etc too.

Help me with this. Thanks.

Additionally: These fakeDrops and meatDrops appears when a player dies. Here's their info.
Код:
fakeDrops = CreatePickup(2804,19,Float:x,Float:y,Float:z);
Код:
meatDrops = CreatePickup(2805,19,Float:x,Float:y,Float:z);



Re: OnPlayerPickUpPickup Problem - Istrator - 01.07.2018

Hello?


Re: OnPlayerPickUpPickup Problem - JasonRiggs - 01.07.2018

Is it only 1 pickup?? called "meatDrops" and "fakeDrops"?? or mutli pickups?


Re: OnPlayerPickUpPickup Problem - Istrator - 01.07.2018

Multi-pickups


Re: OnPlayerPickUpPickup Problem - TadePoleMG - 01.07.2018

What are you trying to say you want that meatDrops pickup gives only Infections you don't know it can't give by itself you have to make it. lol


You forget to close this statement if(team[playerid] == TEAM_HUMAN) { You have to close it after switch. bacause this team is human so obivously other is Infected.


Remove else from your second pickup.


Re: OnPlayerPickUpPickup Problem - Istrator - 02.07.2018

Quote:
Originally Posted by TadePoleMG
Посмотреть сообщение
What are you trying to say you want that meatDrops pickup gives only Infections you don't know it can't give by itself you have to make it. lol


You forget to close this statement if(team[playerid] == TEAM_HUMAN) { You have to close it after switch. bacause this team is human so obivously other is Infected.


Remove else from your second pickup.
First of all, I said:
Quote:
Originally Posted by Istrator
Посмотреть сообщение
That "meatDrops" should only gives ammo, boxes, ladders, etc. That "fakeDrops" should only gives Infections.
Second: That "if(team[playerid] == TEAM_HUMAN) is closed. I compile it with no errors.

Third: I also tried to remove that else on second pickup, but still that fakeDrops gives ammo, boxes, ladders, including Infections. Even on script about fakeDrops only gives Infection.


Re: OnPlayerPickUpPickup Problem - Istrator - 03.07.2018

Hello?


Re: OnPlayerPickUpPickup Problem - Neom - 03.07.2018

Stop bumbing threads within 24 hours


Re: OnPlayerPickUpPickup Problem - Exhibit - 04.07.2018

Show InfectPlayerStandard(playerid);
also try this
PHP код:
if(pickupid == meatDrops)
    {
           if(
team[playerid] == TEAM_HUMAN)
           {
            if(
pInfo[playerid][pHumanClass] == ENGINEER || pInfo[playerid][pHumanClass] == VIPENGINEER || pInfo[playerid][pHumanClass] == BUSINESSHUMAN || pInfo[playerid][pHumanClass] == SCAVENGER)
            {
                switch(
pInfo[playerid][pHumanClass])
                {
                    case 
SCAVENGER:
                    {
                        new 
ammo GetPlayerAmmo(playerid);
                        new 
Float:armor;
                        
GetPlayerArmour(playerid,armor);
                        
SetPlayerArmour(playeridarmor+5);
                        
SetPlayerAmmo(playeridGetPlayerWeapon(playerid), ammo+15);
                         
GameTextForPlayer(playerid"~g~Found~w~: Armour and Ammo",4000,5);
                         
DestroyPickup(meatDrops);
                    }
                    case 
ENGINEERpInfo[playerid][Boxes]++,GameTextForPlayer(playerid,"~g~Found~w~: 1 Box",4000,5),DestroyPickup(meatDrops);
                    case 
VIPENGINEERpInfo[playerid][pVipBoxes] += 3,GameTextForPlayer(playerid,"~g~Found~w~: 3 Boxes",4000,5),DestroyPickup(meatDrops);
                    case 
BUSINESSHUMANpInfo[playerid][pXP] += 10*2,GameTextForPlayer(playerid,"~g~Found~w~ xp",4000,5),DestroyPickup(meatDrops);
                }
            }
            else
            {
                if(
pInfo[playerid][IsPlayerInfected] == 0)
                {
                    new 
slotweapammo;
                    for ( 
slot 0slot 14slot++ )
                    {
                        
GetPlayerWeaponData(playerid,slot,weap,ammo);
                        if(
IsValidWeapon(weap))
                        {
                            new 
randomselect random(2);
                            switch(
randomselect)
                            {
                                case 
0:
                                {
                                    new 
randomammo random(50);
                                    
ServerWeapon(playerid,weap,randomammo);
                                    
format(string,sizeof(string),"~g~Found~w~: %d ammo",randomammo);
                                    
GameTextForPlayer(playerid,string,4000,5);
                                    
DestroyPickup(meatDrops);
                                }
                                case 
1:
                                {
                                    new 
randomxp random(35);
                                    
format(string,sizeof(string),"~g~Found~w~: %d XP",randomxp);
                                    
GameTextForPlayer(playerid,string,4000,5);
                                    
pInfo[playerid][pXP] += randomxp;
                                    
DestroyPickup(meatDrops);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
       if(
pickupid == fakeDrops)
    {
        if(
team[playerid] == TEAM_HUMAN)
         {
            
InfectPlayerStandard(playerid);
            
DestroyPickup(fakeDrops);
        }
    } 



Re: OnPlayerPickUpPickup Problem - Istrator - 06.07.2018

Here's InfectPlayerStandard(playerid);

Код:
stock InfectPlayerStandard(playerid)
{
	if(team[playerid] == TEAM_HUMAN)
	{
		if(pInfo[playerid][IsPlayerInfected] == 0)
		{
	        pInfo[playerid][IsPlayerInfectedTimer] = SetTimerEx("StandardInfection",2000,1,"i",playerid);
			SetPlayerColor(playerid,COLOR_PINK);
			TextDrawShowForPlayer(playerid,Infected[playerid]);
			pInfo[playerid][IsPlayerInfected] = 1;
		}
	}
	return 1;
}
Quote:
Originally Posted by Exhibit
Посмотреть сообщение
Show InfectPlayerStandard(playerid);
also try this
PHP код:
if(pickupid == meatDrops)
    {
           if(
team[playerid] == TEAM_HUMAN)
           {
            if(
pInfo[playerid][pHumanClass] == ENGINEER || pInfo[playerid][pHumanClass] == VIPENGINEER || pInfo[playerid][pHumanClass] == BUSINESSHUMAN || pInfo[playerid][pHumanClass] == SCAVENGER)
            {
                switch(
pInfo[playerid][pHumanClass])
                {
                    case 
SCAVENGER:
                    {
                        new 
ammo GetPlayerAmmo(playerid);
                        new 
Float:armor;
                        
GetPlayerArmour(playerid,armor);
                        
SetPlayerArmour(playeridarmor+5);
                        
SetPlayerAmmo(playeridGetPlayerWeapon(playerid), ammo+15);
                         
GameTextForPlayer(playerid"~g~Found~w~: Armour and Ammo",4000,5);
                         
DestroyPickup(meatDrops);
                    }
                    case 
ENGINEERpInfo[playerid][Boxes]++,GameTextForPlayer(playerid,"~g~Found~w~: 1 Box",4000,5),DestroyPickup(meatDrops);
                    case 
VIPENGINEERpInfo[playerid][pVipBoxes] += 3,GameTextForPlayer(playerid,"~g~Found~w~: 3 Boxes",4000,5),DestroyPickup(meatDrops);
                    case 
BUSINESSHUMANpInfo[playerid][pXP] += 10*2,GameTextForPlayer(playerid,"~g~Found~w~ xp",4000,5),DestroyPickup(meatDrops);
                }
            }
            else
            {
                if(
pInfo[playerid][IsPlayerInfected] == 0)
                {
                    new 
slotweapammo;
                    for ( 
slot 0slot 14slot++ )
                    {
                        
GetPlayerWeaponData(playerid,slot,weap,ammo);
                        if(
IsValidWeapon(weap))
                        {
                            new 
randomselect random(2);
                            switch(
randomselect)
                            {
                                case 
0:
                                {
                                    new 
randomammo random(50);
                                    
ServerWeapon(playerid,weap,randomammo);
                                    
format(string,sizeof(string),"~g~Found~w~: %d ammo",randomammo);
                                    
GameTextForPlayer(playerid,string,4000,5);
                                    
DestroyPickup(meatDrops);
                                }
                                case 
1:
                                {
                                    new 
randomxp random(35);
                                    
format(string,sizeof(string),"~g~Found~w~: %d XP",randomxp);
                                    
GameTextForPlayer(playerid,string,4000,5);
                                    
pInfo[playerid][pXP] += randomxp;
                                    
DestroyPickup(meatDrops);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
       if(
pickupid == fakeDrops)
    {
        if(
team[playerid] == TEAM_HUMAN)
         {
            
InfectPlayerStandard(playerid);
            
DestroyPickup(fakeDrops);
        }
    } 
Sorry, but this doesn't work. It's still the same.