Robbing when leaving Pickup
#1

Hello,

Before I start I want to apologize for my English!

So the problem is that I have a 24/7 shop I use a pickup for this. So I steal the store but when I leave the pickup the time dont stop counting.

Code :

Код:
	if(dialogid == DIALOG_24/7)
	{
	    if(response)
	    {
	        if(listitem == 0)
	        {
	            if(GetPlayerMoney(playerid) < 10000)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous n'avez pas 10000$ pour acheter des Cordes(5x).");
	                return 1;
				}
	            if(IsSpawned[playerid] != 1)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous devez кtre en vie pour pouvoir utiliser le menu du magasin 24/7.");
	                return 1;
				}
				HasRope[playerid] +=5;
				GivePlayerMoney(playerid,-10000);
				format(string,sizeof(string),"Rйceptionniste : Diogo\nProduit achetй: Cordes(5x)\nCoыt Total: 10000$\nArgent Donnй: 10000$\nChange: 0$\nCordes dans votre Sac: %d",HasRope[playerid]);
				ShowPlayerDialog(playerid,DIALOG_24/7,DIALOG_STYLE_MSGBOX,"{FF0000}24/7 Rйception",string,"Ok","Retour");
				return 1;
			}
			if(listitem == 1)
	        {
	            if(GetPlayerMoney(playerid) < 5000)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous n'avez pas 5000$ pour acheter des Ciseaux(1x).");
	                return 1;
				}
	            if(IsSpawned[playerid] != 1)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous devez кtre en vie pour pouvoir utiliser le menu du magasin 24/7.");
	                return 1;
				}
				HasScissors[playerid] +=1;
				GivePlayerMoney(playerid,-5000);
				format(string,sizeof(string),"Rйceptionniste : Diogo\nProduit achetй: Ciseaux(1x)\nCoыt Total: 5000$\nArgent Donnй: 5000$\nChange: 0$\nCiseaux dans votre Sac: %d",HasScissors[playerid]);
				ShowPlayerDialog(playerid,DIALOG_24/7,DIALOG_STYLE_MSGBOX,"{FF0000}24/7 Rйception",string,"Ok","Retour");
				return 1;
			}
			if(listitem == 2)
	        {
	            if(GetPlayerMoney(playerid) < 15000)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous n'avez pas 15000$ pour acheter des Medicaments(5x).");
	                return 1;
				}
	            if(IsSpawned[playerid] != 1)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous devez кtre en vie pour pouvoir utiliser le menu du magasin 24/7.");
	                return 1;
				}
				HasSausageRolls[playerid] +=5;
				GivePlayerMoney(playerid,-15000);
				format(string,sizeof(string),"Rйceptionniste : Diogo\nProduit achetй: Medicaments(5x)\nCoыt Total: 15000$\nArgent Donnй: 15000$\nChange: 0$\nMedicaments dans votre Sac: %d",HasSausageRolls[playerid]);
				ShowPlayerDialog(playerid,DIALOG_24/7,DIALOG_STYLE_MSGBOX,"{FF0000}24/7 Rйception",string,"Ok","Retour");
				return 1;
			}
			if(listitem == 3)
	        {
	            if(GetPlayerMoney(playerid) < 20000)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous n'avez pas 20000$ pour acheter un Anti MST(1x).");
	                return 1;
				}
	            if(IsSpawned[playerid] != 1)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous devez кtre en vie pour pouvoir utiliser le menu du magasin 24/7.");
	                return 1;
				}
				HasAntiSTI[playerid] +=1;
				GivePlayerMoney(playerid,-20000);
				format(string,sizeof(string),"Rйceptionniste : Diogo\nProduit achetй: Anti MST(1x)\nTotal Cost: 20000$\nArgent Donnй: 20000$\nChange: 0$\nAnti MST dans votre Sac: %d",HasAntiSTI[playerid]);
				ShowPlayerDialog(playerid,DIALOG_24/7,DIALOG_STYLE_MSGBOX,"{FF0000}24/7 Rйception",string,"Ok","Retour");
				return 1;
			}
			if(listitem == 4)
	        {
	            if(GetPlayerMoney(playerid) < 5000)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous n'avez pas 5000$ pour acheter Porte Monnaie Sйcurisй(1x).");
	                return 1;
				}
	            if(IsSpawned[playerid] != 1)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous devez кtre en vie pour pouvoir utiliser le menu du magasin 24/7.");
	                return 1;
				}
				HasSecureWallet[playerid] +=1;
				GivePlayerMoney(playerid,-5000);
				format(string,sizeof(string),"Rйceptionniste : Diogo\nProduit achetй: Porte Monnaie Sйcurisй(1x)\nCoыt Total: 5000$\nArgent Donnй: 5000$\nChange: 0$\nPorte Monnaie Sйcurisй dans votre Sac: %d",HasSecureWallet[playerid]);
				ShowPlayerDialog(playerid,DIALOG_24/7,DIALOG_STYLE_MSGBOX,"{FF0000}24/7 Rйception",string,"Ok","Retour");
				return 1;
			}
			if(listitem == 5)
	        {
	            if(GetPlayerMoney(playerid) < 5000)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous n'avez pas 5000$ pour acheter une Seringue(1x).");
	                return 1;
				}
	            if(IsSpawned[playerid] != 1)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous devez кtre en vie pour pouvoir utiliser le menu du magasin 24/7.");
	                return 1;
				}
				if(HasNeedleAndSyringe[playerid] == 1)
				{
				    SendClientMessage(playerid,COLOR_ERROR,"Vous avez dйjа une seringue dans votre Sac.");
				    return 1;
				}
				HasNeedleAndSyringe[playerid] +=1;
				GivePlayerMoney(playerid,-5000);
				format(string,sizeof(string),"Rйceptionniste : Diogo\nProduit achetй: Seringe(1x)\nCoыt Total: 5000$\nArgent Donnй: 5000$\nChange: 0$\nSeringues dans votre Sac: %d",HasNeedleAndSyringe[playerid]);
				ShowPlayerDialog(playerid,DIALOG_24/7,DIALOG_STYLE_MSGBOX,"{FF0000}24/7 Rйception",string,"Ok","Retour");
				return 1;
			}
			if(listitem == 6)
	        {
	            if(GetPlayerMoney(playerid) < 10000)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous n'avez pas 10000$ pour acheter un Pass Commissariat(1x).");
	                return 1;
				}
	            if(IsSpawned[playerid] != 1)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous devez кtre en vie pour pouvoir utiliser le menu du magasin 24/7.");
	                return 1;
				}
				if(HasPS[playerid] == 1)
				{
				    SendClientMessage(playerid,COLOR_ERROR,"Vous avez dйjа achetй un Pass Commissariat.");
				    return 1;
				}
				HasPS[playerid] +=1;
				GivePlayerMoney(playerid,-10000);
				format(string,sizeof(string),"24/7 : Diogo\nProduit achetй: Pass Commissariat(1x)\nCoыt Total: 10000$\nArgent Donnй: 10000$\nChange: 0$");
				ShowPlayerDialog(playerid,DIALOG_24/7,DIALOG_STYLE_MSGBOX,"{FF0000}24/7 Rйception",string,"Ok","Retour");
				return 1;
			}
			if(listitem == 7)
	        {
	            if(IsSpawned[playerid] != 1)
	            {
	                SendClientMessage(playerid,COLOR_ERROR,"Vous devez кtre en vie pour pouvoir utiliser le menu du magasin 24/7.");
	                return 1;
				}
				if(IsCuffed[playerid] == 1)
				{
				    SendClientMessage(playerid,COLOR_ERROR,"Vous ne pouvez pas voler la Save Supa alors que vous кtes menottй.");
				    return 1;
				}
				if(IsFrozen[playerid] == 1)
				{
				    SendClientMessage(playerid,COLOR_ERROR,"Vous avez йtй freeze par un Administrateur donc vous ne pouvez pas voler le 24/7.");
				    return 1;
				}
     			if(IsPlayerInRangeOfPoint(playerid, 3.0, -8.3713,-31.1897,3.9439))
				{
				    SendClientMessage(playerid,COLOR_ERROR,"Vous devez кtre dans le Pickup du 24/7 pour pouvoir le voler.");
				    return 1;
				}
				if(gTeam[playerid] == TEAM_COP || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_CIA || gTeam[playerid] == TEAM_MEDIC)
				{
				    SendClientMessage(playerid,COLOR_ERROR,"Vous ne pouvez pas voler le 24/7 en ayant votre classe actuelle.");
				    return 1;
				}
				if(Magasin247RobbedRecently >= 1)
				{
				    SendClientMessage(playerid,COLOR_ERROR,"Le 24/7 a йtй volй rйcemment. Veuillez attendre avant de le voler а nouveau.");
				    return 1;
				}
				Magasin247RobbedRecently =300;
				RobbingMagasin247[playerid] =25;
				IncreaseWantedLevel(playerid,2);
				IncreasePlayerScore(playerid,1);
				format(string,sizeof(string),"VOL 24/7.\nVOL FINI dans: %d secondes.\nLes policiers sont sur le chemin.",RobbingMagasin247[playerid]);


				format(string,sizeof(string),"[POLICE RADIO] Le Suspect %s(%d) a commencй un vol au 24/7. Arrкtez le suspect!.",pname,playerid);
				SendClientMessageToAllCops(string);

				format(string,sizeof(string),"%s(%d) a commencй un vol au 24/7...",pname,playerid);
				SendClientMessageToAll(COLOR_RED,string);

				format(string,sizeof(string),"4[ROBBERY] %s(%d) a commencй un vol au 24/7...",pname,playerid);
				IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
			}
			return 1;
		}
	}
