NEed help
#1

hi guys

i need help reseting only on weapon from weapon slot

I know GetPlayerWeaponData I dont know how it works.

Can someone give me example of this

Removing a deagle and replacing that with colt

in a weapons slot.
Reply
#2

If you're giving the same weapon, with the same slot. It will replace your secondary slot.
Reply
#3

Here you go:

pawn Код:
new GunSlot2, GunSlot2Ammo; // Declare the variables for the weapon ID and Ammo ID you are going to retrieve from the designated weapon slot (in our case, 2).
GetPlayerWeaponData(playerid, 2, GunSlot2, GunSlot2Ammo); // Get the player-in-question's "pistol" weapon ID and ammo in slot 2, using the variables declared.
if(GunSlot2 == 24) // If the player's "pistol" weapon is a Desert Eagle...
{
    GivePlayerWeapon(playerid, 22, GunSlot2Ammo); // ...  Give the player a Colt (automatically replacing the Desert Eagle in the "pistol" weapon slot) and give the player the ammunition they previously had for the Desert Eagle.
}
Just as an added note: there are various weapon slots depending on the weapon "type". For example, shotguns are slot 3, while pistols are slot 2. For more information on weapon ID and slot values, visit: https://sampwiki.blast.hk/wiki/Weapons
Reply
#4

I am making a taser system!

^ The one you posted it removes my gun and It dont let me use De Eagle, can you see what i did wrong
else if(Tazer[playerid] == 1)
{
new GunSlot2ID, GunSlot2AmmoID; // Declare the variables for the weapon slot (in our case, 2) weapon ID and Ammo ID you are going to retrieve.
GetPlayerWeaponData(playerid, 2, GunSlot2ID, GunSlot2AmmoID); // Get the player-in-question's "pistol" weapon ID and ammo in slot 2, using the variables declared.
if(GunSlot2ID == 22) // If the player's "pistol" weapon is a Desert Eagle...
{
GivePlayerWeaponEx(playerid, 24, GunSlot2AmmoID); // ... Give the player a Colt (automatically replacing the "pistol" weapon slot) and give the player the ammunition they previously had for the Desert Eagle.
}

Tazer[playerid] = 0;

SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;

}
else Tazer[playerid] = 0;
return 1;
}

}

so if someone does /taser at first time it gives them colt
again they do taser i want them to replace colt with sd pistol

I did this way but it dont let me switch to my sd pistol and cant scroll down and shti
Reply
#5

You cannot hold more than one weapon in the same weapon slot, thus you cannot have a Colt and a Desert Eagle at one instance. Could you provide the code for the entire /tazer command? Wrap [pawn] tags around your code, please.
Reply
#6

Код:
if (strcmp("/taser", cmdtext, true, 6) == 0)
        {
           if(PlayerInfo[playerid][pMember] == 1)
           {
            GivePlayerWeaponEx(playerid, TAZE_WEAPON, 100);
            GetPlayerName(playerid, sendername, sizeof(sendername));
            if(Tazer[playerid] == 0)
            {
                        if(GetPlayerWeapon(playerid) == TAZE_WEAPON) {} else return SendClientMessage(playerid, 0xFFFFFFFF, "Taser {8924} You do not have gun on your hand!");
                        Tazer[playerid] = 1;
                        format(string, sizeof(string), "Tazer Eqipped!, %s.", sendername);
                        SendClientMessage(playerid, 0xFFFFFFFF, string);
                        return 1;
                }
                else if(Tazer[playerid] == 1)
                {
                Tazer[playerid] = 0;
                format(string, sizeof(string), "Taser removed!, %s.", sendername);
                SendClientMessage(playerid, 0xFFFFFFFF, string);
                GivePlayerWeaponEx(playerid, 23, 100);
                /*new GunSlot2ID, GunSlot2AmmoID; // Declare the variables for the weapon slot (in our case, 2) weapon ID and Ammo ID you are going to retrieve.
               GetPlayerWeaponData(playerid, 2, GunSlot2ID, GunSlot2AmmoID); // Get the player-in-question's "pistol" weapon ID and ammo in slot 2, using the variables declared.
	            if(GunSlot2ID == 22) // If the player's "pistol" weapon is a Desert Eagle...
                {
                 GivePlayerWeaponEx(playerid, 24, GunSlot2AmmoID); // ...  Give the player a Colt (automatically replacing the "pistol" weapon slot) and give the player the ammunition they previously had for the Desert Eagle.
                 }
				 */
                return 1;

          
			}
          
                else Tazer[playerid] = 0;
                return 1;
        }
 
}
Yeah, I'd want player to just like have a fist once they do /taser again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)