Jump to content

cheez3d

Members
  • Posts

    290
  • Joined

  • Last visited

Everything posted by cheez3d

  1. cheez3d

    Synced Ball

    findRotation() getElementVelocity() setElementVelocity()
  2. dbExec (dbConnect(getElementData(resourceRoot,"dayz:resource.settings.database"),"INSERT INTO `players` VALUES (?,?,?,?);",23,"serial","password","3,4") This query works just fine (if i do not supply the columns to insert into) but the problem is that id is an auto increment column and I don't want to insert the values manually. EDIT: Got the problem! But I still have a dilemma. The creation query will create the id column that has the NOT NULL property. When I insert new values into the table I don't specify the id and that is why it's giving me the error. So, I remove NOT NULL from id and now this query works but there is no id value automatically assigned (it remains empy). -- CREATION QUERY dbExec(getElementData(resourceRoot,"dayz:resource.settings.database"),"CREATE TABLE IF NOT EXISTS `players` (`id` INT PRIMARY KEY,`serial` TEXT NOT NULL,`password` TEXT NOT NULL,`data` TEXT NOT NULL);") -- INSERT QUERY dbExec(getElementData(resourceRoot,"dayz:resource.settings.database"),"INSERT INTO `players` (`serial`,`password`,`data`) VALUES (?,?,?);","serial","password","3,4") EDIT 2: Well, after I documented myself a little bit I found out that you must use a query like this: dbExec(getElementData(resourceRoot,"dayz:resource.settings.database"),"CREATE TABLE IF NOT EXISTS `players` (`id` INTEGER PRIMARY KEY AUTOINCREMENT,`serial` TEXT NOT NULL,`password` TEXT NOT NULL,`data` TEXT NOT NULL);") There are some weird differences between MySQL queries and SQLite queries. Problem finally solved!
  3. Yeah. And I also tried using dbConnect inside the dbExec function.
  4. local connection = dbConnect("sqlite","resources/storage/dayz.db") setElementData(resourceRoot,"dayz:resource.settings.database",connection,false) I also execute a SELECT query before that INSERT and it works fine.
  5. I still need help with this. Also tried using dbConnect inside, instead of getElementData and it is the same thing. I also use outputChatBox and it returns an userdata. Here are some screenshots from SQLite Browser. I think the problem is the id column, but I'm not sure. As you can see the table is empty.
  6. I also tried without ; before posting the topic. Still no result.
  7. dbExec(getElementData(resourceRoot,"dayz:resource.settings.database"),"INSERT INTO `players` (`serial`,`password`,`data`) VALUES (?,?,?);","serial","password","3,4") This is a test query that should insert some data into the database but it is not working. I have already tested and the connection element exists, so there should be a problem inside the query that I cannot figure out. Can anyone help please? I've already searched on Google and didn't find anything. ERROR: dbExec failed (1); SQL logic error or missing database
  8. getPlayerSkin() - This function is deprecated. This means that its use is discouraged and that it might not exist in future versions, but there should be an alternative (usually more generic) way of performing what it once did. Also dxDrawImage() renders the image only for one frame so you must use it with onClientRender. local screenX, screenY = guiGetScreenSize() local skinID = getElementModel(localPlayer) addEventHandler("onClientRender",root,function() dxDrawImage(screenX*0.8505 , screenY*0.0915, 104, 104, "img/" .. skinID .. ".png") end)
  9. You should have used the search button. viewtopic.php?f=91&t=72910
  10. local gate = createObject(10828, -1570.5, 1117.5, 16.10000038147, 0, 0, 91.988525390625) addCommandHandler("gate",function(player) if getPlayerAccount(player) and isObjectInACLGroup(string.format("user.%s",getAccountName(getPlayerAccount(player))),aclGetGroup("Admin")) then setElementData(gate,"opened",not getElementData(gate,"opened")) if getElementData(gate,"opened") then moveObject(gate,3000,-1570.5,1117.5,30.2,0,0,0) else moveObject(gate,3000,-1570.5,1117.5,16.10000038147,0,0,0) end end end)
  11. Client: addEventHandler("onClientPlayerWeaponFire",localPlayer,function() triggerServerEvent("playerFire",source) end) Server: local timers = {} addEventHandler("onResourceStart",resourceRoot,function() for _,player in ipairs (getElementsByType("player")) do timers[player] = setTimer(setPlayerWantedLevel,300000,0,player,getPlayerWantedLevel(player)-1) end end) addEventHandler("onPlayerJoin",root,function() timers[source] = setTimer(setPlayerWantedLevel,300000,0,source,getPlayerWantedLevel(source)-1) end) addEvent("playerFire",true) addEventHandler("playerFire",root,function() if isTimer(timer[client]) then resetTimer(timer[client]) end end) Not tested.
  12. Client: addEventHandler("onClientResourceStart",resourceRoot,function() triggerServerEvent("onPlayerFilesDownloaded",localPlayer) end) Server: addEventHandler("onPlayerJoin",root,function() fadeCamera(source,false,0) end) addEvent("onPlayerFilesDownloaded",true) addEventHandler("onPlayerFilesDownloaded",root,function() spawnPlayer(client,2125.7995605469,-1545.5288085938,302.15188598633) fadeCamera(client,true) setCameraTarget(client,client) -- use client instead of source for security end)
  13. getCursorPosition() returns besides the 2D coordinates from the screen, 3D world coordinates of the position you are pointing at.
  14. cheez3d

    Info!

    outputChatBox() The function that you need.
  15. cheez3d

    gangs....

    You should learn SQL before you jump into databases. If you consider it too hard then just stick to account data.
  16. cheez3d

    gangs....

    Your code doesn't make any sense at all. Please don't post here if you don't know what you're talking about. You misguide the player that is asking for help.
  17. setTimer returns a timer pointer, not an element. killTimer()
  18. cheez3d

    [Bribe]

    -- SERVER SIDE addEventHandler("onPickupHit",createPickup(--[[insert the x coordinate of the pickup here]],--[[insert the y coordinate of the pickup here]],--[[insert the z coordinate of the pickup here]],3,1247),function(player) triggerClientEvent(player,"onPlayerRequestBribeGUI",player,getPlayerWantedLevel(player)) end) -- CLIENT SIDE local Bribe_GUI = {} Bribe_GUI.Window = guiCreateWindow(310,165,112,153,"Bribe",false) guiWindowSetSizable(Bribe_GUI.Window,false) Bribe_GUI[1] = guiCreateRadioButton(9, 31, 93, 15, "1 star", false, Bribe_GUI.Window) Bribe_GUI[2] = guiCreateRadioButton(10, 46, 92, 15, "2 star", false, Bribe_GUI.Window) Bribe_GUI[3] = guiCreateRadioButton(10, 61, 92, 15, "3 star", false, Bribe_GUI.Window) Bribe_GUI[4] = guiCreateRadioButton(9, 76, 93, 15, "4 star", false, Bribe_GUI.Window) Bribe_GUI[5] = guiCreateRadioButton(10, 91, 92, 15, "5 star", false, Bribe_GUI.Window) Bribe_GUI[6] = guiCreateRadioButton(10, 106, 92, 15, "6 star", false, Bribe_GUI.Window) guiSetVisible(Bribe_GUI.Window,false) addEvent("onPlayerRequestBribeGUI",true) addEventHandler("onPlayerRequestBribeGUI",root,function(wanted_level) guiSetVisible(Bribe_GUI.Window,true) guiRadioButtonSetSelected(Bribe_GUI[wanted_level],true) end)
  19. cheez3d

    Tiny help *-*

    addEventHandler("onPlayerChat",root,function(message,_type) if _type == 0 then cancelEvent() local color = getPlayerTeam(source) and {getTeamColor(getPlayerTeam(source))} or {255,255,255} color = string.format("#%X%X%X",color[1],color[2],color[3]) outputChatBox("#FF0000* #999999[Owner] "..color..getPlayerName(source)..":#FFFFFF "..message,root,255,255,255,true) outputServerLog("CHAT - "..getPlayerName(source).." - "..message) end end)
  20. cheez3d

    Random Maps

    local maps = {} for k,resource in ipairs (getResources()) do if getResourceInfo(resource,"type") == "map" then table.insert(maps,k,resource) end end startResource(maps[math.random(1,#maps)])
  21. The account data is stored in the internal.db file located in your server folder. I don't see any disadvantages at all if you know how to use it.
  22. local pickup = createPickup(2487.1398925781,-1667.7604980469,13.34375,3,1273,0) addEventHandler("onPickupHit",pickup,function(player) outputChatBox("Propriedades: Digite /comprar",player) end) addCommandHandler("comprar",function(player) if isElementWithinColShape(player,getElementColShape(pickup)) then takePlayerMoney(player,50) end end)
  23. local colshape = getElementColShape(createPickup(2487.1398925781,-1667.7604980469,13.34375,3,1273,0)) addEventHandler("onColShapeHit",colshape,function(element,dimension) if getElementType(element) == "player" and dimension then -- the code to be executed when he enters the pickup end end) addEventHandler("onColShapeLeave",colshape,function(element,dimension) if getElementType(element) == "player" and dimension then -- the code to be executed when he leaves the pickup end end)
  24. Remove the "spawnmanager" and "play" form mtaserver.conf and restart your server. Also make sure to start your resource before you join. These 2 lines: <resource src="spawnmanager" startup="1" protected="0" /> <resource src="play" startup="1" protected="0" />
×
×
  • Create New...