Jump to content

SDK

Members
  • Posts

    635
  • Joined

  • Last visited

Everything posted by SDK

  1. And when does the error happen? I think it will happen when a player without stats is logged in before the script starts. Try this on line 54) local oldData = getAccountData(account,dataName) or 0
  2. This is getting dangerously close to "How do you get in to MTA and im using the server not the client"
  3. you mean "refresh", upgrade is for scripts
  4. SDK

    Saving Teams?

    Arrr, change player to source
  5. So if you remove the vehicle="522" race still changes your vehicle when playing, or do you mean that the map editor still changes it? Cause it can be either the race gamemode that's bugged or the map editor. Anyway, try updating them both: http://code.google.com/p/mtasa-resource ... p&can=2&q=
  6. No, you can't download the maps from a server. You'll have to ask the server owner to send you a copy.
  7. SDK

    Question :S

    Sounds sortof like a speedometer ? Create all the images, put them in a table. Use a timer or onClientRender to calculate how many you want to show, hide the rest. local images={} for i = 1, 20 do images[i] = guiCreateStaticImage(0 + width * i, 0, width, heigth, "lol.png", false) guiSetVisible(images[i], false) end function update() --here you do your calculations of how much images you want to be shown, store it into "amount" local amount = ... for i = 1, amount do guiSetVisible(images[i], true]) end for i = amount + 1, #images do guiSetVisible(images[i], false]) end end setTimer(update, 500, 0)
  8. SDK

    Saving Teams?

    You're getting the team from root (which is not a player) and only once when the resource starts .. Use it at resourcestart for every player and when a player spawns (revert your other changes) function onResourceStart ( resource ) for id, player in ipairs( getElementsByType ( "player" ) ) do if ( players[player] ) then createBlipAttachedTo ( player, 0, 2, players[source][1], players[source][2], players[source][3] ) elseif getPlayerTeam(player) then local r, g, b = getTeamColor(getPlayerTeam(player)) createBlipAttachedTo ( player, 0, 2, r, g, b ) else createBlipAttachedTo ( player, 0, 2, color[1], color[2], color[3] ) end end end function onPlayerSpawn ( spawnpoint ) if ( players[source] ) then createBlipAttachedTo ( source, 0, 2, players[source][1], players[source][2], players[source][3] ) elseif getPlayerTeam(player) then local r, g, b = getTeamColor(getPlayerTeam(player)) createBlipAttachedTo ( player, 0, 2, r, g, b ) else createBlipAttachedTo ( source, 0, 2, color[1], color[2], color[3] ) end end
  9. SDK

    Help!

    Don't pm me, you can just ask here. My logic failed on line 19: s = (getTickCount() - s) / 1000
  10. Make two teams, and put the players in the teams?
  11. SDK

    Help!

    Why are you making it that hard, you can calculate it much easier (not tested) function onResourceStart() call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Online Time") end addEventHandler("onResourceStart",resourceRoot,onResourceStart) function joinTime() setElementData (source, "joinTime", getTickCount() ) setElementData (source, "Online Time", "0 hours, 0 minutes, 0 seconds" ) end addEventHandler ( "onPlayerJoin", root, joinTime ) function all() for index , player in ipairs ( getElementsByType ( "player" ) ) do local s = getElementData(player,"joinTime") or getTickCount() s = (s - getTickCount()) / 1000 local string = string.format("%02d hours, %02 minutes, %02d seconds", s/3600, (s%3600)/60, s%60) setElementData(player,"Online Time",string) end end setTimer(all,1000,0)
  12. There are already a lot of topics about this, search for them.
  13. I didn't understand him correctly, I thought he meant until all resources are downloaded/started. onClientResourceStart is the way then ofc, use it instead of onPlayerJoin.
  14. SDK

    Help any one !

    Last line is missing a ")"
  15. SDK

    Help any one !

    Are you sure you copy-pasted it correctly? Cause it should be correct, check the last line in the file. (And why math.random(2,200) in setPedWeaponSlot?)
  16. I don't think that will work correctly Buffalo, if one (small) resource is ready with downloading, it will send the onPlayerFinishedDownloading event before the other resources are downloaded. This function returns if the downloading box is active, so you can use it to detect if the player is still downloading. isTransferBoxActive
  17. What's the problem with it being inside the resource? If it's relevant to it, no prob imo. If you want you can use the server log too with outputServerLog(). Also, take a look at this: http://www.yourmuze.fm, it converts radio streams for free I believe.
  18. SDK

    colorcodes

    http://cloford.com/resources/colours/500col.htm
  19. Very nice! I also looked through the file and found some errors you might want to correct: setElementVelocity --has the wrong parameters gtServerConfigSetting => getServerConfigSetting utfChar, utfCode, utfLen, utfSeek, utfSub, getPerformanceStats --Utility functions that aren't added (they're also undocumented on the wiki)
  20. Original topic -> viewtopic.php?f=91&t=24487
  21. getResourceFromName("mapratings") This assumes the resource where it's getting the ratings from is called "mapratings", check that. Also, use debugscript 3 to detect errors
  22. fileCreate, fileOpen, fileWrite, fileClose
  23. Not gonna happen, there are already two good GUI creators. I'm pretty happy with this, mta creating and fixing scripting functionalities and other people using them to make it easier for others. Map editor is an exception imo, it was added so people could create maps for servers without any scripting knowledge.
  24. Add quotation marks? local success, error = exports.sql:query_free( "UPDATE vehicles SET upgrades = '" .. upgrades1 .. "', paintjob = " .. paintjob1 .. " WHERE vehicleID = " .. data.vehicleID )
  25. 1°) I'm not sure how the data is received, but it might be because data.upgrades is a number when only one upgrade is stored. To make sure it's a string, use tostring(): local upgrades = split( tostring(data.upgrades), 44 ) 2°) Not that hard, you can use table.concat to convert a table into a string. local upgradesTable = getVehicleUpgrades(theVehicle) -- table will look like this: -- upgrades = { [1] = 1074, -- [2] = 1139, -- [3] = 1110, -- ...} local upgradesString = table.concat(upgradesTable, ",") -- upgradesString = "1074,1139,1140,..."
×
×
  • Create New...