detect 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)
+--- Thread: detect gun (
/showthread.php?tid=486245)
detect gun -
iBots - 07.01.2014
How to make like:
I have gun and i changed to another gun,then it will auto change my gun to the old one example:
I have spas and deagle and i was holding spas and then changed to deagle, it will change it back to spas
And it can be another guns because i dont know what guns the player has so how to know the weapon he had?
Re: detect gun -
Konstantinos - 07.01.2014
Getting weapon data for the players:
https://sampwiki.blast.hk/wiki/GetPlayerWeaponData
Knowing when a player changes weapon:
https://sampforum.blast.hk/showthread.php?tid=486214
In OnPlayerChangeWeapon, use
SetPlayerArmedWeapon and set the armed weapon to the one you've already stored (check your previous thread, 2nd line of the post).
Re: detect gun -
iBots - 08.01.2014
You can give me the code ? I have made everything and a timer but i need a code to know the gun he used and then onplayerupdate i will put his armed weapon to the id of that gun like
[pawn]
new WeapID
Getplayergun(playerid)
How to use the WeapID so it will be the X id of the gun? And then i can use it on playerupdate
Re: detect gun -
amirab - 08.01.2014
you can use this one:
PHP код:
public OnPlayerUpdate(playerid)
{
new iCurWeap = GetPlayerWeapon(playerid);
if(iCurWeap != GetPVarInt(playerid, "iCurrentWeapon"))
{
OnPlayerChangeWeapon(playerid, GetPVarInt(playerid, "iCurrentWeapon"), iCurWeap);
SetPVarInt(playerid, "iCurrentWeapon", iCurWeap);
}
return 1;
}
stock OnPlayerChangeWeapon(playerid, oldweapon, newweapon)
{
SetPlayerAmmo(playerid, newweapon, -1);
SendClientMessage(playerid, 0xFFFFFFFF, "You Can't Chagne Your Weapon!");
}
Re: detect gun -
iBots - 08.01.2014
let me tell you what i want,i am making a thing like:
if i shot using shotgun and i have deagle,and i change my weapon to deagle it will let me hold the shotgun again till the timer is over,i have made a timer,but how to let him get the weapon he used to shoot?