Jump to content

WASSIm.

Members
  • Posts

    1,412
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by WASSIm.

  1. if this idea hard. what about this ? make menu like that
  2. WASSIm.

    question ?

    its working for all GUI
  3. i can't make ( if (type(result) == "table" and #result == 0 or not result) then ) only in script have database ?
  4. problem its in dbQueryZA local connection = nil addEventHandler ( "onResourceStart", resourceRoot, function ( ) exports["scoreboard"]:addScoreboardColumn( "Zombie kills", root, 80, "Z kills", 6) exports["server"]:dbExecZA("CREATE TABLE IF NOT EXISTS zkills (ID INTEGER PRIMARY KEY NOT NULL, account TEXT, Zkill INT)" ) end ) addEventHandler("onResourceStart", resourceRoot, function () for index, player in ipairs(getElementsByType("player")) do local account = getPlayerAccount(player) if (not account or isGuestAccount(account)) then return false end local accountName = getAccountName(account) local zkill = getAccountZkill ( accountName ) if (account) then if not ( zkill ) then addZkillToDatabase ( accountName ) setElementData(player, "Zombie kills", 0) else setElementData(player, "Zombie kills", tonumber(zkill)) end end end end ) addEventHandler("onResourceStop", resourceRoot, function () for index, player in ipairs(getElementsByType("player")) do local zkill = tonumber(getElementData(player,"Zombie kills")) or 0 local account = getPlayerAccount(player) if (not account or isGuestAccount(account)) then return false end local accountName = getAccountName(account) if (zkill) and (account) then setAccountZkill(accountName, tonumber(zkill)) removeElementData(player, "Zombie kills") end end end) addEventHandler("onPlayerLogout", getRootElement(), function (_,account) local zkill = tonumber(getElementData(source,"Zombie kills")) or 0 local accountName = getAccountName(account) setAccountZkill(accountName, zkill) removeElementData(source, "Zombie kills") end ) addEventHandler("onPlayerQuit", getRootElement(), function ( ) local zkill = tonumber(getElementData(source,"Zombie kills")) or 0 local account = getPlayerAccount(source) if (not account or isGuestAccount(account)) then return false end local accountName = getAccountName(account) if (zkill) and (account) then setAccountZkill(accountName, zkill) end end ) addEventHandler("onPlayerLogin", getRootElement(), function (_,account) local accountName = getAccountName(account) local zkill = getAccountZkill ( accountName ) if not ( zkill ) then addZkillToDatabase ( accountName ) setElementData(source, "Zombie kills", 0) else setElementData(source, "Zombie kills", zkill) end end ) function addZkillToDatabase ( account ) return exports["server"]:dbExecZA("INSERT INTO zkills (ID, account, Zkill) VALUES (NULL, '".. tostring ( account ) .."', '0')" ) end function getAccountZkill ( account ) local result = exports["server"]:dbQueryZA( "SELECT * FROM zkills WHERE account = ?", tostring ( account ) ) return tostring ( result[ 1 ][ "Zkill" ] ) end function setAccountZkill ( account, theZkille ) return exports["server"]:dbExecZA("UPDATE zkills SET Zkill = '".. tostring ( theZkille ) .."' WHERE account = '" .. tostring ( account ) .."'" ) end
  5. that have getAccountZkill ?
  6. now result dbQuery nil
  7. hi guys plis i need help. i have problem it not working plis help EDIT DEBUG: http://i.imgur.com/JFafHLR.png local connection = nil addEventHandler ( "onResourceStart", resourceRoot, function ( ) connection = dbConnect( "sqlite", "database/database.db" ) if ( connection )then outputDebugString ( "Successfully connected to database.db" ) else outputDebugString ( "Failed to connect to database.db", 3 ) end end ) function dbQueryZA( ... ) local handler = connection if ( not handler ) then return false, "Couldn't connect to SQLite database." end local query = dbQuery( connection, ... ) local result, numrows, errmsg = dbPoll ( query, -1 ) if ( type ( result ) == "table" and #result == 0 or not result ) then return false else return result end end function dbExecZA( ... ) local handler = connection if ( not handler ) then return false, "Couldn't connect to SQLite database." end return dbExec( connection, ... ) end this exmple i use function getAccountZkill ( account ) local result = exports["server"]:dbQueryZA( "SELECT * FROM zkills WHERE account = ?", tostring ( account ) ) return tostring ( result[ 1 ][ "Zkill" ] ) end
  8. WASSIm.

    Moveobject

    in line 14 change to this moveObject(policeDoor[1], 3000, 246.36, 72.62, 1002.64, 0, 0, 0)
  9. WASSIm.

    Moveobject

    local policeDoor = { } function createDoors() policeDoor[1] = createObject ( 1535, 246.36, 72.62, 1002.64, 0, 0, 0 ) policeDoor[2] = createObject ( 1535, 244.84, 72.61, 1002.64, 0, 0, 0 ) for i=1,#policeDoor do setElementInterior(policeDoor[i], 6) setElementDimension(policeDoor[i], 9) end end addEventHandler("onResourceStart", resourceRoot, createDoors) function backDoors() moveObject(policeDoor[1], 3000, 1535, 246.36, 72.62, 1002.64, 0, 0, 0) moveObject(policeDoor[2], 3000, 242.84, 72.61, 1002.64, 0, 0, 0) end function openDoors(thePlayer, command) if ( exports.factions:isPlayerInFaction(thePlayer, 1) ) then outputChatBox("PD doors open.", thePlayer) moveObject(policeDoor[1], 3000, 248.36, 72.62, 1002.64, 0, 0, 0) moveObject(policeDoor[2], 3000, 244.84, 72.61, 1002.64, 0, 0, 0) setTimer(backDoors, 5000, 1) end end addCommandHandler("pddd", openDoors)
  10. WASSIm.

    Head Rotation

    addEventHandler("onClientRender", getRootElement(), function() for k,player in ipairs(getElementsByType("player")) do if getElementHealth(player) >= 1 then local width, height = guiGetScreenSize () local lx, ly, lz = getWorldFromScreenPosition ( width/2, height/2, 10 ) setPedLookAt(player, lx, ly, lz) end end end)
  11. thank you. but if why its replace old text not add
  12. i already use it addEvent("onLoadLoginList",true) addEventHandler("onLoadLoginList", root, function (Table) guiGridListClear(GUIEditor.gridlist[1])---HERE for _, v in ipairs(Table) do local row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, column, ""..v.."", false, false ) end end )
  13. thanks but why he mae more row !
  14. how make one like what i mean
  15. if use include will all resource in include restart.
  16. le map extension est .map mat9drch trodo .lua .lua est pour la programmation seul. walakin t9dr trd l map xml file kathrat servers il maps irodhom lua
  17. hi guys i have fail problem in GridList. plis help IMAGE http://i.imgur.com/seXLDdB.png FILE [(2013/11/8) | (12:52)]: CMD-WASSIm.[NOOSE] spawned haut parleur SERVER function getLog(logname) if ( logname ) then local post = ""..logname..".log" local file = fileOpen(post) local textlog = {} for i=1, fileGetSize(file) do local text = fileRead(file, i) table.insert(textlog, text) end fileClose(file) return textlog end end function loadLog(logname) local logs = getLog(""..logname.."") triggerClientEvent("onLoadLoginList", root, logs) end addEvent( "onloadLog", true ) addEventHandler( "onloadLog", getRootElement(), loadLog) CLIENT addEvent("onLoadLoginList",true) addEventHandler("onLoadLoginList", root, function (Table) guiGridListClear(GUIEditor.gridlist[1]) for _, v in ipairs(Table) do local row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, column, ""..v.."", false, false ) end end )
  18. slm lolad. habit nsel kif map nrodo lua ?
  19. root = getRootElement() function SwitchEngine( source ) local theVehicle = getPedOccupiedVehicle ( source ) if theVehicle and getVehicleController ( theVehicle ) == source then local state = getVehicleEngineState ( theVehicle ) setVehicleEngineState ( theVehicle, not state ) end end function BindKeys ( source ) if ( eventName == "onVehicleStartEnter" ) then bindKey ( source,"x","down",SwitchEngine ) else unbindKey ( source,"x","down",SwitchEngine ) end end addEventHandler ( "onPlayerVehicleEnter", root, BindKeys ) addEventHandler ( "onPlayerVehicleExit", root, BindKeys )
  20. -____- plis reread what is say
×
×
  • Create New...