SA-MP Forums Archive
robbery system 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: robbery system problem (/showthread.php?tid=655523)



robbery system problem - div - 23.06.2018

Im making a robbery system.. but when I rob a place, all the places become unavailable to rob.. please help




I've used LOOP in CreateDynamicObject.. (safe ids)


And then, using loop again, i try to make that particular store unavailable to rob for 5 mins, but all the stores become unavailable..


Here's the loop statement


Код:
for(new i = 0; i < sizeof(StoreSafeMoney); i++)
	{
	SafeRecentlyRobbed[i] = 1;
	}
Store safe money is the object id of money..


Re: robbery system problem - JasonRiggs - 23.06.2018

I don't understand what you're trying to do..

I guess that you should make enum to stores the cooldown of a shop, and when the players rob the shop you set that enum to the time stored inside the enum, What do you want now?


Re: robbery system problem - div - 23.06.2018

I've added a cooldown, when i rob a store, it wont be robbed for 5 minutes, but when i rob a store,

It ADDS A COOLDOWN TO ALL THE STORES INSTEAD OF THAT PARTICULAR STORE..


SAFE RECENTLY ROBBED = 1 means it is recently robbed

Then i added a timer after 5 mins, it will be set to 0(SAFE RECENTLY ROBBED = 0)


Re: robbery system problem - JasonRiggs - 23.06.2018

then it's nothing wierd.. You're looping through all the shops(without a specific case) and set its recently robbed to 0.. Then u set all the shops' status to recently robbed..


Re: robbery system problem - div - 23.06.2018

That's not how i want it to be..


I want it like, IF I ROB A STORE, THE LOOT ENDS ONLY IN THAT STORE, NOT ALL STORES


Suppose, there are 2 stores, X and Y

I rob the Store X, X will be on a robbery cooldown


Then i go to Y store, and will rob it, then Y will go on a timeout..



but whats happening to me =>


If i rob a store X,

Y goes on a cooldown too without even robbing Y


Re: robbery system problem - JasonRiggs - 23.06.2018

And why the heck make a loop?? Why not just set the SafeRecentlyRobbed[THE SHOP ID HERE] to 1..


Re: robbery system problem - div - 23.06.2018

I used a loop for adding objects, then i used if(IsPlayerInRangeOfObject) for making the robbery command work


after that, I used loop for different making objects for EXAMPLE
Код:
ENUM

{

POSES LIKE XYZ
}

new SafeMoney[][MoneyOfSafe] =
{
    {382.519470, -56.520069, 1000.847290, 0.000000, 0.000000, -3.399998},
then the robbery command

Код:
 	{
 	if(SafeRecentlyRobbed[playerid] == 1)
	{
	format(str, 128, "{FF0000}[ERROR] {FFFFFF}This store has recently been robbed, please wait before robbing it again.");
	return SendClientMessage(playerid, -1, str);
	}
	if(SafeBeingRobbed[playerid] == 1)
	return SendClientMessage(playerid, -1, "{FF0000}[ERROR] {FFFFFF}You're already robbing a safe.");

	for(new i = 0; i < sizeof(StoreSafeMoney); i++)
	{



	if (IsPlayerInRangeOfPoint(playerid, 2.0, SafeMoney[i][SafeX], SafeMoney[i][SafeY], SafeMoney[i][SafeZ]))
    {
    SetPlayerLookAt(playerid, SafeMoney[i][SafeX], SafeMoney[i][SafeY]);
	ClearAnimations(playerid);
	SetTimer("RobberyStart", 0, false);
then the textdraws

Then, at the END,


SafeRecentlyRobbed[i] = 1;


then a 5 min timer, then the saferecentlyrobbed will be 0;


But it's not adding a COOLDOWN to THAT PARTICULAR SHOP/SAFE, it's adding cooldown to EVERY SAFE present in the ENUMS