-
Posts
681 -
Joined
-
Last visited
-
Days Won
11
Everything posted by Zango
-
I might get you wrong, but you want the script to recognise a player by a part of his name? If the tags you are talking about are made using setPlayerNametagText there shouldn't be a problem. Else, you can try and retrieve player list and see if a player matches the given string tplayer. for k, v in ipairs (getElementsByType ('player')) do if string.find (getPlayerName (v), tplayer, 0, true) then tplayer = v else return end end There's just a problem if someone has parts of identical names ie. player1 is named Drift and player2 is named Drift_King one of those will be chosen. You can probably write around this
-
I made a version for you (thanks to wiki for help) local censored = { 'technocrane', 'teletubbie', 'nebula' -- ... your censored words here } function Check(funcname, ...) local arg = {...} if (type(funcname) ~= "string") then error("Argument type mismatch at 'Check' ('funcname'). Expected 'string', got '"..type(funcname).."'.", 2) end if (#arg % 3 > 0) then error("Argument number mismatch at 'Check'. Expected #arg % 3 to be 0, but it is "..(#arg % 3)..".", 2) end for i=1, #arg-2, 3 do if (type(arg[i]) ~= "string" and type(arg[i]) ~= "table") then error("Argument type mismatch at 'Check' (arg #"..i.."). Expected 'string' or 'table', got '"..type(arg[i]).."'.", 2) elseif (type(arg[i+2]) ~= "string") then error("Argument type mismatch at 'Check' (arg #"..(i+2).."). Expected 'string', got '"..type(arg[i+2]).."'.", 2) end if (type(arg[i]) == "table") then local aType = type(arg[i+1]) for _, pType in next, arg[i] do if (aType == pType) then aType = nil break end end if (aType) then error("Argument type mismatch at '"..funcname.."' ('"..arg[i+2].."'). Expected '"..table.concat(arg[i], "' or '").."', got '"..aType.."'.", 3) end elseif (type(arg[i+1]) ~= arg[i]) then error("Argument type mismatch at '"..funcname.."' ('"..arg[i+2].."'). Expected '"..arg[i].."', got '"..type(arg[i+1]).."'.", 3) end end end function string.explode(self, separator) Check("string.explode", "string", self, "ensemble", "string", separator, "separator") if (#self == 0) then return {} end if (#separator == 0) then return { self } end return loadstring("return {\""..self:gsub(separator, "\",\"").."\"}")() end function string.nail (chat) local exString = string.explode (chat, ' ') for k, v in ipairs (exString) do for j, s in ipairs (censored) do if v == s then outputChatBox ('someone do something, '..tostring (getPlayerName (source))..' just said '..v..'!') -- your action here end end end end addEventHandler ('onPlayerChat', root, string.nail) the code separates all words in a chat message into a table, and matches the values in 'censored' table with any of them, using loops. this way probably isn't very good, rather use string.find to catch people saying 'goddamnit' while only having 'goddamn' listed just an example to show you this doesn't have to fill 600 lines as a suggestion, you could maybe cancelEvent onPlayerChat and outputChatBox the message with the word censored, warning the player, for a less violent way. Your current way is pretty rough
-
mutha fucka is in the censorship words but mother fucker isn't. Isn't it just slang? Also, I personally consider muffdiver a compliment rather something else. Can't associate it with something bad!
-
yes I believe you can parse your sound element and interior id into setElementInterior setElementInterior
-
Isn't quite redundant to do this serverside if you're only going to set weather for the player? clientside: addEventHandler ('onClientPlayerWasted', root, function () if (source == getLocalPlayer()) then setSkyGradient (100,50,0,70,0,0) end end )
-
function getPlayerCash (source, cmd, player) -- function to check for player cash. First variable is the player who called it, second is dummy and third is optional who argument local player = player or source -- if third parameter player doesn't exist, we use it on the source local playerPoints = loadPlayerData (player, 'cash') -- get his money outputChatBox (getPlayerName (player)..' #FF0000has '..tostring (playerPoints)..'$!', root, 255, 0, 0, true) -- output to everyone, how much cash the person has end function getPlayerPoints (source, cmd, player) -- function to check for player points. First variable is the player who called it, second is dummy and third is optional who argument local player = player or source -- if third parameter player doesn't exist, we use it on the source local playerPoints = loadPlayerData (player, 'points') -- get his points outputChatBox (getPlayerName (player)..' #FF0000has '..tostring (playerPoints)..' points!', root, 255, 0, 0, true) -- output to everyone, how much cash the person has end addCommandHandler ('cash', getPlayerCash) -- attach /cash to function getPlayerCash addCommandHandler ('points', getPlayerPoints) -- attach /points to function getPlayerPoints Using commands with '!' is old and not used anymore. Use the inbuilt system for it instead: addCommandHandler. I also assume you defined loadPlayerData as a function somewhere in your script
-
3) Value after damage But onClientPedDamage returns parameter loss so you can add it onto your current amount to get what ped had before addEventHandler ('onClientPedDamage', root, function (attacker, weapon, bodypart, loss) source[health] = getElementHealth (source) source[previousHealth] = getElementHealth (source) + loss end )
-
It is because you are not verifying that the element hit the marker is the local player. Incorporate a check for hitPlayer to be local player in the beginning of function MarkerHit if (hitPlayer == getLocalPlayer()) then
-
Run the following commands within the mta-server directory: chmod -R 740 mta-server aptitude install libpcre3 I reckon you are running Debian, right?
-
local WORLD_DOWN = {0, 0, -1} local UPSIDE_DOWN_THRESHOLD = math.cos(math.rad(20)) function isVehicleUpsideDown (vehicle) local matrix = getElementMatrix (vehicle) local vehicleUp = {matrix_rotate (matrix, 0, 0, 1)} local dotP = math.dotP (vehicleUp, WORLD_DOWN) return (dotP >= UPSIDE_DOWN_THRESHOLD) end function matrix_rotate (matrix, x, y, z) local tx = x * matrix[1][1] + y * matrix[2][1] + z * matrix[3][1] local ty = x * matrix[1][2] + y * matrix[2][2] + z * matrix[3][2] local tz = x * matrix[1][3] + y * matrix[2][3] + z * matrix[3][3] return tx, ty, tz end function math.dotP(v1, v2) return v1[1]*v2[1] + v1[2]*v2[2] + v1[3]*v2[3] end use a timer or something similar to check
-
I had a function once to do this job precisely with matrices, I'll see if I can find tomorrow
-
Open freecam_server.lua inside freecam resource. At the bottom, add the following code: function enableFreecam (player) if (not isPlayerFreecamEnabled (player)) then local x, y, z = getElementPosition (player) setPlayerFreecamEnabled (player, x, y, z) else setPlayerFreecamDisabled (player) end end addCommandHandler ('freecam', enableFreecam) save the file and update archive if it's zipped.
-
you mean whenever the ped vehicle is upside down? There is no event for this, unless you're running freeroam you can for example create your own event and trigger when player uses /flip
-
The only smileyI miss is the yellow one with a tingling upper lip
-
are lines just separated by enter? Or do they properly include \n (newline) If not, when client presses enter and the memo is in focus you could set it to secretly add \n to the string this way, you can count the amount of times \n has been used in your string, or alternatively plus a variable 'lines' by 1 each time
-
Depending on what your preferred gamemode is, checkout FFS Racing, Mr Green or DDC for quality racing. SANL:RPG is a great roleplaying server, DKR Freeroam is a good freeroam server and else there's loads of fun and creativity scattered around on servers you can try. Checkout http://monitor.mtasa.com/ for a list of servers, or use the in-game browser to filter for lowest ping and try ahead
-
Only three errors in your post - that's way above the average Internet level of English Welcome to MTA, you'll soon wonder why the fuck you have SAMP installed
-
Quake 3 ftw MTA San Andreas has grown massive with loads of entertainment. You're in it for the long run once you start
-
Are you creating a file editor in MTA or something?
-
Indeed these textures are different - the hair was going to be separate objects and it would take lots of time to tweak the texture for the model (and it would lack some stuff), but never the less possible (of course not with 100% perfection). The payment were worth 20 full hours for me so it would be worth it Dunno if Kuro wants to shed additional light on it, but he wanted a ff7 gameplay (with characters and stuff) in another game, he told me today he's found a game more suitable (with more ready files)
-
find ped models which matches your new one the most; readjust the texture mapping for the new one to fit this one, and import the TXD. It worked out fine, but he's canceled the project due to other stuff.
-
yea for server owners on linux, screen is probably preferred, but for hosting businesses for example, much easier to execute as daemon and read the server.log
-
[lua][/lua] highlighting
Zango replied to Static-X's topic in Site/Forum/Discord/Mantis/Wiki related
return true -
I can do it
-
I can provide the above emailin'