Jump to content

Gallardo9944

Members
  • Posts

    442
  • Joined

  • Last visited

Everything posted by Gallardo9944

  1. onPlayerChat -- event string.find -- to find your texts string.gsub -- if you wanna remove things like dots and etc to check cancelEvent() -- don't output the players' message
  2. Yeah, that's what i was searching for. Thanks!
  3. I would personally recommend adding global vars like ROOTELEMENT, RESROOTELEMENT, LOCALPLAYER (upper case) so most of the text editors light them up as constants.
  4. Unstested anyway. function onChat(player,_,...) local msg = table.concat({...}," ") local nick = getPlayerName(player) local account = getPlayerAccount(player) local language = getAccountData(account,"Language") if not (language == 1) then return end for i,v in ipairs(getElementsByType("player")) do local vacc = getPlayerAccount(v) if not isGuestAccount(vacc) then local lang = getAccountData(vacc,"Language") if lang == 1 then outputChatBox("[spanish]"..nick..": #ffffff"..msg,v,255,255,255,true) end end end end addCommandHandler("Language",onChat)
  5. Hello. I'm willing to create something like "always visible vehicles", so i can see them clearly even behind the walls without changing walls' alpha. Apparently i've gotta create some sorta screen shader, which extracts vehicles from the world or some sort of that. It should be some kind of AC4's "eagle vision". Any hint on creating that? Thanks.
  6. local amount = #getElementsByType("object")
  7. you actually can create multiple rectangles with "for" vertically by 1 pixel and change the size as it goes. Like this local x,y = guiGetScreenSize() local sx,sy = 400,200 local size = 45 -- pixel size to cut function performRendering() for i=1,sy do local dg = math.min(i,size) -- limit it to the size if i > sy-size then dg = sy-math.max(sy-size,i) -- limit it to the size for bottom parts end local csx = sx-1/dg*size -- use our lovely y = k/x function dxDrawRectangle(x/2-csx/2,y/2-sy/2+i,csx,1,tocolor(0,0,0,200)) -- draw the magic at the middle end end addEventHandler("onClientRender",getRootElement(),performRendering) But it WILL loose the quallity and it WILL look a bit weird. You also can draw that more frequently than 1 pixel, but keep in mind that slow computers will degrade on performance.
  8. You don't need to set dimensions unless you're sending things serverside. Send them via client and hide other players clientside by setting their dimensions to non-zero ones.
  9. empty account data is false, not nil. It's better to check this way: if not xp then
  10. why would you even want a custom component? If it's something like the roof / spoiler of the car, use the bounding box, it's rather precise. Of course you can get the component position, but some components might be missing for some cars.
  11. function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end Get the offset which equals to minX and minY of vehicle's bounding box and draw a line between the element position and that point.
  12. Like this? http://er-mta.net/screenshots/cloud/Scr ... _28_49.png Get offset with vehicle matrix (don't forget to calculate bounding box too), use 3D line, draw simple text over the screen with getScreenFromWorldPosition.
  13. If it's a player, it uses his vehicle. If it's already a vehicle, then it stays. local vehicle = hitElement if getElementType(vehicle) == "player" then vehicle = getPedOccupiedVehicle(vehicle) end
  14. https://community.multitheftauto.com/index.php?p= ... ls&id=7538 Seems to be a modified version of Nextreme's antiafk made long time ago. Even function names are the same. https://community.multitheftauto.com/index.php?p= ... ls&id=3910 Also a modification with the same function names and code. https://community.multitheftauto.com/index.php?p= ... ls&id=6735 A clone (sorta text modification) of "dm_respawn" by arezu
  15. 1. You are checking only 1 velocity value, which is X velocity. getElementVelocity returns 3 values, so you need to check all of them. Like that: local vehicle = getPedOccupiedVehicle(player) local vx,vy,vz = getElementVelocity(vehicle) if vx == 0 and vy == 0 and vz == 0 then -- bla bla bla end 2. You are checking both vehicle state and player velocity. Looks strange. It's better to change both to vehicle checks. 3. You can toggle to addEventHandler clientside with onClientRender to start the check if the vehicle has no velocity and etc and removeEventHandler as soon as he leaves the marker.
  16. it's actually onClientResourceStart with resourceRoot, not with a simple root. Just not to confuse the OP author
  17. You can also create a php page on the same machine to read your chart or whatever and use fetchRemote clientside to your custom page so the server doesn't get affected as much. I have such php file: <?php $s = $_GET['s']; $js = get_web_page("https://internet.page/somepage.php?data=".$s); echo $js['content']; function get_web_page( $url ) { $user_agent='Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/8.0'; $options = array( CURLOPT_CUSTOMREQUEST =>"GET", //set request type post or get CURLOPT_POST =>false, //set to GET CURLOPT_USERAGENT => $user_agent, //set user agent CURLOPT_COOKIEFILE =>"cookie.txt", //set cookie file CURLOPT_COOKIEJAR =>"cookie.txt", //set cookie jar CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); $header['errno'] = $err; $header['errmsg'] = $errmsg; $header['content'] = $content; return $header; } ?> And just request if from the client with s parameter in.
  18. It should be fine, but is there anything in debug? If not, try dbQuery and dbFree, it will return an error if it exists. Also, try using ` symbols and ?? instead of ? symbols. That might help for strings which contain different special stuff in.
  19. as far as i get, you want to be able to create objects fully colliding each other. That way you should use processLineOfSight from the object to the bottom in 5 parts of your object (middle and the corners) and then find the lowest Z value of the collision. So the lowest value will be your desired one. But rotation change would be a pain in the rear end for sure.
  20. if you've got a VPS, you should be having a root password. It might be sent to your email by your hoster. Login into it with your WinSCP or Putty, or use Filezilla with port 22 (sftp)
  21. I wouldn't suggest using arch for servers though. It's the latest yet not the most stable one. Huge updates might kill some things, so be aware.
  22. If you logged in with root, and then just started downloading and installing, then it should be in /root folder.
  23. Another way for keeping it in background after logging out is to use tmux. Use "tmux" to create a new session. Use "tmux attach" for further connections. Use "ctrl+b" and then "d" to detach from the session, use "ctrl+b" and then "c" to create a new one. Switch between them with "ctrl+b" and then 0-9 keys. Imo it's more useful than having over 5-10 screen sessions at the same time cause it's just a nightmare to switch between then. I've been using both for a long time and tmux is the best choice for me. It can be installed with "apt-get install tmux"
  24. of course. Since when do functions work like createPed(int 264...,)?
×
×
  • Create New...