Code if i leave the pickup

Код:
public OnPlayerLeaveCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, -8.3713,-31.1897,3.9439))	
{
		if(RobbingMagasin247[playerid] >= 1)
   		{
		    SendClientMessage(playerid,COLOR_ERROR,"La tentative de vol a йchouйe. Vous кtes sorti du Checkpoint.");
			RobbingMagasin247[playerid] =0;
		    return 1;
		}
		return 1;
	}
Pls help me thx !
Reply
#2

Where are you setting the checkpoint?
If you don't set the checkpoint, the script doesn't know you leave the place.
Reply
#3

FAIL
Reply
#4

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
Where are you setting the checkpoint?
If you don't set the checkpoint, the script doesn't know you leave the place.
Yeah but i dont want to use checkpoints ..
Reply
#5

Then you can't use this code
pawn Код:
public OnPlayerLeaveCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, -8.3713,-31.1897,3.9439)) 
{
        if(RobbingMagasin247[playerid] >= 1)
        {
            SendClientMessage(playerid,COLOR_ERROR,"La tentative de vol a йchouйe. Vous кtes sorti du Checkpoint.");
            RobbingMagasin247[playerid] =0;
            return 1;
        }
        return 1;
    }
You need to check if the player is still on the pickup.
What you can do, is the following
pawn Код:
public OnPlayerPickupPickup(playerid,pickupid)
{
if(pickupid == storepickup)//replace with the pickup id
{
IsonPickup[playerid] = 1;
}
}

