akf94
1
hey,
I made a inventory script and now I need to convert the weapons into item to be able to use them, I added the weapons into the database but I cant figure out how to link each item to the weapons itself, I’m trying to make the item trigger a givewepon command but I cant figure out how to do it, anybody knows how?
or if anybody got other ideas to make it work?
arayni
2
You should save all information of an item inside a database, that are relevant to recreate it in the game.
Basic example:
Your Table “weapons” has the following columns:
- user_id
- model (weaponhash)
- ammo
On player join u can then query all weapons of that player using the user_id:
select * from weapons where user_id = "get user id in script"
And than giving that player all weapons (pseudo code):
foreach(var weapon of players_weapons) {
GiveWeaponToPed(player_ped_id, weapon.model, weapon.ammo, false, false);
}
That example should give you enough information to make progess on your inventory script