-
Posts
269 -
Joined
-
Last visited
Everything posted by fairyoggy
-
This is what I need, thanks for the help.
-
if not utf8.match(edit,"^%u") then -- the first letter not capitalized end How to make a check that all letters are small? I have some code that checks if the first letter is capitalized. But I still don't understand how to use it back. At least some examples are needed. Where can I read more about this?
-
Yes of course. How can I open a window differently if I don't call it Maybe I misunderstand something, but I do it like this: function window() window = guiCreateWindow((sW - 406) / 2, (sH - 461) / 2, 455, 465, "Window", false) windowbutton1 = guiCreateButton(330, 432, 118, 22, "butt", false, window) end function start() window() end addCommandHandler ( "w", start ) function myFunction() outputChatBox ("test", 231,217,176,false ) end addCommandHandler("z",myFunction) addEventHandler("onClientGUIClick",windowbutton1,myFunction,false)
-
OK, thank you. Everything works with your code. But I'm trying to use my button, which is in another window, and I can't get it to work. function window() window = guiCreateWindow((sW - 406) / 2, (sH - 461) / 2, 455, 465, "Window", false) windowbutton1 = guiCreateButton(330, 432, 118, 22, "butt", false, window) end function myFunction() outputChatBox ("test", 231,217,176,false ) end addCommandHandler("z",myFunction) addEventHandler("onClientGUIClick",windowbutton1,myFunction,false) I press the button and nothing happens
-
local mybutton = guiCreateButton(1000, 200, 75, 30, "ACC", false) addEventHandler("onClientGUIClick",mybutton,myFunction,false) function myFunction() outputChatBox ("test", 231,217,176,false ) end addCommandHandler("z",myFunction) I misunderstood something? Using the command /z I get the text in the chat (test) but when I press the button. Nothing happens I just wrote a button click differently in the code(1 post in this topic), and now I don't know how to write it correctly.
-
Can you please give an example of this action in the code?
-
How can I call the button in this way?
-
How to press a button with using a command? I mean, not an ordinary click on the gui (onClientGUIClick) when the player presses the button. I mean how to do with addCommandHandler to make the button click Example: addEventHandler("onClientGUIClick", root, function() if source == button1 then outputChatBox ("HI", 231,217,176,false ) end end) function zxcs() -- text for using button end addEvent("zxcs", true) addEventHandler( "zxcs", localPlayer, zxcs ) addCommandHandler ( "z", zxcs ) I want when the player writes in the chat /z the button must be pressed
-
I'm sorry, but what am I doing wrong? How do I call triggers correctly? -- client function findplayer() local zplayer = getLocalPlayer() triggerServerEvent( 'findemail', zplayer) end addEvent("findplayer", true) addEventHandler( "findplayer", localPlayer, findplayer ) addCommandHandler ( "e", findplayer ) -- server function findemail(zplayer) outputChatBox("Your name: "..getPlayerName(zplayer)) end addEvent("findemail",true) addEventHandler("findemail",root,findemail) I get an error: attempt to concatenate a boolean value
-
@IIYAMA Why is there such a long distance? In theory, if a car hits a radius, its value UID appears in the right corner The machine does not touch the border of the radius. What am I doing wrong? function checkfuel() local radius = 1 local player = localPlayer local x,y,z = getElementPosition(player) local vehiclesAround = getElementsWithinRange(x, y, z, radius, "vehicle") --local colshape = createColSphere(x, y, z, tonumber(radius)) -- Used this line to check the radius visually local vehicleElement = false if #vehiclesAround == 0 then return end for i = 1, #vehiclesAround do vehicleElement = vehiclesAround[i] local uid = getElementData(vehicleElement, "uid") dxDrawText ("uid: "..uid, 850, screenHeight - 365, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "pricedown" ) end end function HandleTheRendering ( ) addEventHandler ( "onClientRender", root, checkfuel ) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) Screen1 Screen2 Screen3
-
Hi, help to solve the problem How to reduce the distance of the checked vehicle? function checkfuel() local radius = 0.0001 local player = localPlayer local x,y,z = getElementPosition(player) local vehiclesAround = getElementsWithinRange(x, y, z, radius, "vehicle") local vehicleElement = false if #vehiclesAround == 0 then return end for i = 1, #vehiclesAround do vehicleElement = vehiclesAround[i] local uid = getElementData(vehicleElement, "uid") dxDrawText ("uid: "..uid, 850, screenHeight - 365, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "pricedown" ) end end function HandleTheRendering ( ) addEventHandler ( "onClientRender", root, checkfuel ) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) Screen1 Screen2 Screen3 Screen4 Focus on the right side of the screen where the text is "uid" In the first screenshot, the value of the first car In the second screenshot, the value of the second car In the third screenshot, I stood between two cars, and the numbers mixed into one. How can I make sure that the distance from the car door is considered. For example. if I'm not standing at the car door it will be like on screen 4
-
ok, I understood how to implement this in your way. But if we consider from the point of view of comparing the speed of a car? if it is used only for cars and that there was a check for speed, and not for two coordinates. How to implement this?
-
How can I calculate the meters traveled? For example, a player got in a car and drove 100 meters and this "100" save in elementData. I tried to work with it, but I don’t understand how to implement it correctly.
-
Is it possible to run a function on an event when a player has loaded the server cache?
-
you do not claim to be the best assistant on the forum? Thanks for one more resolved question!
-
This does not work, I even tried another event(OnPlayerLogin), but the effect is the same. It doesn’t work, but as soon as I type the command into the chat (/engine) then everything works bindKey ( playerSource, "L", "down", switchEngine ) BadArgument 'binkKey' [Expected player at argument 1, got account
-
Error on the same line addEventHandler ( "onResourceStart", getRootElement(), bindTheKeys) if use root instead getRootElement() the error is the same. so here is what i have --server function switchEngine ( playerSource) local theVehicle = getPedOccupiedVehicle ( playerSource ) if theVehicle and getVehicleController ( theVehicle ) == playerSource then local uid = getElementData(theVehicle, "uid") local state = getVehicleEngineState(theVehicle) outputChatBox("Driver", playerSource, 220, 220, 0) setVehicleEngineState(theVehicle,true) elseif not theVehicle then outputChatBox("you are not in car", playerSource, 220, 220, 0) else outputChatBox("Not driver", playerSource, 220, 220, 0) end end addEvent ( "switchEngine", true ) addEventHandler( "switchEngine", root, switchEngine ) function bindTheKeys ( playerSource, commandName ) bindKey ( playerSource, "L", "down", switchEngine ) end addCommandHandler("engine",bindTheKeys) addEventHandler ( "onResourceStart", getRootElement(), bindTheKeys)
-
I, apparently, was mistaken with an error Error: Expected player at argument 1, got resource-data Is this another mistake?
-
if you type the command into the chat /engine then it works as it should, but how to make the necessary function run with the resource without a command? I tried to do through onResourceStart but an error appears and I don’t understand how to solve it. how to fix it? --server side function bindTheKeys ( playerSource, commandName ) bindKey ( playerSource, "L", "down", switchEngine ) end addCommandHandler("engine",bindTheKeys) addEventHandler ( "onResourceStart", getRootElement(), bindTheKeys) error line: addEventHandler ( "onResourceStart", getRootElement(), bindTheKeys) Bad Argument @ "addEventHandler" [Expected element at argument 2, got nill]
-
Everything works as it should, thanks. But I would like to know the nuances about the past code, what is wrong. I added delete colshape but did not post here.
-
@The_GTA Hi again. One more question about this code. If there are no cars in the radius, how can I check this? For example, if there are no cars in the radius, a chat message is displayed
-
very nice, everything works perfect, thank you very much!
-
I made a parameter for each cars "uid" For example, we have setElementData(car,"uid",0) -- car1 setElementData(car,"uid",1) -- car2 How can I open / close, for example, a car with "uid" 0
-
@The_GTA Okay, but if there are 2 cars nearby, and you need to close only one of them
