weapon change issue - 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: weapon change issue (
/showthread.php?tid=652082)
weapon change issue -
UFF - 02.04.2018
i scripted a minigame like gungame, I am facing a issuse with the weapon reset.
Код:
public OnPlayerUpdate(playerid)
{
if(PlayerStatus[playerid][dead] == false)
{
if(!GetPlayerWeapon(playerid))
{
if(PlayerStatus[playerid][pw] == true)
{
GivePlayerWeapon(playerid, 4, 1);
PlayerStatus[playerid][pw] = false;
}
else
{
GivePlayerWeapon(playerid, Weaps[PlayerStatus[playerid][glevel]], 99999);
PlayerStatus[playerid][pw] = true;
}
}
else PlayerStatus[playerid][pw] = GetPlayerWeapon(playerid) == 4 ? false : true;
}
return 1;
}
i gives me the next level weapon but not removing the old level weapon.
example
Level 1 - Mp5
Level 2 - ak47
When i kill someone I level up to 2 and i get ak47 but i have mp5 with me.
when i use SetPlayerArmedWeapon it doesn't give me weapon on re-spawn, only giveplayerweapon works.
There is no error log when i use SetPlayerArmedWeapon!
Re: weapon change issue -
Sielly - 02.04.2018
Hi,
You can use
ResetPlayerWeapons(playerid) before giving a new weapon.
Re: weapon change issue -
UFF - 02.04.2018
Quote:
Originally Posted by Sielly
Hi,
You can use ResetPlayerWeapons(playerid) before giving a new weapon.
|
Thanks I fixed it, +rep for the reply!