Jump to content

Vector

Members
  • Posts

    114
  • Joined

  • Last visited

Details

  • Gang
    right
  • Location
    Spain -> Navarra.

Vector's Achievements

Sucka

Sucka (13/54)

0

Reputation

  1. Vector

    XML

    -- iterate over all the xml nodes and find those whose value and tag name matches... local children = xmlNodeGetChildren(root); for _, child in ipairs(children) do if (xmlNodeGetName(child) == tagName) and (xmlNodeGetValue(child) == someValue) then xmlDestroyNode(child); end; end;
  2. maybe the skill level of your player is not "poor". it can be "pro", "std" and "poor" local M1Garand = function() local skills = {"pro", "std", "poor"}; for _, skill in ipairs(skills) do setWeaponProperty(33, skill, "weapon_range", 180) setWeaponProperty(33, skill, "target_range", 180) setWeaponProperty(33, skill, "accuracy", 5) setWeaponProperty(33, skill, "damage", 50) setWeaponProperty(33, skill, "maximum_clip_ammo", -- s8) --> setWeaponProperty(33, skill, "move_speed", 90) setWeaponProperty(33, skill, "flags", 0x000010) setWeaponProperty(33, skill, "flags", 0x008000) end end addEventHandler("onResourceStart", getRootElement(), M1Garand )
  3. setVehicleLocked getPlayerTeam getTeamFromName getPedOccupiedVehicle
  4. the server i try to connect to is the same server the client is connected to in MTA.
  5. I tried to use server-ip like this "http://x.x.x.x/image.png" and doesn´t work. and with a hostname like myserver.no-ip.org "http://myserver.no-ip.org/image" doesnt´work. error 1006
  6. Hi, I try to use fetchRemote in client-side but it doesnt work. in fact, it works when using fetchRemote in server-side I used to think that this error is because of client or server version are below the minimum required version. But I put this on the meta file, and stil the same error. client="1.3.2" server="1.3.0-9.03739"/> this works -> --server-side fetchRemote("http://localhost/image.png", function(data, errno) if errno == 0 then outputChatBox("error downloading image: " .. errno); return; end; triggerClientEvent(root, "onFileDownload", root, "image.png", data); end); -- client-side addEvent("onFileDownload", true); addEventHandler("onFileDownload", root, function(fileName, data) -- cache the data to a file .. local file; if not fileExists(fileName) then file = fileCreate(fileName); else file = fileOpen(fileName); end; fileWrite(file, data); fileClose(file); -- do whatever with the file ... end); this not work-> (value returned by fetchRemote -> error 1006) --client-side fetchRemote("http://localhost/image.png", function(data, errno) if errno == 0 then outputChatBox("error downloading image: " .. errno); return; end; triggerEvent("onFileDownload", root, "image.png", data); end); addEvent("onFileDownload", false); addEventHandler("onFileDownload", root, function(fileName, data) -- cache the data to a file .. local file; if not fileExists(fileName) then file = fileCreate(fileName); else file = fileOpen(fileName); end; fileWrite(file, data); fileClose(file); -- do whatever with the file ... end); help please.
  7. i didn´t know that function exists. .)
  8. create a collision shape in server-side with createColCuboid createColSphere attach the collision shape to the ped with this. attachElements create an event handler for "onColShapeHit", to check if an element is inside the collision shape that surrounds the ped. attach the event handler to the collision shape. addEventHandler("onColShapeHit",...); check if the element is a player. if it is a player, trigger an event for that player to play the sound. triggerClientEvent -- to trigger the event. addEvent -- to use the event at client-side. addEventHandler -- to create an event handler at client-side attached to that event. now, at client-side .... playSound3D -- to play a sound in a specific 3D pos. getElementPosition -- to get the ped´s position. you can use this function to get the sound´s origin.
  9. -> outputDebugString(maleter["1"]); o outputDebugString(maleter[tostring(1)]); "Note: Indices of a JSON object such as "1": "cat" are being returned as string, not as integer."
  10. the table is not called "classes", is "class" for pIndex, classes in ipairs(class) do --Loop the classes outputDebugString(tostring(pIndex).." "..tostring(classes)) for index, classPackage in ipairs(classes) do outputChatBox(tostring(index).." "..tostring(classPackage)) end end
  11. Vector

    New chat

    hey, this is an example. -> only players around you will be able to see your chat messages. server-side. local maxDistance = 20; -- 20 metres will be the maximum distance to see player messages. addEventHandler("onPlayerChat", getRootElement(), function (message, messageType) if messageType==1 then return; end; -- do nothing if message is an action message. -- now, get players near the player who sent the message and store them in a table. local nearestPlayers = {}; local players = getElementsByType("player", getRootElement()); local pX, pY, pZ = getElementPosition(source); for _,player in ipairs(players) do local sX, sY, sZ = getElementPosition(player); if ((pX-sX)^2 + (pY-sY)^2 + (pZ-sZ)^2) <= maxDistance^2 then -- player is near, so, add it to the list... table.insert(nearestPlayers,player); end; end; -- now, check if the message is a team message. in that case, we remove from the table all the players -- that are not inside the team of the player who sendt the message. local playerTeam = getPlayerTeam(source); if playerTeam and (messageType==2) then for index,player in ipairs(nearestPlayers) do if getPlayerTeam(player) ~= playerTeam then -- if teams are different, remove from list... table.remove(nearestPlayers, index); end; end; end; -- now send the chat message for that players... local chatMessage = getPlayerName(source) .. "#FFFFFF: " .. message; for _,player in ipairs(nearestPlayers) do outputChatBox(chatMessage, player, 255,255,255, true); end; cancelEvent(); -- cancel event so that the chat message will not be shown directly. end);
  12. server-side "onElementClicked" -- [url=https://wiki.multitheftauto.com/wiki/OnElementClicked]https://wiki.multitheftauto.com/wiki/OnElementClicked[/url] client-side "onClientClick" -- [url=https://wiki.multitheftauto.com/wiki/OnClientClick]https://wiki.multitheftauto.com/wiki/OnClientClick[/url]
  13. Vector

    ?? Need help

    yes, you need to read all the answers, search, and do it by yourself. dont´t expect other will do your homework.
  14. Vector

    ?? Need help

    1ºst way: create two different images and use guiStaticImageLoadImage when "onClientMouseEnter", "onClientMouseLeave" events are fired. -> bad way. client need to download 2 images from server. 2ºnd way: change the static image CEGUI property "ImageColours" to make the image a bit darker or brighter, when "onClientMouseEnter", "onClientMouseLeave" events are fired. ---> try this --> function blendStaticImageWithColor(guiStaticImage, r,g,b) local __hex = string.format("%X%X%X",r,g,b); guiSetProperty(guiStaticImage, "ImageColours", "tl:" .. __hex .. " tr:" .. __hex .. " bl:" .. __hex .. " br:" .. __hex); end; function make_it_darker(guiStaticImage) blendStaticImageWithColor(guiStaticImage, 155, 155, 155); end; function make_it_brighter(guiStaticImage) blendStaticImageWithColor(guiStaticImage, 255,255,255); end; addEventHandler("onClientMouseEnter", getRootElement(), function() -- just for static-images. if getElementType(source) ~= "gui-staticimage" then return; end; -- make the static image brighter. make_it_brighter(source); end); addEventHandler("onClientMouseLeave", getRootElement(), function() -- just for static-images. if getElementType(source) ~= "gui-staticimage" then return; end; -- make the static image darker. make_it_darker(source); end);
×
×
  • Create New...