//then in your rob timer add

if(IsonPickup[playerid] != 1) return
{
SendClientMessage(playerid,COLOR_ERROR,"La tentative de vol a йchouйe.
Vous кtes sorti du Checkpoint."
);
RobbingMagasin247[playerid] =0;
}
Then, under OnPlayerUpdate (not recommended, I suggest you set a timer to do this each 2 seconds or something), place this: IsonPickup[playerid] = 0;

The variable will be set to 1 as long as the player is on the pickup, as soon as he leaves it, the timer will set the variable to 0, which should end your robtimer.
Note, that this is only an idea, I have no idea how your robtimer and things are made, so try to get the idea I sketched above, so you can make it to your needs.
Reply
#6

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
Then you can't use this code
pawn Код:
public OnPlayerLeaveCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, -8.3713,-31.1897,3.9439)) 
{
        if(RobbingMagasin247[playerid] >= 1)
        {
            SendClientMessage(playerid,COLOR_ERROR,"La tentative de vol a йchouйe. Vous кtes sorti du Checkpoint.");
            RobbingMagasin247[playerid] =0;
            return 1;
        }
        return 1;
    }
You need to check if the player is still on the pickup.
What you can do, is the following
pawn Код:
public OnPlayerPickupPickup(playerid,pickupid)
{
if(pickupid == storepickup)//replace with the pickup id
{
IsonPickup[playerid] = 1;
}
}

//then in your rob timer add

if(IsonPickup[playerid] != 1) return
{
SendClientMessage(playerid,COLOR_ERROR,"La tentative de vol a йchouйe.
Vous кtes sorti du Checkpoint."
);
RobbingMagasin247[playerid] =0;
}
Then, under OnPlayerUpdate (not recommended, I suggest you set a timer to do this each 2 seconds or something), place this: IsonPickup[playerid] = 0;

The variable will be set to 1 as long as the player is on the pickup, as soon as he leaves it, the timer will set the variable to 0, which should end your robtimer.
Note, that this is only an idea, I have no idea how your robtimer and things are made, so try to get the idea I sketched above, so you can make it to your needs.
It doesnt work when im robbing it stops directly and i didnt leave the pickup ...
Reply
#7

My bad, that's probably because OnPlayerUpdate us called more often than OnPlayerPickupPickup.
Try making a function that resets the variable to 0 each 5 seconds or so, under OnPlayerPickupPickup make sure the variable is set to 1 again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)