Jump to content

βurak

Members
  • Posts

    375
  • Joined

  • Last visited

  • Days Won

    22

Everything posted by βurak

  1. I'm not sure, but can you try to delete the comma at the end of the interior in the query? --here local sendInfo = exports.mysql:_Query("UPDATE characters SET x=?, y=?, z=?, money=?, health=?, dimension=?, interior=? WHERE cuenta=?", x, y, z, money, health, dimension, interior, accName)
  2. you don't get the account name, you compare it directly with the player's account, for this, get the account name with getAccountName in the same way, change the playerAccount to accName in the query you sent. function recordarData() local playerAccount = getPlayerAccount(source) if(playerAccount) then if(isGuestAccount(playerAccount)) then return end end local x, y, z = getElementPosition(source) local money = getPlayerMoney(source) local health = getElementHealth(source) local dimension = getElementDimension(source) local interior = getElementInterior(source) local accName = getAccountName(playerAccount) --get player's account name to compare in mysql --Use dbQuery instead of _Exec --replace this with account name local sendInfo = exports.mysql:_Query("UPDATE characters SET x=?, y=?, z=?, money=?, health=?, dimension=?, interior=?, WHERE cuenta=?", x, y, z, money, health, dimension, interior, accName) if (sendInfo) then iprint("Data saved") else iprint("Error saving") end end addEventHandler("onPlayerQuit", getRootElement(), recordarData)
  3. hmm can you try to delete the break command for _,column in ipairs(setData) do setPlayerMoney(source, column["money"]) --get player's money from mysql and set Using: column["column name"] end
  4. I'm not sure, but you can do it this way, the onPlayerLogin event is suitable for this job, you can transfer the data to the game when the player logs in function setData() local playerAccount = getPlayerAccount(source) if(playerAccount) then if(isGuestAccount(playerAccount)) then return end end local accName = getAccountName(playerAccount) -- get player account name local setData = exports.mysql:_Query("SELECT * FROM characters WHERE name=? LIMIT 1", accName) -- Retrieve all column data with account name accName if(setData) then --if successful? if(#setData > 0) then -- if table size is greater than 0 for _,column in ipairs(setData) do setPlayerMoney(source, column["money"]) --get player's money from mysql and set Using: column["column name"] break --leave the for loop immediately when it has set all the data end end end end
  5. You can use UPDATE for this, but make sure the player always has a column in the database. You can use insert once before. do it with a function in your code that uses dbQuery instead of exec because you're using exports I'm not sure function saveDataCharacter() local playerAccount = getPlayerAccount(source) -- get account of player who exited game if(playerAccount) then if(isGuestAccount(playerAccount)) then return end -- if guest account don't continue end local x, y, z = getElementPosition(source) local money = getPlayerMoney(source) local health = getElementHealth(source) --Use dbQuery instead of _Exec --name I'm not sure of the player's account name? local sendInfo = exports.mysql:_Exec("UPDATE characters SET x=?, y=?, z=?, money=?, health=? WHERE name=?", x, y, z, money, health, playerAccount) if (sendInfo) then iprint("Data saved") else iprint("Error saving") end end addEventHandler("onPlayerQuit", getRootElement(), saveDataCharacter)
  6. There is no reason for you to do this check for the combo box, if you want to check it with the player's input, it may work, but I'll give an example anyway. A2 = string.gsub(A2, "%s+", "") -- delete all spaces for A2 if(string.len(A2) > 0) then --if A2 is greater than 0 characters -- codes here end you can only use this in variables where you use guiComboBoxGeItemText function
  7. try using string.len and string.gsub local text = "" -- empty text text = string.gsub(text, "%s+", "") -- delete all spaces if(string.len(text) > 0) then --if text is greater than 0 characters -- codes here end
  8. yes now the problem is really solved thanks tut
  9. I am using the hero dff exporter with max 2009 version
  10. hello, I painted this object with vertex painting, but when the players walk on this object and take a jetpack, the light changes, and it also changes at different camera angles. What is the reason for this?
  11. you can use a table for this, when you bring back the player's health, you mark it as true in this table, you change it to false when it spawns again so it only uses knocked down players setPlayerKnockDown(player, true) --mark the player as knocked down so he can use the command local isPlayersKnockDown = {} function setPlayerKnockDown(player, condition) isPlayersKnockDown[player] = condition end function revivir(source) if (si==1) and (cancelText==nil) then if(isPlayersKnockDown[source]) then -- only downed players can use spawnPlayer(source, 2041.3568115234,-1409.2247314453,17.1640625,178) si = 0 takePlayerMoney(source, 1000) takeAllWeapons(source) outputChatBox("...", source, 0, 255, 0) setPlayerKnockDown(source, false) --set false when the player spawns so he can't use it again end end end addCommandHandler("test", revivir) addEventHandler("onPlayerQuit", root, function() isPlayersKnockDown[source] = nil -- clean from memory end )
  12. give the source player to the timer like this function revivir1() revivir = 1 cancelText = nil setPedAnimation(source, ".", ".", -1, false, false, false, true) outputChatBox (".", source, 255, 0, 0) setTimer(function(source) -- Pass source player into timer si = 1 cancelText = cancelText if (cancelText==nil) then outputChatBox(".", source, 255, 0, 0) ------This is the wrong text end end, 600, 1, source) -- Pass source player into timer end addEvent("sistemarev", true) addEventHandler("sistemarev", root, revivir1)
  13. it worked, thanks ? i think, considering the size of the facility, 300 units seem to be enough
  14. here thePlayer argument is invalid use for loop to add all players addEventHandler("onResourceStart", resourceRoot, function() for _,thePlayer in ipairs(getElementsByType("player")) do bindKey(thePlayer, "space", "down", pararAnim) end end ) function prueba(thePlayer) setPedAnimation(thePlayer, "finale", "fin_let_go", -1, false, false, false, false) end addCommandHandler("prueba", prueba) function pararAnim(thePlayer, key, keyState) setPedAnimation(thePlayer) end if you want to add for single player you can put it inside prueba command i don't know how to use it
  15. how do you use it can you show more?
  16. Hello, I am modeling a facility. I have a problem with the model that appears here. The object becomes invisible because it is a little big, how do I solve this problem, thanks size of the object
  17. you can debug it with outputDebugString to find out outputDebugString(Hungers) outputDebugString(Thirsts)
  18. change with result if result and #result > 0 then return end
  19. There is actually no player parameter here, can you edit both places like this? addEvent("unload_vehicles",true) local function unload_vehicles(player, veh) setElementFrozen(veh,true) toggleControl(player,"enter_exit",false) setTimer(function(player,veh) local cars = getAttachedElements(veh) for i,v in pairs(cars) do destroyElement(v) end setElementData(veh,"loaded",false) --exports.global:giveMoney(plr,1500) givePlayerMoney(player, 1500) outputChatBox("قدت السيارات وحصلت على 1.500 دولار , يمكنك الرجوع واخذ مهمه جديده",player,255,255,255,true) setElementFrozen(veh,false) toggleControl(player,"enter_exit",true) end,5000,1, player, veh) end addEventHandler("unload_vehicles",resourceRoot,unload_vehicles) local function unload_vehicles(plr,md) if plr ~= localPlayer or not md then return end if source ~= checkpoint then return end local veh = getPedOccupiedVehicle(plr) triggerServerEvent("unload_vehicles",resourceRoot,veh, plr) destroyElement(checkpoint) destroyElement(blip) checkpoint = nil blip = nil end addEventHandler("onClientMarkerHit",resourceRoot,unload_vehicles)
  20. Try changing 0 to -1 for dbPoll function getpaccount (_,account) local AccName = getAccountName(account) local Setpname = setPlayerName(source,tostring(AccName)) local AccData = dbQuery(AccDatacallback(), db,"SELECT * FROM stats WHERE Account=? LIMIT 1", AccName) function AccDatacallback(AccData) local result = dbPoll( AccData, -1 ) --this end if(AccData) then if(#AccData > 0) then return end end local ID = getFreeID() local SetData = dbExec(db,"INSERT INTO stats (ID,Account) VALUES (?, ?)",ID, AccName) end addEventHandler("onPlayerLogin",root, getpaccount)
  21. addEvent("unload_vehicles",true) local function unload_vehicles(veh) setElementFrozen(veh,true) toggleControl(client,"enter_exit",false) setTimer(function(plr,veh) local cars = getAttachedElements(veh) for i,v in pairs(cars) do destroyElement(v) end setElementData(veh,"loaded",false) --exports.global:giveMoney(plr,1500) givePlayerMoney(plr, 1500) outputChatBox("قدت السيارات وحصلت على 1.500 دولار , يمكنك الرجوع واخذ مهمه جديده",plr,255,255,255,true) setElementFrozen(veh,false) toggleControl(plr,"enter_exit",true) end,5000,1, plr) end addEventHandler("unload_vehicles",resourceRoot,unload_vehicles) can you change this line like this, try with normal functions
  22. I don't know this error maybe you can ask someone else
  23. I did not know that. You're welcome. anytime ?
  24. server: function darcosas(precio) local cuenta = getPlayerAccount(source) if (cuenta) and not isGuestAccount (cuenta) then outputDebugString("You selected "..precio) end end addEvent("Dar", true) addEventHandler("Dar", getRootElement(), darcosas) client: function comprarGUI() local item = guiGridListGetSelectedItem(lista) if (item>=0)then local precio = guiGridListGetItemText(lista, guiGridListGetSelectedItem (lista), 2) local dinero = getPlayerMoney(localPlayer) if(dinero >= tonumber(precio)) then item = item + 1 cerrarGUI() triggerServerEvent("Dar", localPlayer, precio) --<----------- else outputChatBox("Test 1", 255, 0, 0) end else outputChatBox("Test 2", 255, 0, 0) can you try this code, it will output according to the column selected by the player
  25. I'm not sure if you want to send the whole table but you can use events for that example: server: addEvent("sendTableToServer", true) addEventHandler("sendTableToServer", root, function(theTable) --the table we will get for i,_ in ipairs(theTable) do outputDebugString(theTable[i]) --Output: Banana Cucumber Eggplant end end ) client: local clientTable = {"Banana", "Cucumber", "Eggplant"} addCommandHandler("sendtable", function() triggerServerEvent("sendTableToServer", localPlayer, clientTable) -- send the whole table as it is end )
×
×
  • Create New...