Synthesize item system for survival server - 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: Synthesize item system for survival server (
/showthread.php?tid=661835)
Item crafting system for survival server -
3417512908 - 16.12.2018
Код:
enum eItem
{
ItemID,
Type,
Owner,
Value,
Exist,
Drop
}
#define MAX_ITEMS 1501
new Item[MAX_ITEMS][eItem];
for example,torch's synthetic formula is three wood(type0) and four grass(type1)
How to check if player don't have enough material to make torch?
I've searched it for a long time...Please tell me how to do I really need it
Re: Synthesize item system for survival server -
Kaliber - 17.12.2018
Why not do it like this?
PHP код:
enum eItem
{
Type,
Value,
Exist,
Drop
};
new Inventar[MAX_PLAYERS][50][eItem]; //you can say 50 Items for Player
stock CanBuildTorch(playerid)
{
new wood,grass;
for(new i; i<sizeof(Inventar[]); i++)
{
if(!Inventar[playerid][i][Exist]) continue;
switch(Inventar[playerid][i][Type])
{
case 0: wood++;
case 1: grass++;
}
}
return (wood >= 3 && grass >= 4);
}