-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
Validate elements if isElement(element) then -- < validate destroyElement(element) -- < destroy end Locals Local variables are active within a block. local marker = createMarker(2234, -2216, 12.5, "cylinder", 4, 255, 0, 0, 255, source) local blip = createBlip(-64, -1134, 0.5, 53, 2, 255, 255, 255, 255, 0, 99999, source) local truck = createVehicle(515, 2202, -2249, 14) local trailer = createVehicle(435, 0, 0, 4) Blocks: Functions functions functionName() local variable -- active t/m end end if elseif else if true then local variable -- active t/m elseif elseif true then local variable -- active t/m else else local variable -- active t/m end end Loops for i=1,10 do local variable -- active t/m end end You can also look here for inspiration: https://forum.multitheftauto.com/viewtopic.php?f ... 9&start=30 He had circa the same question.
-
Why hard?.. i said server-side work normally i want only client-side fix. Because I am trying to teach you something so you can find your problem, but you are with your head somewhere else. I can take a look at your code, spending 20 min looking for the mistake or I can let you debug it and you will learn something from it. And it will only cost 5 min of my time. The last methode is a standard of the scripting section, which is the one I prefer. It is a learning section after all.
-
Sorry, but you are very hard to help and only interested in the end product. I can't help you any further now, you should try to find somebody else who doesn't care about the debug process unlike me. Good luck!
-
This is what you must add: https://wiki.multitheftauto.com/wiki/OutputDebugString Why would we look for an unknown mistake all the way down the code, while you can locate circa the location for us?
-
It is very important to validate data before re-using it. This can be done with the isElement function. Ones data has been stored in variable or elementData and when you are going to re-use it over time, validation is required in order to have 0 warnings/errors. And study what the word local is for, because you are using it the wrong way.
-
There are no debug lines in this code. Add them, test it and then come back and tell me where it stops working.
-
remove line 38, it overwriting something you don't want to be overwritten.
-
The same way as with the label. Using guiSetText. I understand what a variable is, I only don't understand why you call it:www The name is just too hazy.
-
1) You haven't added the fixes, this is still the same code as before. 2) Wtf is elementdata "data" ? Give it a good name. local www = tonumber(getElementData(test, "Data")) or 0 local label = guiCreateLabel(...) [strike]guiSetText(www, ""..www.."")[/strike] guiSetText(label,www) 3) Wtf is www? 4) Where are your tabs?
-
And why don't you show us the code then? Do you really think we can see through your eyes? !
-
What don't you understand about our explanations? We gave you two solutions, where for one already copy past ready is... -_-"
-
Then you should not have said that, because it has nothing to do with the problem. And you know now how to solve it...
-
By checking if the key is pressed. https://wiki.multitheftauto.com/wiki/GetKeyState and a bindKey for the first execution. Use one function for the marker and a second one for the bindkey.
-
Company system. So i need takePlayerMoney from player and givePlayerMoney to company. That has at the moment nothing to do with this. You are using addCommandHandler and not the company resource to trigger this function.
-
When the tonumber function receive something else than number characters(as a string), it will return nil/false. Problem will remains the same when you type wrong characters.
-
Where are you debug lines mate? Add one between line 1 and 2. Add one between line 4 and 5. Add one between line 6 and 7. Add one between line 8 and 9. Add one between line 11 and 12. Add one between line 13 and 14. ETC. And don't add an addEventHandler with "onClientKey" inside this function, because you can't remove that addEventHandler any more. At the end you will have (30+) addEventHandlers, each time you refuel your vehicle another addEventHandler + function will be created and added.
-
Apply the math.floor function on line 5... instead of where it is now.
-
Apply the math.floor function on the variable >amount<, after converting(tonumber) and the validation(if amount then). Which ends at line 4.
-
local payaddon = playerTruckerJobData["Illegal"] and 5000 or 0
-
1 x function = 1 x end 1 x if = 1 x end There are 3 ends, 1 function and 0 if's
-
np.
-
np.
-
Ah I see. Indeed a sort of 'hack'.
-
Typo: function vehicleExit (PlayerAb) local playerTruckerJobData = truckerJobData[player] function vehicleExit (PlayerAb) local playerTruckerJobData = truckerJobData[PlayerAb] Add argument of the player. destroyTimer = setTimer (destroyVehicle, 600000, 1) local destroyTimer = setTimer (destroyVehicle, 600000, 1,PlayerAb) insert the timer >destroyTimer< into playerTruckerJobData. playerTruckerJobData["timer"] = destroyTimer So every player has his own timer. Timers don't support a source element, replace like this: function destroyVehicle (PlayerAb) -- local playerTruckerJobData = truckerJobData[PlayerAb] -- removeEventHandler ("onPlayerQuit", PlayerAb, onQuit) -- truckerJobData[PlayerAb] = nil How do I get this PlayerAb there? Like this: local destroyTimer = setTimer (destroyVehicle, 600000, 1,[color=#FF0000]PlayerAb[/color]) function destroyVehicle ([color=#FF0000]PlayerAb[/color])
-
Those functions are for checking if elements are rendered by the GTA engine. step 1) You add those two events to two functions. step 2) On both of those functions. You validate the source element with the type "vehicle", using the function getElementType. step 3) Use the event onClientElementStreamIn (+ function) to insert the a sound with the source as key of the table. local sound = playSound3D(engine_sound, x, y, z, true) if sound then local_sound[source] = sound setElementParent(sound,source) end and you set the source element as parent of the sound element with setElementParent. (when the vehicle gets destroyed, the sound element is also gone) step 4) Use the event onClientElementStreamOut (+ function) to receive the sound with the source as key of the table. Delete the sound with stopSound. And as last you nil a table location with the sound element as key. local sound = local_sound[source] if isElement(sound) then destroyElement(sound) end local_sound[source] = nil Extra info The only thing you have to take a closer look at is that you have to check the table ones in while(maybe 2 hours?) for destroyed vehicles. This can be done with using getTickCount(). But this is extra, I don't think there are a lot of players playing longer than 10 hours. Or you can choose for onClientElementDestroy to replace the use of setElementParent.
