Jump to content

GTX

Members
  • Posts

    1,273
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by GTX

  1. GTX

    DxDrawText

    local screenWidth, screenHeight = guiGetScreenSize() cResolutionY = 768-- put your current resoultion Y here cResolutionX = 1360 -- put your current resoultion X here function correctResolutinY(y) if y then return (screenHeight/cResolutionY )*y end end function correctResolutinX(x) if x then return (screenWidth/cResolutionX)*x end end
  2. Yeah, exactly. Got solution anyways: getElementBoundingBox.
  3. Nah, I need it more accurate or names will bug into vehicle.
  4. Hi, how can I calculate position right above the vehicle highly accurately?
  5. Easier way: dxSetTextureEdge(renderTarget, "border", tocolor(255, 255, 255, 100))
  6. Checkpoints are in .map file. Use XML functions to get them.
  7. What??? Change it to your resource name.
  8. There is an awesome way to do circular progress bars without any frame drops. Try shaders.
  9. GTX

    MTA SDK, password

    $ip = "ip"; $port = port; $user = "user"; $pass = "pass"; $resname = "your_resource"; include("sdk/mta_sdk.php"); $mtaServer = new mta($ip,$port,$user,$pass); $resource = $mtaServer->getResource($resname); $table = $resource->call("your_function"); function your_function() -- Whatever end <export function="your_resource" type="server" http="true"/> This? Edit: To set a password, rewrite variables in your PHP SDK file @ lines 18-19
  10. Sorry for bumping this post but I have a (temporary?) solution. Use string.char function. outputChatBox(string.char(231)..", "..string.char(227)..", "..string.char(233)..", "..string.char(226)..", "..string.char(244)..", "..string.char(245)) This should output those below if I'm not mistaken. ç, ã, é, â, ô, õ
  11. Lol? setElementData(source, "member_id", result[1]["member_id"])
  12. Don't compile it, use cache attribute in meta.
  13. Are there any possibilities to do a 3D button in GTA world? Like a button on "drvin_screen" object and you could click it.
  14. GTX

    anti forward

    Take a look at wiki. -- From Wiki: function fanFunction() bindKey (source,"forwards","down", function(player,key,state) outputChatBox (getPlayerName (player) .. "#FFFF00 thinks Aintaro is cool.",getRootElement(),255,255,0,true) end ) end addEventHandler ("onPlayerLogin",getRootElement(),fanFunction) https://wiki.multitheftauto.com/wiki/BindKey
  15. GTX

    scare

    "root" is predefined variable. It's same as getRootElement().
  16. GTX

    scare

    What the hell, Blinker.? Your code is wrong. Hazard|, make sure your meta is written properly. (Must include server side and client side file.)
  17. GTX

    scare

    Server: function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end addCommandHandler("scaree", function(player, command, target) local target = getPlayerFromPartialName(target) if target then triggerClientEvent(target, "scareJumpThem", target) end end ) Client: function drawIt() -- Do whatever. end function scare() addEventHandler("onClientRender", root, drawIt) end addEvent("scareJumpThem", true) addEventHandler("scareJumpThem", root, scare)
  18. GTX

    [REL] Hit & Run BETA

    New version (1.1) is available! - Added /whistle. (Shows your blip to everyone. Used to give hunter an advice.) - Fixed nametags. (You could see players' nametags through an object.) I might add stats system in next version.
  19. GTX

    Rank system [HELP]

    Okay. First of all, it took me a while to tabulate your code. Secondly, your 2nd argument in your timer included a string. It must be an integer. local criminal1 = { "Criminal", "Street Rat", "0" } local criminal2 = { "Criminal", "Mugger", "100" } local criminal3 = { "Criminal", "Mobster", "200" } local criminal4 = { "Criminal", "Mercenary", "300" } local criminal5 = { "Criminal", "Kingpin", "500" } local police1 = { "Police", "Trainee", "0" } local police2 = { "Police", "Officer", "100" } local police3 = { "Police", "Head officer", "200" } local police4 = { "Police", "Marshall", "300" } local police5 = { "Police", "FBI Agent", "500" } --TEAM, OCCUPATION, RANKNAME, REQUIRED ACTIONS local civilian1 = { "Civilians", "Trucker", "Trucker Wannabe", "0" } local civilian2 = { "Civilians", "Trucker", "Rookietrucker", "50" } local civilian3 = { "Civilians", "Trucker", "Transport Tycoon", "75" } local civilian4 = { "Civilians", "Trucker", "Hauler", "100" } local civilian5 = { "Civilians", "Trucker", "King of the road", "150" } local emergency1 = { "Emergency", "Medic", "EMT", "0" } local emergency2 = { "Emergency", "Medic", "Nurse", "25" } local emergency3 = { "Emergency", "Medic", "Paramedic", "50" } local emergency4 = { "Emergency", "Medic", "Doctor", "75" } local emergency5 = { "Emergency", "Medic", "Surgeon", "100" } --outputChatBox ( criminal [ 1 ] ) -- bar --outputChatBox ( criminal [ 2 ] ) -- baz --outputChatBox ( criminal [ 3 ] ) -- anything function timer() setTimer(checkIfRankUp, 5000, 0) end function checkIfRankUp() local players = getElementsByType ( "player" ) local method = "error" local thePlayer = false for i, v in ipairs(players) do if ( v ) then thePlayer = v if getElementData ( thePlayer, "Occupation" ) == "Criminal" then method = "criminal" elseif getElementData ( thePlayer, "Occupation" ) == "Police" then method = "police" elseif getElementData ( thePlayer, "Occupation" ) == "Trucker" then method = "trucker" elseif getElementData ( thePlayer, "Occupation" ) == "Medic" then method = "medic" elseif getElementData ( thePlayer, "Occupation" ) == "Freeroam" then method = "freeroam" elseif getElementData ( thePlayer, "Occupation" ) == "Unemployed" then method = "unemployed" else return end end end if method == "freeroam" then setElementData(thePlayer, "Occupation", "Freeroam") setElementData(thePlayer, "Rank", "Insane") elseif method == "unemployed" then setElementData(thePlayer, "Occupation", "Unemployed") setElementData(thePlayer, "Rank", "Unemployed") elseif method == "criminal" then local crimActions = getElementData(thePlayer, "Criminal-actions" ) local occ = getElementData(thePlayer, "Occupation") if crimActions >= 99 and crimActions <= 199 then setElementData(thePlayer, "Rank", criminal2 [ 2 ] ) elseif crimActions >= 199 and crimActions <= 299 then setElementData(thePlayer, "Rank", criminal3 [ 2 ] ) elseif crimActions >= 299 and crimActions <= 499 then setElementData(thePlayer, "Rank", criminal4 [ 2 ] ) elseif crimActions >= 499 and crimActions <= 900 then setElementData(thePlayer, "Rank", criminal5 [ 2 ] ) elseif crimActions == 0 then setElementData(thePlayer, "Rank", criminal1 [ 2 ] ) end elseif method == "police" then local polcActions = getElementData(thePlayer, "Police-actions" ) local occ = getElementData(thePlayer, "Occupation") if polcActions >= 99 and polcActions <= 199 then setElementData(thePlayer, "Rank", police2 [ 2 ] ) elseif polcActions >= 199 and polcActions <= 299 then setElementData(thePlayer, "Rank", police3 [ 2 ] ) elseif polcActions >= 299 and polcActions <= 499 then setElementData(thePlayer, "Rank", police4 [ 2 ] ) elseif polcActions >= 499 and polcActions <= 900 then setElementData(thePlayer, "Rank", police5 [ 2 ] ) elseif polcActions == 0 then setElementData(thePlayer, "Rank", police1 [ 2 ] ) end elseif method == "trucker" then local trucActions = getElementData(thePlayer, "Trucker-actions" ) local occ = getElementData(thePlayer, "Occupation") if trucActions >= 0 and trucActions <= 49 then setElementData(thePlayer, "Rank", civilian2 [ 3 ] ) elseif trucActions>= 49 and trucActions <= 74 then setElementData(thePlayer, "Rank", civilian3 [ 3 ] ) elseif trucActions >= 74 and trucActions <= 99 then setElementData(thePlayer, "Rank", civilian4 [ 3 ] ) elseif trucActions >= 99 and trucActions <= 149 then setElementData(thePlayer, "Rank", civilian5 [ 3 ] ) elseif trucActions == 0 then setElementData(thePlayer, "Rank", civilian1 [ 3 ] ) end elseif method == "medic" then local mediActions = getElementData(thePlayer, "Medic-actions" ) local occ = getElementData(thePlayer, "Occupation") if mediActions >= 0 and mediActions <= 24 then setElementData(thePlayer, "Rank", emergency2 [ 3 ] ) elseif mediActions>= 24 and mediActions <= 49 then setElementData(thePlayer, "Rank", emergency3 [ 3 ] ) elseif mediActions>= 49 and mediActions <= 74 then setElementData(thePlayer, "Rank", emergency4 [ 3 ] ) elseif mediActions >= 74 and mediActions <= 99 then setElementData(thePlayer, "Rank", emergency5 [ 3 ] ) elseif mediActions == 0 then setElementData(thePlayer, "Rank", emergency1 [ 3 ] ) end end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), timer )
  20. GTX

    Player alias

    My old alias script. I hope it still works. addEventHandler("onResourceStart", resourceRoot, function() executeSQLQuery("CREATE TABLE IF NOT EXISTS `players` (`serial` TEXT, `mute` TEXT, `alias` TEXT)") end ) addEventHandler("onPlayerJoin", root, function() local serial = getPlayerSerial(source) local name = getPlayerName(source) local r = executeSQLQuery("SELECT `mute`,`alias` FROM `players` WHERE `serial`=?", serial) if #r == 0 then executeSQLQuery("INSERT INTO `players` (`serial`,`mute`,`alias`) VALUES(?,?,?)", serial, "no", name) else if r[1]["mute"] == "yes" then setPlayerMuted(source, true) outputChatBox(name:gsub("#%x%x%x%x%x%x", "").." has been muted by Console!", root, 255, 0, 0, true) end end end ) addEventHandler("onPlayerQuit", root, function() if isPlayerMuted(source) then else end end ) addEventHandler("onPlayerJoin", root, function() setAlias(source) end ) addEventHandler("onPlayerChangeNick", root, function() setTimer(setAlias, 100, 1, source) end ) function setAlias(source) local find = true local name = getPlayerName(source) local serial = getPlayerSerial(source) local r = executeSQLQuery("SELECT `mute`,`alias` FROM `players` WHERE `serial`=?", serial) for i,v in ipairs(split(r[1]['alias'], 32)) do if v == name then find = false end end if find then executeSQLQuery("UPDATE `players` SET `mute`=?, `alias`=? WHERE `serial`=?", r[1]["mute"], r[1]["alias"].." "..name, serial) end end function findPlayer(name) if name then for i, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then return player end end end return false end local alias1 = "" local alias2 = 0 addCommandHandler("pma", function(p, _, t) local target = findPlayer(t) if target then local serial = getPlayerSerial(target) local r = executeSQLQuery("SELECT `mute`,`alias` FROM `players` WHERE `serial`=?", serial) local spl = split(r[1]["alias"], 32) for i, v in ipairs(spl) do if alias1 == "" then alias1 = v alias2 = alias2 + 1 else alias1 = alias1..", "..v alias2 = alias2 + 1 end if i == #spl then outputChatBox(alias1, p, 255, 255, 255, true) alias1 = "" alias2 = 0 end end end end )
  21. local fuel = math.floor(getElementData(vehicle, "fuel")) This? Edit: Oh, you want to get progress from progress bar? If so: local fuel = math.floor(guiProgressBarGetProgress(progressbar))
  22. Alright, I made it working. All I had to do is put \r\n to define new lines. (I think MTA hates Unix EOL conversions at meta). Thank you all for your time.
  23. Nah. I double-triple checked. Working meta is same as non-working meta. Position of those nodes is important because my common_messages.lua is having wrapper, which disables outputChatBox function.
×
×
  • Create New...