fatboy950412 Posted June 11, 2021 Share Posted June 11, 2021 hi there, i just want when a player take a screenshot a text appear like "You're taked screenshot" thx very m ch Link to comment
Mkl Posted June 11, 2021 Share Posted June 11, 2021 (edited) Hello You can use this script client side : addEventHandler("onClientKey", root, function(button,press) if press and (button == getKeyBoundToCommand("screenshot")) then outputChatBox("You have taken a screenshot !") end end) Edited June 11, 2021 by Mkl Link to comment
Scripting Moderators xLive Posted June 11, 2021 Scripting Moderators Share Posted June 11, 2021 Your thread has been moved into the Scripting section. Link to comment
fatboy950412 Posted June 12, 2021 Author Share Posted June 12, 2021 thank you very much Link to comment
fatboy950412 Posted June 12, 2021 Author Share Posted June 12, 2021 12 hours ago, Mkl said: Hello You can use this script client side : addEventHandler("onClientKey", root, function(button,press) if press and (button == getKeyBoundToCommand("screenshot")) then outputChatBox("You have taken a screenshot !") end end) hello i changed script like; When I take a screenshot, it prints the time and date correctly, but in the next screenshots, it continues to write the date and time in the chat that I took the first screenshot. local hour = getRealTime().hour local minute = getRealTime().minute local second = getRealTime().second local day = getRealTime().monthday local month = getRealTime().month+1 local year = getRealTime().year+1900 addEventHandler("onClientKey", root, function(button,press) if press and (button == getKeyBoundToCommand("screenshot")) then outputChatBox("You have taken a screenshot ! mta-screen_"..year.."-"..month.."-"..day.."_"..hour.."-"..minute.."-"..second..".png", 255, 0, 0, true) end end) Link to comment
Mkl Posted June 12, 2021 Share Posted June 12, 2021 (edited) Include the variables inside the functiun and not outside (and inside the condition). -- local hour = ... -- will get values when the script starts addEventHandler("onClientKey", root, function(button,press) -- local hour = ... -- will get values everytime a player press on a key if press and (button == getKeyBoundToCommand("screenshot")) then -- local hour = ... -- will get values when the key is the screenshot command outputChatBox("You have taken a screenshot ! mta-screen_"..year.."-"..month.."-"..day.."_"..hour.."-"..minute.."-"..second..".png", 255, 0, 0, true) end end) Edited June 12, 2021 by Mkl 1 Link to comment
fatboy950412 Posted June 12, 2021 Author Share Posted June 12, 2021 39 minutes ago, Mkl said: Include the variables inside the functiun and not outside (and inside the condition). -- local hour = ... -- will get values when the script starts addEventHandler("onClientKey", root, function(button,press) -- local hour = ... -- will get values everytime a player press on a key if press and (button == getKeyBoundToCommand("screenshot")) then -- local hour = ... -- will get values when the key is the screenshot command outputChatBox("You have taken a screenshot ! mta-screen_"..year.."-"..month.."-"..day.."_"..hour.."-"..minute.."-"..second..".png", 255, 0, 0, true) end end) it's done thank you very much 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