Muntemondo
New member
- Joined
- Jul 10, 2024
- Messages
- 3
- Reaction score
- 0
Hi guys! I just need at every 2 hours or when the carachter hp it s below 30% to run the command /heal in chat . Thx
Which samp version you are usingHi guys! I just need at every 2 hours or when the carachter hp it s below 30% to run the command /heal in chat . Thx
0.3.7 r1 and sampfuncsWhich samp version you are using
I'll do when I get free time0.3.7 r1 and sampfuncs
I will try to do it now.I'll do when I get free time
local sampev = require 'lib.samp.events'
local last_heal_time = os.time()
local heal_interval = 2 * 60 * 60
function main()
while not isSampAvailable() do wait(100) end
sampAddChatMessage("{00FF00}Auto Heal script loaded.", -1)
while true do
wait(1000)
check_health_and_heal()
end
end
function check_health_and_heal()
local player_health = getCharHealth(PLAYER_PED)
if player_health =< 30 or (os.time() - last_heal_time) >= heal_interval then
sampSendChat("/heal")
last_heal_time = os.time()
sampAddChatMessage("{00FF00}Auto Heal executed.", -1)
end
end
thx, i will waitI'll do when I get free time
Try the One from tuzasthx, i will wait
thx, i will wait
Hi guys! I just need at every 2 hours or when the carachter hp it s below 30% to run the command /heal in chat . Thx
{$CLEO .cs}
0000:
REPEAT
IF 8256: player $PLAYER_CHAR defined
THEN 0A93: end_custom_thread
END
WAIT 1500
UNTIL 0256: player $PLAYER_CHAR defined
WHILE TRUE
WAIT 0
IF 0256: player $PLAYER_CHAR defined
THEN
0226: 1@ = actor $PLAYER_ACTOR health
IF 1@ <= 30
THEN
0AC8: 6@ = allocate_memory_size 144
0AD3: 6@ = format "/heal"
0AB1: @process_chat_input 1 InputText 6@
0AC9: free_allocated_memory 6@
WAIT 1500
END
END
END
:get_samp_version_id
// 0AB1: @get_samp_version_id 0 _returned: ID 0@
30@ = 0
IF 0AA2: 31@ = "samp.dll" // IF and SET
THEN
31@ += 0x128
0A8D: 29@ = read_memory 31@ size 4 virtual_protect 1
IF 29@ == 0x5542F47A
THEN // 0.3.7 R1
30@ = 1
END
IF 29@ == 0x59C30C94
THEN // 0.3.7 R2
30@ = 2
END
IF 29@ == 0x5A6A3130
THEN // 0.3.DL
30@ = 3
END
31@ -= 8 // reading samp.dll + 0x120
0A8D: 29@ = read_memory 31@ size 4 virtual_protect 1
IF 29@ == 0x5C0B4243
THEN // 0.3.7 R3
30@ = 4
END
IF 29@ == 0x5DD606CD
THEN // 0.3.7 R4
30@ = 5
END
IF 29@ == 0x6094ACAB
THEN // 0.3.7 R4 - v2
30@ = 6
END
IF 29@ == 0x6372C39E
THEN // 0.3.7 R5
30@ = 7
END
END
0AB2: ret 1 30@
:process_chat_input
/*
0AC8: 1@ = allocate_memory_size 144
0AD3: 1@ = format "text or /command"
0AB1: @process_chat_input 1 InputText 1@
0AC9: free_allocated_memory 1@
*/
IF 0AA2: 31@ = "samp.dll"
THEN
0AB1: @get_samp_version_id 0 _returned: ID 17@
IF 17@ > 0
THEN
IF 17@ == 1 // 0.3.7 R1
THEN
0A8E: 30@ = 31@ + 0x21A0E8 // SAMP_CHAT_INPUT_INFO_OFFSET
0A8D: 29@ = readMem 30@ sz 4 vp 0 // pChatInput;
0A8E: 28@ = 29@ + 0x8 // pChatInput->pEditBox;
0A8D: 27@ = readMem 28@ sz 4 vp 0 // pEditBox;
0A8E: 26@ = 31@ + 0x80F60 // CDXUTEditBox::SetText
0A8E: 25@ = 31@ + 0x65D30 // PROCESS_INPUT
END
IF 17@ == 2 // 0.3.7 R2
THEN
0A8E: 30@ = 31@ + 0x21A0F0 // SAMP_CHAT_INPUT_INFO_OFFSET
0A8D: 29@ = readMem 30@ sz 4 vp 0 // pChatInput;
0A8E: 28@ = 29@ + 0x8 // pChatInput->pEditBox;
0A8D: 27@ = readMem 28@ sz 4 vp 0 // pEditBox;
0A8E: 26@ = 31@ + 0x81000 // CDXUTEditBox::SetText
0A8E: 25@ = 31@ + 0x65E00 // PROCESS_INPUT
END
IF 17@ == 3 // 0.3.DL
THEN
0A8E: 30@ = 31@ + 0x2ACA14 // SAMP_CHAT_INPUT_INFO_OFFSET
0A8D: 29@ = readMem 30@ sz 4 vp 0 // pChatInput;
0A8E: 28@ = 29@ + 0x8 // pChatInput->pEditBox;
0A8D: 27@ = readMem 28@ sz 4 vp 0 // pEditBox;
0A8E: 26@ = 31@ + 0x85000 // CDXUTEditBox::SetText
0A8E: 25@ = 31@ + 0x69410 // PROCESS_INPUT
END
IF 17@ == 4 // 0.3.7 R3
THEN
0A8E: 30@ = 31@ + 0x26E8CC // SAMP_CHAT_INPUT_INFO_OFFSET
0A8D: 29@ = readMem 30@ sz 4 vp 0 // pChatInput;
0A8E: 28@ = 29@ + 0x8 // pChatInput->pEditBox;
0A8D: 27@ = readMem 28@ sz 4 vp 0 // pEditBox;
0A8E: 26@ = 31@ + 0x84E70 // CDXUTEditBox::SetText
0A8E: 25@ = 31@ + 0x69260 // PROCESS_INPUT
END
IF 17@ == 5 // 0.3.7 R4
THEN
0A8E: 30@ = 31@ + 0x26E9FC // SAMP_CHAT_INPUT_INFO_OFFSET
0A8D: 29@ = readMem 30@ sz 4 vp 0 // pChatInput;
0A8E: 28@ = 29@ + 0x8 // pChatInput->pEditBox;
0A8D: 27@ = readMem 28@ sz 4 vp 0 // pEditBox;
0A8E: 26@ = 31@ + 0x855B0 // CDXUTEditBox::SetText
0A8E: 25@ = 31@ + 0x69990 // PROCESS_INPUT
END
IF 17@ == 6 // 0.3.7 R4 - v2
THEN
0A8E: 30@ = 31@ + 0x26E9FC // SAMP_CHAT_INPUT_INFO_OFFSET
0A8D: 29@ = readMem 30@ sz 4 vp 0 // pChatInput;
0A8E: 28@ = 29@ + 0x8 // pChatInput->pEditBox;
0A8D: 27@ = readMem 28@ sz 4 vp 0 // pEditBox;
0A8E: 26@ = 31@ + 0x855E0 // CDXUTEditBox::SetText
0A8E: 25@ = 31@ + 0x699D0 // PROCESS_INPUT
END
IF 17@ == 7 // 0.3.7 R5
THEN
0A8E: 30@ = 31@ + 0x26EB84 // SAMP_CHAT_INPUT_INFO_OFFSET
0A8D: 29@ = readMem 30@ sz 4 vp 0 // pChatInput;
0A8E: 28@ = 29@ + 0x8 // pChatInput->pEditBox;
0A8D: 27@ = readMem 28@ sz 4 vp 0 // pEditBox;
0A8E: 26@ = 31@ + 0x85580 // CDXUTEditBox::SetText
0A8E: 25@ = 31@ + 0x699D0 // PROCESS_INPUT
END
0AA8: call_function_method 26@ struct 27@ num_params 2 pop 0 _bSelected 0 _pszText 0@ _retVal 6@
0AA8: call_function_method 25@ struct 29@ num_params 0 pop 0 _retVal 7@
END
END
0AB2: 0