JeViCo

Members
  • Content Count

    549
  • Joined

  • Last visited

  • Days Won

    1

JeViCo last won the day on April 21 2018

JeViCo had the most liked content!

Community Reputation

93 Popular

3 Followers

About JeViCo

  • Rank
    Playa Partner

Recent Profile Visitors

2,579 profile views
  1. I made script a long time ago. I've tried to apply shader on weapon in different ways but got nothing. Weapons you holding are not actually objects (for some reason) and that's pretty annoying sometimes. Anyway i solved that problem: 1. I replace weapon with custom dff and txd with transparent texture. (You can see it in video below at the beginning. Replacing provides correct muzzle offset for custom weapon); 2. I replace 1 random object (not weapon) with my weapon's dff and txd normally; 3. When ped gets ak47 (weapon) i create shader with texture replacement, apply it on my object (not ped) and use render target as texture; 4. When i switch to ak47 i attach weapon to player's hand (using bone_attach resource) and remove it if i switch to another weapon; 5. I use render targets so i can easily redraw the texture and that's it.
  2. JeViCo

    Help, please

    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("addVip", function(pl, cmd, ...) local nick = table.concat({...}, " ") local player = getPlayerFromPartialName(nick) if not player then return end local accName = getAccountName(player) aclGroupAddObject(aclGetGroup("Vip"), "user."..accName) end) Try this code
  3. JeViCo

    Help, please

    you mean this? if not isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "Policja" ) ) then return end
  4. Example code: local scx, scy = guiGetScreenSize() local text = "hello world" showCursor(true) addEventHandler("onClientRender", root, function() if isCursorShowing() then -- can be removed local cx, cy = getCursorPosition() local boxW = dxGetTextWidth(text) + 2*20 -- add left and right paddings local boxH = dxGetFontHeight() + 2*10 -- add top and bottom paddings dxDrawRectangle(cx*scx, cy*scy, boxW, boxH) dxDrawText(text, cx*scx, cy*scy, boxW+cx*scx, boxH+cy*scy, tocolor(0, 0, 0, 255), 1, "default", "center", "center") end end) Result: Also don't forget about scale, font and color-coded properties which affect on dxGetTextWidth, dxGetFontHeight and drawing functions
  5. You want to draw rectangle next to cursor, am i right? getCursorPosition returns values from 0 to 1 so you should multiply values to get absolute coordinates like this: local scx, scy = guiGetScreenSize() local cx, cy = getCursorPosition() addEventHandler("onClientRender", root, function() dxDrawRectangle(cx*scx, cy*scy, 300, 100) end)
  6. @xxMANxx, you probably need this function Math.isPointInPolygon. You should iterate through each point of one rectangle and check if one of them is inside the other one
  7. Solved, my bad. So what was wrong? 1. I was trying to send code as plain text. I had to send a file, not a text. 2. I thought content type had to be "application/x-www-form-urlencoded". Nope - "multipart/form-data" (found in luac.mtasa.com's web page source code) 3. UTF-BOM and UTF without BOM didn't work for me so i used Encoding.Default everywhere (fixed StreamWriter too)
  8. Possible solution: convert otf to ttf font
  9. JeViCo

    Help, please

    if ( player_faggio1~=localPlayer) then -- player is not in faggio teleport vehicle to player setElementPosition(faggio1, x, y, z)
  10. @Scyrix On my opinion the problem is right here: local results = dbPoll(queryHandle, 0) change result timeout from 0 to -1: local results = dbPoll(queryHandle, -1) Wiki: Use 0 for an instant response (which may return nil)
  11. if account = false (boolean) then the problem is somewhere around here getAccount(username, password) Also i don't see any "submitLogin" event triggering in your code. Possible problems: - "submitLogin" event arguments are missing - "submitLogin" event arguments are incorrect and getAccount function says "i don't know this person"
  12. It seems that api does not support programming-based remote access. PHP script has same result - "ERROR Could not compile file". Code: <?php $data = array( 'compile' => '1', 'debug' => '0', 'obfuscate' => '3', 'luasource' => 'print("Hello World!")' ); $query = http_build_query ($data); $contextData = array ( 'method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n". "Connection: close\r\n". "Content-Length: ".strlen($query)."\r\n", 'content'=> $query ); $context = stream_context_create (array ( 'http' => $contextData )); $result = file_get_contents ('http://luac.mtasa.com/index.php', false, $context); echo $result;
  13. Hello, thanks for reply! I've tried to implement that method and got the same result. Updated code: using System.Net.Http; private string PostRequest(string text) { var values = new Dictionary<string, string> { { "compile", "1" }, { "debug", "0" }, { "obfuscate", "3" }, { "luasource", "local a = 10" } // example code }; using (var client = new HttpClient()) { var content = new FormUrlEncodedContent(values); var response = client.PostAsync("http://luac.mtasa.com/index.php", content).Result; //var response = client.GetAsync("http://google.com").Result; if (response.IsSuccessStatusCode) { var responseContent = response.Content; // by calling .Result you are synchronously reading the result string resp = responseContent.ReadAsStringAsync().Result; Console.WriteLine(resp); // ERROR Could not compile file return resp; } else { return "Error connecting website"; } } } I had some problems with async methods in sync thread however i fixed it somehow
  14. Awesome idea, however it sounds impossible for a single person. Since collisions are client-side, bullets, object and ped ragdolls will be asynced. It may cause additional problems in future so you have to deal with server as well. Anyway i guess it's time to go onto the next level for good old SA so good luck 💪
  15. I have a code: private static string PostRequest(string text) { WebRequest request = WebRequest.Create("http://luac.mtasa.com/index.php"); request.Method = "POST"; string data = "compile=1&debug=0&obfuscate=3&luasource=" + text; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = byteArray.Length; using (Stream dataStream = request.GetRequestStream()) { dataStream.Write(byteArray, 0, byteArray.Length); } WebResponse response = request.GetResponse(); string resp; using (Stream stream = response.GetResponseStream()) { using (StreamReader reader = new StreamReader(stream)) { resp = reader.ReadToEnd(); } } response.Close(); return resp; } which should return compiled and obfuscates version of text but there is a problem - it always returns "ERROR Could not compile file" even if i use "local a = 10" string as a text. I guess that problem hides in ContentType variable and urlencoded maybe ruins Lua code however i don't know how to fix it right now.