Gallardo9944
Members-
Posts
442 -
Joined
-
Last visited
Everything posted by Gallardo9944
-
setCameraMatrix getElementPosition
-
What's wrong? What if he wants to get the last used nick from some account? That does make sense.
-
No point of doing this as the two functions i posted above do the job simply. But what if player is not logged in or the player is not actually online?
-
Haven't noticed any with R3 of 1.3.4 though.
-
This code prints the stuff each new line.
-
Untested, but must be working though. DoorPositions = { [1]={ 10,20,30 }, [2]={ 10,30,20 }, [3]={ 100,500,250}, [4]={ 0,10,500}, } function checkPosition(player) local px,py,pz = getElementPosition(player) if not px or not py or not pz then outputChatBox("You're nowhere, lol",player) return false end local doorTableNew = DoorPositions -- Create a new variable with the same contains so we don't touch the original table table.sort(doorTableNew,function(one,two) local d1 = getDistanceBetweenPoints3D(px,py,pz,one[1],one[2],one[3]) local d2 = getDistanceBetweenPoints3D(px,py,pz,two[1],two[2],two[3]) return d1 < d2 -- Sort by the shortest distance end) local val = doorTableNew[1] -- Use doorTableNew[#doorTableNew] to get the most distant one if you ever need it outputChatBox("The closest door to you is at : "..val[1]..","..val[2]..","..val[3],player) end addCommandHandler("check",checkPosition)
-
function getOnlinePlayers() return getElementsByType("player") end function listOnlinePlayers(player) local players = getOnlinePlayers() local playerNames = { } for i=1,#players do table.insert(playerNames,getPlayerName(players[i])) end local text = table.concat(playerNames,", ") -- Separate each player with comma outputChatBox(text,getRootElement()) end
-
that depends on your script. GIve us the code and we will be able to help you after that.
-
Are you sure that everything is fine packages-wise? I guess you've gotta install another libmysqliclient. If you're running debian/*buntu or any other deb-compatible Linux distro, just try installing each package in the zip (with dpkg -i file.deb) and see if it provides any positive result. Three packages are contained in the zip. https://mega.co.nz/#!t98ymZ6a!YtQlpCIe1 ... q6KvEgtkew
-
well, you've gotta write the account each time a user is logging in, logging out, changing his nickname. Then you are able to read the stuff from there.
-
int = shorter name of integer. They are the same.
-
Didn't test though. local x,y = guiGetScreenSize() local defScale = 1 local currentScale = defScale local maxScale = 3 local step = 0.3 -- How fast to change the size local turn = true -- true = increase size, false = decrease size local font = "default-bold" local text = "This texts pulses" function renderPulse() if turn == true then -- If we increase the value currentScale = currentScale + step if currentScale > maxScale then currentScale = maxScale turn = false -- Reached max? Then make it go back end else currentScale = currentScale - step if currentScale < defScale then currentScale = defScale turn = true end end local width = dxGetTextWidth(text,currentScale,font) local height = dxGetFontHeight(currentScale,font) dxDrawText(text,x/2-width/2,y/2-height/2,width,height,tocolor(255,255,255,255),currentScale,font) end addEventHandler("onClientRender",getRootElement(),renderPulse)
-
This should be working. Though if you have tons of accounts (e.g. more than a thousand), spamming the function might slow down the server. The code is untested, report if any problems found. function isRegisteredWithSerial(serial) local accounts = getAccounts() for i=1,#accounts do local acc = accounts[i] local srl = getAccountData(acc,"serial") if srl == serial then -- If we found an account with the serial return true -- Return true end end return false -- Unless the interation finished and found nothing, return false end function onLogin(prev,new) -- Get the logged account serial local srl = getAccountData(new,"serial") if not srl then -- If the account doesn't have serial info yet setAccountData(new,"serial",getPlayerSerial(source)) -- Write it with the player's serial end end addEventHandler("onPlayerLogin",getRootElement(),onLogin) function customFunctionToCheck(player) local isreg = isRegisteredWithSerial(getPlayerSerial(player)) if isreg == true then outputChatBox("You have an account with your serial") else outputChatBox("Nope, you're not owning any account") end end addCommandHandler("check",customFunctionToCheck)
-
I'm also having fun of this "antivirus" window being shown on Linux, lol.
-
then try getting the distance between the marker and the player (if it's less than marker radius, then trigger the money give)
-
[OK] MySQL on Debian 6 (64bits) and MTA Lua Script
Gallardo9944 replied to =KoG=Rouche's topic in Scripting
dbConnect works flawlessly, use it. -
Hello. Of course, I have a lot of APIs to use for my needs, but a lot of them are using secured HTTP (aka HTTPS), so I get error #1 each time I try to fetchRemote it. Is there any way to make this dumbo understand HTTPS links? Tested with the same link, but with HTTP, it receives the data, but the API returns an error that you can't use HTTP. Thanks in advance.
-
Are you sure you have set the player's element data correctly?
-
If they open the source code of the compiler and let them create their own place for compiling - I'm all for it. Otherwise, the answer is a strict "no".
-
Yes, I already mentioned that as an option. Element data is usually easier to understand and it's fully mta-wide so it can be used in further developments without any additional triggers or anything.
-
the logic should go like this: 1. --SERVERSIDE setElementData(player,"money",getPlayerMoney(player)) -- Each time player money changes. Yes, each time you write your player money. 2. --CLIENTSIDE playerMoney = getElementData(player,"money") -- This is what we read. So it equals to your player's money if you set that correctly. guiGridListSetItemText (mgrid, row2, money, playerMoney, false, false ) -- Add the value to the grid
-
I suppose it's either containing a code which reads that CSS, but it's still dx and gui stuff or it's a CSS file for http login.
-
what has changed? --CLIENTSIDE local playerMoney = getPlayerMoney(player) -- WON'T WORK. It will return the money of your player, so everyone in the gridlist will have your amount of money shown local playerMoney = getPlayerMoney() -- THIS IS THE SAME AS THE PREVIOUS ONE. No differences, at all. Basically, you have to write your money serverside into the element data of each user. Add a function to "refreshCash" and write element data of a user with a value of his money amount. And use element data clientside, it will work. Or you can trigger client from server with user data and then build the gridlist rows and stuff.
-
Use the first way. Remove both animate and render handlers.
