SA-MP Forums Archive
Armed body not working well - 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: Armed body not working well (/showthread.php?tid=625918)



Armed body not working well - pedrotvr - 08.01.2017

Why my armed body not work on weapons AK/M4 and RIFLE/SNIPER (that weapons, didnt have on system, i tried to add by myserlf, but i'm noob)

What i'm making wrong?
Код:
stock GetWeaponModel(weaponid) {
        switch(weaponid) {
            case 1:
                return 331;
            case 2..8:
                return weaponid+331;
    		case 9:
                return 341;
            case 10..15:
                return weaponid+311;
            case 16..18:
                return weaponid+326;
            case 22..29:
                return weaponid+324;
            case 30,31:
                return weaponid+325;
            case 32:
                return 372;
            case 33..45:
                return weaponid+324;
            case 46:
                return 371;
        }
        return 0;
}
forward ArmasSkin(playerid); public ArmasSkin(playerid) {
    if(!IsPlayerInAnyVehicle(playerid)) {
        if(GetTickCount() - armedbody_pTick[playerid] > 113) { //prefix check itter
            new weaponid[13],weaponammo[13],pArmedWeapon;
            pArmedWeapon = GetPlayerWeapon(playerid);
            GetPlayerWeaponData(playerid,1,weaponid[1],weaponammo[1]);
            GetPlayerWeaponData(playerid,2,weaponid[2],weaponammo[2]);
            GetPlayerWeaponData(playerid,4,weaponid[4],weaponammo[4]);
            GetPlayerWeaponData(playerid,5,weaponid[5],weaponammo[5]);
            GetPlayerWeaponData(playerid,6,weaponid[6],weaponammo[6]);
            #if ARMEDBODY_USE_HEAVY_WEAPON
            GetPlayerWeaponData(playerid,7,weaponid[7],weaponammo[7]);
            #endif
            if(weaponid[1] && weaponammo[1] > 0){
                if(pArmedWeapon != weaponid[1]) {
                    if(!IsPlayerAttachedObjectSlotUsed(playerid,0)){
                        SetPlayerAttachedObject(playerid,0,GetWeaponModel(weaponid[1]),1, 0.199999, -0.139999, 0.030000, 0.500007, -115.000000, 0.000000, 1.000000, 1.000000, 1.000000);
                    }
                }
                else {
                    if(IsPlayerAttachedObjectSlotUsed(playerid,0)) { RemovePlayerAttachedObject(playerid,0); }
                }
            }
            else if(IsPlayerAttachedObjectSlotUsed(playerid,0)){ RemovePlayerAttachedObject(playerid,0); }
            // pistol
            if(weaponid[2] && weaponammo[2] > 0){
                if(pArmedWeapon != weaponid[2]){
                    if(!IsPlayerAttachedObjectSlotUsed(playerid,1)){
                        SetPlayerAttachedObject(playerid,1,GetWeaponModel(weaponid[2]),8, -0.079999, -0.039999, 0.109999, -90.100006, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000);
                    }
                }
                else { if(IsPlayerAttachedObjectSlotUsed(playerid,1)){ RemovePlayerAttachedObject(playerid,1); } }
            }
            else if(IsPlayerAttachedObjectSlotUsed(playerid,1)){ RemovePlayerAttachedObject(playerid,1); }
            // mp5
            if(weaponid[4] && weaponammo[4] > 0){
                if(pArmedWeapon != weaponid[4]){
                    if(!IsPlayerAttachedObjectSlotUsed(playerid,2)){
                        SetPlayerAttachedObject(playerid,2,GetWeaponModel(weaponid[4]),7, 0.000000, -0.100000, -0.080000, -95.000000, -10.000000, 0.000000, 1.000000, 1.000000, 1.000000);
                    }
                }
                else { if(IsPlayerAttachedObjectSlotUsed(playerid,2)) { RemovePlayerAttachedObject(playerid,2); } }
            }
            else if(IsPlayerAttachedObjectSlotUsed(playerid,2)){ RemovePlayerAttachedObject(playerid,2); }
            // ak,m4
            if(weaponid[5] && weaponammo[5] > 0){
                if(pArmedWeapon != weaponid[5]){
                    if(!IsPlayerAttachedObjectSlotUsed(playerid,3)) {
                        SetPlayerAttachedObject(playerid,3,GetWeaponModel(weaponid[5]),1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000);
                    }
                }
                else {
                    if(IsPlayerAttachedObjectSlotUsed(playerid,3)){ RemovePlayerAttachedObject(playerid,3); }
                }
            }
            else if(IsPlayerAttachedObjectSlotUsed(playerid,3)){ RemovePlayerAttachedObject(playerid,3); }
            // shotgun,spaz
            if(weaponid[3] && weaponammo[3] > 0){
                if(pArmedWeapon != weaponid[3]){
                    if(!IsPlayerAttachedObjectSlotUsed(playerid,6)) {
                        SetPlayerAttachedObject(playerid,6,GetWeaponModel(weaponid[3]),1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000);
                    }
                }
                else {
                    if(IsPlayerAttachedObjectSlotUsed(playerid,6)){ RemovePlayerAttachedObject(playerid,6); }
                }
            }
            // rifle,sniper
            if(weaponid[6] && weaponammo[6] > 0){
                if(pArmedWeapon != weaponid[6]){
                    if(!IsPlayerAttachedObjectSlotUsed(playerid,5)) {
                        SetPlayerAttachedObject(playerid,5,GetWeaponModel(weaponid[6]),1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000);
                    }
                }
                else {
                    if(IsPlayerAttachedObjectSlotUsed(playerid,5)){ RemovePlayerAttachedObject(playerid,5); }
                }
            }
            //
            #if ARMEDBODY_USE_HEAVY_WEAPON
            if(weaponid[7] && weaponammo[7] > 0){
                    if(pArmedWeapon != weaponid[7]){
                        if(!IsPlayerAttachedObjectSlotUsed(playerid,4)){
                            SetPlayerAttachedObject(playerid,4,GetWeaponModel(weaponid[7]),1,-0.100000, 0.000000, -0.100000, 84.399932, 112.000000, 10.000000, 1.099999, 1.000000, 1.000000);
                        }
                    }
                    else {
                        if(IsPlayerAttachedObjectSlotUsed(playerid,4)) { RemovePlayerAttachedObject(playerid,4); }
                    }
            }
            else if(IsPlayerAttachedObjectSlotUsed(playerid,4)){ RemovePlayerAttachedObject(playerid,4); }
            #endif
            armedbody_pTick[playerid] = GetTickCount();
        }
        return true;
    }
    return 1;
}



Re: Armed body not working well - pedrotvr - 08.01.2017

Someone know?


Re: Armed body not working well - pedrotvr - 10.01.2017

Someone know?


Re: Armed body not working well - Stones - 10.01.2017

Perhaps your missing
Код:
stock GetWeaponModel(weaponid)
{
	switch(weaponid)
	{
	    case 1:
	        return 331;

		case 2..8:
		    return weaponid+331;

                case 9:
		    return 341;

		case 10..15:
			return weaponid+311;

		case 16..18:
		    return weaponid+326;

		case 22..29:
		    return weaponid+324;

		case 30,31:
		    return weaponid+325;

		case 32:
		    return 372;

		case 33..45:
		    return weaponid+324;

		case 46:
		    return 371;
	}
	return 0;
}
Sourced from here


Re: Armed body not working well - pedrotvr - 11.01.2017

Quote:
Originally Posted by Stones
Посмотреть сообщение
Perhaps your missing
Код:
stock GetWeaponModel(weaponid)
{
	switch(weaponid)
	{
	    case 1:
	        return 331;

		case 2..8:
		    return weaponid+331;

                case 9:
		    return 341;

		case 10..15:
			return weaponid+311;

		case 16..18:
		    return weaponid+326;

		case 22..29:
		    return weaponid+324;

		case 30,31:
		    return weaponid+325;

		case 32:
		    return 372;

		case 33..45:
		    return weaponid+324;

		case 46:
		    return 371;
	}
	return 0;
}
Sourced from here
I gave you a rep to try to help me, but still not working
All weapons are working, only m4/ak and shotgun/spaz is not working


Re: Armed body not working well - pedrotvr - 13.01.2017

Anyone?


Re: Armed body not working well - pedrotvr - 16.01.2017

Anybody know?


Re: Armed body not working well - pedrotvr - 19.01.2017

Anybody know?


Re: Armed body not working well - Sew_Sumi - 19.01.2017

What is it you are trying to do? Is this like a way of making the holster mod or something on the server?

And how do you mean, not working well? Is it not working at all, or is it half working, and what is it doing?


Re: Armed body not working well - pedrotvr - 22.01.2017

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
What is it you are trying to do? Is this like a way of making the holster mod or something on the server?

And how do you mean, not working well? Is it not working at all, or is it half working, and what is it doing?
It's a way to try to make the holster mod on server (to work without mods)...
It's work in all weapons, but not work only in weapons: Rifle (33) Sniper (34) / Shotgun (25) Spaz (27)