HI everyone, it's about 2 months that i'm trying to understand what i did wrong in the following script, that would give a player the weapons he had when lastly logged. Here is a part of the script, check if is there any weap on each slot, in this case, the number 5:
if not (isGuestAccount (getPlayerAccount (source))) then
paccount = getPlayerAccount (source)
if (paccount) then
slot5 = getPedWeapon (source, 5)
slot5a = getPedTotalAmmo (source, 5)
setAccountData (paccount, "rpg-slot5", slot5)
setAccountData (paccount, "rpg-slot5Ammo", slot5a)
end
end
So far, it is OK, as they get stored correctly on the DB...
Now, on the player login, the weapon can't be given to the player, but i don't get any error. Here is the code:
if not (isGuestAccount (getPlayerAccount (source))) then
local accountData = getAccountData (theCurrentAccount, "rpg-money")
if (accountData) then
lslot5 = tonumber(getAccountData (theCurrentAccount, "rpg-slot5"))
lslot5a = tonumber(getAccountData (theCurrentAccount, "rpg-slot5Ammo"))
if not lslot5 == 0 then
setTimer (giveWeapon, 2000, 1, source, lslot5, lslot5a)
end
Do you see any mistake?
Thanks for the help!