-
Posts
27 -
Joined
-
Last visited
Everything posted by holuzs
-
local playersVehicles = {}; function serverSpawn(selectedList1,playerxyz) local x, y, z = getElementPosition(playerxyz) local rx,ry,rz = getElementRotation(playerxyz) if (getPedOccupiedVehicle(playerxyz)) then removePedFromVehicle(playerxyz); destroyElement(getPedOccupiedVehicle(playerxyz)); end if (playersVehicles[playerxyz]) then local veh = playersVehicles[playerxyz]; if (isElement(veh)) then destroyElement(veh); end end local playerVehicle = createVehicle ( selectedList1, x+1, y+1, z+0.5, rx,ry,rz ) local playerCreatedVehicle = getPedOccupiedVehicle ( playerxyz ) warpPedIntoVehicle ( playerxyz, playerVehicle ) playersVehicles[playerxyz] = playerVehicle; end addEvent("spawncar",true) addEventHandler("spawncar",getRootElement(),serverSpawn)
-
Létrehozol egy fegyvert objectként (https://dev.prineside.com/en/gtasa_samp_model_id/tag/144-weapons/), majd createObjectPreviewnál megadod az objectet.
-
I want to get text from a page with fetchRemote. So, when a player enter a command with a code, the fetchRemote call a site with 2 GET request. How can I get a simply text from the site? function newCommand(player, cmd, code) fetchRemote('http://domain.tld/index.php?get&code='..code, function(data, error) if (error) then return print(error); end end); end addCommandHandler('cmd', newCommand);
-
Hello! I want to remove a part from LS and LV. I use SA:MP editor, but I don't know how convert the object ids and their positions in a table. (I want to remove them with a for loop.)
-
hosp_loc = { {-2655, 635, 14, 180}, -- San Fierro {2038, -1411, 17, 130}, --Jefferson {1173, -1323, 15, 270}, -- All Saints {1242, 327, 19, 340}, -- Red County {1609, 1816, 12, 360}, -- Las Venturas {-2200, -2311, 30, 320}, -- Angel Pine {-320, 1049, 20, 0}, --Fort Carson - Bone County {-1514.5, 2524, 56, 0} --Tierra Robada } function Respawn() local randPosition = math.random(1, #hosp_loc) local skinid = getElementModel(source) outputChatBox("You respawn in 10 second!", source, 255, 255, 255, true) setTimer(function() spawnPlayer(source, hosp_loc[randPosition][1], hosp_loc[randPosition][2], hosp_loc[randPosition][3], hosp_loc[randPosition][4], skinid, 0, 0) end, 10000, 1) end addEventHandler("onPlayerWasted", root, Respawn)
-
addEventHandler("onColShapeLeave", greenzone, greenzoneLeave)
-
[EN] Hi, I want to make a multi language survival server, but I don't know how much lag cause the exporting. It would be a problem with exporting? [HU] Cső, szeretnék csinálni egy több nyelvű túlélő szervert, de nem tudom mennyi laggot okozna a folyamatos export. Mennyi laggot okozna ha mindenhova exportálnám? Example/Példa: texts = { ["hu"] = { --<[ DXhez használt szövegek ]>-- ["ban.user"] = "Felhasználóneved", ["ban.admin"] = "Admin", ["ban.serial"] = "Serialod", ["ban.reason"] = "Ban indok", ["ban.date"] = "Ban időpontja", ["ban.expire"] = "Ban lejár", --<[ Chathez használt szövegek ]>-- }, ["en"] = { --<[ DXhez használt szövegek ]>-- ["ban.user"] = "Username", ["ban.admin"] = "Admin", ["ban.serial"] = "Serial", ["ban.reason"] = "Ban reason", ["ban.date"] = "Ban date", ["ban.expire"] = "Expire date", --<[ Chathez használt szövegek ]>-- }, ["de"] = { } ["ro"] = { } } function getText(player, neededText) return texts[getElementData(player, "player->language")][neededText] or "Unknown text" end
-
Nyelv rendszert csinálok és ahhoz kell.
-
ENG: So, I try to make a word replacer script, but when I want to replace 2 or more word in a sentence didn't work. Someone can help me in this? HUN: Szóval, megpróbáltam csinálni egy "szó helyettesítő scriptet", de ha 2 vagy több szót akarok helyettesíteni, nem működik. Valaki tudna segíteni? An example/Egy példa: outputChatBox(exports["resourcename"]:replaceWords("%PLAYERNAME% has %PLAYERMONEY% dollar!", "%PLAYERNAME%", getPlayerName(player), "%PLAYERMONEY%", getPlayerMoney(player))
-
function getAllPlayer(player, cmd) local mx, my, mz = getElementPosition(player) for i,v in ipairs(getElementsByType("player")) do local rand = math.random(1, 5) setElementPosition(v, mx+rand, my+rand, mz) end end addCommandHandler("getallplayer", getAllPlayer)
-
Command with space characters!!! Help with team names!
holuzs replied to Razor70538's topic in Scripting
local clanName = table.concat({clanName}, " ") or clanName:gsub("_", " ") This replace underline with space. -
Hello! [ENG] I want to make a sms paying script. So, when I send a text to a mobile number, the sms aggregator open(/trigger) my php code. When the php code opened, I want to approve the buying, and give the premium points to player immediately on the server. (Sorry for my bad english skills. xd) Hali! [HUN] Szeretnék csinálni egy EDSMS jóváírós scriptet, viszont fogalmam sincs hogyan kéne a php kódot úgy megcsinálni, hogy az MTA-n megírt scriptet meghívja. Ugye MTAra az account idjét (amit megadott a prefix után) illetve a jóváírandó összeget szeretném átvinni. (Azt már sikerült megoldanom hogy phpmyadminba jóváírja, de akkor reconnect kell hogy megkapja.) AggregatorAggregator
-
sendMessage(target player, "English text", "Russian text") function sendMessage(writeTo, enText, ruText) if getElementData(writeTo, "language")=="english" then outputChatBox(enText, writeTo, 255, 255, 255, true) elseif getElementData(writeTo, "language")=="russian" then outputChatBox(ruText, writeTo, 255, 255, 255, true) end end
-
-- Copy to 'server.lua' function healPlayer(player, cmd, name, price) if not name or not price then outputChatBox("/heal [Player_Name] [Price]", player, 255, 255, 255, true) else local target = getPlayerFromName(name) if target then if getPlayerMoney(target)>=tonumber(price) then takePlayerMoney(target, tonumber(price)) givePlayerMoney(player, tonumber(price)) setElementHealth(target, 100) outputChatBox(getPlayerName(player) .. " healed you!", player, 255, 255, 255, true) outputChatBox("You healed " .. getPlayerName(target), player, 255, 255, 255, true) else outputChatBox("Can't pay the healing", player, 255, 255, 255, true) end else outputChatBox("I can't find the target!", player, 255, 255, 255, true) end end addCommandHandler("heal", healPlayer) -- Copy to 'meta.xml' <meta> <script src="server.lua" type="server"/> </meta>
-
use fadeCamera
-
Hello. I started make a movable and a scalable interface. The moving is working, but the scaling not. local cursorX, cursorY = getCursorPosition(); cursorX = cursorX * x; cursorY = cursorY * y; if cursorX<=hpDefX+hpDefSX-12 and cursorX>=hpDefX+hpDefSX and cursorY<=hpDefY+hpDefSY-12 and cursorY>=hpDefY+hpDefSY then print("Sizeing") else hpDefX = cursorX - moveHPX; hpDefY = cursorY - moveHPY; end (hpDefX & hpDefY = bar position) (hpDefSX & hpDefSY = bar size)
-
function pickedUpTheHiker() local veh = getPedOccupiedVehicle(localPlayer) setPedAnimation(hiker) setPedControlState(hiker, "enter_passenger", true) end The ped stop the anim, but don't in into the nearest vehicle.
-
English pls. :DD
-
Why I can't trigger client side? Server: itemsS = {} function loadItems() local loadSQL = dbPoll(dbQuery(sql, "SELECT * FROM items"), -1) for i,v in ipairs(loadSQL) do --outputChatBox(v["itemid"] .. " | " .. v["ownerid"] .. " | " .. v["value"] .. " | " .. v["count"]) local insert = table.insert(itemsS, {v["itemid"], v["ownerid"], v["value"], v["count"]}) end for i,v in ipairs(getElementsByType("player")) do loadItemsToOnePlayer(v) end end addEventHandler("onResourceStart", resourceRoot, loadItems) function loadItemsToOnePlayer(player) for i,v in ipairs(itemsS) do if getElementData(player, "user:id")==tonumber(v[2]) then triggerClientEvent("sendItems", player, v[1], v[3], v[4]) end end end Client: addEvent("sendItems", true) addEventHandler("sendItems", root, function(id, value, count) table.insert(itemsC, {id, value, count}) end)
-
showPlayetHudComponent("all", false)
-
Hello, someone can send me a good positioning and scaling for dx? :DD
-
local spawnX, spawnY, spawnZ = 1480.9730224609, -1771.46875, 18.8 function joinHandler() spawnPlayer(source, spawnX, spawnY, spawnZ) fadeCamera(source, true) setCameraTarget(source, source) end addEventHandler("onPlayerJoin", getRootElement(), joinHandler) local spawnPos = { {2034.9428710938, -1403.2003173828, 18, "Hospital mais próximo: Los Santos"}, {-2655.3991699219, 638.16137695313, 15, "Hospital mais próximo: San Fierro"}, {-1514.6713867188, 2522.4748535156, 56, "Hospital mais próximo: Tierra Robada"}, {1607.62890625, 1818.9958496094, 11, "Hospital mais próximo: Las Venturas"}, {-2198.5632324219, -2306.6220703125, 31, "Hospital mais próximo: Whetstone"}, } addEventHandler ("onPlayerWasted", getRootElement(), function (ammo, attacker, weapon, bodypart) local x, y, z = getElementPosition (source) local dist = 99999 local id = 0 for i, v in ipairs (spawnPos) do local pX, pY, pZ = spawnPos[i][1], spawnPos[i][2], spawnPos[i][3] if getDistanceBetweenPoints3D (x, y, z, pX, pY, pZ) < dist then dist = getDistanceBetweenPoints3D (x, y, z, pX, pY, pZ) id = i end end outputChatBox(spawnPos[id][4], source) --Write out spawn pos setTimer(spawnPlayer, 3000, 1, source, spawnPos[id][1], spawnPos[id][2], spawnPos[id][3]) -- Spawn after 3 second end) Try this.
-
local spawnX, spawnY, spawnZ = 1480.9730224609, -1771.46875, 18.8 function joinHandler() spawnPlayer(source, spawnX, spawnY, spawnZ) fadeCamera(source, true) setCameraTarget(source, source) end addEventHandler("onPlayerJoin", getRootElement(), joinHandler) local spawnPos = { {2034.9428710938, -1403.2003173828, 18, "Hospital mais próximo: Los Santos"}, {-2655.3991699219, 638.16137695313, 15, "Hospital mais próximo: San Fierro"}, {-1514.6713867188, 2522.4748535156, 56, "Hospital mais próximo: Tierra Robada"}, {1607.62890625, 1818.9958496094, 11, "Hospital mais próximo: Las Venturas"}, {-2198.5632324219, -2306.6220703125, 31, "Hospital mais próximo: Whetstone"}, } addEventHandler ("onPlayerWasted", getRootElement(), function () local x, y, z = getElementPosition (source) local dist = 0 local id = 0 for i, v in ipairs (spawnPos) do local pX, pY, pZ = spawnPos[i][1], spawnPos[i][2], spawnPos[i][3] if getDistanceBetweenPoints3D (x, y, z, pX, pY, pZ) < dist then dist = getDistanceBetweenPoints3D (x, y, z, pX, pY, pZ) id = i end end outputChatBox(spawnPos[id][4], source) --Write out spawn pos setTimer(function() spawnPlayer(source, spawnPos[id][1], spawnPos[id][2], spawnPos[id][3]) end, 1000*3, 1) -- Respawn after 3 second (1000=1 second) end)