Jump to content

Gravestone

Members
  • Posts

    467
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Gravestone

  1. Yeah that's a bug with MTA. If you make a weapon dual which is not dual by default, it's hard to set it to normal. Try stopping the resource and then reconnect, if doesn't work, restart your server.
  2. Start from: https://wiki.multitheftauto.com/wiki/Main_Page
  3. If he's the only one in the VIP acl group, then yeah, he'll be the "ALONE" with the ability to use Jetpack and laser.
  4. You need to check whether the player is VIP and then allow these stuff for him. Use isObjectInACLGroup to check whether he is VIP or not.
  5. Somewhere in the script of the resource 'onResourceStart' event is being handled and it is being cancelled.
  6. The link was working fine for me, if this doesn't work either, try refreshing the page. Here's the updated link, previous one has been removed. [UPDATES]
  7. Hello community fellows, today I'm going to introduce you a Clan War System made by me. This clan war system uses SQLite to save clan data and a GUI to challenge clans. Here is a list of current features and some screenshots: Features: - Uses GUI to challenge online clans - Uses SQLite to save clan data when the clan is destroyed or the resource is stopped - Clan war starts when the following things are successful: - When a clan wins, each player in the team gets ((bet amount / by the num ber of players)*2) and the lost clan's players get taken (bet amount / the number of players) - If a player tries to go out of boundaries, he will be killed and a message will be shown - A GUI window containing the list of maps - If the challenge remains un accepted for 45 seconds, it expires. - Contains 5 different locations and 20 spawnpoints for each location. - When a player is wasted, he respawns at in the sky after 4 seconds at random spawnpoint in the specific location - If a new team is created and it's winnings and losts are more than 0, it will be automatically added to the gridlist. Commands: Screenshots: NOTE: Don't destroy a team because the resource gets all the teams which are online and if one of them is destroyed while the resource is running, there will be lots of errors. However if you still do something like this, you can restart the resource and it won't be bugging again. - If you find any bugs or require help regarding the clan war system, please reply to this topic or contact me via PM. - Also if you are willing to have more custom maps, contact me via PM and I'll edit the resource for you. - You can also send me some maps if you wish to. I will be adding more maps in this soon. - Will be making a clan system and only the clan leader would be able to send challenges. Download this resource from here
  8. I am trying to check a global variable but everytime it is returning false. something1 = false something2 = false something3 = false something4 = false something5 = false function checksomething(_, _, ...) local d = table.concat({...}, " ") if tostring(d) == true then outputChatBox("true") return true else outputChatBox("false") return false end end addCommandHandler("checks", checksomething) But if I do it in this way: something1 = false something2 = false something3 = false something4 = false something5 = false function checksomething(_, _, ...) local d = table.concat({...}, " ") if something1 == true then outputChatBox("true") return true else outputChatBox("false") return false end end addCommandHandler("checks", checksomething) then it will return true. Any ideas how to fix this?
  9. function getTeams() local results = dbPoll( dbQuery( connection, "SELECT * FROM teaminfo WHERE teamname = ?"), -1 ) if type(results) == "table" and #results == 0 or not results then return false else return results[1]["teamname"] end end function doo() local names = getTeams() for i, v in ipairs(names) do outputChatBox(v) end end addCommandHandler("teams", doo) Tried this but the returns of the getTeams function are false even tho the table name is teaminfo and column name is teamname.
  10. I'm trying to say that two teams exist in the server, Ballas and Grove. I destroy one team by /destroyteam Grove so now only Ballas exists. I want to load the data for Grove as well and output it to the chatbox, how do I?
  11. For adding the image to the scoreboard, you'll have to edit the scoreboard resource and add the image path there or you can set a different element data which describes the path and then get it using getElementData. Then add dxDrawImage in scoreboard.
  12. @Bebo1king, JR10 has already told me the solution. Thanks tho.
  13. Alright so now I want to get all the data in the database even if the team doesn't exist. Table name: teaminfo Colum1: kills I load the team data when the resource starts but how do I load the data for the teams who don't exist but they were saved when the resource stopped?
  14. Gravestone

    Peds' aim

    Oh my bad, have you tried processLineOfSight?
  15. if getPlayerTeam(localPlayer) then r, g, b = getTeamColor(getPlayerTeam(localPlayer)) else r, g, b = getPlayerNametagColor(localPlayer) end
  16. table.sort only sorts number values so even if the kills are sorted, how do I sort the teams according to the kills? Edit: Tried this and adds the values successfully according to the kills but it doesn't change the order in the gridlist every second if the data changes of a team. Restart is required. kills = {} setTimer(function () for _,team in ipairs (getElementsByType ("team")) do -- local account = getPlayerAccount (player) local teamkills = getElementData (team, "Kills") if not table.contains(kills, teamkills) then table.insert (kills, teamkills) end end function sortData() setTimer(function() table.sort (percentages, function (a, b) return a > b end )end, 1000, 0) for _,v in ipairs (kills) do for _,team in ipairs (getElementsByType ("team")) do local teamkills = getElementData (team, "Kills") if v == teamkills then -- outputChatBox("Team "..getTeamName(team).." has "..v) if not isTextInGridList(rankinggrid, getTeamName(team)) then local row = guiGridListAddRow(rankinggrid, getTeamName(team)) setTimer( function() local r, g, b = getTeamColor(team) local kills = getElementData(team, "Kills") guiGridListSetItemColor(rankinggrid, row, 1, r, g, b) guiGridListSetItemText(rankinggrid, row, 2, tonumber(kills), false, true) guiGridListSetItemColor(rankinggrid, row, 2, 0, 255, 0) end end end end , 1000, 0) end setTimer (sortData, 1000, 0)
  17. The mg and mg2 variables are not global, means they can not be destroyed by another function. Use getAttachedElements maybe.
  18. Gravestone

    Peds' aim

    onClientColShapeHit's root resourceRoot? resourceRoot is a predifined variable which gets the current resource's root and should be used with onClientResourceStart/Stop only. Try this, not tested. function cancelUnkillableDamage(p, md) if (isElement(p)) then if (p.type ~= "player") then return end for _, v in ipairs(Element.getAllByType("ped")) do if (v:getData("ms:guard") == true) then local x, y, z = getPedBonePosition(p, 3) local px, py, pz = getElementPosition(v) local dg = findRotation(px, py, x, y) setPedAimTarget(v, x, y, z) setPedControlState(v, "fire", true) setElementRotation(v, 0, 0, tonumber(dg)) end end end end addEventHandler("onClientColShapeHit", root, cancelUnkillableDamage) addEventHandler("onClientColShapeLeave", root, function(p, md) if (isElement(p)) then if (p.type ~= "player") then return end for _, v in ipairs(Element.getAllByType("ped")) do if (v:getData("ms:guard") == true) then if getPedTarget(v) == p then setPedControlState(v, "fire", false) end end end end end )
  19. Thanks, another thing. I am adding the team name with it's kills to a gridlist. I want to sort it according to the kills, how do I use this table.sort function in combination with this code? local allteams = getElementsByType("team") local function sort (a,b) return (getElementData(a,"Kills") or 0) > (getElementData(b,"Kills") or 0) end for key,value in ipairs (allteams) do local row = guiGridListAddRow(rankinggrid, getTeamName(value)) setTimer( function() local r, g, b = getTeamColor(value) local kills = getElementData(value, "Kills") guiGridListSetItemColor(rankinggrid, row, 1, r, g, b) guiGridListSetItemText(rankinggrid, row, 2, tonumber(kills), false, true) guiGridListSetItemColor(rankinggrid, row, 2, 0, 255, 0) end, 1000, 0) end And there's a problem with the above code, the teams keep moving if I click on the column name to sort.
  20. Hello everyone. I am creating something to save team kills when the resource stops. The kills are successfully saved but I want to load them when resource starts back, I mean the db is connected and sets the element (team) data to which it had before the resource had stopped. The coloumn in which the kills are stored is known as "Kills" and where the team name is before that column named "teamname". I tried this: addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function () for i, team in ipairs(getElementsByType("team")) do local name = getTeamName(team) local data = getTeamData(name) outputChatBox(tostring(false)) setElementData(team, "Kills", data) end end ) function getTeamData(team) local results = dbPoll( dbQuery( connection, "SELECT * FROM claninfo WHERE teamname = ?", teamname), -1 ) if type(results) == "table" and #results == 0 or not results then return false else return results[2]["Kills"] end end Error: it is returning false
  21. I have created a gridlist which should display all the available team names but the problem is that the code only gets the team name of the first team tho it adds the correct number of rows to the column. e.g If there are 4 teams, Ballas, Grove, Aztecs and Vagos, it writes Ballas in all the four lines also it displays in the chatbox only Ballas. rankinggrid = guiCreateGridList(24, 58, 439, 240, false, Window)
  22. https://wiki.multitheftauto.com/wiki/Debugging
×
×
  • Create New...