Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. try: addEventHandler ( "onPlayerWasted", root, function( totalAmmo, killer, killerWeapon, bodypart, stealth ) local account = getPlayerAccount ( killer ) if account and isElement( killer ) then setAccountData( account,"totalkillsdeaths.kills",getAccountData( account,"totalkillsdeaths.kills" )+1 ) setAccountData( account,"totalkillsdeaths.Deaths",getAccountData(account,"totalkillsdeaths.Deaths")+1) setElementData( killer, "T/K", tonumber( getAccountData( account,"totalkillsdeaths.kills" ) or 0 ) ) setElementData( killer, "T/D", tonumber( getAccountData( account,"totalkillsdeaths.Deaths" ) or 0 ) ) end end ) addEventHandler( "onPlayerLogin",root, function( thePreviousAccount, theCurrentAccount, autoLogin ) if not getAccountData( theCurrentAccount,"totalkillsdeaths.kills" ) and not getAccountData( theCurrentAccount,"totalkillsdeaths.deaths" ) then setAccountData( theCurrentAccount,"totalkillsdeaths.kills",0) setAccountData( theCurrentAccount,"totalkillsdeaths.deaths",0) end end ) addEventHandler( "onResourceStart",resourceRoot, function( ) outputDebugString( "add Total Kills to scoreboard Return: "..tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "T/K",root,2, 0.035 ) ) ) outputDebugString( "add Total Deaths to scoreboard Return: "..tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "T/D",root,3, 0.035 ) ) ) end ) EDIT:code updated EDIT2:if not getAccountData return false not nil
  2. Yes is exported. If he not modified resource.
  3. Maybe problem in meta.xml show please.
  4. Named Scoreboard? Remember case sensitive. function addScoreboardItems( ) outputDebugString( "add Total Kills to scoreboard Return: "..tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "Total Kills",root,1, 0.5 ) ) ) outputDebugString( "add Total Deaths to scoreboard Return: "..tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "Total Deaths",root,1, 0.5 ) ) ) end addEventHandler( "onResourceStart",resourceRoot,addScoreboardItems ) Read my upper post i update.
  5. function addScoreboardItems( ) outputDebugString( "add Total Kills to scoreboard Return: "..tostring( call( getResourceFromName("scoreboard"), "addScoreboardColumn", "Total Kills",root,1, 0.5 ) ) ) outputDebugString( "add Total Deaths to scoreboard Return: "..tostring( call( getResourceFromName("scoreboard"), "addScoreboardColumn", "Total Deaths",root,1, 0.5 ) ) ) end addEventHandler( "onResourceStart",resourceRoot,addScoreboardItems ) EDIT:I update upper post please read. EDIT2:In future if you need debug for example client side script read clientscript.log in folder:MTA_FOLDER\MTA\clientscript.log this is rly useful.
  6. /debugscript 3 not say errors? maybe resource scoreboard not running Check return value call function And you don't need use getRootElement() in event "onResourceStart" you need use resourceRoot Otherwise every start resource add columns to scoreboard
  7. Kenix

    Money

    function playerMoney( thePlayer ) givePlayerMoney ( thePlayer, 12000 ) end addCommandHandler("givemoney", playerMoney) <meta> <script src="money.lua" type="server"/> </meta>
  8. Kenix

    Money

    Show meta.xml
  9. Kenix

    Money

    function playerMoney( thePlayer ) givePlayerMoney ( thePlayer, 12000 ) end addCommandHandler("givemoney", playerMoney)
  10. function hideold( ) showPlayerHudComponent( "armour",false ) showPlayerHudComponent( "health",false ) showPlayerHudComponent( "clock",false ) showPlayerHudComponent( "money",false ) showPlayerHudComponent( "weapon",false ) showPlayerHudComponent( "ammo",false ) showPlayerHudComponent( "wanted",false ) end setTimer( hideold,1000,1 ) this better p.s Why every 5 sec hide hud?????????????????????
  11. Проверь возвращаемое значение ну и в /debugscript 3 смотри.
  12. mysql module in more functional all the same
  13. I use mysql module mysql_query
  14. No problem JR10,Only in function dbQuery ?
  15. lol???? addEventHandler( "onResourceStart", resourceRoot, function( ) local key = dbConnect( "sqlite", "Storedinfo.db" ) dbFree ( dbQuery ( key, "CREATE TABLE IF NOT EXISTS teleports ( teleportID INT, aX FLOAT, aY FLOAT,\ aZ FLOAT, aInterior INT, aDimension INT, bX FLOAT, bY FLOAT, bZ FLOAT,bInterior INT, bDimension INT )" ) ) local returnedData = dbPoll ( dbQuery ( key , "SELECT * FROM table" ), -1 ) local result = dbPoll ( dbQuery( key, "SELECT * FROM teleports" ),-1 ) end )
  16. omg this is not correct you create table with not type fields Try addEventHandler( "onResourceStart", resourceRoot, function( ) local key = dbConnect( "sqlite", "Storedinfo.db" ) dbFree ( dbQuery ( key, "CREATE TABLE IF NOT EXISTS teleports ( teleportID INT, aX FLOAT, aY FLOAT,\ aZ FLOAT, aInterior INT, aDimension INT, bX FLOAT, bY FLOAT, bZ FLOAT,bInterior INT, bDimension INT )" ) ) local result = dbPoll(dbQuery(key, "SELECT * FROM teleports" ),-1) -- You forgot about dbPoll. --[[for key, value in ipairs( result ) do dbQuery( value,"(teleportID, value.aX, value.aY, value.aZ, value.aInterior, value.aDimension, value.bX, value.bY, value.bZ, value.bInterior, value.bDimension)" ) -- What is this ? end]] end )
  17. Try: addEventHandler ( "onResourceStart" , resourceRoot , function ( ) database = dbConnect ( "sqlite" , "database.db" ) dbExec ( database , "CREATE TABLE IF NOT EXISTS RaceStats ( RaceWins INT,RaceLoses INT,serial TEXT )" ) end ) function DestructionMoney2() local alivePlayers = getAlivePlayers() if info == "Destruction derby" then if #alivePlayers == 1 then local playername = getPlayerName(alivePlayers[1]) local serial = getPlayerSerial(alivePlayers[1]) local raceWins local oldData = dbPoll ( dbQuery ( database , "SELECT * FROM RaceStats WHERE serial = ?" , getPlayerSerial ( alivePlayers [ 1 ] ) ) , -1 ) if #oldData == 0 then dbExec ( database , "INSERT INTO RaceStats VALUES (?,?,?)" , "1" , "0" , getPlayerSerial ( alivePlayers [ 1 ] ) ) raceWins = "1" else raceWins = tostring ( tonumber ( oldData [ 1 ] [ "RaceWins" ] ) + 1 ) dbExec ( database , "UPDATE RaceStats SET RaceWins = ? WHERE serial = ?" , raceWins , getPlayerSerial ( alivePlayers [ 1 ] ) ) end setElementData(alivePlayers[1], "RaceWins", raceWins ) outputChatBox(getPlayerName(alivePlayers[1] ) .. " is the last player alive!", root, 0, 255, 0) end end end addEventHandler("onPlayerWasted", getRootElement(), function() local serial = getPlayerSerial(source) local oldData = dbPoll ( dbQuery ( database , "SELECT * FROM RaceStats WHERE serial = ?" , serial ) , -1 ) local raceLoses if #oldData == 0 then dbExec ( database , "INSERT INTO RaceStats VALUES (?,?,?)" , "0" , "1" , serial ) raceLoses = "1" else raceLoses = tostring(tonumber(oldData[1]["RaceWins"]) + 1) dbExec ( database , "UPDATE RaceStats SET RaceLoses = ? WHERE serial = ?" , raceLoses , serial ) end setElementData(source, "RaceLoses", raceLoses) end)
  18. No problem You not attack event "onClientGUIClick" for button
  19. Kenix

    Map Ratings

    Try: addEventHandler('onGamemodeMapStart', root, function( theMapStarts) local mapName = getMapName( ) if mapName then theMapRate = call( getResourceFromName("mapratings"), "getMapRating", mapName ) outputChatBox ( "#CC0000*This map has a rate of ".. theMapRate .."!", 255,255,255, true ) else outputChatBox( "can't get map name" ) end end )
  20. Через шейдеры можно вроде.
×
×
  • Create New...