Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {$CLEO}
- 0000: NOP
- repeat
- wait 50
- until 0AFA: is_samp_structures_available
- 0AF8: samp add_message_to_chat "doorKeeper is {00CC00}Enabled {F7F694}[Switch: /dk]" color 0xF7F694
- 0B34: samp register_client_command "dk" to_label @activate
- 0AF0: 31@ = get_int_from_ini_file "CLEO\INI\doorKeeper.ini" section "Settings" key "Auto on"
- 0AF0: 30@ = get_int_from_ini_file "CLEO\INI\doorKeeper.ini" section "Settings" key "Max players on your server"
- 0AF0: 29@ = get_int_from_ini_file "CLEO\INI\doorKeeper.ini" section "Settings" key "How often checks will be made"
- 29@ *= 1000
- 33@ = 0
- 27@ = 0
- 26@ = 0 //lower range of players to check
- 29@ /= 20 //divide timeNeeded, to avoid lag and spread the checks through the time
- 28@ = 1 //multiplier of the timer
- 30@ /= 20 //divide max players, to avoid lag and spread the checks through the time
- 0085: 24@ = 29@ //24@ = stable 1/20 of the timeNeeded
- 0085: 25@ = 30@ //25@ = stable 1/20 of the players (needed to substract to get lower range of players to check)
- wait 10000
- :First
- wait 0
- if and
- 31@ == 1
- 001D: 33@ > 29@ // (int)
- 0AAB: file_exists "CLEO\INI\doorKeeper.ini"
- then
- //0AD1: show_formatted_text_highpriority "multip=%d timeN=%d min=%d max=%d first=%d" time 10000 28@ 29@ 26@ 30@ 27@
- for 0@ = 26@ to 30@
- if 27@ == 0
- then
- //first time
- if 0B23: samp is_player_connected 0@
- then
- 0AB1: call_scm_func @save_to_ini 2 id 0@ isPlayer? 1
- else
- 0AB1: call_scm_func @save_to_ini 2 id 0@ isPlayer? 0
- end
- else
- //main work
- if 0B23: samp is_player_connected 0@
- then
- 0AB1: call_scm_func @compare_with_ini 2 id 0@ isPlayer? 1
- else
- 0AB1: call_scm_func @compare_with_ini 2 id 0@ isPlayer? 0
- end
- end
- end
- 28@++ //multiplier
- 0085: 29@ = 24@
- 0085: 30@ = 25@
- 006A: 29@ *= 28@ // multiply timer
- 006A: 30@ *= 28@ // multiply higher range of players to check
- 0085: 26@ = 30@ // copy higher range of players
- 0062: 26@ -= 25@ // substract 1/20 to get lower range of players
- if 28@ > 20
- then
- //reset to start all the checks again from ID: 0
- 28@ = 1
- 0085: 29@ = 24@
- 0085: 30@ = 25@
- 26@ = 0
- 33@ = 0
- 27@ = 1 //to make sure that the first flow of the script will be save only (without compare)
- end
- end
- jump @First
- :activate
- 0B12: 31@ = 31@ XOR 1
- if 31@ == 1
- then
- 0AD1: show_formatted_text_highpriority "doorKeeper ~G~on" time 1000
- 28@ = 1
- 0085: 29@ = 24@
- 0085: 30@ = 25@
- 33@ = 0
- 26@ = 0
- 27@ = 0
- else
- 0AD1: show_formatted_text_highpriority "doorKeeper ~R~off" time 1000
- end
- samp.CmdRet
- //0AB1: call_scm_func @save_to_ini 0
- :save_to_ini
- 0AC8: 2@ = allocate_memory_size 260
- if 1@ == 1
- then
- 0B36: samp 2@ = get_player_nickname 0@
- else
- 0AD3: 2@ = format "nope"
- end
- 0AD3: 25@v = format "ID: %d" 0@
- 0AF5: write_string 2@ to_ini_file "CLEO\INI\doorKeeper.ini" section "Name" key 25@v
- 0AC9: free_allocated_memory 2@
- 0AB2: ret 0
- //0AB1: call_scm_func @compare_with_ini 1 num
- :compare_with_ini
- 0AC8: 24@ = allocate_memory_size 260
- 0AC8: 10@ = allocate_memory_size 260
- 0AD3: 25@v = format "ID: %d" 0@
- 0AF4: 24@ = read_string_from_ini_file "CLEO\INI\doorKeeper.ini" section "Name" key 25@v
- if 1@ == 1 //check if the player just connected
- then
- 0B36: samp 2@ = get_player_nickname 0@
- if 8C14: strcmp string1 24@ string2 2@
- then
- //player just connected
- 0B37: samp 3@ = get_player_color 0@
- 0AF8: samp add_message_to_chat "%s(%d){F7F694} connected" color 3@ 2@ 0@
- 0AF5: write_string 2@ to_ini_file "CLEO\INI\doorKeeper.ini" section "Name" key 25@v
- end
- else
- //check if disconnected
- 0AD3: 10@ = format "nope"
- if 8C14: strcmp string1 24@ string2 10@
- then
- //player just disconnected
- 0AF8: samp add_message_to_chat "%s(%d) disconnected" color 0xABABAB 24@ 0@
- 0AF5: write_string 10@ to_ini_file "CLEO\INI\doorKeeper.ini" section "Name" key 25@v
- end
- end
- 0AC9: free_allocated_memory 24@
- 0AC9: free_allocated_memory 10@
- 0AB2: ret 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement