Jump to content

SDK

Members
  • Posts

    635
  • Joined

  • Last visited

Everything posted by SDK

  1. What does this output: addEventHandler("onClientResourceStart",resourceRoot, function() skin1 = engineLoadTXD ( "106.txd" ) import1 = engineImportTXD ( skin1, 106 ) skin2 = engineLoadTXD ( "107.txd" ) import2 = engineImportTXD ( skin2, 107 ) outputChatBox( 1 .. " " tostring(skin1) .. " " .. tostring(import1) ) outputChatBox( 2 .. " " tostring(skin2) .. " " .. tostring(import2) ) end) <meta> <script src="client.lua" type="client" /> <file src="106.txd" type="client" /> <file src="107.txd" type="client" /> </meta>
  2. Your for loop stopped after it found a user node, but it should stop if it finds the correct user node instead. How 'bout this: function client_login ( usrNm, pass, rememberUsr, rememberPass ) if getAccount ( usrNm ) == false then outputChatBox ( "*An account with this username was not found", client, 255, 0, 0 ) elseif getAccount ( usrNm, pass ) == false then outputChatBox ( "*You specified an incorrect password for this account", client, 255, 0, 0 ) elseif logIn ( client, getAccount ( usrNm, pass ), pass ) == true then isGangMember = getAccountData ( getAccount ( usrNm, pass ), "gangMember" ) hasProperty = getAccountData ( getPlayerAccount ( client ), "hasProperty" ) isAdmin = getAccountData ( getPlayerAccount ( client ), "isAdmin" ) if isGangMember == "true" then setPlayerTeam ( client, getTeamFromName ( getAccountData ( getPlayerAccount ( client ), "gangName" ) ) ) elseif isGangMember == "false" or isGangMember == nil then if hasObjectPermissionTo ( client, "function.banPlayer" ) == true then setPlayerTeam ( client, getTeamFromName ( "Admins" ) ) else setPlayerTeam ( client, getTeamFromName ( "Registered Users" ) ) end end triggerClientEvent ( client, "playerLoggedIn", client, isGangMember, hasProperty, isAdmin ) -------- playerSerial = getPlayerSerial ( client ) playerIP = getPlayerIP ( client ) actName = getAccountName ( getPlayerAccount ( client ) ) actDatabase = xmlLoadFile ( "data/server/account database.xml" ) accountNodes = xmlNodeGetChildren ( actDatabase ) if table.getn ( accountNodes ) == 0 then firstActNode = xmlCreateChild ( actDatabase, "user" ) xmlNodeSetAttribute ( firstActNode, "actName", ""..actName.."" ) xmlNodeSetAttribute ( firstActNode, "actPass", ""..pass.."" ) xmlNodeSetAttribute ( firstActNode, "curActSerial", ""..playerSerial.."" ) xmlNodeSetAttribute ( firstActNode, "curActIP", ""..playerIP.."" ) xmlNodeSetAttribute ( firstActNode, "rememberUsername", tostring(rememberUsr) ) xmlNodeSetAttribute ( firstActNode, "rememberPassword", tostring(rememberPass) ) outputChatBox ( "No accounts found in database, adding first entry" ) end outputChatBox ( table.getn ( accountNodes ) ) for i, actNode in pairs ( accountNodes ) do if xmlNodeGetName ( actNode ) == "user" and actName == xmlNodeGetAttribute ( actNode, "actName" ) then --only update the node instead of adding one xmlNodeSetAttribute ( actNode, "actName", ""..actName.."" ) xmlNodeSetAttribute ( actNode, "actPass", ""..pass.."" ) xmlNodeSetAttribute ( actNode, "curActSerial", ""..playerSerial.."" ) xmlNodeSetAttribute ( actNode, "curActIP", ""..playerIP.."" ) xmlNodeSetAttribute ( actNode, "rememberUsername", tostring(rememberUsr) ) xmlNodeSetAttribute ( actNode, "rememberPassword", tostring(rememberPass) ) outputChatBox ( "Your account was found in the database and is being updated" ) xmlSaveFile ( actDatabase ) return end end --add a whole new node for this account newAccountNode = xmlCreateChild ( actDatabase, "user" ) xmlNodeSetAttribute ( newAccountNode, "actName", ""..actName.."" ) xmlNodeSetAttribute ( newAccountNode, "actPass", ""..pass.."" ) xmlNodeSetAttribute ( newAccountNode, "curActSerial", ""..playerSerial.."" ) xmlNodeSetAttribute ( newAccountNode, "curActIP", ""..playerIP.."" ) xmlNodeSetAttribute ( newAccountNode, "rememberUsername", tostring(rememberUsr) ) xmlNodeSetAttribute ( newAccountNode, "rememberPassword", tostring(rememberPass) ) outputChatBox ( "There are accounts in the database but yours was not found. Adding it now" ) xmlSaveFile ( actDatabase ) end end
  3. Rename the resource to 'hedit', it doesn't like it when you change the name.
  4. Remove the dot from the folder name. "GareNLRPv1.2" => "GareNLRPv1_2" Always keep map names simple, usually people won't see them anyway on the servers.
  5. SDK

    Question

    Nope There might be a workaround by replacing another vehicle, but that's hacky.
  6. SDK

    Editor

    There's no other way, put the marker target to a location so it gets rotated.
  7. SDK

    Editor

    setMarkerTarget
  8. Remove the spaces and the dots from the .zips or folders '[DM]OldSchoolSkillZ' '[dm]alba_feat_key-you_not_sorry' '[DD]Vicarne'
  9. Ok, tested and figured it out. The biggest problem was that you were making a proxy of the resourceGui table, while you needed the resourceGui.window table. You also need the __index in the metatable because when you set the window text, you're retrieving "t.element". resourceGui = {} local meta = { __newindex = function (t,k,v) if k == "text" then guiSetText ( t.element, v ) end _t[k] = v end, __index = function (t,k) return _t[k] end } resourceGui.window = guiCreateWindow ( 0.25,0.25,0.5,0.5,"OldTitle", true ) _t = resourceGui.window resourceGui.window = {} setmetatable(resourceGui.window, meta) resourceGui.window.text = "NewTitle"
  10. i'm not very experienced on this topic. But I noticed that you create a table, set it's proxy and metatable and then add a another table to the table. I'm guessing you need to set the metatable on that new table. resourceGui.window = guiCreateWindow ( blah ) setmetatable(resourceGui.window, meta) resourceGui.window.text = "NewTitle"
  11. You and the rest of the community ^^ What you're asking here is pretty hard
  12. SDK

    If admin join

    so, where's your code
  13. 1337 scripting technique Is it working now?
  14. onClientPlayerSpawn is clientside function playSonido() local sound = playSound("m.wav",false) setSoundVolume(sound, 1.9) end addEventHandler ( "onClientPlayerSpawn", getRootElement(), playSonido)
  15. SDK

    question

    If you mean, draw every player on a new line, use this method: addEventHandler("onClientRender", root, function() local x, y = 385,190 local dy = 15 for i, player in ipairs(getElementsByType('player') do dxDrawText(getPlayerName(player), x, y + dy * (i - 1)) end end)
  16. Eh, is this the complete file? If not, post more (relevant) code
  17. Ah, if you're new I'd recommend not doing it that way (but it is correct tho!) function LSA_Command123(thePlayer) -- first create the function 'LSA_Command123' (you can rename it) if (isPedInVehicle(thePlayer)) then local theVehicle = getPedOccupiedVehicle(thePlayer) setElementPosition(theVehicle,1907.1351318359,-2491.1325683594,13.217620849609) else setElementPosition(thePlayer,1907.1351318359,-2491.1325683594,13.217620849609) end end -- then attach a command to the function addCommandHandler("LSA", LSA_Command123,false,false)
  18. Read the wiki, you can make it ignore the case of the command. addCommandHandler("LSA",function(thePlayer) ... end, false, false) First false is for restricted access, just ignore that and put the default value (false) Second false is for case-insensitive Edit: Ah, no offense intended JR10 ^^. I was replying to the TS that he should read the addCommandHandler wikipage for more info.
  19. You would've known it much faster if you tested it yourself ... But yes, it should work.
  20. viewtopic.php?p=355929#p355929 Search, search, search
  21. Yes, race_ghost by awwu https://community.multitheftauto.com/index.php?p= ... ils&id=665 You'll have to modify it so it works for DM's
  22. SDK

    help whit gui

    addEventHandler("onClientResourceStart",root,ablak) Don't use "root", it willl happen when any resource/map starts, not just yours addEventHandler("onClientResourceStart",resourceRoot,ablak)
  23. SDK

    dxImages

    Use for the moment, [lua] is fucked up as you can see in your post. [code=text]local pointx, pointy, worldx, worldy, worldz = getCursorPosition() * guiGetScreenSize() Ehm, that won't work... local pointx, pointy = getCursorPosition() local screenx, screeny = guiGetScreenSize() local pointx = screenx * pointx local pointy = screeny * pointy
  24. SDK

    dxImages

    point x,y is the cursor position on the screen (using getCursorPosition * guiGetScreenSize ) boundx,y is the image position boundw,h is image width and height
  25. He was obviously being sarcastic ...
×
×
  • Create New...