
Mathias Lui
Members-
Posts
41 -
Joined
-
Last visited
About Mathias Lui
- Birthday 21/04/2000
Details
-
Gang
Westside Empire
-
Location
Germany
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Mathias Lui's Achievements

Rat (9/54)
1
Reputation
-
Ou okay I will take a look at that, too ^^
-
Idk how this bump system works, but I did not realize that. I realized, that the post was very old after I replied, though. Maybe this information was useful to someone else reading this thread.
-
You can set it to 200 and as long as you fly below the clouds, you can see the whole map
-
Hello world, I wanted to ask if somebody knows how to add new objects to MTA? Like 3d objects? If I e.g. modeled a house and wanted to import it into my server? I heard that you can do that hardly with replacing an existing object in your game files. But I want to add a new one, so my game files are not modded, so that it is just a resource. Hopefully someone can help me MathiasLui
-
Lol how did you do that? I'm only an advanced beginner.. I don't do guis yet. This looks awesome!
-
And how did he do this now? Because I have 3d Models, which I wanna have in my server, not my game, but as a resource. Did you now replace any object to get this object in the game? Or how?
-
Hey world. I wanted to make a script which gives a desired player a desired amount of money. like /pay player money.. but when I try this with myself, like /pay myself money, it will just give me money, and not subtract it first. So i have 100$, I do /pay myself 100, and then I have 200$ So I don't know any further. Here's my full code with comments... [lua] function pay(playerSource, cmd, player, amount) local playermoney = getPlayerMoney(playerSource) --Don't know why I wrote this but when I deactivate this line, it makes no difference local x, y, z = getElementPosition(playerSource) --get Position of the paying Player local x1, y1, z1 = getElementPosition(getPlayerFromName(player)) --get Position of player who will recieve the money local dist = getDistanceBetweenPoints3D(x, y, z, x1, y1, z1) --gets distance between the two players local playermoney = getPlayerMoney(playerSource) --gets Money of the paying Player local targetmoney = getPlayerMoney(getPlayerFromName(player)) --gets Money of the player who will recieve the money local amount = tonumber(amount) --makes the amount typed in to a number. Amount is the money amount if not player or not amount then --if player or amount wasnt typed in there is a warning message outputChatBox("Usage: /pay Name Amount", playerSource, 255, 0, 0) else --if everything is typed in correctly... if (playermoney >= amount) then --if you have at least as much money as you wanna pay if (dist <= 10) then --and you are maximum 10 meters away from the recieving player setPlayerMoney(playerSource, playermoney-amount) --here's the problem. This should take the desired amount of money away setTimer(function() end, 1000, 1) --and this should be a pause, but it does nothing. btw Is there an easy way to make a pause of 1 second? setPlayerMoney(getPlayerFromName(tostring(player)), targetmoney+amount) --gives the recieving player the desired amount of money outputChatBox(getPlayerName(playerSource).." gave you "..amount.." $!", getPlayerFromName(player), 0, 255, 0) --message to inform both players outputChatBox("You gave "..player.." "..amount.." $!", playerSource, 0, 255, 0) --also just a message else --if the player is not in range to the other player there is a warning message (below) outputChatBox("The desired player is not in range.", playerSource, 255, 0, 0) --just warning message end --ends the distance if-statement else --if you haven't got at least as much money as you wanna pay there is a warning message, which also works (below) outputChatBox("You don't have enough money.", playerSource, 255, 0, 0) --just warning message end --ends playermoney if-statement end --ends typing correctly if-statement end --ends the whole pay function addCommandHandler("pay", pay) --command. Usage /pay target money [/lua] The meta isn't the problem. Just a server sided script. hope you can help me!
-
That's a good idea. I didn't have that in mind. Just...I'm not familiar with timers, for loops and repeat and while loops. There aren't any good tutorials out there on the net.
-
Thanks guys. After a bit I found it out myself and then I realized someone has answered. Thanks guuuys
-
Hello Community, I hope this is in the right section. I wanted to ask you if you like this resource I made, or if you have any improvement suggestions. This is one of my first scripts. Here's the link: https://community.multitheftauto.com/in ... s&id=13524 would be great if you would take some minutes and test it. regards Mathias Lui
-
Hi, how can I check, if a player is currently in the chatbox? e.g. I made a tiny script where the mouse cursor is showing when pressing the m or ralt key, or I made a script where you can jump with the vehicle by pressing z. but all these things also happen when typing Z or M in the chatbox. And I don't want them to jump when they type Z
-
Hi, I wanted to make a script, which saves the money from a player, if he logs out or leaves, and then sets the money to 0. When he logs in again he should get the money back. With my first method it worked. I just saved the money amount in a text file. Now, I tried it with setAccountData, but there is one little Error. My first (working) script: function playerQuit() local playeracc = getPlayerAccount( source ) if (playeracc) and not isGuestAccount(playeracc) then local playername = getPlayerName( source ) local playercash = tostring(getPlayerMoney( source )) local fileHandle = fileCreate( "bankaccounts/"..playername..".txt" ) if fileHandle then fileWrite( fileHandle, playercash ) fileClose( fileHandle ) end end setPlayerMoney( source, 0 , true ) end function playerLogin() local playername = getPlayerName( source ) local playeracc = getPlayerAccount( source ) if (playeracc) and not isGuestAccount(playeracc) then local playername = getPlayerName( source ) local fileHandle = fileOpen( "bankaccounts/"..playername..".txt" ) local filesize = fileGetSize( fileHandle ) local money = fileRead( fileHandle, filesize ) setPlayerMoney( source, tonumber(money), true ) fileClose( fileHandle ) end end addEventHandler( "onPlayerLogin", getRootElement(), playerLogin ) addEventHandler( "onPlayerQuit", getRootElement(), playerQuit ) addEventHandler( "onPlayerLogout", getRootElement(), playerQuit ) my 2nd (not working) script: function playerQuit() local playeracc = getPlayerAccount( source ) if (playeracc) and not isGuestAccount(playeracc) then local playername = getPlayerName( source ) local playercash = getPlayerMoney( source ) setAccountData(playeracc, "cash", playercash) end setPlayerMoney( source, 0 , true ) end function playerLogin() local playername = getPlayerName( source ) local playeracc = getPlayerAccount( source ) if (playeracc) and not isGuestAccount(playeracc) then local playername = getPlayerName( source ) local money = getAccountData(playeracc, "cash") setPlayerMoney( source, tonumber(money), true ) end end addEventHandler( "onPlayerLogin", getRootElement(), playerLogin ) addEventHandler( "onPlayerQuit", getRootElement(), playerQuit ) addEventHandler( "onPlayerLogout", getRootElement(), playerQuit ) The error is in line 18. It says, it setPlayerMoney, expected a number in argument 2, but got nil. But I saved it as a number, didn't I? And also I wrote tonumber. would appreciate help. Mathias Lui
-
It is. Here's the meta.xml:
-
Hi, i created a train, which drives along the tracks, but when I try to get in, it respawns, and I don't want players to get into this vehicle. Also the train only spawns, or drives, when in draw distance, so when I leave, get back, the train continues driving. But only when it is in somebodys draw distance. How can I change that?
-
Hey. I wanted to make a script, which looks, if a file with the player's name already exists. usage: /setlicence playername 1/0 playername = target, which we wanna give (1) or remove (0) the driving licence. If a file with his name exists in this folder, there comes a fitting message. My script is serverside, and gives no errors... but I don't get a message, if it worked, and I can't delete or add my driving licence either... how = 0 or 1 function setLicence( playerSource, command, target, how ) how = how if how then targetsource = getPlayerFromName(target) adminname = getPlayerName(playerSource) accountName = getAccountName(getPlayerAccount(playerSource)) if isObjectInACLGroup("user."..accountName , aclGetGroup("Admin")) then if (fileExists(":wangcars/licences/"..target..".txt")) then local fileHandle = fileOpen(":wangcars/licences/"..target..".txt") if fileHandle then end end if (fileExists(":wangcars/licences/"..target..".txt")) and (how == 1) then outputChatBox( "The player already has a driving licence.", playerSource, 255, 0, 0 ) elseif (fileExists(":wangcars/licences/"..target..".txt")) and (how == 0) then fileDelete(fileHandle) outputChatBox("You deleted the driving licence of "..target".", playerSource, 0, 255, 0 ) outputChatBox("Your driving licence has been deleted by "..adminname.."!", targetSource, 255, 0, 0 ) elseif not (fileExists(":wangcars/licences/"..target..".txt")) and (how == 1) then fileHandle = fileCreate(":wangcars/licences/"..target..".txt") fileWrite(fileHandle, "--Got a driving licence by an admin--") fileClose(fileHandle) outputChatBox("You gave the player "..target.." a driving licence.", playerSource, 0, 255, 0 ) outputChatBox("You got a driving licence from "..adminname, targetsource, 0, 255, 0 ) elseif not (fileExists(":wangcars/licences/"..target..".txt")) and (how == 0) then outputChatBox("The player already hasn't got a driving licence.", playerSource, 255, 0, 0 ) end else outputChatBox("It is not confirmed, that you are an admin.", playerSource, 255, 0, 0 ) end else outputChatBox("Please enter a number. 1 = yes, 0 = no", playerSource, 255, 0, 0 ) end end addCommandHandler( "setlicence", setLicence )