-
Posts
369 -
Joined
-
Last visited
-
Days Won
4
Everything posted by WorthlessCynomys
-
Did the resource work with the original GUI?
-
OOP is based on objects. So like vehicle is an object and the vehicle object has a create function. It is basically createVehicle() just in OOP(Vehicle.create()) On wiki there's the OOP syntax too for every function. There's also an OOP tutorial on MTA wiki.
-
dxVisible = false function togglePanel() if (dxVisible == false) then dxVisible = true else dxVisible = false end end bindKey() addEventHandler("onClientRender", root, function() if (dxVisible == true) then dxDrawFunction end end )
-
When you set the VIP ranks. Try to make a simple "else" after that bunch of "elseif"s so if something else happens then your conditions, than VIP rank is none.
-
MTAs default resources are made by experienced programers. They like it that way. Also if you check the default resources, you can see that it is really complex. I don't mean the code, I mean the resource in runtime. To achieve that complexity so you can do a lot of things it can be necessary for everything to be connected to everything. About OOP. It is much more clear, if you "speak" OOP you can see that it is more effective and more simple. What you can make in OOP in 10 lines, CAN take up to 30 in not OOP.
-
[Question]How can you destroy one element in a table?
WorthlessCynomys replied to kieran's topic in Scripting
Spawn = createMarker (1682.8740234375, -2326.5634765625, 12.5, "cylinder", 1.5, 0, 50, 150, 200) vehicle = {} function ShowPanel (hitElement, matchingDimension) if isElement(hitElement) and getElementType(hitElement) == "player" and matchingDimension then if not isPedOnGround ( hitElement ) then -- to check if the player is in a vehicle, you can use getPedOccupiedVehicle(). It returns false if the player is not in a vehicle. outputChatBox("You must be on foot!", hitElement, 230, 102, 103) return -- This will make sure, that if the player is not on foot, the code will not run further. end local theVeh = getElementData( hitElement, "freecar" ) if ( theVeh ~= false ) then -- You checked if "theVeh" is equal to "veh" but I can't find the "veh" variable in this code block. destroyElement(theVeh) theVeh = nil -- With "vehicle = nil" you erased your table, defined above. This line, by the way, is not really neccessary. setElementData(hitElement, "freecar", false) -- I changed the nil to false. end triggerClientEvent(hitElement, "showmenu", resourceRoot) -- triggerClientEvent(elementToSend, eventToTrigger, sourceElement, additional, arguments) bindKey ( hitElement, "1", "down", Sanchez, hitElement) -- Added the hitElement argument, so the Sanchez function actually gets it. end end addEventHandler("onMarkerHit", Spawn, ShowPanel) function Sanchez (hitElement) -- You have to send that "hitElement" to this function, in this case, we do it as an argument in bindKey. local x, y, z = getElementPosition (hitElement) local rotX, rotY, rotZ = getElementRotation (hitElement) veh = createVehicle (468, x, y+5, z, rotX, rotY, 270) -- You used the variable "vehicle" here. You have a table named "vehicle" so this can't be that. I fixed it to "veh" warpPedIntoVehicle (hitElement, veh) setElementData(hitElement, "freecar", veh) -- BUT here you used the "veh" variable, which in your case is nil. end function DestroyPanel (hitElement, matchingDimension) if isElement(hitElement) and getElementType(hitElement) == "player" and matchingDimension then triggerClientEvent(hitElement, "hidemenu", resourceRoot) unbindKey ( hitElement, "1", "down", Sanchez ) end end addEventHandler("onMarkerLeave", Spawn, DestroyPanel) It should work. I DID NOT test it, so it can have syntax errors, but this should work. -
[Question]How can you destroy one element in a table?
WorthlessCynomys replied to kieran's topic in Scripting
Variable "theVeh" is the current vehicle of the player(getPedOccupiedVehicle). If the player is not in a vehicle, "theVeh" equals to nil and if (theVeh) then will be false, so the code in it wont run. As i saw, you have put the hit element in the vehicles table, which, in the case if you are walking into the marker, is the player. -
[Question]How can you destroy one element in a table?
WorthlessCynomys replied to kieran's topic in Scripting
You have all your code in: if (theVeh) then end This means, that your code will only run if the vehicle is existing. If the player is not in a vehicle then the vehicle can not exist. Also you put the player in the vehicles table instead of the vehicle. What's more, you can set the vehicle element as element data on the player. local veh = createVehicle(411, 0,0,5) setElementData(player, "vehicle", veh) -
I don't think that this is possible. Even if it is, it needs a huge bandwidth to communicate these resources with every player. If you want to protect your scripts, convert them to encoded luac files. Luac files run faster since they are binary and if you encrypt them, no one will be able to fully steal them
-
What is line 117?
-
help Hi, I NEED HELP, sorry for the inconvenience
WorthlessCynomys replied to Odonton's topic in Scripting
dxDraw functions have to be in the onClientRender or PreRender event. addEventHandler("onClientRender", getRootElement(), function() -- dxDraw functions end ) To make it visible/unvisible you have to make an if check in that local dxVisible = false addEventHandler("onClientRender", getRootElement(), function() if (dxVisible == true) then -- dxDraw functions end end ) -- Make a function here that changes the "dxVisible" variant's value. -
What you want to do exactly? Making peds to defend a base is quite simple. You give em a weapon, make a col shape around them and tell them to aim and shoot onColShapeEnter
-
Mysql problem - bad argument #1 to 'mysql_fetch_row'
WorthlessCynomys replied to jessiepinkman's topic in Scripting
Well... MTA now has it's own SQL functions, which are great and easy to use. If you haven't got a script of 2000 lines, I'd recommend to use the MTA's db functions. This module is quite messy. -
Can you please provide some other information? Pictures, what exactly happens, have you got any debugscript 3 error msgs?
-
Well. People have a bad habit of hurting others. Think about it. A community where the staff is so hateful, is a really bad community. I recomnend you to leave that community and the forum behind you and don't let those b***ards drive you crazy. If you feel bad or threatend, leave. For yourself.
-
Yes. Then you use a trigger on server side, with the target player as the target of the trigger. So like: function sendMsg(targetPlayer, theMessage) -- You send the targetPlayer and the msg with the client sided trigger as additional arguments targetPlayer = getPlayerFromName(targetPlayer) -- Find the target player who has to get the msg triggerServerEvent(targetPlayer, "forwardMsg", resourceRoot, theMessage) -- Trigger a client sided event at that player to put the msg in it's gridlist end addEvent("someEventNameYouWantHere", true) -- Add the event addEventHandler("theSameEventNameAsInAddEvent", resourceRoot, sendMsg) -- Handle the event
-
It is a VERY useful check. It simply prevents your server from breaking down, if somehow you did not get a result from sql. How to use it? Simple. All you have to do is, that you make that if and put everything in it which directly uses the data from result. ( Basically you put the for loop in the if )
-
Sorry... what's the problem with the setFPSLimit?
-
Mysql problem - bad argument #1 to 'mysql_fetch_row'
WorthlessCynomys replied to jessiepinkman's topic in Scripting
Do you use sql module? -
I couldn't see the source of the problem, but that is a forum. You can leave it if you feel bad while there.
-
As well as I know, you have to make chat presets in meta for that. OR you can use dx functions to make a new one.
-
Scoreboard játszott óraszám mentése
WorthlessCynomys replied to Marki1021's topic in Hungarian / Magyar
Nem leszólás, csak kérdés. Miért nem írsz egyet magadnak? Nagyon izgalmas folyamat. -
You have to call that function to get it work. You can do this with a simple event, and addEventHandler. This event is onClientMarkerHit ON CLIENT SIDE. So like:
-
The markers are invisible because when you define the color of them you have to use RGBA, which you did. you made your markers white, but defined their alpha 0. So they are completly transparent. Set the forth number to 255 and you'll see them. createMarker()
-
You call this function somehow, right?