toxicsmoke11 Posted August 12, 2014 Share Posted August 12, 2014 (edited) - Edited August 13, 2014 by Guest Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 Are you sure 'command' == "repair"? Test it with an 'outputChatBox(tostring())' and also on 'g_Me'. (Doubt that last) Link to comment
Max+ Posted August 12, 2014 Share Posted August 12, 2014 i don't see any event with the command = repair add this on the bottom addEventHandler ( 'onPlayerCommand', resourceRoot, blockRepairCmdFunc ) Link to comment
toxicsmoke11 Posted August 12, 2014 Author Share Posted August 12, 2014 i don't see any event with the command = repair add this on the bottom addEventHandler ( 'onPlayerCommand', resourceRoot, blockRepairCmdFunc ) you didn't read my whole script. i am calling that function when needed,not using event handler @Et-win im sure its repair and g_Me stands for getLocalPlayer() and when i output it,it outputs userdata value and in debugscript 3 it says expected number at argument 2,got player Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 Ow: outputChatBox Client-side: bool outputChatBox ( string text [, int r=231, int g=217, int b=176, bool colorCoded=false ] ) No 'player' argument needed. (So both 'outputChatBox' code's are wrong here in this script.) Link to comment
toxicsmoke11 Posted August 12, 2014 Author Share Posted August 12, 2014 oh thanks but when im not allowed to use that command, it doesn't output that i need to wait 15 nor it gives debugscript 3 error or warning Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 Does something start function 'blockRepairCmdFunc'? If so what? Link to comment
toxicsmoke11 Posted August 12, 2014 Author Share Posted August 12, 2014 yea in here blockTimer = setTimer(blockRepairCmdFunc,250,0) if blockTimer then Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 You forgot to send 'command' withing the timer. Link to comment
toxicsmoke11 Posted August 12, 2014 Author Share Posted August 12, 2014 i have added 'command' without ' ' on last argument and it didnt do anything Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 "repair" you have to send with. And still, I don't understand that script of you The function get's runned 1 time in 250 ms, then it outputs "You need to wait 15 seconds in order to repair your vehicle again!" and then cancel's the event, but no command-handler was added to the function? Link to comment
toxicsmoke11 Posted August 13, 2014 Author Share Posted August 13, 2014 (edited) - Edited August 13, 2014 by Guest Link to comment
Et-win Posted August 13, 2014 Share Posted August 13, 2014 if getElementData(g_Me,"repairallowed") == 1 then server.fixVehicle(vehicle) setElementData(g_Me,"repairallowed",0) blockTimer = setTimer(blockRepairCmdFunc,250,0) if blockTimer then returnRepair() end end If 'repair' is allowed, then do that. So in other words, you don't have an 'else' in the script. It only continues if the data is '0'. Link to comment
toxicsmoke11 Posted August 13, 2014 Author Share Posted August 13, 2014 my element data is successfully changing, and there is no problem in it, i don't need 'else'. only problem is that it doesn't output the message when player can't use repair,however after 15 secs expire, it outputs that he can use repair again Link to comment
Et-win Posted August 13, 2014 Share Posted August 13, 2014 That's what I am saying: --You are now going to check or command "repair" is blocked: function checkIfRepairAllowed() --Start the function local vehicle = getPedOccupiedVehicle(g_Me) --Get the vehicle if vehicle then --If it exists if getElementData(g_Me,"repairallowed") == 1 then --When the data is '1' then: server.fixVehicle(vehicle) --Fix it. setElementData(g_Me,"repairallowed",0) --Set the data to '0' blockTimer = setTimer(blockRepairCmdFunc,250,0) --Give a message that he can't use it. if blockTimer then --If the timer does exists returnRepair() --Start this function end end --End the 'if' from " if getElementData(g_Me,"repairallowed") == 1 then". Wait, how can he output a message, if the data is NOT '1' and there isn't an 'elseif' or 'else' ? The data isn't '1' so he is never going to reach that timer to output it into the chat. end end To output it when it's disable, replace that 'end' with: elseif (getElementData(g_Me, "repairallowed") == 0) then blockRepairCmdFunc("repair") end Link to comment
toxicsmoke11 Posted August 13, 2014 Author Share Posted August 13, 2014 doesnt output Link to comment
Et-win Posted August 13, 2014 Share Posted August 13, 2014 Give your recent script... Link to comment
toxicsmoke11 Posted August 13, 2014 Author Share Posted August 13, 2014 everything is same except that end which u told me to replace, and when i replaced end with your thing, i added extra outputchatbox there too but it also didnt output Link to comment
Et-win Posted August 13, 2014 Share Posted August 13, 2014 I have a feeling this is not your full script, isn't it? Link to comment
toxicsmoke11 Posted August 13, 2014 Author Share Posted August 13, 2014 that is freeroam client sided script as i said before, i am only editing it, and i posted already all edits i've done considering repair function Link to comment
Et-win Posted August 13, 2014 Share Posted August 13, 2014 Maybe that repair function is the problem. Show your whole script lol. Link to comment
toxicsmoke11 Posted August 13, 2014 Author Share Posted August 13, 2014 (edited) - Edited August 13, 2014 by Guest Link to comment
Et-win Posted August 13, 2014 Share Posted August 13, 2014 You didn't do it good. function checkIfRepairAllowed() local vehicle = getPedOccupiedVehicle(g_Me) if vehicle then if getElementData(g_Me,"repairallowed") == 1 then server.fixVehicle(vehicle) setElementData(g_Me,"repairallowed",0) blockTimer = setTimer(blockRepairCmdFunc,250,0,command) if blockTimer then returnRepair() elseif (getElementData(g_Me, "repairallowed") == 0) then blockRepairCmdFunc("repair") outputChatBox("You need to wait 15 seconds in order to repair your vehicle again!",255,0,0) end end end end It has to be this: function checkIfRepairAllowed() local vehicle = getPedOccupiedVehicle(g_Me) if vehicle then if getElementData(g_Me,"repairallowed") == 1 then server.fixVehicle(vehicle) setElementData(g_Me,"repairallowed",0) blockTimer = setTimer(blockRepairCmdFunc,250,0,command) if blockTimer then returnRepair() end elseif (getElementData(g_Me, "repairallowed") == 0) then blockRepairCmdFunc("repair") end end end Link to comment
toxicsmoke11 Posted August 13, 2014 Author Share Posted August 13, 2014 alright, thank you Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now