SA-MP Forums Archive
GetPlayerWeaponData Not Work - 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: GetPlayerWeaponData Not Work (/showthread.php?tid=145125)



GetPlayerWeaponData Not Work - jame20702 - 01.05.2010

Код:
if(newstate == PLAYER_STATE_WASTED)
    {
       for (new i; i<13; i++)
	{
  	   GetPlayerWeaponData(playerid, i, PlayerWeapon[playerid][i], PlayerAmmo[playerid][i]);
	}
       injured[playerid] = 1; 
            
Public SetPlayerSpawn
{
  if(injured == 1)
  {
    for (new i; i<13; i++)
    {
      SafeGivePlayerWeapon(playerid, PlayerWeapon[playerid][i], PlayerAmmo[playerid][i]);
      PlayerWeapon[playerid][i] = 0;
      PlayerAmmo[playerid][i] = 0;
    }
no weapon if i spawn



Re: GetPlayerWeaponData Not Work - GTAguillaume - 01.05.2010

Код:
if(injured = 1;)
Change it to:
Код:
if(injured == 1)
I don't know if it will solve the problem


Re: GetPlayerWeaponData Not Work - maij - 01.05.2010

It will not. I posted this in the sa-mp bug report.

In many scenarios this function returns false values.
This function is unreliable.


Re: GetPlayerWeaponData Not Work - xomka - 01.05.2010

are you sure you don't ResetPlayerWeapons above this code?


Re: GetPlayerWeaponData Not Work - maij - 01.05.2010

It doesn't matter, the function itself is bugged.

But yet besides that, when you die, sa-mp automaticly removes your weapons.


Re: GetPlayerWeaponData Not Work - Outbreak - 01.05.2010

When you die, your weapons automatically reset, you'll notice as soon as you die, look at the weapons. It changes to fist.

You could run it on a timer. Checking every second or two.

Then during the checks, to eliminate the possibility of checking while the player is dead. You can get their state, if it's wasted then return 1; to avoid gathering the weapon data.


Re: GetPlayerWeaponData Not Work - jame20702 - 02.05.2010

ok man
and

if i use onplayerdeath. it work ?