kevin433
Members-
Posts
66 -
Joined
-
Last visited
Everything posted by kevin433
-
Hi, When I'm running Firefox and I maximize MTA again, it just goes back to the desktop and MTA is minimized again. I then have to close Firefox to maximize MTA again. It's annoying as hell, since I need the Wiki very often to script. Does anyone know why this happens?
-
Hi, I wanted to know if there is a way to find out if the Player is facing a vehicle or object or something like that. BTW: I wanted also to ask if there are any limits in MTA. In SA:MP there are Vehicle, object and pickup limits, but are there also limits in MTA?
-
Ok, thanks Did that now.
-
I thought it's immune against SQL Injections: This is what it says in the WIKI
-
I got it! Just locked the vehicle when he is not the owner.
-
Forgot to read the Client-side syntax But it's still not cancelling
-
Thank you xbost! Now it works! But now I'm having another problem. If I'm not the owner it doesn't cancel the event function checkvehicleowner(player) if(getElementData(source, "Owner") == getPlayerName(player)) then setVehicleLocked(source, false) outputChatBox(getElementData(source, "Owner")) else outputChatBox("Du bist nicht der besitzer diese fahrzeugs!", player) cancelEvent() end end addEventHandler("onClientVehicleStartEnter", getRootElement(), checkvehicleowner)
-
Yeah, I know about this. I've given every vehicle a ID in form of a string when they spawn, and that works. When I enter a vehicle with a Server-side function it tells me the ID. But it doesn't client-side
-
Hi, I'm trying to prevent the player from entering a vehicle if he's not the owner. The problem is that "getElementID" doesn't get the ID from the Vehicle. I'm using the function called "onClientVehicleStartEnter", I've read at the Wiki that the parameters are "thePlayer, seat, door" and that the source is the Vehicle the player enters. So I wonder why it's not getting the Vehicle ID. function checkvehicleowner(player) local vre = executeSQLSelect("Vehicles", "Owner", "CarID = '" .. getElementID(source) .."'") outputChatBox(vre[1].Owner) if(vre[1].Owner == getPlayerName(player)) then setVehicleLocked(source, false) outputChatBox(vre[1].Owner) else outputChatBox("Du bist nicht der besitzer diese fahrzeugs!", getLocalPlayer()) end end addEventHandler("onClientVehicleStartEnter", getRootElement(), checkvehicleowner) I see nothing wrong with this code, it's giving me no errors in the MTA:SE nor in the Console when I start to enter the vehicle. I also tested out how far the code proceeds with textmessages between the lines. It only goes to the line with "local vre = executeSQLSelect("Vehicles", "Owner", "CarID = '" .. getElementID(source) .."'")".
-
https://wiki.multitheftauto.com/wiki/OnClientPlayerJoin If you have ever read wiki, you'd know. I've already read about the function, and it says that it gets triggered when a player joins the server and that the source of this event is the player who joined the server.
-
It works now, thanks! But what's then "onClientPlayerJoin"?
-
But I want to show it for the player who joins. Hm, that didn't work for me
-
Hi, I'm trying to make a GUI, but it doesn't show up when a client connects. That's my code, I've got no errors: function LoginWindow() --LOGIN FENSTER LoginFenster = guiCreateWindow(382,291,345,222,"Bitte einloggen!",false) guiWindowSetMovable(LoginFenster,false) guiWindowSetSizable(LoginFenster,false) --NICKNAME TEXT Nickname = guiCreateLabel(20,59,65,17,"Nickname:",false,LoginFenster) guiLabelSetColor(Nickname,255,255,255) guiLabelSetVerticalAlign(Nickname,"top") guiLabelSetHorizontalAlign(Nickname,"left",false) guiSetFont(Nickname,"default-bold-small") --PASSWORT TEXT Passwort = guiCreateLabel(21,111,65,17,"Passwort:",false,LoginFenster) guiLabelSetColor(Passwort,255,255,255) guiLabelSetVerticalAlign(Passwort,"top") guiLabelSetHorizontalAlign(Passwort,"left",false) guiSetFont(Passwort,"default-bold-small") --NICKNAME TEXTBOX NicknameBox = guiCreateEdit(89,52,219,32,"",false,LoginFenster) guiEditSetMaxLength(NicknameBox,20) --PASSWORT TEXTBOX PasswortBox = guiCreateEdit(88,107,219,32,"",false,LoginFenster) guiEditSetMaxLength(PasswortBox,20) --LOGIN BUTTON LoginButton = guiCreateButton(117,173,100,36,"Login",false,LoginFenster) guiSetFont(LoginButton,"default-bold-small") --REGISTER BUTTON RegisterButton = guiCreateButton(229,173,100,36,"Registrieren",false,LoginFenster) guiSetFont(RegisterButton,"default-bold-small") end addEventHandler("onClientPlayerJoin", getRootElement(), LoginWindow)
-
My last question is now: If I do this in the loop, will it get "saved" for the specific vehicle? setElementData(tempVeh, .......
-
Thanks 50p! BTW: Is the loop now re-defining "tempVeh" every time it runs through? Does it work this way?
-
Hi, I'm currently working on my Vehicle system. Now I want to spawn multiple cars at the same time, and that's working, but I want to set the Vehicle Color for each, and I'm using a for loop. How can I do this? That's how my code i currently looking: function createCar() local resultvehicle = executeSQLSelect("Vehicles","*") if(#resultvehicle == 0) then else for i = 1, 2 do createVehicle(resultvehicle[i].ModelID, resultvehicle[i].PosX,resultvehicle[i].PosY,resultvehicle[i].PosZ) end end end addCommandHandler("createcar", createCar)
-
OK, it works now. Thanks! But if I don't use "Autoincrement", can I get the number from the rowid with a function? And, if I understood it right: If I would make something with Autoincrement and it looks like this: 1,539 2,611 3,599 And I would delete number 2, Autoincrement would never re-use the number 2, but rowid would?
-
How do I use Auto increment? My code is like this: function createVehicleDB() executeSQLCreateTable("Vehicles", "CarID INT AUTO_INCREMENT PRIMARY KEY, ModelID INT") end addEventHandler("onResourceStart", getRootElement(), createVehicleDB)
-
So it would be faster if the Database would look like this? ID, NAME, GELD, etc ID would be auto increment
-
I want to make a system where every Vehicle has a static "ID", so that I can save that "ID" in a SQLite database.
-
Hi, I'm trying to make a car system where every car has driven km's, fuel etc in it. In SA:MP there were Vehicle ID's, but in MTA everything is an element. Now, how can I make a system where every car has an unique "ID"?
-
Yeah, I should read about basic SQL syntax's I'm one of thoses who are learning more from trying than from reading
-
Thanks! It works! I thought I had to use executeSQLInsert, or do I have to use it if the value in the database is 0 NULL?
-
Hi, I'm currently trying to make an account system with SQL. I have already made a login and register command and it works also. Now I want to make a command where the player types /savespawn and his spawn coordinates are getting changed in his "profile" in the SQL table. Now, my problem is how can I select the players "colum" i the database and change his coordinates. My table is setup like this: "Name", "Password", "SkinID", "Geld", "SpawnX","SpawnY","SpawnZ" How can I insert values into SpawnX, Y and Z without "re-setting" Name, Password, SkinID and Geld?
-
damn, I'm an idiot! In a file broph.lua I had this: addEventHandler("onResourceStart", resourceRoot, function() for i,player in ipairs(getElementsByType("player")) do spawn(player) end MYSQLData() CreateMYSQLAccount("ROFL") end ) Before I used getPlayerName I just typed in a Name into the function. Forgot to take away the CreateMYSQLAccount("ROFL")
