SA-MP Forums Archive
Hold Just One Gun. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Hold Just One Gun. (/showthread.php?tid=199235)



Hold Just One Gun. - Karl1195 - 14.12.2010

How to make that every player can just hold one gun in his hand? Is it that difficult. I am really looking forward to do this i got this idea to prevent some non-rping if you got an idea how to do it i will be very pleased if you can help me

msn: khibs@hotmail.com

Karl1195. Thanks


Re: Hold Just One Gun. - Scenario - 14.12.2010

You should be able to use this function to do that.


Re: Hold Just One Gun. - Karl1195 - 14.12.2010

public OnPlayerSpawn(playerid)
{
SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
//This will make them use single-handed sawnoff shotguns.
return 1;
}

Doesn't that just make a player to spawn with a sawnoff shotgun?


Re: Hold Just One Gun. - Marcel - 14.12.2010

No, it sets the skill level of the sawnoff shotgun to 1. Meaning they can only hold 1 shotgun. Use GivePlayerWeapon to give someone a weapon.


Re: Hold Just One Gun. - Karl1195 - 14.12.2010

Ohh cool. So i have to do SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1); For every gun?


Re: Hold Just One Gun. - Marcel - 14.12.2010

Yes, but replace WEAPONSKILL_SAWNOFF_SHOTGUN for these:
https://sampwiki.blast.hk/wiki/Skillweapons


Re: Hold Just One Gun. - Mauzen - 14.12.2010

In short, you can rewrite a GivePlayerWeaponEx function. Check if the player already has the weapon you want to give him with GetPlayerWeaponData. If he has, give him the weapon normally, else reset his weapons and then give him the weapon.

That wont work for pickups, but you could use custom pickups for that then.