Jump to content
  • 0

[HELP] Having trouble with weapon on start script


AlexMiller

Question

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!

Link to comment

1 answer to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...