Jump to content

mtamaster97

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by mtamaster97

  1. I fixed it already, sry, but now I have another problem I'm making cmd for changing names of T1 T2 on cw script that are display with function dxDrawColorText and when I use command like this "/tsn1 Test" it returns "nil" , here is the code: function teamSetName1(thePlayer,command,Name1) local team1x = tostring(Name1) T1Name = team1x end addCommandHandler("tsn1",teamSetName1)
  2. Hello, I'm making simple cw script and I've defined T1Score and T2Score to " " empty i mean and now I make this function which is supose to add 1 point to team wether is 1 or 2 and its always executed else statement I mean it outputs "Arguments allowed are: 1,2" but i type this "/ap 1" in ChatBox function addPoint(thePlayer,command,Team) if (Team == 1) then T1Score = T1Score + 1 elseif (Team == 2) then T2Score = T2Score + 1 else display("Arguments allowed are: 1,2") end end addCommandHandler("ap",addPoint)
  3. Man but atleast explain me what is wrong there? I don't see any mistake , i replaced source in 1,3 lines with "player" element and still don''t work I don't see any forking Idea why it shouldn't work not logic man I made few small scripts and I'm not totally noob at scripting, but idk whats wrong with this.. just tell me if u know
  4. ik whats nil lol, but aren't "source","thePlayer","player","ped" already defined at MTA Source codes? thats the whole script there I tryed this too but doesn't work accName = getAccountName (source) -- get his account name source = getAccountPlayer(theAccount) account = getPlayerAccount(source) --local admin = isObjectInACLGroup ( "user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ) ) mass = 100000 veh = getPedOccupiedVehicle (ped) --local oldmass = getVehicleHandlingProperty ( element, "mass" ) any hint? which function should I use to define source ?
  5. This is the whole code but idk why I get error 2 line = expected account at argument 1 got nil 4 line = expected element at argument 1 got nil 7 line = expected ped at argument 1 got nil accName = getAccountName (account) -- get his account name me = getRootElement() account = getPlayerAccount(source) --local admin = isObjectInACLGroup ( "user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ) ) mass = 100000 veh = getPedOccupiedVehicle (ped) --local oldmass = getVehicleHandlingProperty ( element, "mass" ) function show(msg) outputChatBox(msg,source, 0,81,255,true) end function turnOn(player, cmd, option) if option == "yes" then function babaking_tankYes ( me ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and veh then bindKey ( me, "handbrake" or "space", "both", function(key,state) if state == "down" then setVehicleHandling ( veh, "mass", mass ) setVehicleHandling ( veh, "brakeDeceleration", mass ) show(tostring(getVehicleHandlingProperty ( element, "mass" ))) elseif state == "up" then setVehiceHandling (veh, "mass", true) setVehicleHandling ( veh, "brakeDeceleration", true ) show(tostring(getVehicleHandlingProperty ( element, "mass" ))) end end) addEventHandler ( "onResourceStart", getRootElement(), babaking_tankYes ) elseif not veh then return false end end elseif option == "no" then function babaking_tankNo ( me ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and veh then bindKey ( me, "handbrake", "both", function(key,state) if state == "down" then setVehicleHandling ( veh, "mass", true ) show(tostring(getVehicleHandlingProperty ( element, "mass" ))) elseif state == "up" then setVehiceHandling (veh, "mass", true) show(tostring(getVehicleHandlingProperty ( element, "mass" ))) end end) addEventHandler ( "onResourceStart", getRootElement(), babaking_tankNo ) elseif not veh then return false end end else return false end end addCommandHandler("fpskickon", turnOn) function getVehicleHandlingProperty ( element, property ) if isElement ( element ) and getElementType ( element ) == "vehicle" and type ( property ) == "string" then local handlingTable = getVehicleHandling ( element ) local value = handlingTable[property] if value then return value end end return false end
  6. hello here is the code that i need to fix function topmap( player, command ) local map = getResourceName ( exports['mapmanager']:getRunningGamemodeMap ( ) ) local tableOrder = { } for i, v in ipairs ( getAccounts ( ) ) do table.insert ( tableOrder, { name = getAccountData ( v, "nick") or getAccountName(v), data = getAccountData ( v, map) or 0 } ) end table.sort ( tableOrder, function ( a, b ) return ( tonumber ( a.data ) or 0 ) > ( tonumber ( b.data ) or 0 ) end ) triggerClientEvent ( "returnTable", getRootElement(), tableOrder ) end addEventHandler ( "onMapStarting", root, topmap) function refresh(thePlayer) local account = getPlayerAccount(source) setAccountData(account, "nick", getPlayerName(source) ) end addEventHandler("onPlayerConnect", getRootElement(), refresh) addEventHandler("onPlayerWasted", getRootElement(), refresh) addEventHandler("onPlayerChangeNick", getRootElement(), refresh) addEventHandler("onPlayerLogin", getRootElement(), refresh) my friend gave me but it doesn't store wins nowhere he don't know how to do it either
  7. can u fix the code above? cuz I bought this resource and it doesn't work. guy that sold me that deleted me on skype and I don't understand what u mean by checking each index. If anyone have bit of time to fix it I 'd appreciate that
  8. ERROR: topwins/topc.lua:28: attempt to index local 'top' (a nill value)
  9. Can someone tell me whats wrong with this code?? Client.lua: topTable = { } addEvent ( "returnTable", true ) addEventHandler ( "returnTable", getRootElement(), function ( newTable ) topTable = newTable setTimer(removeEventHandler,5000,1,"onClientRender", getRootElement(), renderMapWins) end ) local winners = { } local localData = { } local mapName = "" local state = false local sx, sy = guiGetScreenSize ( ) local x,y = guiGetScreenSize ( ) function renderMapWins ( ) if ( state ) then dxDrawRectangle ( x-250, 60, 240, 200, tocolor(0,0,0,180), false ) dxDrawRectangle ( x-250, 60, 240, 26, tocolor(255, 0, 0, 200), false ) dxDrawText ( tostring ( mapName ), x-245, 80, 250, 60, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "center", false, false, true, false, false ) for index = 1, 8 do local top = topTable [ index ] dxDrawText ( "\n\n\n\n\n#FF0000".. tostring ( index ) ..". #FFFFFF".. tostring( top.name ), x-245, ( 20 * index ), 250, 120, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, true, false ) dxDrawText ( "\n\n\n\n\n"..tostring ( top.data ).." #ff0000wins", x-50, ( 20 * index ), x-15, 40, tocolor(255, 255, 255, 255), 1.00, "default-bold", "right", "top", false, false, true, true, false ) end else removeEventHandler ( "onClientRender", root, renderMapWins ) end end addEvent ( "onClientMapStarting", true ) addEventHandler ( "onClientMapStarting", root, function ( mapInfo ) mapName = mapInfo.name addEventHandler ( "onClientRender", root, renderMapWins ) bindKey ( "F5", "down", showMapWins ) state = true --triggerServerEvent ( "mapWins:requestList", localPlayer ) hideTimer = setTimer ( function ( ) if ( state ) then showMapWins ( ) end end ,10000, 1 ) end ) addEvent ( "mapWins:returnList", true ) addEventHandler ( "mapWins:returnList", root, function ( winners_ ) winners = { } localData = { } for index, winner in ipairs ( winners_ ) do if ( index < 11 ) then table.insert ( winners, { serial = winner.serial, nick = top.name, wins = top.kill } ) end if ( winner.serial == getPlayerSerial ( ) ) then localData = { rank = index, nick = winner.nick, wins = winner.wins } end end end ) addEvent ( "onClientMapStopping", true ) addEventHandler ( "onClientMapStopping", root, function ( ) removeEventHandler ( "onClientRender", root, renderMapWins ) winners = { } localData = { } unbindKey ( "F5", "down", showMapWins ) state = false mapName = "" if ( isTimer ( hideTimer ) ) then killTimer ( hideTimer ) end end ) function showMapWins ( ) state = ( not state ) removeEventHandler ( "onClientRender", root, renderMapWins ) if ( state ) then --triggerServerEvent ( "mapWins:requestList", localPlayer ) addEventHandler ( "onClientRender", root, renderMapWins ) else if ( isTimer ( hideTimer ) ) then killTimer ( hideTimer ) end end end addEvent ( "mapWins:show", true ) addEventHandler ( "mapWins:show", root, function ( ) if ( not state ) then showMapWins ( ) end end ) Server.lua: function topmap( player, command ) local map = getResourceName ( exports['mapmanager']:getRunningGamemodeMap ( ) ) local tableOrder = { } for i, v in ipairs ( getAccounts ( ) ) do table.insert ( tableOrder, { name = getAccountData ( v, "nick") or getAccountName(v), data = getAccountData ( v, map) or 0 } ) end table.sort ( tableOrder, function ( a, b ) return ( tonumber ( a.data ) or 0 ) > ( tonumber ( b.data ) or 0 ) end ) triggerClientEvent ( "returnTable", getRootElement(), tableOrder ) end addEventHandler ( "onMapStarting", root, topmap) function refresh(thePlayer) local account = getPlayerAccount(source) setAccountData(account, "nick", getPlayerName(source) ) end addEventHandler("onPlayerConnect", getRootElement(), refresh) addEventHandler("onPlayerWasted", getRootElement(), refresh) addEventHandler("onPlayerChangeNick", getRootElement(), refresh) addEventHandler("onPlayerLogin", getRootElement(), refresh)
  10. What to use and how to use it to create a Top Wins each map for players, u know what I mean u press "F5" and then apears dxRectangle with map name in header and 5 players names with their wins next to their names and the 6th line are wins of the client. but I don't have any Idea how to do it.
  11. Hello guys, I'm asking for help about replacing textures like nos textures, fire texture (when veh have 0 hp) ok here is a link of an image http://www.gtagarage.com/mods/screen.php?s=22884 I want to replace that in my MTA SA server, is it possible and if it is how ?
  12. Yes, can u give me a hint or something else?
  13. Oh, I've problem here.. Did anyone have idea how to get wins of all maps?
  14. Thank you both, especially you LinKin, good luck with gamemode, have fun makin' it bro
  15. Thank you, I'll read a book , I though I'll figure it out cuz its an easy language without book but I'll be forced to read it. Thank you anways and good luck ur gamemode.
  16. mtamaster97

    [Q&A]

    How to store wins of players to their account or store data to a document where key will be their account name and value will be their wins, how could I do that? I need for top wins resource
  17. mtamaster97

    [Q&A]

    Hello, I wish if someone could give me Idea how to make this dx Rectangles with Info's about players joined, changed nick and else, but actualy I just dont know how to make that animation and make it appear in row like kill messages for example(dont tell me to look how they made it in killmessages cuz i tryed they use mta methods and some functions that are not explained in MTA Wiki so I dont understand anything almost).
  18. I've problem with teamColors in Scoreboard, this is the code actualy its not mine i downloaded it on MTA Community and every team have Black title and Black tag, I want to have real team colors on it, ok code: if row.isTeamTitle then local playerTeam = getPlayerTeam(source) thisRowHeight = heightBlueBar nextRowTeamPlayerBgColor = row.teamPlayerBgColor -- use this as bg color for team players rows dxDrawRectangle(x, rowY, boardWidth, thisRowHeight, row.rowBgColor, drawOverGUI) local cx = x+5 local r, g, b = getTeamColor (playerTeam) dxDrawText(row.teamName, cx+1, rowY+1, cx+200, rowY+heightBlueBar, tocolor(0,0,0,255), 1, fontTitle12, "left", "center", false, false, drawOverGUI) dxDrawText(row.teamName, cx, rowY, cx+200, rowY+heightBlueBar, tocolor(r,g,b,255), 1, fontTitle12, "left", "center", false, false, drawOverGUI) else thisRowHeight = rowHeight local fullRowBgColor = rowBgColor if row.isLocalPlayer then fullRowBgColor = localPlayerBackgroundColor elseif row.isFriend then fullRowBgColor = friendBackgroundColor end dxDrawRectangle(x, rowY, boardWidth, thisRowHeight, fullRowBgColor, drawOverGUI) if nextRowTeamPlayerBgColor then dxDrawRectangle(x, rowY, boardWidth, thisRowHeight, nextRowTeamPlayerBgColor, drawOverGUI) end for o, mainColumn in ipairs(mainColumns) do for i, c in ipairs(mainColumn.columns) do if row[c.id] then local cx = x + mainColumn.x + c.x if c.bgcolor then dxDrawRectangle(cx, rowY, c.width, thisRowHeight, c.bgcolor, drawOverGUI, false) end local xOffset = c.xOffset or 0 local yOffset = c.yOffset or 0 if c.type == "dot" then dxDrawDot(cx+c.radius, rowY+1+c.radius, row[c.id], drawOverGUI) elseif c.type == "image" then dxDrawImage(cx+xOffset, rowY + yOffset, c.width, c.height, row[c.id], 0,0,0, tocolor(80,178,0,150), drawOverGUI) else local alignX = c.alignX or "left" local font = c.font or fontRow10 local r, g, b = getTeamColor (playerTeam) local color = row.color or c.color or tocolor(r,g,b,255) local isColorCoded = c.isColorCoded or false if isShadowRendered then local shadowText = row[c.id] if isColorCoded then shadowText = removeColorCodes(shadowText) end dxDrawText(shadowText, cx+xOffset-3, rowY+yOffset, cx+c.width+1.2, rowY+yOffset+thisRowHeight, tocolor(80,178,0), 1.02, fontRowBold10, alignX, "center", false, false, drawOverGUI, false, true) end dxDrawText(row[c.id], cx+xOffset, rowY+yOffset, cx+c.width, rowY+yOffset+thisRowHeight, color, 1, font, alignX, "center", fals, false, drawOverGUI, isColorCoded) end end end end end How to fix it?
  19. Hello there I've download some done dashboard or user panel whatever, and its good main menu where u select small menus like "Maps" "Options" its done by using dx functions also have animation when u press 'U' . but the problem is that everything else i mean small menus like Maps Options Stats are done in Gui and it look rly sux so I need some help about modifying those small menus from Gui to Dx, I know how to use Dx functions I'm not that noob but I dont know how to make search without useing Gui Edit Fields I saw it on lot of servers so its possible to make it but idk how and Idk too how to make gridlist thats able to scroll up an' down by using scroll with Dx functions, so if anyone have bit free time to help me I'd appreciate that. here is the gridlist I'd like to make(not same but to have Dx look): http://mymtascripts.weebly.com/uploads/ ... 3_w800.png and edit field that doesnt contains Gui elements: https://i.ytimg.com/vi/pl_E3AfGnxA/maxresdefault.jpg Thank you for reading.
  20. Hello guys, I've a problem about ranks, I want to make ranks 5 that will be calculated by kills & wins and every logged player I'll have his own rank name & rankLogo at stats window and only rankLogo at Scoreboard next to name , but I don't know how to store kills and wins to someones account, Can someone of u guys help ne or just give me a hint, ty.
  21. I need help about creating ranks, ranks will be calculated by number of wins and kills, I've formula for that, but idk how to store all that data and make that resource, I'm new at scripting, actualy i've readed 50-60 pages of Lua scripting book, but MTA is completly different and i dont understand most of things and patterns, so can someone help me, please?
  22. Never mind i've opened "scoreboard" resource and copied some lines, ty anyways
  23. Dude, I'm making my own with dx functions, and its done ping,fps all just idk how the heck to get their team and name colors to scoreboard
×
×
  • Create New...