SA-MP Forums Archive
Not working anymore - 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: Not working anymore (/showthread.php?tid=618135)



Not working anymore - GoldenLion - 01.10.2016

Hi, the code below I made used to work before, but now it doesn't for some reason, I'm really confused because nothing seems to be wrong with it, and sometimes it works and stops working again when I add some new stuff. It's supposed to create a weapon object on you when you don't use the weapon. The WeaponCheck part doesn't work. It's a filterscript also.
Here's the code:
Код:
GetWeaponObjectSlot(weaponid)
{
	new slot;
	
	switch (weaponid)
	{
    	case 22..24: slot = 0;
    	case 25..27: slot = 1;
		case 28, 29, 32: slot = 2;
		case 30, 31: slot = 3;
		case 33, 34: slot = 4;
		case 35..38: slot = 5;
	}
	return slot;
}

GetWeaponModel(weaponid)
{
    new const WeaponModels[] =
	{
		0, 331, 333, 334, 335, 336, 337, 338, 339, 341, 321, 322, 323, 324,
		325, 326, 342, 343, 344, 0, 0, 0, 346, 347, 348, 349, 350, 351, 352,
		353, 355, 356, 372, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366,
		367, 368, 368, 371
	};
  	return WeaponModels[weaponid];
}

forward WeaponCheck(playerid);
public WeaponCheck(playerid)
{
	new weapon[13], ammo[13], objectslot, weaponcount;

	for (new i; i <= 12; i++)
	{
	    GetPlayerWeaponData(playerid, i, weapon[i], ammo[i]);

		if (weapon[i] && ammo[i])
		{
			objectslot = GetWeaponObjectSlot(weapon[i]);
			
		    if (GetPlayerWeapon(playerid) != weapon[i]) SetPlayerAttachedObject(playerid, objectslot, GetWeaponModel(weapon[i]), 1, -0.116999, -0.087999, -0.126999, -176.799987, 42.499992, 6.300001, 1.000000, 1.000000, 1.000000);
		    else if (IsPlayerAttachedObjectSlotUsed(playerid, objectslot)) RemovePlayerAttachedObject(playerid, objectslot);
		}
	}
}
What's up?


Re: Not working anymore - GoldenLion - 01.10.2016

Eh, got it working again without doing anything lol...