SA-MP Forums Archive
how would i... - 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: how would i... (/showthread.php?tid=65867)



how would i... - CJ101 - 17.02.2009

ok i have an area where you can sell weapons, but...

how would i check if the player does not have any weapons and say:

You do not have any weapons to sell!


Re: how would i... - Joe Staff - 17.02.2009

GetWeaponData(playerid,&slot,&ammo)


Re: how would i... - 1337pr0 - 17.02.2009

I'm not sure exactly what you are doing... Are you doing it like CrazyBob's where you have a weapon stockpile, and each time you sell any weapon it goes down by 1? Or are you trying to sell one player's weapons to another player?

Could you post some of your code?


Re: how would i... - kazimieras - 17.02.2009

Код:
stock DoesPlayerHaveAnyWeapons_OMG_thats_a_long_name_for_a_Freakn_function(playerid)
{
   new ammo,weapon;
   for(new slot=0; slot<12; slot++) // Assuming that there are only 12 weapon slots (cuz now I don't remember the real count)
   {
     GetPlayerWeaponData(playerid,slot,ammo,weapon);
     if(ammo || weapon) return true; //ZOMFG >_> we found one.
   }
   return false; // Nope.. he's clean.
}
Should work.


Re: how would i... - 1337pr0 - 17.02.2009

Quote:
Originally Posted by KANiS6111
Код:
stock DoesPlayerHaveAnyWeapons_OMG_thats_a_long_name_for_a_Freakn_function(playerid)
I lol'd