If pickup id spams -
jasperschellekens - 24.03.2017
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.");
}
Re: If pickup id spams -
Toroi - 24.03.2017
Which pickup type are you using?
https://sampwiki.blast.hk/wiki/PickupTypes
Re: If pickup id spams -
jasperschellekens - 24.03.2017
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);
Re: If pickup id spams -
Sew_Sumi - 24.03.2017
Are you using OnPlayerPickUpPickup, or OnPlayerPickUpDynamicPickup?
Re: If pickup id spams -
jasperschellekens - 24.03.2017
OnPlayerPickUpDynamicPickup
Re: If pickup id spams -
ATGOggy - 24.03.2017
Make them press a key like F to get the job while standing on the pickup.
Re: If pickup id spams -
jasperschellekens - 24.03.2017
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(playerid, 12345, DIALOG_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(playerid, 12345, DIALOG_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(playerid, 12345, DIALOG_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(playerid, 12345, DIALOG_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(playerid, 12345, DIALOG_STYLE_LIST, "Ammunation Weapon Shop", "Melee Weapons\nSub MachineGuns\nLethal Guns\nShotGuns\nHand Guns\nMisc", "Choose", "Cancel");
}else return 0;
}
Re: If pickup id spams -
Toroi - 24.03.2017
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.