If pickup id spams
#1

Hello,

Im a little stuck on an on duty pickup.
The problem is that the pickup spams every 2 seconds.
If your organization is id 4 it will spam going on and off duty.
If you are not, It spams the message that you are not allowed to do it.

Is there any way i can fix this?

Code:
Код:
if(pickupid==ArmyDuty)
	{
	    if(PlayerOrg[playerid]==4)
		{
        if(PlayerInfo[playerid][USMCDuty] == 0)
        {
    		Suited[playerid]=1;
 			PlayerInfo[playerid][USMCDuty] = 1;
 			PlayerInfo[playerid][LawDuty] = 1;
 			GivePlayerWeaponEx(playerid, 27, 300);
 			GivePlayerWeaponEx(playerid, 31, 300);
 			GivePlayerWeaponEx(playerid, 24, 300);
 			GivePlayerWeaponEx(playerid, 41, 500);
  			SetPlayerArmourEx(playerid, 100);
  			SetPlayerColor(playerid, 0x0000FFAA);
			SetPlayerSkin(playerid, 287);
  			SendClientMessage(playerid, GREEN, "You are now on USMC duty, /usmchelp for help");
  		}
  		else
  		{
 			Suited[playerid]=0;
			PlayerInfo[playerid][USMCDuty] = 0;
			PlayerInfo[playerid][LawDuty] = 0;
			PlayerInfo[playerid][FreeSkin] = 1;
			SetPlayerArmourEx(playerid, 0);
			ResetPlayerWeapons(playerid);
			SetPlayerSkin(playerid, 3);
 			SetPlayerColor(playerid, COLOR_WHITE);
 			SendClientMessage(playerid, GREEN, "You are not on USMC duty anymore. You can change ur skin for free once by using /freeskin");
 		}
 		}else return SendClientMessage(playerid, RED, "You are not allowed to do this.");
	}
Reply
#2

Which pickup type are you using?

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

I am using pickup type 2. The pickup does not destroy. I do use type 2 for ammunation too, and that does work just fine:
Код:
ArmyDuty=CreateDynamicPickup(1247,2,268.4107,1871.3419,8.6094,-1);

BuySomeGuns=CreateDynamicPickup(1274,2,297.0358,-38.5132,1001.5156,-1);
Reply
#4

Are you using OnPlayerPickUpPickup, or OnPlayerPickUpDynamicPickup?
Reply
#5

OnPlayerPickUpDynamicPickup
Reply
#6

Make them press a key like F to get the job while standing on the pickup.
Reply
#7

I have started based on the way you said.
Only i have a problem.
I can press H anywhere, but when i am on the Pickup, it returns the 0.
What am i doing wrong?

PHP код:
if(newkeys==KEY_CTRL_BACK)
    {
        if(
GetPlayerScore(playerid)<3)return GameTextForPlayer(playerid,"You need at least 3 score",800,1);
        if(!
IsPlayerInRangeOfPoint(playerid,5,297.0358,-38.5132,1001.5156))
        {
              
ShowPlayerDialog(playerid12345DIALOG_STYLE_LIST"Ammunation Weapon Shop""Melee Weapons\nSub MachineGuns\nLethal Guns\nShotGuns\nHand Guns\nMisc""Choose""Cancel");
        }else return 
0;
        if(
GetPlayerScore(playerid)<3)return GameTextForPlayer(playerid,"You need at least 3 score",800,1);
        if(!
IsPlayerInRangeOfPoint(playerid,5,291.8283,-85.2263,1001.5156))
         {
              
ShowPlayerDialog(playerid12345DIALOG_STYLE_LIST"Ammunation Weapon Shop""Melee Weapons\nSub MachineGuns\nLethal Guns\nShotGuns\nHand Guns\nMisc""Choose""Cancel");
        }else return 
0;
        if(
GetPlayerScore(playerid)<3)return GameTextForPlayer(playerid,"You need at least 3 score",800,1);
         if(!
IsPlayerInRangeOfPoint(playerid,5,290.2377,-109.7684,1001.5156))
         {
              
ShowPlayerDialog(playerid12345DIALOG_STYLE_LIST"Ammunation Weapon Shop""Melee Weapons\nSub MachineGuns\nLethal Guns\nShotGuns\nHand Guns\nMisc""Choose""Cancel");
        }else return 
0;
        if(
GetPlayerScore(playerid)<3)return GameTextForPlayer(playerid,"You need at least 3 score",800,1);
         if(!
IsPlayerInRangeOfPoint(playerid,5,312.6401,-166.1406,999.6010))
         {
              
ShowPlayerDialog(playerid12345DIALOG_STYLE_LIST"Ammunation Weapon Shop""Melee Weapons\nSub MachineGuns\nLethal Guns\nShotGuns\nHand Guns\nMisc""Choose""Cancel");
        }else return 
0;
        if(
GetPlayerScore(playerid)<3)return GameTextForPlayer(playerid,"You need at least 3 score",800,1);
         if(!
IsPlayerInRangeOfPoint(playerid,5,314.2591,-133.5507,999.6016))
        {
              
ShowPlayerDialog(playerid12345DIALOG_STYLE_LIST"Ammunation Weapon Shop""Melee Weapons\nSub MachineGuns\nLethal Guns\nShotGuns\nHand Guns\nMisc""Choose""Cancel");
        }else return 
0;
    } 
Reply
#8

PHP код:
  if(!IsPlayerInRangeOfPoint(playerid,5,297.0358,-38.5132,1001.5156)) 
You're asking if the IsPlayerInRangeOfPoint function is false. You should remove the ! from these conditions for your function to work as you intend.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)