Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 15/02/22 in all areas

  1. I used a previous command for the new "bone attach" resource, just in case this happens to another person, check the new parameters if you downloaded it
    1 point
  2. Assim que um grupo for aceito, use return para não verificar outros grupos, evitando spam. function setarTUDO (thePlayer, commandName, id, SetFomeSede) for _, group in ipairs(settudoacl) do if (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup(group))) then if (id) then if (tonumber(SetFomeSede)) then local playerID = tonumber(id) if (playerID) then local targetPlayer, targetPlayerName = getPlayerID(playerID) local fomesede = tonumber(SetFomeSede) if (targetPlayer) then if (commandName == settudo) then end -- exports["Script_Dxinfo"]:addBox(thePlayer, "success", "#ffffffFome e Sede de #25C740"..getPlayerName(targetPlayer).." #ffffffsetado para #25C740"..fomesede.."%") exports["Script_Dxinfo"]:addBox(targetPlayer, "info", "#ffffffO STAFF #25C740"..getPlayerName(thePlayer).." #ffffffalterou sua Fome e Sede para #25C740"..fomesede.."%") setElementData(targetPlayer, "hunger", fomesede) setElementData(targetPlayer, "sede", fomesede) return else exports["Script_Dxinfo"]:addBox(thePlayer, "error", "#ffffffO jogador não foi encontrado!") return end else exports["Script_Dxinfo"]:addBox(thePlayer, "error", "#ffffffUtilize : #ff0000/"..commandName.." #ffffff[ID] [Quantidade]") return end else exports["Script_Dxinfo"]:addBox(thePlayer, "error", "#ffffffUtilize : #ff0000/"..commandName.." #ffffff[ID] [Quantidade]") return end else exports["Script_Dxinfo"]:addBox(thePlayer, "error", "#ffffffUtilize : #ff0000/"..commandName.." #ffffff[ID] [Quantidade]") return end end end exports["Script_Dxinfo"]:addBox(thePlayer, "error", "#ffffffPermissão Negada!") end addCommandHandler(settudo, setarTUDO)
    1 point
  3. it seems you haven't started the "bone_attach" script
    1 point
  4. json returns a string type, so when saving, we should do it as VARCHAR in mysql, I'm not sure, but this string may be equivalent to mysql example: addCommandHandler("weap", function(player) local weapon = '[{ "27": 1500, "22": 1500, "28": 1500 } ]' --As you can see here json data is string giveWeaponsFromJSON(player, weapon) end) You can check the return value of the functions you use to distinguish it from the wiki, for example, the getPlayerName function returns a string on success. --here string getPlayerName ( player thePlayer ) likewise the setPlayerName function takes a string of data --here bool setPlayerName ( player thePlayer, string newName ) so the player's name is always string By looking at the return values of the functions you use, you can understand what should be INT and what should be VARCHAR.
    1 point
  5. The column in the table was specified with "INT" instead of "VARCHAR", thank you for your help Burak! it's a little confusing to me... Why sometimes it's VARCHAR and sometimes "INT" ? my columns with INT: Position, dimension, interior, rotation... my columns with VARCHAR: names, texts, name of the account... but why this (weapon's table) have to be varchar? just asking EDIT: I know int means integer, but why in this case the int doesn't work?
    1 point
  6. Try using the giveWeaponsFromJSON function inside the "onPlayerSpawn" event other than that make sure the column type is VARCHAR and has sufficient length To test whether the weapon gives or not, you can enter the column manually [{ "27": 1500, "22": 1500, "28": 1500 } ] Apart from that, I tested both functions on my own computer, there is no problem.
    1 point
  7. I couldn't see an error here. Is the weapon column empty when you exit? Is there any error in the debugscript? You give the weapons when the player spawns, right? or maybe there is a error elsewhere
    1 point
  8. If you don't give a slot to getPedWeapon, it will return the weapon you have. so specify the slot you will get getPedWeapon ( ped thePed, [ int weaponSlot = current ] ) you can use JSON to save the weapons in a mysql column You can create an inventory column in mysql and then you can use convertWeaponsToJSON at game exit. When you spawned, you can give weapons using giveWeaponsFromJSON --this part will be executed when the player exits the game function convertWeaponsToJSON(player) local weaponSlots = 12 --up to which slot the weapons will be saved local weaponsTable = {} --a table to temporarily store weapons for slot=0, weaponSlots do local weapon = getPedWeapon(player, slot) local ammo = getPedTotalAmmo(player, slot) if (weapon > 0 and ammo > 0) then if(weapon == 37) then --for ammo increase bug in this flamethrower ammo = ammo/10 end weaponsTable[weapon] = ammo --create a reference to the table with the weapon id and ammo amount end end return toJSON(weaponsTable) --return table as json end --to give weapons from mysql table when this player spawn (just one time) function giveWeaponsFromJSON(player, weapons) if (weapons and weapons ~= "") then takeAllWeapons(player) --take all weapons before the player. To avoid the ammo increase bug for weapon, ammo in pairs(fromJSON(weapons)) do --convert json format to table and load weapons into player if (weapon and ammo) then giveWeapon(player, tonumber(weapon), tonumber(ammo)) --give weapon to player end end end end
    1 point
  9. Hey, Well if you are using getPlayerFromPartialName then just remove the :lower() from the lines 2 and 5.
    1 point
  10. You can't use the addCommandHandler like that. You can either do it like this (server side ONLY!): addEventHandler("onPlayerCommand", root, function(cmd) if (cmd == "Check" or cmd == "Checkk" or cmd == "checkkk") then outputChatBox("Okay") end end) or like this: function testFunc() outputChatBox("Ok") end addCommandHandler( "Check", testFunc) addCommandHandler( "Checkk", testFunc) addCommandHandler( "checkkk", testFunc)
    1 point
×
×
  • Create New...