How can i make a Timer to spawn a Weapon Crate.
#1

The code is mostly done, i just need to make a timer so thats every 5-10 mins a weapon crate spawns, Thanks alot inadvance.
I got the money bag code from this topic here:https://sampforum.blast.hk/showthread.php?tid=159389 But edited it so it's weapon crates.
Code:
Код:
new mbrand;

new Moneybag1;
new Moneybag2;
new Moneybag3;

stock MR()
{
	mbrand = 1+ random(2);
	if(mbrand == 1)
	{
	    	MB1();
 	}
	if(mbrand == 2)
	{
	    	MB2();
	}
	if(mbrand == 3)
	{
	    	MB3();
	}
	return 1;
}
stock MB1()
{
	Moneybag1 = CreatePickup(3014, 2, -1951.67785645,401.15267944,35.20492935);// weaponcrate 1
	return SendClientMessageToAll(COLOR_YELLOW, "A Weapon Crate Has Been Dropped Somewhere Around The Map! Find It And Recieve Weapons.");
}
stock MB2()
{
	Moneybag2 = CreatePickup(3014, 2, 3014,-1965.84082031,401.74401855,35.20492935);//  weaponcrate 2
	return SendClientMessageToAll(COLOR_YELLOW, "A Weapon Crate Has Been Dropped Somewhere Around The Map! Find It And Recieve Weapons.");
}
stock MB3()
{
	Moneybag3 = CreatePickup(3014, 2, -1986.19873047,394.87664795,35.20492935);// weapon crate 3
	return SendClientMessageToAll(COLOR_YELLOW, "A Weapon Crate Has Been Dropped Somewhere Around The Map! Find It And Recieve Weapons.");
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
    	new name[MAX_PLAYER_NAME];
    	new string[128];

	GetPlayerName(playerid,name,sizeof(name));

	if(pickupid == Moneybag1)
	{
		format(string, sizeof(string), "%s (%d) Has Found The Weapon Crate And Recieved The Weapons.",name,playerid);
		 GivePlayerWeapon(playerid, 24, 200);
		GivePlayerWeapon(playerid, 27, 200);
		GivePlayerWeapon(playerid, 29, 1000);
		GivePlayerWeapon(playerid, 30, 500);
	}
	if(pickupid == Moneybag2)
	{
		format(string, sizeof(string), "%s (%d) Has Found The Weapon Crate And Recieved The Weapons.",name,playerid);
		 GivePlayerWeapon(playerid, 24, 200);
		GivePlayerWeapon(playerid, 27, 200);
		GivePlayerWeapon(playerid, 29, 1000);
		GivePlayerWeapon(playerid, 30, 500);
	}
	else if(pickupid == Moneybag3)
	{
		format(string, sizeof(string), "%s (%d) Has Found The Weapon Crate And Recieved The Weapons.",name,playerid);
	 	GivePlayerWeapon(playerid, 24, 200);
		GivePlayerWeapon(playerid, 27, 200);
		GivePlayerWeapon(playerid, 29, 1000);
		GivePlayerWeapon(playerid, 30, 500);
	}

	SendClientMessageToAll(COLOR_YELLOW, string);

	DestroyMR();
}
stock DestroyMR()
{
	DestroyPickup(Moneybag1);
	DestroyPickup(Moneybag2);
	DestroyPickup(Moneybag3);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)